feat: adjust supplier page
This commit is contained in:
parent
787e74419e
commit
7179d8f807
|
@ -1,25 +1,17 @@
|
||||||
import React, { useEffect, useState } from "react";
|
import React, {useState} from "react";
|
||||||
import { Button, Form, Input, message, Modal, Space, Table, Tag } from "antd";
|
import {Button, Form, Input, message, Modal, Space, Table, Tag} from "antd";
|
||||||
import { observer } from "mobx-react-lite";
|
import {observer} from "mobx-react-lite";
|
||||||
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
import {ExclamationCircleOutlined} from "@ant-design/icons";
|
||||||
import { useHistory } from "react-router-dom";
|
import {useHistory} from "react-router-dom";
|
||||||
import { useStore } from "../utils/useStore";
|
import {useStore} from "../utils/useStore";
|
||||||
import { LINKS } from "../routes/app";
|
import {LINKS} from "../routes/app";
|
||||||
import { TopupsaldoModal } from "./TopupsaldoModal";
|
import {TopupsaldoModal} from "./TopupsaldoModal";
|
||||||
|
|
||||||
export const SupplierComponent = observer((props) => {
|
export const SupplierComponent = observer((props) => {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const [idData, setIdData] = useState("");
|
const [idData, setIdData] = useState("");
|
||||||
const [code, setCode] = useState("");
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const init = async () => {
|
|
||||||
await store.supplier.getData();
|
|
||||||
};
|
|
||||||
init();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleEditButton = (data) => {
|
const handleEditButton = (data) => {
|
||||||
console.log(data, "isi data");
|
console.log(data, "isi data");
|
||||||
|
@ -38,8 +30,9 @@ export const SupplierComponent = observer((props) => {
|
||||||
code: data.code,
|
code: data.code,
|
||||||
});
|
});
|
||||||
store.supplier.visibleModalTransaction = true;
|
store.supplier.visibleModalTransaction = true;
|
||||||
setCode(data.code);
|
store.supplier.code = data.code;
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeStatus = async (id, isActive) => {
|
const changeStatus = async (id, isActive) => {
|
||||||
const status = isActive ? "inactive" : "active";
|
const status = isActive ? "inactive" : "active";
|
||||||
const status2 = isActive ? "Inactivating" : "Activating";
|
const status2 = isActive ? "Inactivating" : "Activating";
|
||||||
|
@ -66,7 +59,6 @@ export const SupplierComponent = observer((props) => {
|
||||||
dataIndex: "code",
|
dataIndex: "code",
|
||||||
key: "code",
|
key: "code",
|
||||||
},
|
},
|
||||||
,
|
|
||||||
{
|
{
|
||||||
title: "Saldo",
|
title: "Saldo",
|
||||||
dataIndex: ["coa","amount"],
|
dataIndex: ["coa","amount"],
|
||||||
|
@ -216,20 +208,18 @@ export const SupplierComponent = observer((props) => {
|
||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{idData ? (
|
{!idData &&
|
||||||
""
|
<Form.Item
|
||||||
) : (
|
name="code"
|
||||||
<Form.Item
|
label="Kode"
|
||||||
name="code"
|
rules={[{required: true, message: "Please input kode!"}]}
|
||||||
label="Kode"
|
>
|
||||||
rules={[{ required: true, message: "Please input kode!" }]}
|
<Input/>
|
||||||
>
|
</Form.Item>
|
||||||
<Input />
|
}
|
||||||
</Form.Item>
|
|
||||||
)}
|
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
<TopupsaldoModal code={code} />
|
<TopupsaldoModal code={store.supplier.code}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Form, Input, message, Modal } from "antd";
|
import {Form, Input, message, Modal} from "antd";
|
||||||
import { observer } from "mobx-react-lite";
|
import {observer} from "mobx-react-lite";
|
||||||
import { useStore } from "../utils/useStore";
|
import {useStore} from "../utils/useStore";
|
||||||
|
|
||||||
export const TopupsaldoModal = observer((props) => {
|
export const TopupsaldoModal = observer((props) => {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
@ -10,6 +10,7 @@ export const TopupsaldoModal = observer((props) => {
|
||||||
const handleCancelTransaction = () => {
|
const handleCancelTransaction = () => {
|
||||||
store.supplier.visibleModalTransaction = false;
|
store.supplier.visibleModalTransaction = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmitTransaction = async (data) => {
|
const handleSubmitTransaction = async (data) => {
|
||||||
console.log(data, "isi data2");
|
console.log(data, "isi data2");
|
||||||
|
|
||||||
|
@ -49,19 +50,19 @@ export const TopupsaldoModal = observer((props) => {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
initialValues={{ supplier: props.code }}
|
initialValues={{supplier: store.supplier.code}}
|
||||||
>
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="supplier"
|
name="supplier"
|
||||||
label="Supplier"
|
label="Supplier"
|
||||||
rules={[{ required: true, message: "Please input supplier!" }]}
|
rules={[{required: true, message: "Please input supplier!"}]}
|
||||||
>
|
>
|
||||||
<Input disabled={true} />
|
<Input disabled={true} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="amount"
|
name="amount"
|
||||||
label="Amount"
|
label="Amount"
|
||||||
rules={[{ required: true, message: "Please input amount!" }]}
|
rules={[{ required: true, message: "Please input amount!" }]}
|
||||||
>
|
>
|
||||||
|
|
|
@ -8,7 +8,8 @@ export class Supplier {
|
||||||
total_data = 0;
|
total_data = 0;
|
||||||
filterCategory = null;
|
filterCategory = null;
|
||||||
visibleModalSupplier = false;
|
visibleModalSupplier = false;
|
||||||
visibleModalTransaction=false;
|
visibleModalTransaction = false;
|
||||||
|
code = "";
|
||||||
|
|
||||||
pageCategories = 0;
|
pageCategories = 0;
|
||||||
pageSizeCategories = 10
|
pageSizeCategories = 10
|
||||||
|
|
Loading…
Reference in New Issue
Block a user