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.swp b/src/views/SimproV2/CreatedProyek/.DialogHierarchy.js.swp deleted file mode 100644 index 426e022..0000000 Binary files a/src/views/SimproV2/CreatedProyek/.DialogHierarchy.js.swp and /dev/null differ diff --git a/src/views/SimproV2/CreatedProyek/DialogGantt.js b/src/views/SimproV2/CreatedProyek/DialogGantt.js index 27e0380..738a075 100644 --- a/src/views/SimproV2/CreatedProyek/DialogGantt.js +++ b/src/views/SimproV2/CreatedProyek/DialogGantt.js @@ -1,19 +1,19 @@ import React, { useEffect, useState, useMemo } from 'react' -import { Modal, ModalHeader, ModalBody, ModalFooter, Breadcrumb, BreadcrumbItem } from 'reactstrap'; +import { Modal, ModalHeader, ModalBody, Col, Row, Breadcrumb, BreadcrumbItem } from 'reactstrap'; import { Button } from 'reactstrap'; -import { Table, Tooltip, Spin } from 'antd'; +import { Select, Table, Tooltip, Spin } from 'antd'; import 'antd/dist/antd.css'; import moment from 'moment'; import SweetAlert from 'react-bootstrap-sweetalert'; -import { VERSION_GANTT_DELETE, VERSION_GANTT_SEARCH, USER_LIST } from '../../../const/ApiConst'; +import { VERSION_GANTT_DELETE, VERSION_GANTT_SEARCH } from '../../../const/ApiConst'; import axios from "../../../const/interceptorApi" import { NotificationContainer, NotificationManager } from 'react-notifications'; import DialogForm from './DialogFormGantt'; import DialogUserGantt from './DialogUserGantt'; - import { Link } from 'react-router-dom'; -const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id }) => { +const { Option } = Select +const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => { if (role_id && user_id && token && isLogin) { role_id = role_id; user_id = user_id; @@ -38,10 +38,10 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName const [alertDelete, setAlertDelete] = useState(false) const [idDelete, setIdDelete] = useState(0) const [idGantt, setIdGantt] = useState(0) - const [humanResource, setHumanResource] = useState([]) const [dataEdit, setDataEdit] = useState([]) const [typeDialog, setTypeDialog] = useState('') const [loading, setLoading] = useState(true); + const [searchGantt, setSearchGantt] = useState(null); useEffect(() => { if (openDialog && hierarchyId > 0 || idTask > 0 && !openDialogHierarchy) { @@ -51,33 +51,7 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName if (!openDialog) { setDataGantt([]); } - }, [hierarchyId, idTask, openDialog]) - - const getDataHumanResource = async () => { - const result = await axios - .get(USER_LIST, HEADER) - .then(res => res) - .catch((error) => error.response); - - if (result && result.status == 200) { - setTransferUser(result.data.data); - } else { - - } - } - - const setTransferUser = (data) => { - const finalData = [] - data.map((val, index) => { - let data = { - key: val.id, - title: val.name - } - finalData.push(data) - }); - setHumanResource(finalData) - } - + }, [hierarchyId, idTask, openDialog, searchGantt]) const getdataGantt = async () => { let payload; @@ -85,7 +59,8 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName payload = { "select": ["id", "name_version", "calculation_type", "description", "created_at", "progress"], "columns": [ - { "name": "hierarchy_ftth_id", "logic_operator": "=", "value": hierarchyId, "operator": "AND" } + { "name": "hierarchy_ftth_id", "logic_operator": "=", "value": hierarchyId, "operator": "AND" }, + { "name": "id", "logic_operator": "=", "value": searchGantt, "operator": "AND" } ], "orders": { "columns": ["name_version"], "ascending": true } } @@ -93,7 +68,8 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName payload = { "select": ["id", "name_version", "calculation_type", "description", "created_at", "progress"], "columns": [ - { "name": "proyek_id", "logic_operator": "=", "value": idTask, "operator": "AND" } + { "name": "proyek_id", "logic_operator": "=", "value": idTask, "operator": "AND" }, + { "name": "id", "logic_operator": "=", "value": searchGantt, "operator": "AND" } ], "orders": { "columns": ["name_version"], "ascending": true }, } @@ -168,6 +144,7 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName token: token, role_id: role_id, user_id: user_id, + dataViewStartDate: dataViewStartDate } }}> @@ -262,17 +239,36 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName <> - {hierarchyName ? + {hierarchyName ? ( Project {hierarchyName} - : -
Gantt Project {proyekName}
- } - {!hierarchyId && (<> - + ) : ( +
Gantt Project {proyekName}
+ )} + + + {!hierarchyId && ( + )} +
@@ -281,10 +277,8 @@ const DialogGantt = ({ 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} /> <> - + {" "} - + {" "} - + ,