diff --git a/src/views/SimproV2/CreatedProyek/AsignCustProject.js b/src/views/SimproV2/CreatedProyek/AsignCustProject.js index dca803a..55c1dd6 100644 --- a/src/views/SimproV2/CreatedProyek/AsignCustProject.js +++ b/src/views/SimproV2/CreatedProyek/AsignCustProject.js @@ -1,7 +1,7 @@ import React, { useEffect, useState, useMemo } from 'react' import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Button, Form } from 'reactstrap'; -import { Table, Tooltip } from 'antd'; +import { Table, Tooltip, Spin } from 'antd'; import 'antd/dist/antd.css'; import moment from 'moment'; import { @@ -25,9 +25,11 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy const [alertDelete, setAlertDelete] = useState(false) const [idDelete, setIdDelete] = useState(0) const [openDialogFormTools, setOpenDialogFormTools] = useState(false) + const [loading, setLoading] = useState(true); useEffect(() => { - if (idTask > 0) { + if (idTask > 0) { + setLoading(true); getDataAssignHr(); } }, [openDialog]); @@ -63,8 +65,10 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy if (result && result.data && result.data.code == 200) { let dataRes = result.data.data || [] const filteredData = dataRes.filter(item => item.is_customer === true); - setdataUserToProject(filteredData); + setdataUserToProject(filteredData); + setLoading(false); } else { + setLoading(false); NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); } } @@ -185,8 +189,10 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
Assign Customer - {proyekName}
- - {renderForm()} + + + {renderForm()} + { if (idTask > 0) { + setLoading(true); getDataAssignHr(); } }, [openDialog]); useEffect(() => { - if (openDialog) { + if (openDialog) { getDataProjectRole(); getDataUser(); } @@ -70,9 +72,10 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR if (result && result.data && result.data.code == 200) { let dataRes = result.data.data || [] - - setdataUserToProject(dataRes); + setdataUserToProject(dataRes); + setLoading(false); } else { + setLoading(false); NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); } } @@ -158,7 +161,7 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR } const handleOpenDialogFormTools = () => { - setOpenDialogFormTools(true) + setOpenDialogFormTools(true) } const handleCancel = () => { @@ -280,8 +283,10 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
Assign Human Resource - {proyekName}
- - {renderForm()} + + + {renderForm()} + {/* diff --git a/src/views/SimproV2/CreatedProyek/AssignK3Project.js b/src/views/SimproV2/CreatedProyek/AssignK3Project.js index 8b8c2b5..14506ea 100644 --- a/src/views/SimproV2/CreatedProyek/AssignK3Project.js +++ b/src/views/SimproV2/CreatedProyek/AssignK3Project.js @@ -1,141 +1,149 @@ -import React, { useEffect, useState } from 'react' -import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; -import { Button, Form } from 'reactstrap'; -import axios from "../../../const/interceptorApi"; -import { PROJECT_TO_CHECKLIST_K3_ADDS, PROJECT_TO_CHECKLIST_K3_SEARCH } from '../../../const/ApiConst'; -import { Transfer } from 'antd'; -import 'antd/dist/antd.css'; - -const AssignK3Project = ({ openDialog, closeDialog, toggleDialog, idTask, dataK3, proyekName }) => { - const token = localStorage.getItem("token") - const HEADER = { - headers: { - "Content-Type": "application/json", - "Authorization": `Bearer ${token}` - } - } - const [id, setId] = useState(0) - const [targetKeys, setTargetKeys] = useState([]) - - - const handleClearData = () => { - setId(0) - setTargetKeys([]) - } - - useEffect(() => { - if(!openDialog){ - handleClearData() - } - }, [openDialog]) - - useEffect(() => { - if(idTask && idTask > 0){ - getK3toProject() - } - }, [idTask]) - - const getK3toProject = async () => { - const payload = { - "columns": [ - { "name": "proyek_id", "logic_operator": "=", "value": idTask, "operator": "AND" } - ] - } - const result = await axios - .post(PROJECT_TO_CHECKLIST_K3_SEARCH, payload, HEADER) - .then(res => res) - .catch((error) => error.response); - - if(result && result.status==200){ - console.log("cek get project to checklist k3",result.data.data) - let data = result.data.data || [] - let newTargetKeys = [] - if (data.length > 0) { - data.map((val,index)=> { - newTargetKeys.push(val.checklist_k3_id) - }); - } - setTargetKeys(newTargetKeys) - }else{ - - } - } - - const handleSave = async () => { - await saveAssign() - handleClearData() - } - - const saveAssign= async () => { - - const formData = { - checklist_k3_id:targetKeys, - proyek_id:idTask - } - - const result = await axios - .post(PROJECT_TO_CHECKLIST_K3_ADDS, formData, HEADER) - .then(res => res) - .catch((error) => error.response); - - - if(result && result.status==200){ - closeDialog('success') - }else{ - closeDialog('failed') - } - } - - const handleCancel = () => { - closeDialog('cancel') - handleClearData() - } - - const handleChange = targetKeys => { - setTargetKeys(targetKeys) - }; - - const renderForm = () => { - return ( -
- item.title} - listStyle={{ - width: 250, - height: 300, - }} - /> -
- ) - } - - - return ( - <> - - Assign K3 to Project {proyekName !== '' ? `- ${proyekName}` : ''} - - {renderForm()} - - - {' '} - - - - - ) - -} - -export default AssignK3Project; \ No newline at end of file +import React, { useEffect, useState } from 'react' +import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; +import { Button, Form } from 'reactstrap'; +import axios from "../../../const/interceptorApi"; +import { PROJECT_TO_CHECKLIST_K3_ADDS, PROJECT_TO_CHECKLIST_K3_SEARCH } from '../../../const/ApiConst'; +import { Transfer, Spin } from 'antd'; +import 'antd/dist/antd.css'; +import { NotificationManager } from 'react-notifications'; + +const AssignK3Project = ({ openDialog, closeDialog, toggleDialog, idTask, dataK3, proyekName }) => { + const token = localStorage.getItem("token") + const [loading, setLoading] = useState(true); + + const HEADER = { + headers: { + "Content-Type": "application/json", + "Authorization": `Bearer ${token}` + } + } + const [id, setId] = useState(0) + const [targetKeys, setTargetKeys] = useState([]) + + + const handleClearData = () => { + setId(0) + setTargetKeys([]) + } + + useEffect(() => { + if(!openDialog){ + handleClearData() + } + }, [openDialog]) + + useEffect(() => { + if (idTask && idTask > 0) { + setLoading(true); + getK3toProject() + } + }, [idTask]) + + const getK3toProject = async () => { + const payload = { + "columns": [ + { "name": "proyek_id", "logic_operator": "=", "value": idTask, "operator": "AND" } + ] + } + const result = await axios + .post(PROJECT_TO_CHECKLIST_K3_SEARCH, payload, HEADER) + .then(res => res) + .catch((error) => error.response); + + if(result && result.status==200){ + console.log("cek get project to checklist k3",result.data.data) + let data = result.data.data || [] + let newTargetKeys = [] + if (data.length > 0) { + data.map((val,index)=> { + newTargetKeys.push(val.checklist_k3_id) + }); + } + setTargetKeys(newTargetKeys) + setLoading(false); + }else{ + setLoading(false); + NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); + } + } + + const handleSave = async () => { + await saveAssign() + handleClearData() + } + + const saveAssign= async () => { + + const formData = { + checklist_k3_id:targetKeys, + proyek_id:idTask + } + + const result = await axios + .post(PROJECT_TO_CHECKLIST_K3_ADDS, formData, HEADER) + .then(res => res) + .catch((error) => error.response); + + + if(result && result.status==200){ + closeDialog('success') + }else{ + closeDialog('failed') + } + } + + const handleCancel = () => { + closeDialog('cancel') + handleClearData() + } + + const handleChange = targetKeys => { + setTargetKeys(targetKeys) + }; + + const renderForm = () => { + return ( +
+ item.title} + listStyle={{ + width: 250, + height: 300, + }} + /> +
+ ) + } + + + return ( + <> + + Assign K3 to Project {proyekName !== '' ? `- ${proyekName}` : ''} + + + {renderForm()} + + + + {' '} + + + + + ) + +} + +export default AssignK3Project; diff --git a/src/views/SimproV2/CreatedProyek/DialogDocument.js b/src/views/SimproV2/CreatedProyek/DialogDocument.js index 6a70a96..a39529e 100644 --- a/src/views/SimproV2/CreatedProyek/DialogDocument.js +++ b/src/views/SimproV2/CreatedProyek/DialogDocument.js @@ -1,341 +1,347 @@ -import React, { useEffect, useState, useMemo } from 'react' -import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; -import { Button } from 'reactstrap'; -import { Table, Tooltip, Popover } from 'antd'; -import 'antd/dist/antd.css'; -import moment from 'moment'; -import SweetAlert from 'react-bootstrap-sweetalert'; -import { DOCUMENT_DOWNLOAD, DOCUMENT_GET, BASE_SIMPRO_LUMEN_FILE, REQUEST_MATERIAL_EDIT, DOCUMENT_DELETE, DOCUMENT_SEARCH, FOLDER_DOCUMENT_PROYEK_GET_TREE, FOLDER_DOCUMENT_PROYEK_DELETE } from '../../../const/ApiConst'; -import axios from "../../../const/interceptorApi" -import { NotificationContainer, NotificationManager } from 'react-notifications'; -import DialogRequest from './FormDocument'; -import DialogRequestFolder from './FormFolderDocument'; -const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => { - const token = localStorage.getItem("token") - const HEADER = { - headers: { - "Content-Type": "application/json", - "Authorization": `Bearer ${token}` - } - } - const config = { - headers: - { - Authorization: `Bearer ${token}`, - "Content-type": `application/json` - } - }; - const [dataDocument, setDataDocument] = useState([]) - const [openDialogReq, setOpenDialogReq] = useState(false) - const [openDialogNewFolder, setOpenDialogNewFolder] = useState(false) - const [alertDelete, setAlertDelete] = useState(false) - const [alertDeleteFolder, setAlertDeleteFolder] = useState(false) - const [idDelete, setIdDelete] = useState(0) - const [dataEdit, setDataEdit] = useState(null) - const [parentIdNewFolder, setParentIdNewFolder] = useState(0) - - useEffect(() => { - if (idTask > 0) { - getDataDocument(); - } - }, [idTask, openDialog]) - - useEffect(() => { - if (!openDialog) { - setDataDocument([]); - } else { - - } - }, [openDialog]) - - - - - - - const getDataDocument = async () => { - const url = FOLDER_DOCUMENT_PROYEK_GET_TREE(idTask) - const result = await axios - .get(url, config) - .then(res => res) - .catch((error) => error.response); - if (result && result.data && result.data.code == 200) { - setDataDocument(result.data.data); - } else { - NotificationManager.error('Gagal mengambil data, Silahkan coba lagi!!', 'Failed'); - } - } - - const handleCancel = () => { - setDataDocument([]); - closeDialog('cancel', 'none') - } - - const handleDelete = (id) => { - setIdDelete(id) - setAlertDelete(true) - } - - const handleDeleteFolder = (id) => { - setIdDelete(id) - setAlertDeleteFolder(true) - } - - const handleDownload = (id, file) => { - fetch(DOCUMENT_DOWNLOAD(id), { - headers: new Headers({ - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }) - }) - .then(response => { - response.blob().then(blob => { - const url = window.URL.createObjectURL(new Blob([blob])); - let a = document.createElement('a'); - a.href = url; - a.download = file; - a.click(); - a.remove(); - }); - //window.location.href = response.url; - }); - // const urlDownload = DOCUMENT_DOWNLOAD(id); - // window.open(urlDownload); - } - - const handleShow = (file) => { - const urlShow = `${BASE_SIMPRO_LUMEN_FILE}/${file}` - window.open(urlShow); - } - - const handleNewFolderParent = (folderId) => { - setParentIdNewFolder(folderId) - setOpenDialogNewFolder(true) - } - - const handleNewFolderWOParent = () => { - setParentIdNewFolder(0) - setOpenDialogNewFolder(true) - } - - const handleNewFileParent = (folderId) => { - setParentIdNewFolder(folderId) - openDialogRequest() - } - - const handleNewFileWOParent = () => { - setParentIdNewFolder(0) - openDialogRequest() - } - - const renderShowDokumen = (file) => { - let arrayFile = file.split(".") - let length = arrayFile.length - length = length - 1 - const fileExt = arrayFile[length]; - if (fileExt == "pdf" || fileExt == "png" || fileExt == "jpg" || fileExt == "jpeg" || fileExt == "gif") { - return ( - - - - ) - } - } - const RenderTable = useMemo(() => { - const columns = [ - { - title: 'Action', - dataIndex: '', - key: 'id', - className: "nowrap", - render: (text, record) => - <> - {!record.isDir && - - }{" "} - {record.isDir && - - }{" "} - {!record.isDir && - - }{" "} - {record.isDir && - - }{" "} - {record.isDir && - - }{" "} - {text.file ? renderShowDokumen(text.file) : ""} - - , - }, - { title: 'Document Name', dataIndex: 'name_folder', key: 'name_folder', render: (text, record) => record.isDir ? record.name_folder : record.file }, - { title: 'Type', dataIndex: 'isDir', key: 'isDir', render: (text, record) => record.isDir ? 'Folder' : 'File' }, - { title: 'Upload Date', dataIndex: 'created_at', key: 'created_at', render: (text, record) => (
{text ? moment(text).format("D-M-YYYY") : "-"}
) } - ]; - - return ( - - ) - }, [dataDocument]) - - const closeDialogReq = (type) => { - if (type == "upload") { - getDataDocument(); - } - setOpenDialogReq(false); - } - - const toggleDialogReq = () => { - setOpenDialogReq(!openDialogReq) - } - - const openDialogRequest = () => { - setOpenDialogReq(true) - } - - const cancelDelete = () => { - setAlertDelete(false) - setIdDelete(0) - } - - const cancelDeleteFolder = () => { - setAlertDeleteFolder(false) - setIdDelete(0) - } - - const onConfirmDelete = async () => { - let urlDel = DOCUMENT_DELETE(idDelete) - const result = await axios.delete(urlDel, HEADER) - .then(res => res) - .catch((error) => error.response); - - if (result && result.data && result.data.code === 200) { - getDataDocument() - setIdDelete(0) - setAlertDelete(false) - NotificationManager.success(`Dokumen project berhasil dihapus`, 'Success!!'); - } else { - setIdDelete(0) - setAlertDelete(false) - NotificationManager.error(`Dokumen project gagal dihapus`, 'Failed!!'); - } - } - - const onConfirmDeleteFolder = async () => { - let urlDel = FOLDER_DOCUMENT_PROYEK_DELETE(idDelete) - const result = await axios.delete(urlDel, HEADER) - .then(res => res) - .catch((error) => error.response); - - if (result && result.data && result.data.code === 200) { - getDataDocument() - setIdDelete(0) - setAlertDeleteFolder(false) - NotificationManager.success(`Folder berhasil dihapus`, 'Success!!'); - } else { - setIdDelete(0) - setAlertDeleteFolder(false) - NotificationManager.error(`Folder gagal dihapus`, 'Failed!!'); - } - } - - const closeDialogNewFolder = (type) => { - if (type == "upload") { - getDataDocument(); - } - setOpenDialogNewFolder(false); - setParentIdNewFolder(0); - } - - const toggleDialogNewFolder = () => { - setOpenDialogNewFolder(!openDialogNewFolder) - } - - return ( - <> - - -
Project Documents - {proyekName}
- {/* */} - {/* - - */} -
- - - - - - - -
- {/* */} -
- -
- {RenderTable} -
-
- {/* - - */} -
- - cancelDelete()} - focusCancelBtn - > - Delete this data - - - cancelDeleteFolder()} - focusCancelBtn - > - Delete this folder - - - - - - - ) - -} - -export default DialogDocument; +import React, { useEffect, useState, useMemo } from 'react' +import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; +import { Button } from 'reactstrap'; +import { Table, Tooltip, Popover, Spin } from 'antd'; +import 'antd/dist/antd.css'; +import moment from 'moment'; +import SweetAlert from 'react-bootstrap-sweetalert'; +import { DOCUMENT_DOWNLOAD, DOCUMENT_GET, BASE_SIMPRO_LUMEN_FILE, REQUEST_MATERIAL_EDIT, DOCUMENT_DELETE, DOCUMENT_SEARCH, FOLDER_DOCUMENT_PROYEK_GET_TREE, FOLDER_DOCUMENT_PROYEK_DELETE } from '../../../const/ApiConst'; +import axios from "../../../const/interceptorApi" +import { NotificationContainer, NotificationManager } from 'react-notifications'; +import DialogRequest from './FormDocument'; +import DialogRequestFolder from './FormFolderDocument'; +const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => { + const token = localStorage.getItem("token") + const HEADER = { + headers: { + "Content-Type": "application/json", + "Authorization": `Bearer ${token}` + } + } + const config = { + headers: + { + Authorization: `Bearer ${token}`, + "Content-type": `application/json` + } + }; + const [dataDocument, setDataDocument] = useState([]) + const [openDialogReq, setOpenDialogReq] = useState(false) + const [openDialogNewFolder, setOpenDialogNewFolder] = useState(false) + const [alertDelete, setAlertDelete] = useState(false) + const [alertDeleteFolder, setAlertDeleteFolder] = useState(false) + const [idDelete, setIdDelete] = useState(0) + const [dataEdit, setDataEdit] = useState(null) + const [parentIdNewFolder, setParentIdNewFolder] = useState(0) + const [loading, setLoading] = useState(true); + + useEffect(() => { + if (idTask > 0) { + setLoading(true); + getDataDocument(); + } + }, [idTask, openDialog]) + + useEffect(() => { + if (!openDialog) { + setDataDocument([]); + } else { + + } + }, [openDialog]) + + + + + + + const getDataDocument = async () => { + const url = FOLDER_DOCUMENT_PROYEK_GET_TREE(idTask) + const result = await axios + .get(url, config) + .then(res => res) + .catch((error) => error.response); + if (result && result.data && result.data.code == 200) { + setDataDocument(result.data.data); + setLoading(false); + } else { + setLoading(false); + NotificationManager.error('Gagal mengambil data, Silahkan coba lagi!!', 'Failed'); + } + } + + const handleCancel = () => { + setDataDocument([]); + closeDialog('cancel', 'none') + } + + const handleDelete = (id) => { + setIdDelete(id) + setAlertDelete(true) + } + + const handleDeleteFolder = (id) => { + setIdDelete(id) + setAlertDeleteFolder(true) + } + + const handleDownload = (id, file) => { + fetch(DOCUMENT_DOWNLOAD(id), { + headers: new Headers({ + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + }) + }) + .then(response => { + response.blob().then(blob => { + const url = window.URL.createObjectURL(new Blob([blob])); + let a = document.createElement('a'); + a.href = url; + a.download = file; + a.click(); + a.remove(); + }); + //window.location.href = response.url; + }); + // const urlDownload = DOCUMENT_DOWNLOAD(id); + // window.open(urlDownload); + } + + const handleShow = (file) => { + const urlShow = `${BASE_SIMPRO_LUMEN_FILE}/${file}` + window.open(urlShow); + } + + const handleNewFolderParent = (folderId) => { + setParentIdNewFolder(folderId) + setOpenDialogNewFolder(true) + } + + const handleNewFolderWOParent = () => { + setParentIdNewFolder(0) + setOpenDialogNewFolder(true) + } + + const handleNewFileParent = (folderId) => { + setParentIdNewFolder(folderId) + openDialogRequest() + } + + const handleNewFileWOParent = () => { + setParentIdNewFolder(0) + openDialogRequest() + } + + const renderShowDokumen = (file) => { + let arrayFile = file.split(".") + let length = arrayFile.length + length = length - 1 + const fileExt = arrayFile[length]; + if (fileExt == "pdf" || fileExt == "png" || fileExt == "jpg" || fileExt == "jpeg" || fileExt == "gif") { + return ( + + + + ) + } + } + const RenderTable = useMemo(() => { + const columns = [ + { + title: 'Action', + dataIndex: '', + key: 'id', + className: "nowrap", + render: (text, record) => + <> + {!record.isDir && + + }{" "} + {record.isDir && + + }{" "} + {!record.isDir && + + }{" "} + {record.isDir && + + }{" "} + {record.isDir && + + }{" "} + {text.file ? renderShowDokumen(text.file) : ""} + + , + }, + { title: 'Document Name', dataIndex: 'name_folder', key: 'name_folder', render: (text, record) => record.isDir ? record.name_folder : record.file }, + { title: 'Type', dataIndex: 'isDir', key: 'isDir', render: (text, record) => record.isDir ? 'Folder' : 'File' }, + { title: 'Upload Date', dataIndex: 'created_at', key: 'created_at', render: (text, record) => (
{text ? moment(text).format("D-M-YYYY") : "-"}
) } + ]; + + return ( +
+ ) + }, [dataDocument]) + + const closeDialogReq = (type) => { + if (type == "upload") { + getDataDocument(); + } + setOpenDialogReq(false); + } + + const toggleDialogReq = () => { + setOpenDialogReq(!openDialogReq) + } + + const openDialogRequest = () => { + setOpenDialogReq(true) + } + + const cancelDelete = () => { + setAlertDelete(false) + setIdDelete(0) + } + + const cancelDeleteFolder = () => { + setAlertDeleteFolder(false) + setIdDelete(0) + } + + const onConfirmDelete = async () => { + let urlDel = DOCUMENT_DELETE(idDelete) + const result = await axios.delete(urlDel, HEADER) + .then(res => res) + .catch((error) => error.response); + + if (result && result.data && result.data.code === 200) { + getDataDocument() + setIdDelete(0) + setAlertDelete(false) + NotificationManager.success(`Dokumen project berhasil dihapus`, 'Success!!'); + } else { + setIdDelete(0) + setAlertDelete(false) + NotificationManager.error(`Dokumen project gagal dihapus`, 'Failed!!'); + } + } + + const onConfirmDeleteFolder = async () => { + let urlDel = FOLDER_DOCUMENT_PROYEK_DELETE(idDelete) + const result = await axios.delete(urlDel, HEADER) + .then(res => res) + .catch((error) => error.response); + + if (result && result.data && result.data.code === 200) { + getDataDocument() + setIdDelete(0) + setAlertDeleteFolder(false) + NotificationManager.success(`Folder berhasil dihapus`, 'Success!!'); + } else { + setIdDelete(0) + setAlertDeleteFolder(false) + NotificationManager.error(`Folder gagal dihapus`, 'Failed!!'); + } + } + + const closeDialogNewFolder = (type) => { + if (type == "upload") { + getDataDocument(); + } + setOpenDialogNewFolder(false); + setParentIdNewFolder(0); + } + + const toggleDialogNewFolder = () => { + setOpenDialogNewFolder(!openDialogNewFolder) + } + + return ( + <> + + +
Project Documents - {proyekName}
+ {/* */} + {/* + + */} +
+ + + + + + + +
+ {/* */} +
+ + +
+ {RenderTable} +
+
+
+ {/* + + */} +
+ + cancelDelete()} + focusCancelBtn + > + Delete this data + + + cancelDeleteFolder()} + focusCancelBtn + > + Delete this folder + + + + + + + ) + +} + +export default DialogDocument; diff --git a/src/views/SimproV2/CreatedProyek/DialogGantt.js b/src/views/SimproV2/CreatedProyek/DialogGantt.js index 76bcb1d..e2ce30c 100644 --- a/src/views/SimproV2/CreatedProyek/DialogGantt.js +++ b/src/views/SimproV2/CreatedProyek/DialogGantt.js @@ -1,7 +1,7 @@ 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 { Table, Tooltip, Spin } from 'antd'; import 'antd/dist/antd.css'; import moment from 'moment'; import SweetAlert from 'react-bootstrap-sweetalert'; @@ -31,6 +31,7 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName const [humanResource, setHumanResource] = useState([]) const [dataEdit, setDataEdit] = useState([]) const [typeDialog, setTypeDialog] = useState('') + const [loading, setLoading] = useState(true); useEffect(() => { if (openDialog && hierarchyId > 0 || idTask > 0 && !openDialogHierarchy) { @@ -96,7 +97,9 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName return a.name_version.toLowerCase().localeCompare(b.name_version.toLowerCase()); }); setDataGantt(sortedData); + setLoading(false); } else { + setLoading(false); NotificationManager.error(`Data gantt project gagal terload silahkan coba lagi!`, 'Failed!!'); } } @@ -254,7 +257,9 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
- {RenderTable} + + {RenderTable} +
{/* diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js index c12f2dd..7bc00bc 100644 --- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -1,7 +1,21 @@ import React, {useState, useEffect} from 'react' -import { Modal, ModalHeader, ModalBody, ModalFooter, Card, CardHeader, CardBody } from 'reactstrap'; -import { TabContent, TabPane, Nav, NavItem, NavLink, Row, Col, Input } from 'reactstrap'; -import { Button } from 'reactstrap'; +import { + Modal, + ModalHeader, + ModalBody, + ModalFooter, + Card, + CardHeader, + CardBody, + TabContent, + TabPane, + Nav, + NavItem, + NavLink, + Row, + Col, + Button +} from 'reactstrap'; import axios from "../../../const/interceptorApi"; import { NotificationManager, @@ -9,7 +23,7 @@ import { import { BASE_SIMPRO_LUMEN } from "../../../const/ApiConst"; import 'antd/dist/antd.css'; import './style.css' -import { Select, Table, Tooltip } from 'antd'; +import { Select, Table, Tooltip, Spin } from 'antd'; import DialogFormAnalysis from './DialogFormAnalysis'; import moment from "moment"; const { Option } = Select @@ -29,6 +43,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => const [hrList, setHrList] = useState([]); const [groupedActivity, setGroupedActivity] = useState([]); const [selectedHr, setSelectedHr] = useState(null); + const [loading, setLoading] = useState(false); const toggle = (tab) => { if (activeTab !== tab) { @@ -235,12 +250,14 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => useEffect(() => { if (search) { + setLoading(true); getDataActivity() } }, [search]); useEffect(() => { if (selectedHr) { + setLoading(true); getDataActivityToHr() } }, [selectedHr]); @@ -398,7 +415,9 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => }); setAvgActivityHr(sum / dataRes.length); setDataTableActivityToHr(dataRes); + setLoading(false); } else { + setLoading(false); NotificationManager.error("Gagal Mengambil Data!!", "Failed"); } }; @@ -474,7 +493,9 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => setSumVolPlan(sumPlan); setSumVolAct(sumAct); setDatatable(dataRes); + setLoading(false); } else { + setLoading(false); NotificationManager.error("Gagal Mengambil Data!!", "Failed"); } }; @@ -531,13 +552,15 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
-
+ +
+ @@ -559,13 +582,15 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
-
+ +
+ diff --git a/src/views/SimproV2/CreatedProyek/index.js b/src/views/SimproV2/CreatedProyek/index.js index 4245557..b29b17a 100644 --- a/src/views/SimproV2/CreatedProyek/index.js +++ b/src/views/SimproV2/CreatedProyek/index.js @@ -525,6 +525,7 @@ const CreatedProyek = ({ params, ...props }) => { }; const handleOpenDialogViewDetail = async (data) => { + setLoading(true); setidTask(data.id); // setDataView(data) await getDataProject(data.id); @@ -698,7 +699,10 @@ const CreatedProyek = ({ params, ...props }) => { .then((res) => res) .catch((err) => err.response); if (result && result.data && result.data.code === 200) { + setLoading(false) setProjectImage(result.data.data); + }else{ + setLoading(false) } } diff --git a/src/views/SimproV2/ResourceWorker/index.js b/src/views/SimproV2/ResourceWorker/index.js index 8b42928..a466811 100644 --- a/src/views/SimproV2/ResourceWorker/index.js +++ b/src/views/SimproV2/ResourceWorker/index.js @@ -8,7 +8,7 @@ import moment from 'moment' import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap'; import { DownloadOutlined } from '@ant-design/icons'; import { NotificationContainer, NotificationManager } from 'react-notifications'; -import { Pagination, Table, Button, Tooltip } from 'antd'; +import { Pagination, Table, Button, Tooltip, Spin } from 'antd'; import { PROYEK_SEARCH, USER_ADD, USER_SEARCH, USER_EDIT, USER_DELETE, ROLE_SEARCH, DIVISI_SEARCH, USER_SHIFT_ADD, USER_SYNC } from '../../../const/ApiConst'; @@ -18,6 +18,7 @@ const proyek_id = localStorage.getItem('proyek_id'); const role_id = localStorage.getItem('role_id'); const format = "DD-MM-YYYY"; const token = window.localStorage.getItem('token'); + const config = { headers: { @@ -55,12 +56,15 @@ const ResourceWorker = ({ params }) => { const [typeDialogShift, setTypeDialogShift] = useState('Save') const pageName = params.name; const { t } = useTranslation(); + const [loading, setLoading] = useState(true); + useEffect(() => { getRoleList() getDivisiList() }, []) useEffect(() => { + setLoading(true); getDataUser() }, [search, rowsPerPage, currentPage]) @@ -218,7 +222,9 @@ const ResourceWorker = ({ params }) => { if (result && result.data && result.data.code == 200) { setDatatable(result.data.data); setTotalPage(result.data.totalRecord); + setLoading(false); } else { + setLoading(false); NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); } } @@ -583,7 +589,9 @@ const ResourceWorker = ({ params }) => { - {RenderTable} + + {RenderTable} +