diff --git a/src/views/SimproV2/CreatedProyek/AsignHrProject.js b/src/views/SimproV2/CreatedProyek/AsignHrProject.js index ff990b1..d65c399 100644 --- a/src/views/SimproV2/CreatedProyek/AsignHrProject.js +++ b/src/views/SimproV2/CreatedProyek/AsignHrProject.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 { 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'; @@ -25,16 +25,18 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR const [openDialogFormTools, setOpenDialogFormTools] = useState(false) const [dataEdit, setDataEdit] = useState(null) const [listUser, setListUser] = useState([]) - const [listRole, setListRole] = useState([]) + const [listRole, setListRole] = useState([]) + const [loading, setLoading] = useState(true); useEffect(() => { 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