Browse Source

add loader

pull/1/head
wahyuun 1 year ago
parent
commit
4109188206
  1. 14
      src/views/SimproV2/CreatedProyek/DialogHierarchy.js

14
src/views/SimproV2/CreatedProyek/DialogHierarchy.js

@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from 'react' import React, { useEffect, useState, useMemo } from 'react'
import { Modal, ModalHeader, ModalBody, } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, } from 'reactstrap';
import { Button } from 'reactstrap'; import { Button } from 'reactstrap';
import { Space, Table, Tooltip } from 'antd'; import { Space, Table, Tooltip, Spin } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import moment from 'moment'; import moment from 'moment';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
@ -41,8 +41,10 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
const [idGantt, setIdGantt] = useState(0) const [idGantt, setIdGantt] = useState(0)
const [humanResource, setHumanResource] = useState([]) const [humanResource, setHumanResource] = useState([])
const { t } = useTranslation(); const { t } = useTranslation();
const [loading, setLoading] = useState(true);
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
setLoading(true);
getdataHierarchy(); getdataHierarchy();
} }
}, [saveHierarchy, idTask, openDialog, closeDialog, openDialogFormGantt]) }, [saveHierarchy, idTask, openDialog, closeDialog, openDialogFormGantt])
@ -157,7 +159,9 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
if (result && result.status == 200) { if (result && result.status == 200) {
const sortedData = _.orderBy(result.data.data, ['name'], ['asc']); const sortedData = _.orderBy(result.data.data, ['name'], ['asc']);
setDataHierarchy(sortedData); setDataHierarchy(sortedData);
setLoading(false);
} else { } else {
setLoading(false);
NotificationManager.error(`Data gantt project gagal terload silahkan coba lagi!`, 'Failed!!'); NotificationManager.error(`Data gantt project gagal terload silahkan coba lagi!`, 'Failed!!');
} }
} }
@ -285,9 +289,11 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
</Tooltip> </Tooltip>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
<div style={{ width: '100%', overflow: "auto" }}> <Spin tip="Loading..." spinning={loading}>
{RenderTable} <div style={{ width: '100%', overflow: "auto" }}>
</div> {RenderTable}
</div>
</Spin>
</ModalBody> </ModalBody>
{/* <ModalFooter> {/* <ModalFooter>
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Batal</Button> <Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Batal</Button>

Loading…
Cancel
Save