Perbaikan Project PPOB
This commit is contained in:
@@ -65,6 +65,7 @@ export const PartnerComponent = observer((props) => {
|
||||
setIsChangePassword(true);
|
||||
store.partner.visibleModalPartner = true;
|
||||
setIdData(data.id);
|
||||
console.log(data.id);
|
||||
};
|
||||
|
||||
const columns = [
|
||||
@@ -161,20 +162,22 @@ export const PartnerComponent = observer((props) => {
|
||||
if (idData !== "") {
|
||||
modalLoader.setLoading(true);
|
||||
try {
|
||||
await store.partner.update(idData, data);
|
||||
isChangePassword
|
||||
? await store.partner.updatePassword(idData, data)
|
||||
: await store.partner.update(idData, data);
|
||||
modalLoader.setLoading(false);
|
||||
message.success(
|
||||
isChangePassword
|
||||
? "Failed Change Partner Password"
|
||||
? "Success Change Password"
|
||||
: "Success Update Data Partner"
|
||||
);
|
||||
|
||||
//await store.partner.getData()
|
||||
} catch (e) {
|
||||
modalLoader.setLoading(true);
|
||||
modalLoader.setLoading(false);
|
||||
message.error(
|
||||
isChangePassword
|
||||
? "Failed Change Partner Password"
|
||||
? "Failed Change Password"
|
||||
: "Failed Update Data Partner"
|
||||
);
|
||||
}
|
||||
@@ -280,7 +283,9 @@ export const PartnerComponent = observer((props) => {
|
||||
>
|
||||
{item?.status === true ? "Inactive" : "Active"}
|
||||
</Button>
|
||||
<Button onClick={(owner,name) => handleEditButton(item)}>
|
||||
<Button
|
||||
onClick={(owner, name) => handleEditButton(item)}
|
||||
>
|
||||
Edit
|
||||
</Button>
|
||||
{/* <Button onClick={() => handleDelete(record.id)}>Delete</Button> */}
|
||||
@@ -358,17 +363,17 @@ export const PartnerComponent = observer((props) => {
|
||||
</Form.Item>
|
||||
)}
|
||||
{!idData && (
|
||||
<Form.Item
|
||||
name="code"
|
||||
label="Kode"
|
||||
rules={[
|
||||
idData
|
||||
? { required: false }
|
||||
: { required: true, message: "Please input code partner!" },
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="code"
|
||||
label="Kode"
|
||||
rules={[
|
||||
idData
|
||||
? { required: false }
|
||||
: { required: true, message: "Please input code partner!" },
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
)}
|
||||
{!idData && (
|
||||
<Form.Item
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, {useContext, useState} from "react";
|
||||
import React, { useContext, useState } from "react";
|
||||
import {
|
||||
Button,
|
||||
Col,
|
||||
@@ -15,19 +15,19 @@ import {
|
||||
Tag,
|
||||
Typography,
|
||||
} 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 {ModalLoaderContext} from "../utils/modal";
|
||||
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 { ModalLoaderContext } from "../utils/modal";
|
||||
|
||||
const {Title, Text} = Typography;
|
||||
const { Title, Text } = Typography;
|
||||
|
||||
export const ProductComponent = observer((props) => {
|
||||
const store = useStore();
|
||||
const [form] = Form.useForm();
|
||||
const {Option} = Select;
|
||||
const { Option } = Select;
|
||||
const history = useHistory();
|
||||
const [idData, setIdData] = useState("");
|
||||
const [filterSupplier, setFilterSupplier] = useState([]);
|
||||
@@ -107,12 +107,14 @@ export const ProductComponent = observer((props) => {
|
||||
key: "action",
|
||||
render: (text, record) => (
|
||||
<Button
|
||||
onClick={async () => {
|
||||
history.push(LINKS.PRODUCT_DETAIL.replace(":id", record.product_id));
|
||||
}}
|
||||
>
|
||||
Detail
|
||||
</Button>
|
||||
onClick={async () => {
|
||||
history.push(
|
||||
LINKS.PRODUCT_DETAIL.replace(":id", record.product_id)
|
||||
);
|
||||
}}
|
||||
>
|
||||
Detail
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
];
|
||||
@@ -258,7 +260,11 @@ export const ProductComponent = observer((props) => {
|
||||
width: store.ui.mediaQuery.isMobile ? 250 : "",
|
||||
}}
|
||||
columns={columns}
|
||||
dataSource={store.product.data}
|
||||
dataSource={
|
||||
store.authentication.userData.role === "Admin Partner"
|
||||
? store.product.dataProductPartner
|
||||
: store.product.data
|
||||
}
|
||||
bordered
|
||||
pagination={{
|
||||
pageSize: store.product.pageSize,
|
||||
|
||||
@@ -192,14 +192,18 @@ export const SupplierComponent = observer((props) => {
|
||||
try {
|
||||
modalLoader.setLoading(true);
|
||||
const response = await store.supplier.create(data);
|
||||
response?.body?.statusCode === 201 || response?.body?.statusCode === 200
|
||||
console.log(response)
|
||||
response?.body?.statusCode === 201 && response?.body?.statusCode === 200
|
||||
? message.success(
|
||||
response?.body?.message || "Berhasil Tambah Supplier Baru"
|
||||
)
|
||||
: message.error(
|
||||
response?.body?.statusCode === 406
|
||||
response?.body?.error
|
||||
? response?.body?.error || "Supplier Sudah Ada"
|
||||
: response?.body?.message || "Gagal Tambah Supplier Baru"
|
||||
// response?.body?.statusCode === 406
|
||||
// ? response?.body?.error || "Supplier Sudah Ada"
|
||||
// : response?.body?.message || "Gagal Tambah Supplier Baru"
|
||||
//response?.body?.message || "Gagal Tambah Supplier Baru"
|
||||
);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user