Browse Source

update loader

pull/1/head
wahyuun 1 year ago
parent
commit
acc832a019
  1. 9
      src/views/SimproV2/CreatedProyek/AsignHrProject.js

9
src/views/SimproV2/CreatedProyek/AsignHrProject.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 { API_ADW, TOKEN_ADW, ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_DELETE, USER_LIST, PROJECT_ROLE_SEARCH, ASSIGN_HR_PROJECT_ADD, ASSIGN_HR_PROJECT_EDIT } from '../../../const/ApiConst'; import { API_ADW, TOKEN_ADW, ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_DELETE, USER_LIST, PROJECT_ROLE_SEARCH, ASSIGN_HR_PROJECT_ADD, ASSIGN_HR_PROJECT_EDIT } from '../../../const/ApiConst';
@ -26,9 +26,11 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
const [dataEdit, setDataEdit] = useState(null) const [dataEdit, setDataEdit] = useState(null)
const [listUser, setListUser] = useState([]) const [listUser, setListUser] = useState([])
const [listRole, setListRole] = useState([]) const [listRole, setListRole] = useState([])
const [loading, setLoading] = useState(true);
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
setLoading(true);
getDataAssignHr(); getDataAssignHr();
} }
}, [openDialog]); }, [openDialog]);
@ -70,9 +72,10 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [] let dataRes = result.data.data || []
setdataUserToProject(dataRes); setdataUserToProject(dataRes);
setLoading(false);
} else { } else {
setLoading(false);
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
} }
} }
@ -281,7 +284,9 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
<div>Assign Human Resource - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button> <div>Assign Human Resource - {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>
{/* <ModalFooter> {/* <ModalFooter>
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Close</Button> <Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Close</Button>

Loading…
Cancel
Save