From 4767cdbdc83fd1c924fb8ab86a6f71205f84e0b6 Mon Sep 17 00:00:00 2001 From: farhan048 Date: Thu, 6 Apr 2023 09:25:57 +0700 Subject: [PATCH] update dialogHierarchy --- .../SimproV2/CreatedProyek/DIalogHierarchy.js | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/DIalogHierarchy.js b/src/views/SimproV2/CreatedProyek/DIalogHierarchy.js index 27a43b9..f82aa87 100644 --- a/src/views/SimproV2/CreatedProyek/DIalogHierarchy.js +++ b/src/views/SimproV2/CreatedProyek/DIalogHierarchy.js @@ -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 {" "} - + - + {" "} + {text.dataGantt && ( + + )} , }, @@ -204,21 +209,6 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek { - if (Array.isArray(record.dataGantt)) { - return record.dataGantt.map((data) => ( - - -

{data.name_version}

-
- - )); - } 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 - +