Perbaikan Project PPOB
This commit is contained in:
parent
bf0e28c4f3
commit
7ad15665cc
|
@ -20,6 +20,7 @@ import { ModalLoaderContext } from "../utils/modal";
|
|||
|
||||
export const PartnerComponent = observer((props) => {
|
||||
const store = useStore();
|
||||
const [value, setValue] = useState();
|
||||
const [form] = Form.useForm();
|
||||
const history = useHistory();
|
||||
const [idData, setIdData] = useState("");
|
||||
|
@ -415,9 +416,21 @@ export const PartnerComponent = observer((props) => {
|
|||
required: true,
|
||||
message: "Please input password phone number!",
|
||||
},
|
||||
{
|
||||
pattern: /^(?:\d*)$/,
|
||||
message: "Value should contain just number",
|
||||
},
|
||||
{
|
||||
pattern: /^[\d]{0,12}$/,
|
||||
message: "Value should be less than 12 character",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
<Input
|
||||
onChange={(value) => {
|
||||
setValue(value);
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
)}
|
||||
{!isChangePassword && (
|
||||
|
|
|
@ -118,23 +118,30 @@ export const DesktopLayout = observer(() => {
|
|||
}}
|
||||
>
|
||||
<Menu>
|
||||
{store.authentication.userData.role !== "Admin Partner" && (
|
||||
{/* {store.authentication.userData.role !== "Admin Partner" && ( */}
|
||||
<Menu.Item key="home">
|
||||
<Link to={LINKS.HOME}>
|
||||
<HomeOutlined />
|
||||
<span>Beranda</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role !== "Retail" ||
|
||||
(store.authentication.userData.role !== "Admin Partner" && (
|
||||
{/* )} */}
|
||||
{store.authentication.userData.role === "Admin" && (
|
||||
<Menu.Item key="membership">
|
||||
<Link to={LINKS.MEMBERSHIP}>
|
||||
<FileProtectOutlined />
|
||||
<span>Keanggotaan</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
))}
|
||||
)}
|
||||
{store.authentication.userData.role === "Supervisor" && (
|
||||
<Menu.Item key="membership">
|
||||
<Link to={LINKS.MEMBERSHIP}>
|
||||
<FileProtectOutlined />
|
||||
<span>Keanggotaan</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role === "Admin" && (
|
||||
<SubMenu
|
||||
key="config"
|
||||
|
@ -192,7 +199,7 @@ export const DesktopLayout = observer(() => {
|
|||
)}
|
||||
</SubMenu>
|
||||
)}
|
||||
{store.authentication.userData.role !== "Admin" && (
|
||||
{store.authentication.userData.role === "Supervisor" && (
|
||||
<Menu.Item key="product">
|
||||
<Link to={LINKS.PRODUCT}>
|
||||
<DatabaseOutlined />
|
||||
|
@ -200,16 +207,31 @@ export const DesktopLayout = observer(() => {
|
|||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role === "Retail" ||
|
||||
(store.authentication.userData.role === "Admin Partner" && (
|
||||
{store.authentication.userData.role === "Admin Partner" && (
|
||||
<Menu.Item key="product">
|
||||
<Link to={LINKS.PRODUCT}>
|
||||
<DatabaseOutlined />
|
||||
<span>Produk</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role === "Admin Partner" && (
|
||||
<Menu.Item key="transaction">
|
||||
<Link to={LINKS.TRANSACTION}>
|
||||
<ShoppingCartOutlined />
|
||||
<span>Transaksi</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
))}
|
||||
{store.authentication.userData.role !== "Admin Partner" && (
|
||||
)}
|
||||
{store.authentication.userData.role === "Retail" && (
|
||||
<Menu.Item key="transaction">
|
||||
<Link to={LINKS.TRANSACTION}>
|
||||
<ShoppingCartOutlined />
|
||||
<span>Transaksi</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role !== "Admin Partner" && store.authentication.userData.role !== "Retail" && (
|
||||
<SubMenu
|
||||
key="payback-main"
|
||||
icon={<ProfileOutlined />}
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
SlackOutlined,
|
||||
CodepenOutlined,
|
||||
WindowsOutlined,
|
||||
AliyunOutlined
|
||||
AliyunOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { useStore } from "../../utils/useStore";
|
||||
|
@ -48,16 +48,23 @@ export const MenuList = observer((props) => {
|
|||
overflowedIndicator={0}
|
||||
forceSubMenuRender={true}
|
||||
>
|
||||
{store.authentication.userData.role === "Admin" && (
|
||||
{/* {store.authentication.userData.role === "Admin" && ( */}
|
||||
<Menu.Item key="home">
|
||||
<Link to={LINKS.HOME}>
|
||||
<HomeOutlined />
|
||||
<span>Beranda</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
{/* )} */}
|
||||
{store.authentication.userData.role === "Admin" && (
|
||||
<Menu.Item key="membership">
|
||||
<Link to={LINKS.MEMBERSHIP}>
|
||||
<FileProtectOutlined />
|
||||
<span>Keanggotaan</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role !== "Retail" &&
|
||||
store.authentication.userData.role !== "Admin Partner" && (
|
||||
{store.authentication.userData.role === "Supervisor" && (
|
||||
<Menu.Item key="membership">
|
||||
<Link to={LINKS.MEMBERSHIP}>
|
||||
<FileProtectOutlined />
|
||||
|
@ -129,15 +136,22 @@ export const MenuList = observer((props) => {
|
|||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role === "Retail" ||
|
||||
(store.authentication.userData.role === "Admin Partner" && (
|
||||
{store.authentication.userData.role === "Admin Partner" && (
|
||||
<Menu.Item key="transaction">
|
||||
<Link to={LINKS.TRANSACTION}>
|
||||
<ShoppingCartOutlined />
|
||||
<span>Transaksi</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
))}
|
||||
)}
|
||||
{store.authentication.userData.role === "Retail" && (
|
||||
<Menu.Item key="transaction">
|
||||
<Link to={LINKS.TRANSACTION}>
|
||||
<ShoppingCartOutlined />
|
||||
<span>Transaksi</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role !== "Retail" &&
|
||||
store.authentication.userData.role !== "Admin Partner" && (
|
||||
<SubMenu
|
||||
|
|
|
@ -104,15 +104,15 @@ export const Membership = observer(() => {
|
|||
: (response = await store.transaction.distribute(data));
|
||||
|
||||
response?.body?.statusCode === 201
|
||||
? message.success("Success Top Up")
|
||||
: message.error("Failed Top Up");
|
||||
? message.success("Sukses Top Up")
|
||||
: message.error("Saldo Tidak Mencukupi");
|
||||
|
||||
modalLoader.setLoading(false);
|
||||
await getData();
|
||||
} catch (e) {
|
||||
console.log(e, "apa errornya");
|
||||
modalLoader.setLoading(false);
|
||||
message.error("Failed Top Up");
|
||||
message.error("Gagal Top Up");
|
||||
}
|
||||
setConfirmLoading(false);
|
||||
setIsVisibleTopUpModal(false);
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import React from "react";
|
||||
import {Form, Input, Modal, Select} from "antd";
|
||||
import {useStore} from "../../utils/useStore";
|
||||
import React, { useState } from "react";
|
||||
import { Form, Input, Modal, Select, InputNumber } from "antd";
|
||||
import { useStore } from "../../utils/useStore";
|
||||
|
||||
export const MembershipModal = ({
|
||||
visible,
|
||||
onCreate,
|
||||
onCancel,
|
||||
initialData,
|
||||
}) => {
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
const {Option} = Select;
|
||||
const { Option } = Select;
|
||||
const store = useStore();
|
||||
const [value, setValue] = useState();
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
@ -51,18 +52,18 @@ export const MembershipModal = ({
|
|||
<Form.Item
|
||||
name="name"
|
||||
label="Name"
|
||||
rules={[{required: true, message: "Please input Name!"}]}
|
||||
rules={[{ required: true, message: "Please input Name!" }]}
|
||||
>
|
||||
<Input/>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
)}
|
||||
{!initialData.id && (
|
||||
<Form.Item
|
||||
name="username"
|
||||
label="Username"
|
||||
rules={[{required: true, message: "Please input Username!"}]}
|
||||
rules={[{ required: true, message: "Please input Username!" }]}
|
||||
>
|
||||
<Input/>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
)}
|
||||
{((initialData.id && initialData.isChangePassword) ||
|
||||
|
@ -70,9 +71,9 @@ export const MembershipModal = ({
|
|||
<Form.Item
|
||||
name="password"
|
||||
label="Password"
|
||||
rules={[{required: false, message: "Please input password!"}]}
|
||||
rules={[{ required: false, message: "Please input password!" }]}
|
||||
>
|
||||
<Input.Password/>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
)}
|
||||
{((initialData.id && !initialData.isChangePassword) ||
|
||||
|
@ -80,9 +81,23 @@ export const MembershipModal = ({
|
|||
<Form.Item
|
||||
name="phone_number"
|
||||
label="Phone Number"
|
||||
rules={[{required: true, message: "Please input Phone Number!"}]}
|
||||
rules={[
|
||||
{ required: true, message: "Please input Phone Number!" },
|
||||
{
|
||||
pattern: /^(?:\d*)$/,
|
||||
message: "Value should contain just number",
|
||||
},
|
||||
{
|
||||
pattern: /^[\d]{0,12}$/,
|
||||
message: "Value should be less than 12 character",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input/>
|
||||
<Input
|
||||
onChange={(value) => {
|
||||
setValue(value);
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
)}
|
||||
{((initialData.id && !initialData.isChangePassword) ||
|
||||
|
@ -90,7 +105,7 @@ export const MembershipModal = ({
|
|||
<Form.Item
|
||||
name="roleId"
|
||||
label="Role"
|
||||
rules={[{required: true, message: "Please input role id!"}]}
|
||||
rules={[{ required: true, message: "Please input role id!" }]}
|
||||
>
|
||||
<Select>
|
||||
{store.role.data.map((item) => (
|
||||
|
|
|
@ -175,7 +175,7 @@ export const Payback = observer(() => {
|
|||
modalLoader.setLoading(true);
|
||||
try {
|
||||
const response = await store.payback.confirmPayback(id, type);
|
||||
console.log(response)
|
||||
console.log(response);
|
||||
response.body.statusCode !== 201 && response.body.statusCode !== 200
|
||||
? message.error(
|
||||
response?.body?.message || `Failed ${capitalize(type)} Payback`
|
||||
|
@ -288,7 +288,79 @@ export const Payback = observer(() => {
|
|||
title={item.name}
|
||||
description={
|
||||
<div style={{}}>
|
||||
<Image src={item.picture} preview={false} />
|
||||
<p>
|
||||
<span>{item.userData_name}</span>
|
||||
<br />
|
||||
<small>Amount: {item.amount}</small>
|
||||
<br />
|
||||
{PAYBACK_STATUS[item.status] ===
|
||||
PAYBACK_STATUS[0] ? (
|
||||
<Space size="middle">
|
||||
<Button
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: `Are you sure Accept this submission?`,
|
||||
icon: <CheckOutlined />,
|
||||
okText: "Accept",
|
||||
cancelText: "Cancel",
|
||||
okType: "primary",
|
||||
onOk() {
|
||||
handleAction(item.id, "accept");
|
||||
},
|
||||
onCancel() {
|
||||
console.log("Cancel");
|
||||
},
|
||||
});
|
||||
}}
|
||||
icon={<CheckCircleOutlined />}
|
||||
style={{
|
||||
backgroundColor: "#1bb91d",
|
||||
color: "#fff",
|
||||
borderColor: "#1bb91d",
|
||||
}}
|
||||
>
|
||||
Accept
|
||||
</Button>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: `Are you sure Reject this submission?`,
|
||||
icon: <StopOutlined />,
|
||||
okText: "Reject",
|
||||
cancelText: "Cancel",
|
||||
okType: "primary",
|
||||
onOk() {
|
||||
handleAction(item.id, "reject");
|
||||
},
|
||||
onCancel() {
|
||||
console.log("Cancel");
|
||||
},
|
||||
});
|
||||
}}
|
||||
icon={<CloseOutlined />}
|
||||
style={{
|
||||
backgroundColor: "#ff1c1c",
|
||||
color: "#fff",
|
||||
borderColor: "#ff1c1c",
|
||||
}}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
</Space>
|
||||
) : (
|
||||
<Tag
|
||||
color={
|
||||
PAYBACK_STATUS[item.status] ===
|
||||
PAYBACK_STATUS[3]
|
||||
? "cyan"
|
||||
: "red"
|
||||
}
|
||||
style={{ color: "#4F566B" }}
|
||||
>
|
||||
{PAYBACK_STATUS[item.status]}
|
||||
</Tag>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
@ -299,7 +371,10 @@ export const Payback = observer(() => {
|
|||
margin: 0,
|
||||
}}
|
||||
>
|
||||
{item.amount}
|
||||
<Image
|
||||
src={`${appConfig.apiUrl}/config/image/${item.image_prove}`}
|
||||
style={{ width: "10vw" }}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
</List.Item>
|
||||
|
|
Loading…
Reference in New Issue
Block a user