diff --git a/src/component/SupplierComponent.js b/src/component/SupplierComponent.js index 3bf915d..dce358e 100644 --- a/src/component/SupplierComponent.js +++ b/src/component/SupplierComponent.js @@ -1,12 +1,23 @@ -import React, {useContext, useState} from "react"; -import {Button, Form, Input, message, Modal, Space, Table, Tag} from "antd"; -import {observer} from "mobx-react-lite"; -import {ExclamationCircleOutlined} from "@ant-design/icons"; -import {useHistory} from "react-router-dom"; -import {useStore} from "../utils/useStore"; -import {LINKS} from "../routes/app"; -import {TopupsaldoModal} from "./TopupsaldoModal"; -import {ModalLoaderContext} from "../utils/modal"; +import React, { useContext, useState } from "react"; +import { + Button, + Form, + Input, + message, + Modal, + Space, + Table, + Tag, + List, + Divider, +} from "antd"; +import { observer } from "mobx-react-lite"; +import { ExclamationCircleOutlined } from "@ant-design/icons"; +import { useHistory } from "react-router-dom"; +import { useStore } from "../utils/useStore"; +import { LINKS } from "../routes/app"; +import { TopupsaldoModal } from "./TopupsaldoModal"; +import { ModalLoaderContext } from "../utils/modal"; export const SupplierComponent = observer((props) => { const store = useStore(); @@ -70,10 +81,10 @@ export const SupplierComponent = observer((props) => { key: ["coa", "amount"], width: "20%", render: (text, record) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text) + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Saldo di System", @@ -81,10 +92,10 @@ export const SupplierComponent = observer((props) => { key: ["coa_undistribute", "amount"], width: "20%", render: (text, record) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text) + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Status", @@ -94,7 +105,7 @@ export const SupplierComponent = observer((props) => { render: (text, record) => ( {record?.status === true ? " ACTIVE" : "INACTIVE"} @@ -137,7 +148,7 @@ export const SupplierComponent = observer((props) => { const handleDelete = (id) => { Modal.confirm({ title: "Are you sure delete this record?", - icon: , + icon: , okText: "Yes", okType: "primary", cancelText: "Cancel", @@ -190,27 +201,121 @@ export const SupplierComponent = observer((props) => { return (
- { - let pageNumber = page.current; - store.supplier.pageSize = page.pageSize; - store.supplier.page = pageNumber - 1; - modalLoader.setLoading(true); - //await store.supplier.getData(); - modalLoader.setLoading(false); - }} - /> + {store.ui.mediaQuery.isDesktop && ( +
{ + let pageNumber = page.current; + store.supplier.pageSize = page.pageSize; + store.supplier.page = pageNumber - 1; + modalLoader.setLoading(true); + //await store.supplier.getData(); + modalLoader.setLoading(false); + }} + /> + )} + {store.ui.mediaQuery.isMobile && ( + { + store.supplier.pageSize = page.pageSize; + store.supplier.page = page.current; + modalLoader.setLoading(true); + await store.supplier.getData(); + modalLoader.setLoading(false); + }, + pageSize: store.supplier.pageSize, + total: store.supplier.total_data, + current: store.supplier.page, + style: { marginBottom: "1rem", marginRight: "1rem" }, + }} + dataSource={store.supplier.data} + style={{ padding: 0 }} + renderItem={(item) => { + return ( +
+ + +

+ Name : {item.name}
+ Saldo Supplier : {item.coa.amount} +
+ + Saldo System : {item.coa_undistribute.amount} + +
+ + + + + {item?.status === true ? " ACTIVE" : "INACTIVE"} + +

+

+
+ } + /> + + + + ); + }} + /> + )} { - + {!idData && ( - + )} - + ); }); diff --git a/src/pages/Config/Supplier.js b/src/pages/Config/Supplier.js index 5c6d60a..fc088b5 100644 --- a/src/pages/Config/Supplier.js +++ b/src/pages/Config/Supplier.js @@ -75,7 +75,7 @@ export const Supplier = observer(() => { placeholder="input search text" style={{ width: store.ui.mediaQuery.isMobile ? 160 : 200, - marginRight: store.ui.mediaQuery.isMobile ? 0 : 10, + marginRight: store.ui.mediaQuery.isMobile ? 10 : 10, marginBottom: store.ui.mediaQuery.isMobile ? 10 : 0, }} onSearch={(value) => console.log(value)}