|
|
|
@ -11,6 +11,7 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
|
|
|
|
|
import DialogUserGantt from './DialogUserGantt'; |
|
|
|
|
import DialogForm from './DIalogFormHierarchy' |
|
|
|
|
import DialogFormGantt from './DialogFormGantt'; |
|
|
|
|
import DialogGantt from './DialogGantt'; |
|
|
|
|
import { useTranslation } from 'react-i18next'; |
|
|
|
|
import { async } from '@dabeng/react-orgchart'; |
|
|
|
|
import { Link } from 'react-router-dom'; |
|
|
|
@ -29,6 +30,7 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
|
|
|
|
|
const [dataGantt, setDataGantt] = useState([]) |
|
|
|
|
const [typeDialog, setTypeDialog] = useState("add") |
|
|
|
|
const [openDialogForm, setOpenDialogForm] = useState(false) |
|
|
|
|
const [openDialogGantt, setOpenDialogGantt] = useState(false) |
|
|
|
|
const [openDialogFormGantt, setOpenDialogFormGantt] = useState(false) |
|
|
|
|
const [openDialogUserGantt, setOpenDialogUserGantt] = useState(false) |
|
|
|
|
const [dataHierarchy, setDataHierarchy] = useState([]) |
|
|
|
@ -41,7 +43,7 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
|
|
|
|
|
if (idTask > 0) { |
|
|
|
|
getdataHierarchy(); |
|
|
|
|
} |
|
|
|
|
}, [idTask, openDialog, closeDialog]) |
|
|
|
|
}, [saveHierarchy, idTask, openDialog, closeDialog]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
getDataHumanResource(); |
|
|
|
@ -96,6 +98,11 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
|
|
|
|
|
setOpenDialogFormGantt(true) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleViewGant = (id) => { |
|
|
|
|
setParentId(id) |
|
|
|
|
setOpenDialogGantt(true) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const toggleDialogFormGantt = () => { |
|
|
|
|
setOpenDialogFormGantt(!openDialogFormGantt) |
|
|
|
|
} |
|
|
|
@ -138,11 +145,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getdataHierarchy = async () => { |
|
|
|
|
|
|
|
|
|
const payload = { |
|
|
|
|
"columns": [{ "name": "project_id", "logic_operator": "=", "value": idTask, "operator": "AND" }], |
|
|
|
|
"joins": [{ "name": "m_version_gantt", "column_join": "hierarchy_ftth_id", "column_results": "progress" }], |
|
|
|
|
} |
|
|
|
|
const url = HIERARCHY_FTTH_TREE(idTask) |
|
|
|
|
const result = await axios |
|
|
|
|
.get(url, HEADER) |
|
|
|
@ -186,9 +188,12 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
|
|
|
|
|
<Tooltip title="Tambah Data"> |
|
|
|
|
<Button size={"sm"} color='success' onClick={() => handleAddWithParent(text.id)}><i className="fa fa-plus"></i></Button> |
|
|
|
|
</Tooltip>{" "} |
|
|
|
|
<Tooltip title="Gantt"> |
|
|
|
|
<Tooltip title="Tambah Gantt"> |
|
|
|
|
<Button size={"sm"} color='primary' onClick={() => handleAddGant(text.id)}><i className="fa fa-gears"></i></Button> |
|
|
|
|
</Tooltip> |
|
|
|
|
</Tooltip>{" "} |
|
|
|
|
{text.dataGantt && (<Tooltip title="Detail Gantt"> |
|
|
|
|
<Button size={"sm"} color='info' onClick={() => handleViewGant(text.id)}><i className="fa fa-info"></i></Button> |
|
|
|
|
</Tooltip>)} |
|
|
|
|
</> |
|
|
|
|
, |
|
|
|
|
}, |
|
|
|
@ -204,21 +209,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
|
|
|
|
|
<Table |
|
|
|
|
size="small" |
|
|
|
|
columns={[Table.EXPAND_COLUMN, ...columns]} |
|
|
|
|
expandable={{ |
|
|
|
|
expandedRowRender: (record) => { |
|
|
|
|
if (Array.isArray(record.dataGantt)) { |
|
|
|
|
return record.dataGantt.map((data) => ( |
|
|
|
|
<Link to={`/projects/${data.id}/${idTask}/gantt`}> |
|
|
|
|
<Space align="center"> |
|
|
|
|
<p style={{ marginLeft: 15, width: "100%" }}>{data.name_version}</p> |
|
|
|
|
</Space> |
|
|
|
|
</Link> |
|
|
|
|
)); |
|
|
|
|
} else { |
|
|
|
|
return null; // or some default content if dataGantt is not an array
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}} |
|
|
|
|
rowKey="id" |
|
|
|
|
dataSource={dataHierarchy} |
|
|
|
|
pagination={{ position: ["bottomLeft"] }} |
|
|
|
@ -312,7 +302,11 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
|
|
|
|
|
> |
|
|
|
|
Delete this data |
|
|
|
|
</SweetAlert> |
|
|
|
|
|
|
|
|
|
<DialogGantt |
|
|
|
|
openDialog={openDialogGantt} |
|
|
|
|
hierarchyId={parentId} |
|
|
|
|
idTask={idTask} |
|
|
|
|
/> |
|
|
|
|
<DialogFormGantt |
|
|
|
|
idTask={idTask} |
|
|
|
|
openDialog={openDialogFormGantt} |
|
|
|
|