diff --git a/src/const/ApiConst.js b/src/const/ApiConst.js
index ed3b5ec..d90b6af 100644
--- a/src/const/ApiConst.js
+++ b/src/const/ApiConst.js
@@ -460,4 +460,11 @@ export const API_PANIC_BUTTON_SIMPRO = `${BASE_SIMPRO_LUMEN}/panic-button`
export const PANIC_BUTTON_SEARCH = `${BASE_SIMPRO_LUMEN}/panic-button/search`;
export const PANIC_BUTTON_UPDATE = (id) => { return `${BASE_SIMPRO_LUMEN}/panic-button/update/${id}` }
+export const HIERARCHY_FTTH_GET = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths`
+export const HIERARCHY_FTTH_ADD = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths`
+export const HIERARCHY_FTTH_SEARCH = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/search`
+export const HIERARCHY_FTTH_SHOW = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}`}
+export const HIERARCHY_FTTH_UPDATE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}`}
+export const HIERARCHY_FTTH_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}`}
+
export const WAYPOINT_SEARCH = `${BASE_SIMPRO_LUMEN}/waypoint/search`
diff --git a/src/views/SimproV2/CreatedProyek/DIalogHierarchy.js b/src/views/SimproV2/CreatedProyek/DIalogHierarchy.js
new file mode 100644
index 0000000..0ad927d
--- /dev/null
+++ b/src/views/SimproV2/CreatedProyek/DIalogHierarchy.js
@@ -0,0 +1,246 @@
+import React, { useEffect, useState, useMemo } from 'react'
+import { Modal, ModalHeader, ModalBody, } from 'reactstrap';
+import { Button } from 'reactstrap';
+import { Table, Tooltip } from 'antd';
+import 'antd/dist/antd.css';
+import moment from 'moment';
+import SweetAlert from 'react-bootstrap-sweetalert';
+import { HIERARCHY_FTTH_DELETE, HIERARCHY_FTTH_SEARCH, USER_LIST } from '../../../const/ApiConst';
+import axios from "../../../const/interceptorApi"
+import { NotificationContainer, NotificationManager } from 'react-notifications';
+import DialogForm from './DialogFormHierarchy';
+import DialogUserGantt from './DialogUserGantt';
+
+const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => {
+ const token = localStorage.getItem("token")
+ const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ }
+ }
+
+ const [openDialogForm, setOpenDialogForm] = useState(false)
+ const [openDialogUserGantt, setOpenDialogUserGantt] = useState(false)
+ const [dataHierarchy, setDataHierarchy] = useState([])
+ const [alertDelete, setAlertDelete] = useState(false)
+ const [idDelete, setIdDelete] = useState(0)
+ const [idGantt, setIdGantt] = useState(0)
+ const [humanResource, setHumanResource] = useState([])
+
+ useEffect(() => {
+ if (idTask > 0) {
+ getdataHierarchy();
+ }
+ }, [idTask, openDialog])
+
+ useEffect(() => {
+ getDataHumanResource();
+ }, [])
+
+ useEffect(() => {
+ if (!openDialog) {
+ setDataHierarchy([]);
+ } else {
+
+ }
+ }, [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)
+ }
+
+
+ const getdataHierarchy = async () => {
+
+ const payload = {
+ "columns": [
+ { "name": "project_id", "logic_operator": "=", "value": idTask, "operator": "AND" }
+ ]
+ }
+ const result = await axios
+ .post(HIERARCHY_FTTH_SEARCH, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.status == 200) {
+ setDataHierarchy(result.data.data);
+ } else {
+ NotificationManager.error(`Data gantt project gagal terload silahkan coba lagi!`, 'Failed!!');
+ }
+ }
+
+ const handleCancel = () => {
+ setDataHierarchy([]);
+ closeDialog('cancel', 'none')
+ }
+
+ const handleDelete = (id) => {
+ setIdDelete(id)
+ setAlertDelete(true)
+ }
+
+ const handleUserGant = (id) => {
+ setIdGantt(id)
+ setOpenDialogUserGantt(true)
+ }
+
+ const RenderTable = useMemo(() => {
+ const columns = [
+ {
+ title: 'Action',
+ dataIndex: '',
+ key: 'id',
+ className: "nowrap",
+ render: (text, record) =>
+ <>
+
+
+ {" "}
+ >
+ ,
+ },
+ { title: 'Nama', dataIndex: 'name', key: 'name' },
+ { title: 'Tanggal dibuat', dataIndex: 'created_at', key: 'created_at', render: (text, record) => (
{text ? moment(text).format("D-M-YYYY") : "-"}
) },
+
+ ];
+
+ return (
+
+ )
+ }, [dataHierarchy])
+
+ const cancelDelete = () => {
+ setAlertDelete(false)
+ setIdDelete(0)
+ }
+
+ const onConfirmDelete = async () => {
+ let urlDel = HIERARCHY_FTTH_DELETE(idDelete)
+ const result = await axios.delete(urlDel, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ getdataHierarchy()
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.success(`Data Hierarchy berhasil dihapus`, 'Success!!');
+ } else {
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.error(`Data Hierarchy gagal dihapus`, 'Failed!!');
+ }
+ }
+
+ const handleOpenDialogForm = () => {
+ setOpenDialogForm(true)
+ }
+
+ const toggleDialogForm = () => {
+ setOpenDialogForm(!openDialogForm)
+ }
+
+ const closeDialogForm = (status) => {
+ if (status == "success") {
+ getdataHierarchy()
+ NotificationManager.success(`Gantt berhasil dibuat!`, 'Success!!');
+ } else if (status == "failed") {
+ NotificationManager.error(`Gantt gagal dibuat!`, 'Failed!!');
+ }
+ setOpenDialogForm(false)
+ }
+
+ const toggleDialogUser = () => {
+ if (openDialogUserGantt) {
+ setIdGantt(0)
+ }
+ setOpenDialogUserGantt(!openDialogUserGantt)
+ }
+
+ const closeDialogUser = (status) => {
+ if (status == "success") {
+ NotificationManager.success(`Gantt Permission berhasil disimpan!`, 'Success!!');
+ } else if (status == "failed") {
+ NotificationManager.error(`Gantt Permission gagal disimpan!`, 'Failed!!');
+ }
+ setOpenDialogUserGantt(false)
+ setIdGantt(0)
+ }
+
+ return (
+ <>
+
+
+ Hierarchy Project {proyekName}
+
+
+
+ {RenderTable}
+
+
+ {/*
+
+ */}
+
+
+ cancelDelete()}
+ focusCancelBtn
+ >
+ Delete this data
+
+
+
+
+ >
+ )
+
+}
+
+export default DialogHierarchy;
diff --git a/src/views/SimproV2/CreatedProyek/index.js b/src/views/SimproV2/CreatedProyek/index.js
index 7e20d37..21d8fd4 100644
--- a/src/views/SimproV2/CreatedProyek/index.js
+++ b/src/views/SimproV2/CreatedProyek/index.js
@@ -65,6 +65,7 @@ import DialogTableTools from "./DialogTableTools";
import DialogDocument from "./DialogDocument";
import DialogInitDocument from "./DialogInitDocument";
import DialogGantt from "./DialogGantt";
+import DialogHierarchy from "./DIalogHierarchy";
// import DialogAsignHr from './AsignHrProject';
import AssignHrProject from "./AsignHrProject";
import AssignK3Project from "./AssignK3Project";
@@ -98,6 +99,7 @@ const CreatedProyek = ({ params, ...props }) => {
const [openDialogMaterial, setOpenDialogMaterial] = useState(false);
const [openDialogTools, setOpenDialogTools] = useState(false);
const [openDialogGantt, setOpenDialogGantt] = useState(false);
+ const [openDialogHierarchy, setOpenDialogHierarchy] = useState(false);
const [openDialogAsignHR, setOpenDialogAsignHR] = useState(false);
const [openDialogAssignK3, setOpenDialogAssignK3] = useState(false);
const [dataK3, setDataK3] = useState([]); // transfer list
@@ -125,7 +127,9 @@ const CreatedProyek = ({ params, ...props }) => {
const [projectApproval, setProjectApproval] = useState(null);
const [loadVersionGantt, setLoadVersionGantt] = useState(false);
+ const [loadHierarchy, setLoadHierarchy] = useState(false);
const [dataVersionGantt, setDataVersionGantt] = useState([]);
+ const [dataHierarchy, setDataHierarchy] = useState([]);
const pageName = params.name;
@@ -302,6 +306,33 @@ const CreatedProyek = ({ params, ...props }) => {
}
};
+ const getdataHierarchy = async (idTask) => {
+ setLoadHierarchy(true);
+ const payload = {
+ columns: [
+ {
+ name: "proyek_id",
+ logic_operator: "=",
+ value: idTask,
+ operator: "AND",
+ },
+ ],
+ };
+ const result = await axios
+ .post(VERSION_GANTT_SEARCH, payload, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.status == 200) {
+ setDataHierarchy(result.data.data);
+ setLoadHierarchy(false);
+ } else {
+ NotificationManager.error(
+ `Data gantt project gagal terload silahkan coba lagi!`,
+ "Failed!!"
+ );
+ }
+ };
const getDataToolsResource = async () => {
const result = await axios
.get(TOOLS_RESOURCE_LIST, HEADER)
@@ -355,6 +386,12 @@ const CreatedProyek = ({ params, ...props }) => {
setProyekName(data.nama);
setOpenDialogGantt(true);
};
+
+ const handleOpenDialogHierarchy = (data) => {
+ setidTask(data.id);
+ setProyekName(data.nama);
+ setOpenDialogHierarchy(true);
+ };
const toggleDialogGantt = () => {
setOpenDialogGantt(!openDialogGantt);
@@ -363,6 +400,14 @@ const CreatedProyek = ({ params, ...props }) => {
const closeDialogGantt = () => {
setOpenDialogGantt(false);
};
+
+ const toggleDialogHierarchy = () => {
+ setOpenDialogHierarchy(!openDialogHierarchy);
+ };
+
+ const closeDialogHierarchy = () => {
+ setOpenDialogHierarchy(false);
+ };
const handleOpenDialogMaterial = (data) => {
setidTask(data.id);
@@ -987,15 +1032,25 @@ const CreatedProyek = ({ params, ...props }) => {
}}
>
)}
- handleOpenDialogGantt(text)}
- >
-
-
-
- More Gantt Menu ...
-
+ {text.type_proyek_id == 9 ?
+ handleOpenDialogHierarchy(text)}
+ >
+
+
+
+ More Hierarchy Menu ...
+
:
+ handleOpenDialogGantt(text)}
+ >
+
+
+
+ More Gantt Menu ...
+
}
>
)}
@@ -1026,15 +1081,26 @@ const CreatedProyek = ({ params, ...props }) => {
content={popupMenuGantt(text, record)}
trigger="click"
>
-
-
+ {
+ text.type_proyek_id == 9 ?
+ :
+
+ }
+
>
),
},
@@ -1254,6 +1320,19 @@ const CreatedProyek = ({ params, ...props }) => {
),
[openDialogGantt]
);
+
+ const renderDialogHierarchy = useMemo(
+ () => (
+
+ ),
+ [openDialogHierarchy]
+ );
return (
@@ -1278,6 +1357,7 @@ const CreatedProyek = ({ params, ...props }) => {
{RenderDialogTableTools}
{RenderDialogDoc}
{renderDialogGantt}
+ {renderDialogHierarchy}
{RenderDialogAsignHr}
{RenderDialogAssignK3}