Browse Source

add loader

pull/1/head
wahyuun 1 year ago
parent
commit
88ff7f47d7
  1. 8
      src/views/SimproV2/CreatedProyek/AsignCustProject.js

8
src/views/SimproV2/CreatedProyek/AsignCustProject.js

@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from 'react' import React, { useEffect, useState, useMemo } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button, Form } from 'reactstrap'; import { Button, Form } from 'reactstrap';
import { Table, Tooltip } from 'antd'; import { Table, Tooltip, Spin } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import moment from 'moment'; import moment from 'moment';
import { import {
@ -25,9 +25,11 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
const [alertDelete, setAlertDelete] = useState(false) const [alertDelete, setAlertDelete] = useState(false)
const [idDelete, setIdDelete] = useState(0) const [idDelete, setIdDelete] = useState(0)
const [openDialogFormTools, setOpenDialogFormTools] = useState(false) const [openDialogFormTools, setOpenDialogFormTools] = useState(false)
const [loading, setLoading] = useState(true);
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
setLoading(true);
getDataAssignHr(); getDataAssignHr();
} }
}, [openDialog]); }, [openDialog]);
@ -64,7 +66,9 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
let dataRes = result.data.data || [] let dataRes = result.data.data || []
const filteredData = dataRes.filter(item => item.is_customer === true); const filteredData = dataRes.filter(item => item.is_customer === true);
setdataUserToProject(filteredData); setdataUserToProject(filteredData);
setLoading(false);
} else { } else {
setLoading(false);
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
} }
} }
@ -186,7 +190,9 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
<div>Assign Customer - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button> <div>Assign Customer - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
<Spin tip="Loading..." spinning={loading}>
{renderForm()} {renderForm()}
</Spin>
</ModalBody> </ModalBody>
</Modal> </Modal>
<FormAsignCust <FormAsignCust

Loading…
Cancel
Save