diff --git a/src/views/SimproV2/CreatedProyek/DialogGantt.js b/src/views/SimproV2/CreatedProyek/DialogGantt.js
index 9d2f776..fdce115 100644
--- a/src/views/SimproV2/CreatedProyek/DialogGantt.js
+++ b/src/views/SimproV2/CreatedProyek/DialogGantt.js
@@ -1,276 +1,293 @@
-import React, { useEffect, useState, useMemo } from 'react'
-import { Modal, ModalHeader, ModalBody, ModalFooter, Breadcrumb, BreadcrumbItem} 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 { VERSION_GANTT_DELETE, VERSION_GANTT_SEARCH, USER_LIST } 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 }) => {
- 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 [dataGantt, setDataGantt] = useState([])
- const [alertDelete, setAlertDelete] = useState(false)
- const [idDelete, setIdDelete] = useState(0)
- const [idGantt, setIdGantt] = useState(0)
- const [humanResource, setHumanResource] = useState([])
-
- useEffect(() => {
- if (openDialog && hierarchyId > 0 || idTask > 0 && !openDialogHierarchy) {
- getdataGantt();
- }
- 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)
- }
-
-
- const getdataGantt = async () => {
- let payload;
- if (hierarchyId) {
- payload = {
- "select": ["id", "name_version", "calculation_type", "description", "created_at", "progress"],
- "columns": [
- { "name": "hierarchy_ftth_id", "logic_operator": "=", "value": hierarchyId, "operator": "AND" }
- ]
- }
- } else {
- payload = {
- "select": ["id", "name_version", "calculation_type", "description", "created_at", "progress"],
- "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) {
- setDataGantt(result.data.data);
- } else {
- NotificationManager.error(`Data gantt project gagal terload silahkan coba lagi!`, 'Failed!!');
- }
- }
-
- const handleCancel = () => {
- setDataGantt([]);
- 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_version', key: 'name_version' },
- { title: 'Tipe kalkulasi', dataIndex: 'calculation_type', key: 'calculation_type' },
- { title: 'Deskripsi', dataIndex: 'description', key: 'description' },
- { title: 'Tanggal dibuat', dataIndex: 'created_at', key: 'created_at', render: (text, record) => (
{text ? moment(text).format("D-M-YYYY") : "-"}
) },
- { title: 'Progress', dataIndex: 'progress', key: 'progress' }
-
- ];
-
- return (
-
- )
- }, [dataGantt])
-
- const cancelDelete = () => {
- setAlertDelete(false)
- setIdDelete(0)
- }
-
- const onConfirmDelete = async () => {
- let urlDel = VERSION_GANTT_DELETE(idDelete)
- const result = await axios.delete(urlDel, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code === 200) {
- getdataGantt()
- setIdDelete(0)
- setAlertDelete(false)
- NotificationManager.success(`Dokumen project berhasil dihapus`, 'Success!!');
- } else {
- setIdDelete(0)
- setAlertDelete(false)
- NotificationManager.error(`Dokumen project gagal dihapus`, 'Failed!!');
- }
- }
-
- const handleOpenDialogForm = () => {
- setOpenDialogForm(true)
- }
-
- const toggleDialogForm = () => {
- setOpenDialogForm(!openDialogForm)
- }
-
- const closeDialogForm = (status) => {
- if (status == "success") {
- getdataGantt()
- 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 (
- <>
-
-
- {hierarchyName ?
-
- Project
- {hierarchyName}
-
- :
- Gantt Project {proyekName}
- }
- {!hierarchyId && (<>
- >
- )}
-
-
-
- {RenderTable}
-
-
- {/*
-
- */}
-
-
- cancelDelete()}
- focusCancelBtn
- >
- Delete this data
-
-
-
-
- >
- )
-
-}
-
-export default DialogGantt;
+import React, { useEffect, useState, useMemo } from 'react'
+import { Modal, ModalHeader, ModalBody, ModalFooter, Breadcrumb, BreadcrumbItem} 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 { VERSION_GANTT_DELETE, VERSION_GANTT_SEARCH, USER_LIST } 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 }) => {
+ 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 [dataGantt, setDataGantt] = useState([])
+ 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('')
+
+ useEffect(() => {
+ if (openDialog && hierarchyId > 0 || idTask > 0 && !openDialogHierarchy) {
+ getdataGantt();
+ }
+ 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)
+ }
+
+
+ const getdataGantt = async () => {
+ let payload;
+ if (hierarchyId) {
+ payload = {
+ "select": ["id", "name_version", "calculation_type", "description", "created_at", "progress"],
+ "columns": [
+ { "name": "hierarchy_ftth_id", "logic_operator": "=", "value": hierarchyId, "operator": "AND" }
+ ]
+ }
+ } else {
+ payload = {
+ "select": ["id", "name_version", "calculation_type", "description", "created_at", "progress"],
+ "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) {
+ setDataGantt(result.data.data);
+ } else {
+ NotificationManager.error(`Data gantt project gagal terload silahkan coba lagi!`, 'Failed!!');
+ }
+ }
+
+ const handleCancel = () => {
+ setDataGantt([]);
+ closeDialog('cancel', 'none')
+ }
+
+ const handleDelete = (id) => {
+ setIdDelete(id)
+ setAlertDelete(true)
+ }
+
+ const handleEdit = (data) => {
+ setDataEdit(data)
+ handleOpenDialogForm('Edit');
+ }
+
+ 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_version', key: 'name_version' },
+ { title: 'Tipe kalkulasi', dataIndex: 'calculation_type', key: 'calculation_type' },
+ { title: 'Deskripsi', dataIndex: 'description', key: 'description' },
+ { title: 'Tanggal dibuat', dataIndex: 'created_at', key: 'created_at', render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
+ { title: 'Progress', dataIndex: 'progress', key: 'progress' }
+
+ ];
+
+ return (
+
+ )
+ }, [dataGantt])
+
+ const cancelDelete = () => {
+ setAlertDelete(false)
+ setIdDelete(0)
+ }
+
+ const onConfirmDelete = async () => {
+ let urlDel = VERSION_GANTT_DELETE(idDelete)
+ const result = await axios.delete(urlDel, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ getdataGantt()
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.success(`Dokumen project berhasil dihapus`, 'Success!!');
+ } else {
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.error(`Dokumen project gagal dihapus`, 'Failed!!');
+ }
+ }
+
+ const handleOpenDialogForm = async (type) => {
+ await setTypeDialog(type);
+ setOpenDialogForm(true);
+ }
+
+ const toggleDialogForm = () => {
+ setOpenDialogForm(!openDialogForm)
+ }
+
+ const closeDialogForm = (status) => {
+ if (status == "Save") {
+ getdataGantt()
+ NotificationManager.success(`Gantt berhasil dibuat!`, 'Success!!');
+ }else if (status == "Edit") {
+ getdataGantt()
+ NotificationManager.success(`Gantt berhasil dibubah!`, 'Failed!!');
+ }else if (status == "failed") {
+ NotificationManager.error(`Gantt gagal dibuat!`, 'Failed!!');
+ }
+ setDataEdit([])
+ 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 (
+ <>
+
+
+ {hierarchyName ?
+
+ Project
+ {hierarchyName}
+
+ :
+ Gantt Project {proyekName}
+ }
+ {!hierarchyId && (<>
+ >
+ )}
+
+
+
+ {RenderTable}
+
+
+ {/*
+
+ */}
+
+
+ cancelDelete()}
+ focusCancelBtn
+ >
+ Delete this data
+
+
+
+
+ >
+ )
+
+}
+
+export default DialogGantt;