Mobile responsive
This commit is contained in:
parent
9cefac57ae
commit
45e6b92ee7
|
@ -1,12 +1,23 @@
|
||||||
import React, {useContext, useState} from "react";
|
import React, { useContext, useState } from "react";
|
||||||
import {Button, Form, Input, message, Modal, Space, Table, Tag} from "antd";
|
import {
|
||||||
import {observer} from "mobx-react-lite";
|
Button,
|
||||||
import {ExclamationCircleOutlined} from "@ant-design/icons";
|
Form,
|
||||||
import {useHistory} from "react-router-dom";
|
Input,
|
||||||
import {useStore} from "../utils/useStore";
|
message,
|
||||||
import {LINKS} from "../routes/app";
|
Modal,
|
||||||
import {TopupsaldoModal} from "./TopupsaldoModal";
|
Space,
|
||||||
import {ModalLoaderContext} from "../utils/modal";
|
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) => {
|
export const SupplierComponent = observer((props) => {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
@ -70,10 +81,10 @@ export const SupplierComponent = observer((props) => {
|
||||||
key: ["coa", "amount"],
|
key: ["coa", "amount"],
|
||||||
width: "20%",
|
width: "20%",
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
new Intl.NumberFormat("id-ID", {
|
new Intl.NumberFormat("id-ID", {
|
||||||
style: "currency",
|
style: "currency",
|
||||||
currency: "IDR",
|
currency: "IDR",
|
||||||
}).format(text)
|
}).format(text),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Saldo di System",
|
title: "Saldo di System",
|
||||||
|
@ -81,10 +92,10 @@ export const SupplierComponent = observer((props) => {
|
||||||
key: ["coa_undistribute", "amount"],
|
key: ["coa_undistribute", "amount"],
|
||||||
width: "20%",
|
width: "20%",
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
new Intl.NumberFormat("id-ID", {
|
new Intl.NumberFormat("id-ID", {
|
||||||
style: "currency",
|
style: "currency",
|
||||||
currency: "IDR",
|
currency: "IDR",
|
||||||
}).format(text)
|
}).format(text),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Status",
|
title: "Status",
|
||||||
|
@ -94,7 +105,7 @@ export const SupplierComponent = observer((props) => {
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Tag
|
<Tag
|
||||||
color={record?.status === true ? "processing" : "#E3E8EE"}
|
color={record?.status === true ? "processing" : "#E3E8EE"}
|
||||||
style={{color: "#4F566B"}}
|
style={{ color: "#4F566B" }}
|
||||||
>
|
>
|
||||||
{record?.status === true ? " ACTIVE" : "INACTIVE"}
|
{record?.status === true ? " ACTIVE" : "INACTIVE"}
|
||||||
</Tag>
|
</Tag>
|
||||||
|
@ -137,7 +148,7 @@ export const SupplierComponent = observer((props) => {
|
||||||
const handleDelete = (id) => {
|
const handleDelete = (id) => {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: "Are you sure delete this record?",
|
title: "Are you sure delete this record?",
|
||||||
icon: <ExclamationCircleOutlined/>,
|
icon: <ExclamationCircleOutlined />,
|
||||||
okText: "Yes",
|
okText: "Yes",
|
||||||
okType: "primary",
|
okType: "primary",
|
||||||
cancelText: "Cancel",
|
cancelText: "Cancel",
|
||||||
|
@ -190,27 +201,121 @@ export const SupplierComponent = observer((props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Table
|
{store.ui.mediaQuery.isDesktop && (
|
||||||
style={{textAlign: "center"}}
|
<Table
|
||||||
columns={columns}
|
style={{ textAlign: "center" }}
|
||||||
dataSource={store.supplier.data}
|
columns={columns}
|
||||||
bordered
|
dataSource={store.supplier.data}
|
||||||
pagination={{
|
bordered
|
||||||
pageSize: store.supplier.pageSize,
|
pagination={{
|
||||||
total: store.supplier.total_data,
|
pageSize: store.supplier.pageSize,
|
||||||
current: store.supplier.page + 1,
|
total: store.supplier.total_data,
|
||||||
showSizeChanger: true,
|
current: store.supplier.page + 1,
|
||||||
simple: false,
|
showSizeChanger: true,
|
||||||
}}
|
simple: false,
|
||||||
onChange={async (page) => {
|
}}
|
||||||
let pageNumber = page.current;
|
onChange={async (page) => {
|
||||||
store.supplier.pageSize = page.pageSize;
|
let pageNumber = page.current;
|
||||||
store.supplier.page = pageNumber - 1;
|
store.supplier.pageSize = page.pageSize;
|
||||||
modalLoader.setLoading(true);
|
store.supplier.page = pageNumber - 1;
|
||||||
//await store.supplier.getData();
|
modalLoader.setLoading(true);
|
||||||
modalLoader.setLoading(false);
|
//await store.supplier.getData();
|
||||||
}}
|
modalLoader.setLoading(false);
|
||||||
/>
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{store.ui.mediaQuery.isMobile && (
|
||||||
|
<List
|
||||||
|
itemLayout="horizontal"
|
||||||
|
position={"top"}
|
||||||
|
pagination={{
|
||||||
|
onChange: async (page) => {
|
||||||
|
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 (
|
||||||
|
<div>
|
||||||
|
<List.Item
|
||||||
|
key={item.id}
|
||||||
|
style={{
|
||||||
|
backgroundColor: "#ffffff",
|
||||||
|
paddingTop: 0,
|
||||||
|
paddingBottom: 0,
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<List.Item.Meta
|
||||||
|
className={["cariparkir-container"].join(" ")}
|
||||||
|
title={item.code}
|
||||||
|
description={
|
||||||
|
<div style={{}}>
|
||||||
|
<p>
|
||||||
|
<small>Name : {item.name}</small> <br />
|
||||||
|
<small>Saldo Supplier : {item.coa.amount}</small>
|
||||||
|
<br />
|
||||||
|
<small>
|
||||||
|
Saldo System : {item.coa_undistribute.amount}
|
||||||
|
</small>
|
||||||
|
<br />
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
marginRight: 10,
|
||||||
|
}}
|
||||||
|
type={item?.status === true ? "danger" : "primary"}
|
||||||
|
onClick={() => changeStatus(item?.id, item?.status)}
|
||||||
|
>
|
||||||
|
{item?.status === true ? "INACTIVE" : "ACTIVE"}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={() => handleTopup(item)}
|
||||||
|
style={{
|
||||||
|
marginRight: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Top Up Saldo
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={() => handleEditButton(item)}
|
||||||
|
style={{
|
||||||
|
marginBottom: 5,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</Button>
|
||||||
|
<Tag
|
||||||
|
color={
|
||||||
|
item?.status === true ? "processing" : "#E3E8EE"
|
||||||
|
}
|
||||||
|
style={{ color: "#4F566B" }}
|
||||||
|
>
|
||||||
|
{item?.status === true ? " ACTIVE" : "INACTIVE"}
|
||||||
|
</Tag>
|
||||||
|
</p>
|
||||||
|
<p></p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</List.Item>
|
||||||
|
<Divider plain style={{ margin: 0 }} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Modal
|
<Modal
|
||||||
visible={store.supplier.visibleModalSupplier}
|
visible={store.supplier.visibleModalSupplier}
|
||||||
title={idData ? "Edit Supplier" : "Create a new Supplier"}
|
title={idData ? "Edit Supplier" : "Create a new Supplier"}
|
||||||
|
@ -237,22 +342,22 @@ export const SupplierComponent = observer((props) => {
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="name"
|
name="name"
|
||||||
label="Name"
|
label="Name"
|
||||||
rules={[{required: true, message: "Please input name!"}]}
|
rules={[{ required: true, message: "Please input name!" }]}
|
||||||
>
|
>
|
||||||
<Input/>
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{!idData && (
|
{!idData && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="code"
|
name="code"
|
||||||
label="Kode"
|
label="Kode"
|
||||||
rules={[{required: true, message: "Please input kode!"}]}
|
rules={[{ required: true, message: "Please input kode!" }]}
|
||||||
>
|
>
|
||||||
<Input/>
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
<TopupsaldoModal code={store.supplier.code}/>
|
<TopupsaldoModal code={store.supplier.code} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -75,7 +75,7 @@ export const Supplier = observer(() => {
|
||||||
placeholder="input search text"
|
placeholder="input search text"
|
||||||
style={{
|
style={{
|
||||||
width: store.ui.mediaQuery.isMobile ? 160 : 200,
|
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,
|
marginBottom: store.ui.mediaQuery.isMobile ? 10 : 0,
|
||||||
}}
|
}}
|
||||||
onSearch={(value) => console.log(value)}
|
onSearch={(value) => console.log(value)}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user