From b788b7ac7a606c350254b0eb0450f05a88945748 Mon Sep 17 00:00:00 2001 From: farhantock Date: Mon, 11 Dec 2023 12:50:43 +0700 Subject: [PATCH] add calculate progress --- src/const/ApiConst.js | 5 ++++ .../SimproV2/CreatedProyek/DialogHierarchy.js | 29 +++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/const/ApiConst.js b/src/const/ApiConst.js index c13daa3..5552366 100644 --- a/src/const/ApiConst.js +++ b/src/const/ApiConst.js @@ -727,6 +727,11 @@ export const HIERARCHY_FTTH_DELETE = (id) => { export const HIERARCHY_FTTH_TREE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/tree/${id}`; }; + +export const HIERARCHY_FTTH_COUNT_TREE = (id) => { + return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/count-tree/${id}`; +}; + export const WAYPOINT_SEARCH = `${BASE_SIMPRO_LUMEN}/waypoint/search`; export const IMAGE_UPLOAD = `${BASE_SIMPRO_LUMEN}/image/upload`; diff --git a/src/views/SimproV2/CreatedProyek/DialogHierarchy.js b/src/views/SimproV2/CreatedProyek/DialogHierarchy.js index 2bb089d..563d14d 100644 --- a/src/views/SimproV2/CreatedProyek/DialogHierarchy.js +++ b/src/views/SimproV2/CreatedProyek/DialogHierarchy.js @@ -5,7 +5,7 @@ import { Space, Table, Tooltip, Spin } from 'antd'; import 'antd/dist/antd.css'; import moment from 'moment'; import SweetAlert from 'react-bootstrap-sweetalert'; -import { HIERARCHY_FTTH_DELETE, HIERARCHY_FTTH_TREE, VERSION_GANTT_SEARCH, HIERARCHY_FTTH_ADD, USER_LIST } from '../../../const/ApiConst'; +import { HIERARCHY_FTTH_DELETE, HIERARCHY_FTTH_TREE, HIERARCHY_FTTH_COUNT_TREE, HIERARCHY_FTTH_ADD, USER_LIST } from '../../../const/ApiConst'; import axios from "../../../const/interceptorApi" import { NotificationContainer, NotificationManager } from 'react-notifications'; import DialogUserGantt from './DialogUserGantt'; @@ -13,11 +13,8 @@ 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'; -import { use } from 'i18next'; import _ from 'lodash'; -const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => { +const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, dataViewStartDate }) => { const token = localStorage.getItem("token") const HEADER = { headers: { @@ -98,6 +95,22 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek setOpenDialogFormGantt(true) } + const handleHitungProgress = async (id) => { + const url = HIERARCHY_FTTH_COUNT_TREE(id) + const result = await axios + .get(url, HEADER) + .then(res => res) + .catch((error) => error.response); + + if (result && result.status == 200) { + setLoading(false); + } else { + setLoading(false); + NotificationManager.error(`Data gagal dihitung silahkan coba lagi!`, 'Failed!!'); + } + } + + const handleViewGant = (id, name) => { setParentId(id) setParentName(name) @@ -196,11 +209,14 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek {" "} + + + {" "} {" "} {text.dataGantt && ( - + )} , @@ -320,6 +336,7 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek hierarchyName={parentName} idTask={idTask} openDialogHierarchy={openDialog} + dataViewStartDate={dataViewStartDate} />