Browse Source

Merge pull request 'dev-wahyu' (#74) from dev-wahyu into staging

Reviewed-on: ordo/adw-frontend#74
pull/2/head
ibnu 1 year ago
parent
commit
bccca99726
  1. 7
      src/views/SimproV2/CreatedProyek/DialogGantt.js
  2. 1
      src/views/SimproV2/CreatedProyek/DialogHierarchy.js
  3. 23
      src/views/SimproV2/Gantt/GanttFrame.js
  4. 25
      src/views/SimproV2/Gantt/index.js

7
src/views/SimproV2/CreatedProyek/DialogGantt.js

@ -13,7 +13,7 @@ import DialogUserGantt from './DialogUserGantt';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, hierarchyId, hierarchyName }) => { const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, hierarchyId, hierarchyName, openDialogHierarchy }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
@ -31,10 +31,7 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
const [humanResource, setHumanResource] = useState([]) const [humanResource, setHumanResource] = useState([])
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (hierarchyId > 0 || idTask > 0 && !openDialogHierarchy) {
getdataGantt();
}
if (hierarchyId > 0) {
getdataGantt(); getdataGantt();
} }
}, [hierarchyId, idTask, openDialog]) }, [hierarchyId, idTask, openDialog])

1
src/views/SimproV2/CreatedProyek/DialogHierarchy.js

@ -311,6 +311,7 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
hierarchyId={parentId} hierarchyId={parentId}
hierarchyName={parentName} hierarchyName={parentName}
idTask={idTask} idTask={idTask}
openDialogHierarchy={openDialog}
/> />
<DialogFormGantt <DialogFormGantt
idTask={idTask} idTask={idTask}

23
src/views/SimproV2/Gantt/GanttFrame.js

@ -0,0 +1,23 @@
import React from 'react';
import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst';
const GanttFrame = React.memo((props) => {
const { versionGanttId, idProject, token, ro, timestamp } = props;
const iframeSrc = `https://adw-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}`;
return (
<iframe
id="frame-gantt"
src={iframeSrc}
style={{
width: '100%',
height: '95vh',
}}
scrolling="no"
frameBorder="0"
allow="fullscreen"
></iframe>
);
});
export default GanttFrame;

25
src/views/SimproV2/Gantt/index.js

@ -6,7 +6,7 @@ import axios from "../../../const/interceptorApi"
import { Fab, Action } from 'react-tiny-fab'; import { Fab, Action } from 'react-tiny-fab';
import 'react-tiny-fab/dist/styles.css'; import 'react-tiny-fab/dist/styles.css';
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import GanttFrame from './GanttFrame';
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const userId = parseInt(localStorage.getItem("user_id")); const userId = parseInt(localStorage.getItem("user_id"));
const HEADER = { const HEADER = {
@ -82,24 +82,19 @@ const Gantt = (props) => {
} }
roCount = roCount + 1; roCount = roCount + 1;
} }
const RenderGantt = () => (
<iframe
id="frame-gantt"
src={`https://adw-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}`}
style={{
width: '100%',
height: '95vh',
}}
scrolling="no"
frameBorder="0"
allow="fullscreen"
></iframe>
)
return ( return (
<> <>
<div style={{ margin: "-15px", marginBottom: "-30px" }}> <div style={{ margin: "-15px", marginBottom: "-30px" }}>
{ready && <RenderGantt />} {ready && (
<GanttFrame
versionGanttId={versionGanttId}
idProject={idProject}
token={token}
ro={ro}
timestamp={timestamp}
/>
)}
</div> </div>
</> </>
); );

Loading…
Cancel
Save