Merge branch 'main' of https://gitlab.com/empatnusabangsa/ppob/ppob-frontend into devops-production
This commit is contained in:
commit
dbae6e03c1
|
@ -10,7 +10,6 @@ import {
|
||||||
Space,
|
Space,
|
||||||
Table,
|
Table,
|
||||||
Tag,
|
Tag,
|
||||||
InputNumber,
|
|
||||||
} from "antd";
|
} 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";
|
||||||
|
@ -38,13 +37,13 @@ export const SupplierComponent = observer((props) => {
|
||||||
setIdData(data.id);
|
setIdData(data.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTopup = async (data) => {
|
const handleTopup = (data) => {
|
||||||
store.supplier.code = data.code;
|
console.log(data, "isi data");
|
||||||
console.log(data.code, "isi data");
|
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
code: data.code,
|
code: data.code,
|
||||||
});
|
});
|
||||||
store.supplier.visibleModalTransaction = true;
|
store.supplier.visibleModalTransaction = true;
|
||||||
|
store.supplier.code = data.code;
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeStatus = async (id, isActive) => {
|
const changeStatus = async (id, isActive) => {
|
||||||
|
@ -164,27 +163,7 @@ export const SupplierComponent = observer((props) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancelTransaction = () => {
|
|
||||||
store.supplier.visibleModalTransaction = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSubmitTransaction = async (data) => {
|
|
||||||
try {
|
|
||||||
modalLoader.setLoading(true);
|
|
||||||
const response = await store.supplier.createTransaction(data);
|
|
||||||
message.success(response?.body?.message || "Success Top Up");
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e, "apa errornya");
|
|
||||||
message.error(e.response?.body?.message || "Failed Top Up");
|
|
||||||
}
|
|
||||||
|
|
||||||
modalLoader.setLoading(false);
|
|
||||||
store.supplier.visibleModalTransaction = false;
|
|
||||||
form.resetFields();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
form.resetFields();
|
|
||||||
setIdData("");
|
setIdData("");
|
||||||
store.supplier.visibleModalSupplier = false;
|
store.supplier.visibleModalSupplier = false;
|
||||||
};
|
};
|
||||||
|
@ -371,6 +350,7 @@ export const SupplierComponent = observer((props) => {
|
||||||
okText={idData ? "Edit" : "Buat"}
|
okText={idData ? "Edit" : "Buat"}
|
||||||
cancelText="Batal"
|
cancelText="Batal"
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
|
form.resetFields();
|
||||||
handleCancel();
|
handleCancel();
|
||||||
}}
|
}}
|
||||||
onOk={() => {
|
onOk={() => {
|
||||||
|
@ -440,54 +420,7 @@ export const SupplierComponent = observer((props) => {
|
||||||
)}
|
)}
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
<Modal
|
<TopupsaldoModal code={store.supplier.code} />
|
||||||
visible={store.supplier.visibleModalTransaction}
|
|
||||||
title="Top Up Saldo"
|
|
||||||
okText="Top Up"
|
|
||||||
cancelText="Batal"
|
|
||||||
onCancel={() => {
|
|
||||||
form.resetFields();
|
|
||||||
handleCancelTransaction();
|
|
||||||
}}
|
|
||||||
onOk={() => {
|
|
||||||
form
|
|
||||||
.validateFields()
|
|
||||||
.then((values) => {
|
|
||||||
console.log(values, "isi form");
|
|
||||||
handleSubmitTransaction(values);
|
|
||||||
form.resetFields();
|
|
||||||
})
|
|
||||||
.catch((info) => {
|
|
||||||
console.error("Validate Failed:", info);
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Form
|
|
||||||
form={form}
|
|
||||||
layout="vertical"
|
|
||||||
>
|
|
||||||
<Form.Item
|
|
||||||
name="code"
|
|
||||||
label="Supplier"
|
|
||||||
rules={[{ required: true, message: "Please input supplier!" }]}
|
|
||||||
>
|
|
||||||
<Input disabled={true} />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
name="amount"
|
|
||||||
label="Nominal"
|
|
||||||
rules={[{ required: true, message: "Please input amount!" }]}
|
|
||||||
>
|
|
||||||
<InputNumber
|
|
||||||
style={{ width: "100%" }}
|
|
||||||
formatter={(value) =>
|
|
||||||
`Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",")
|
|
||||||
}
|
|
||||||
parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")}
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user