Browse Source

Merge pull request 'update logic getData Project and add spinner loading' (#76) from dev-ibnu1 into staging

Reviewed-on: ordo/adw-frontend#76
pull/2/head
ibnu 1 year ago
parent
commit
e0bda36bee
  1. 13
      src/views/SimproV2/CreatedProyek/index.js

13
src/views/SimproV2/CreatedProyek/index.js

@ -19,7 +19,7 @@ import {
Tooltip, Tooltip,
Popover, Popover,
Skeleton, Skeleton,
Divider, Spin,
} from "antd"; } from "antd";
import { import {
PROJECT_APPROVAL_ADD, PROJECT_APPROVAL_ADD,
@ -134,6 +134,7 @@ const CreatedProyek = ({ params, ...props }) => {
const [dataVersionGantt, setDataVersionGantt] = useState([]); const [dataVersionGantt, setDataVersionGantt] = useState([]);
const [dataHierarchy, setDataHierarchy] = useState([]); const [dataHierarchy, setDataHierarchy] = useState([]);
const [dataDetail, setDataDetail] = useState(null); const [dataDetail, setDataDetail] = useState(null);
const [loading, setLoading] = useState(true);
const pageName = params.name; const pageName = params.name;
@ -244,6 +245,8 @@ const CreatedProyek = ({ params, ...props }) => {
operator: "AND", operator: "AND",
}, },
], ],
select: ["id", "nama", "rencana_biaya",
"currency_symbol", "mulai_proyek", "akhir_proyek"],
joins: [ joins: [
{ {
name: "m_users", name: "m_users",
@ -273,13 +276,14 @@ const CreatedProyek = ({ params, ...props }) => {
.then((res) => res) .then((res) => res)
.catch((error) => error.response); .catch((error) => error.response);
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 || [];
setDatatable(dataRes); setDatatable(dataRes);
setTotalPage(result.data.totalRecord); setTotalPage(result.data.totalRecord);
setLoading(false);
} else { } else {
setLoading(false);
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); NotificationManager.error("Gagal Mengambil Data!!", "Failed");
} }
}; };
@ -1466,7 +1470,10 @@ const CreatedProyek = ({ params, ...props }) => {
</Row> </Row>
</CardHeader> </CardHeader>
<CardBody> <CardBody>
{RenderTable} <Spin tip="Loading..." spinning={loading}>
{RenderTable}
</Spin>
<Pagination <Pagination
style={{ marginTop: "25px" }} style={{ marginTop: "25px" }}
showSizeChanger showSizeChanger

Loading…
Cancel
Save