Merge branch 'develop' into 'devops-staging'
Develop See merge request empatnusabangsa/ppob/ppob-frontend!21
This commit is contained in:
commit
d2ebb38727
|
@ -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("");
|
||||
|
@ -65,6 +66,7 @@ export const PartnerComponent = observer((props) => {
|
|||
setIsChangePassword(true);
|
||||
store.partner.visibleModalPartner = true;
|
||||
setIdData(data.id);
|
||||
console.log(data.id);
|
||||
};
|
||||
|
||||
const columns = [
|
||||
|
@ -161,20 +163,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 +284,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> */}
|
||||
|
@ -410,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 && (
|
||||
|
|
|
@ -108,7 +108,9 @@ export const ProductComponent = observer((props) => {
|
|||
render: (text, record) => (
|
||||
<Button
|
||||
onClick={async () => {
|
||||
history.push(LINKS.PRODUCT_DETAIL.replace(":id", record.product_id));
|
||||
history.push(
|
||||
LINKS.PRODUCT_DETAIL.replace(":id", record.product_id)
|
||||
);
|
||||
}}
|
||||
>
|
||||
Detail
|
||||
|
@ -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) {
|
||||
|
|
|
@ -14,7 +14,13 @@ import {
|
|||
PayCircleOutlined,
|
||||
ProfileOutlined,
|
||||
ShoppingCartOutlined,
|
||||
UserOutlined
|
||||
UserOutlined,
|
||||
IdcardOutlined,
|
||||
SettingOutlined,
|
||||
WindowsOutlined,
|
||||
SlackOutlined,
|
||||
AppstoreAddOutlined,
|
||||
AppstoreOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { AppRoute, LINKS } from "../../routes/app";
|
||||
import { useStore } from "../../utils/useStore";
|
||||
|
@ -118,16 +124,26 @@ export const DesktopLayout = observer(() => {
|
|||
}}
|
||||
>
|
||||
<Menu>
|
||||
{/* {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" && (
|
||||
<Menu.Item key="membership">
|
||||
<Link to={LINKS.MEMBERSHIP}>
|
||||
<FileProtectOutlined/>
|
||||
<IdcardOutlined />
|
||||
<span>Keanggotaan</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role === "Supervisor" && (
|
||||
<Menu.Item key="membership">
|
||||
<Link to={LINKS.MEMBERSHIP}>
|
||||
<IdcardOutlined />
|
||||
<span>Keanggotaan</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
|
@ -135,25 +151,25 @@ export const DesktopLayout = observer(() => {
|
|||
{store.authentication.userData.role === "Admin" && (
|
||||
<SubMenu
|
||||
key="config"
|
||||
icon={<HomeOutlined />}
|
||||
icon={<SettingOutlined />}
|
||||
title="Config"
|
||||
style={{ backgroundColor: "#e3e8ee" }}
|
||||
>
|
||||
<Menu.Item key="partner">
|
||||
<Link to={LINKS.PARTNER}>
|
||||
<HomeOutlined/>
|
||||
<WindowsOutlined />
|
||||
<span>Rekanan</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="commision">
|
||||
<Link to={LINKS.COMMISSION}>
|
||||
<HomeOutlined/>
|
||||
<SlackOutlined />
|
||||
<span>Komisi</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="supplier">
|
||||
<Link to={LINKS.SUPPLIER}>
|
||||
<HomeOutlined />
|
||||
<AppstoreOutlined />
|
||||
<span>Supplier</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
|
@ -162,7 +178,7 @@ export const DesktopLayout = observer(() => {
|
|||
{store.authentication.userData.role === "Admin" && (
|
||||
<SubMenu
|
||||
key="product-main"
|
||||
icon={<DatabaseOutlined />}
|
||||
icon={<AppstoreAddOutlined />}
|
||||
title="Product"
|
||||
>
|
||||
<Menu.Item key="product">
|
||||
|
@ -189,14 +205,30 @@ export const DesktopLayout = observer(() => {
|
|||
)}
|
||||
</SubMenu>
|
||||
)}
|
||||
{store.authentication.userData.role !== "Admin" && (
|
||||
{store.authentication.userData.role === "Supervisor" && (
|
||||
<Menu.Item key="product">
|
||||
<Link to={LINKS.PRODUCT}>
|
||||
<DatabaseOutlined/>
|
||||
<AppstoreAddOutlined />
|
||||
<span>Produk</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role === "Admin Partner" && (
|
||||
<Menu.Item key="product">
|
||||
<Link to={LINKS.PRODUCT}>
|
||||
<AppstoreAddOutlined />
|
||||
<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 === "Retail" && (
|
||||
<Menu.Item key="transaction">
|
||||
<Link to={LINKS.TRANSACTION}>
|
||||
|
@ -205,6 +237,8 @@ export const DesktopLayout = observer(() => {
|
|||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role !== "Admin Partner" &&
|
||||
store.authentication.userData.role !== "Retail" && (
|
||||
<SubMenu
|
||||
key="payback-main"
|
||||
icon={<ProfileOutlined />}
|
||||
|
@ -227,6 +261,7 @@ export const DesktopLayout = observer(() => {
|
|||
</Menu.Item>
|
||||
)}
|
||||
</SubMenu>
|
||||
)}
|
||||
{store.authentication.userData.role !== "Admin" && (
|
||||
<Menu.Item key="profile">
|
||||
<Link to={LINKS.PROFILE}>
|
||||
|
@ -364,13 +399,14 @@ export const DesktopLayout = observer(() => {
|
|||
}}
|
||||
mode="inline"
|
||||
>
|
||||
{store.authentication.userData.role !== "Admin" && <Menu.Item>
|
||||
{store.authentication.userData.role !== "Admin" && (
|
||||
<Menu.Item>
|
||||
<Link to={LINKS.PROFILE}>
|
||||
<UserOutlined />
|
||||
<span>Profile</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
}
|
||||
)}
|
||||
<Menu.Item
|
||||
onClick={() => {
|
||||
store.authentication.logout();
|
||||
|
@ -386,7 +422,7 @@ export const DesktopLayout = observer(() => {
|
|||
<Text>
|
||||
{store.user.data.username}
|
||||
<Paragraph
|
||||
style={{fontWeight: 400, marginTop: '0.5rem'}}
|
||||
style={{ fontWeight: 400, marginTop: "0.5rem" }}
|
||||
type={"secondary-dark"}
|
||||
strong
|
||||
>
|
||||
|
@ -488,7 +524,7 @@ export const DesktopLayout = observer(() => {
|
|||
title={
|
||||
<Text>
|
||||
<Paragraph
|
||||
style={{fontWeight: 400, marginTop: '0.5rem'}}
|
||||
style={{ fontWeight: 400, marginTop: "0.5rem" }}
|
||||
type={"secondary-dark"}
|
||||
strong
|
||||
>
|
||||
|
|
|
@ -9,11 +9,16 @@ import {
|
|||
FileSyncOutlined,
|
||||
HomeOutlined,
|
||||
MenuUnfoldOutlined,
|
||||
MoneyCollectOutlined,
|
||||
ProfileOutlined,
|
||||
ProjectOutlined,
|
||||
ShoppingCartOutlined,
|
||||
UserOutlined,
|
||||
SlackOutlined,
|
||||
CodepenOutlined,
|
||||
WindowsOutlined,
|
||||
AliyunOutlined,
|
||||
SettingOutlined,
|
||||
IdcardOutlined,
|
||||
AppstoreAddOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { useStore } from "../../utils/useStore";
|
||||
|
@ -23,8 +28,7 @@ const {SubMenu} = Menu;
|
|||
|
||||
export const MenuList = observer((props) => {
|
||||
const store = useStore();
|
||||
useEffect(() => {
|
||||
}, []);
|
||||
useEffect(() => {}, []);
|
||||
|
||||
const [setKeys, setSetKeys] = useState(["dashboard"]);
|
||||
|
||||
|
@ -47,31 +51,41 @@ export const MenuList = observer((props) => {
|
|||
overflowedIndicator={0}
|
||||
forceSubMenuRender={true}
|
||||
>
|
||||
{/* {store.authentication.userData.role === "Admin" && ( */}
|
||||
<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" && (
|
||||
<Menu.Item key="membership">
|
||||
<Link to={LINKS.MEMBERSHIP}>
|
||||
<FileProtectOutlined />
|
||||
<IdcardOutlined />
|
||||
<span>Keanggotaan</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role === "Supervisor" && (
|
||||
<Menu.Item key="membership">
|
||||
<Link to={LINKS.MEMBERSHIP}>
|
||||
<IdcardOutlined />
|
||||
<span>Keanggotaan</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role === "Admin" && (
|
||||
<SubMenu key="config" icon={<MenuUnfoldOutlined />} title="Config">
|
||||
<SubMenu key="config" icon={<SettingOutlined />} title="Config">
|
||||
<Menu.Item key="partner">
|
||||
<Link to={LINKS.PARTNER}>
|
||||
<ProjectOutlined />
|
||||
<WindowsOutlined />
|
||||
<span>Rekanan</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="commision">
|
||||
<Link to={LINKS.COMMISSION}>
|
||||
<MoneyCollectOutlined />
|
||||
<SlackOutlined />
|
||||
<span>Komisi</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
|
@ -84,10 +98,14 @@ export const MenuList = observer((props) => {
|
|||
</SubMenu>
|
||||
)}
|
||||
{store.authentication.userData.role === "Admin" && (
|
||||
<SubMenu key="product-main" icon={<ProfileOutlined />} title="Product">
|
||||
<Menu.Item key="product">
|
||||
<SubMenu
|
||||
key="product-main"
|
||||
icon={<AppstoreAddOutlined />}
|
||||
title="Produk"
|
||||
>
|
||||
<Menu.Item key="produk">
|
||||
<Link to={LINKS.PRODUCT}>
|
||||
<DatabaseOutlined />
|
||||
<AliyunOutlined />
|
||||
<span>Produk</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
|
@ -109,14 +127,30 @@ export const MenuList = observer((props) => {
|
|||
)}
|
||||
</SubMenu>
|
||||
)}
|
||||
{store.authentication.userData.role === "Admin Partner" && (
|
||||
<Menu.Item key="retail">
|
||||
<Link to={LINKS.PRODUCT}>
|
||||
<AppstoreAddOutlined />
|
||||
<span>Produk</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{store.authentication.userData.role === "Supervisor" && (
|
||||
<Menu.Item key="retail">
|
||||
<Link to={LINKS.PRODUCT}>
|
||||
<DatabaseOutlined />
|
||||
<AppstoreAddOutlined />
|
||||
<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 === "Retail" && (
|
||||
<Menu.Item key="transaction">
|
||||
<Link to={LINKS.TRANSACTION}>
|
||||
|
@ -125,7 +159,13 @@ export const MenuList = observer((props) => {
|
|||
</Link>
|
||||
</Menu.Item>
|
||||
)}
|
||||
<SubMenu key="payback-main" icon={<ProfileOutlined />} title="Pembayaran">
|
||||
{store.authentication.userData.role !== "Retail" &&
|
||||
store.authentication.userData.role !== "Admin Partner" && (
|
||||
<SubMenu
|
||||
key="payback-main"
|
||||
icon={<CodepenOutlined />}
|
||||
title="Pembayaran"
|
||||
>
|
||||
{store.authentication.userData.role !== "Retail" && (
|
||||
<Menu.Item key="payback-to-user">
|
||||
<Link to={LINKS.PAYBACK}>
|
||||
|
@ -143,6 +183,7 @@ export const MenuList = observer((props) => {
|
|||
</Menu.Item>
|
||||
)}
|
||||
</SubMenu>
|
||||
)}
|
||||
{store.authentication.userData.role !== "Admin" && (
|
||||
<Menu.Item key="profile">
|
||||
<Link to={LINKS.PROFILE}>
|
||||
|
|
|
@ -38,7 +38,7 @@ export const Commission = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.COMMISSION,
|
||||
|
|
|
@ -36,7 +36,7 @@ export const Partner = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.PARTNER,
|
||||
|
|
|
@ -51,7 +51,7 @@ export const Supplier = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.SUPPLIER,
|
||||
|
|
|
@ -1,25 +1,157 @@
|
|||
import React from "react";
|
||||
import {Button, PageHeader} from "antd";
|
||||
import { Button, PageHeader, Card, Row, Col } from "antd";
|
||||
import { store } from "../../utils/useStore";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import {
|
||||
DropboxOutlined,
|
||||
DollarCircleOutlined,
|
||||
BarChartOutlined,
|
||||
} from "@ant-design/icons";
|
||||
|
||||
export const Home = observer(() => {
|
||||
return <div className={["ppob-container"].join(" ")}>
|
||||
<PageHeader
|
||||
return (
|
||||
<div>
|
||||
{store.ui.mediaQuery.isDesktop && (
|
||||
<Row
|
||||
style={{
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
height: 40,
|
||||
backgroundColor: "transparent",
|
||||
marginTop: 30,
|
||||
marginLeft: 30,
|
||||
}}
|
||||
title={"Home"}
|
||||
>
|
||||
<Card
|
||||
className={"shadow"}
|
||||
hoverable
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
height: 200,
|
||||
marginBottom: 10,
|
||||
borderColor: "salmon",
|
||||
width: "30%",
|
||||
}}
|
||||
>
|
||||
<Row>
|
||||
<BarChartOutlined style={{ fontSize: 30 }} />
|
||||
<PageHeader title={<span>Total Transaksi</span>}>
|
||||
<span>Total Transaksi : 25 Transaksi</span>
|
||||
</PageHeader>
|
||||
<Button onClick={() => {
|
||||
store.ui.setTestValue();
|
||||
}}>{store.ui.testValue}</Button>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus aut recusandae velit! Consequatur corporis,
|
||||
eum fuga, harum incidunt laboriosam minus necessitatibus neque non nostrum pariatur tempore. Dignissimos impedit
|
||||
rem tempora!
|
||||
</Row>
|
||||
</Card>
|
||||
<Card
|
||||
className={"shadow"}
|
||||
hoverable
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
height: 200,
|
||||
marginBottom: 10,
|
||||
borderColor: "salmon",
|
||||
width: "30%",
|
||||
}}
|
||||
>
|
||||
<Row>
|
||||
<DropboxOutlined style={{ fontSize: 30 }} />
|
||||
<PageHeader title={<span>Total Keuntungan</span>}>
|
||||
<span>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
}).format(store.authentication.profileData?.wallet || 0)}
|
||||
</span>
|
||||
</PageHeader>
|
||||
</Row>
|
||||
</Card>
|
||||
<Card
|
||||
className={"shadow"}
|
||||
hoverable
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
height: 200,
|
||||
marginBottom: 10,
|
||||
borderColor: "salmon",
|
||||
width: "30%",
|
||||
}}
|
||||
>
|
||||
<Row>
|
||||
<DollarCircleOutlined style={{ fontSize: 30 }} />
|
||||
<PageHeader title={<span>Saldo</span>}>
|
||||
<span>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
}).format(store.authentication.profileData?.wallet || 0)}
|
||||
</span>
|
||||
</PageHeader>
|
||||
</Row>
|
||||
</Card>
|
||||
</Row>
|
||||
)}
|
||||
{store.ui.mediaQuery.isMobile && (
|
||||
<div style={{ marginTop: 10 }}>
|
||||
<Card
|
||||
className={"shadow"}
|
||||
hoverable
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
height: 200,
|
||||
marginBottom: 10,
|
||||
marginRight: 20,
|
||||
borderColor: "salmon",
|
||||
}}
|
||||
>
|
||||
<Row>
|
||||
<BarChartOutlined style={{ fontSize: 30 }} />
|
||||
<PageHeader title={<span>Total Transaksi</span>}>
|
||||
<span>Total Transaksi : 25 Transaksi</span>
|
||||
</PageHeader>
|
||||
</Row>
|
||||
</Card>
|
||||
<Card
|
||||
className={"shadow"}
|
||||
hoverable
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
height: 200,
|
||||
marginBottom: 10,
|
||||
marginRight: 20,
|
||||
borderColor: "salmon",
|
||||
}}
|
||||
>
|
||||
<Row>
|
||||
<DropboxOutlined style={{ fontSize: 30 }} />
|
||||
<PageHeader title={<span>Total Keuntungan</span>}>
|
||||
<span>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
}).format(store.authentication.profileData?.wallet || 0)}
|
||||
</span>
|
||||
</PageHeader>
|
||||
</Row>
|
||||
</Card>
|
||||
<Card
|
||||
className={"shadow"}
|
||||
hoverable
|
||||
style={{
|
||||
marginLeft: 20,
|
||||
height: 200,
|
||||
marginBottom: 10,
|
||||
marginRight: 20,
|
||||
borderColor: "salmon",
|
||||
}}
|
||||
>
|
||||
<Row>
|
||||
<DollarCircleOutlined style={{ fontSize: 30 }} />
|
||||
<PageHeader title={<span>Saldo</span>}>
|
||||
<span>
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
}).format(store.authentication.profileData?.wallet || 0)}
|
||||
</span>
|
||||
</PageHeader>
|
||||
</Row>
|
||||
</Card>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
|
|
@ -127,7 +127,7 @@ export const DetailUser = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.MEMBERSHIP,
|
||||
|
|
|
@ -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);
|
||||
|
@ -174,7 +174,7 @@ export const Membership = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.MEMBERSHIP,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from "react";
|
||||
import {Form, Input, Modal, Select} from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { Form, Input, Modal, Select, InputNumber } from "antd";
|
||||
import { useStore } from "../../utils/useStore";
|
||||
|
||||
export const MembershipModal = ({
|
||||
|
@ -11,6 +11,7 @@ export const MembershipModal = ({
|
|||
const [form] = Form.useForm();
|
||||
const { Option } = Select;
|
||||
const store = useStore();
|
||||
const [value, setValue] = useState();
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
@ -80,9 +81,27 @@ 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: /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})/,
|
||||
pattern: /^[\d]{0,12}$/,
|
||||
message: "Value should be less than 12 character",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input/>
|
||||
<Input
|
||||
onChange={(value) => {
|
||||
setValue(value);
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
)}
|
||||
{((initialData.id && !initialData.isChangePassword) ||
|
||||
|
|
|
@ -163,7 +163,7 @@ export const Payback = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.PAYBACK,
|
||||
|
@ -175,15 +175,23 @@ export const Payback = observer(() => {
|
|||
modalLoader.setLoading(true);
|
||||
try {
|
||||
const response = await store.payback.confirmPayback(id, type);
|
||||
if (response.body.status !== 201) {
|
||||
message.error(
|
||||
console.log(response);
|
||||
response.body.statusCode !== 201 && response.body.statusCode !== 200
|
||||
? message.error(
|
||||
response?.body?.message || `Failed ${capitalize(type)} Payback`
|
||||
);
|
||||
} else {
|
||||
message.success(
|
||||
)
|
||||
: message.success(
|
||||
response?.body?.message || `Success ${capitalize(type)} Payback`
|
||||
);
|
||||
}
|
||||
// if (response.body.status !== 201 ) {
|
||||
// message.error(
|
||||
// response?.body?.message || `Failed ${capitalize(type)} Payback`
|
||||
// );
|
||||
// } else {
|
||||
// message.success(
|
||||
// response?.body?.message || `Success ${capitalize(type)} Payback`
|
||||
// );
|
||||
// }
|
||||
} catch (e) {
|
||||
console.error(e, "apa errornya");
|
||||
message.error(
|
||||
|
@ -200,10 +208,10 @@ export const Payback = observer(() => {
|
|||
<div>
|
||||
<Row style={{ marginBottom: 20 }}>
|
||||
<Col span={12}>
|
||||
<Button>
|
||||
{/* <Button>
|
||||
<FilterOutlined />
|
||||
Filter
|
||||
</Button>
|
||||
</Button> */}
|
||||
</Col>
|
||||
<Col span={12} style={{ textAlign: "right" }}>
|
||||
{/* <Search
|
||||
|
@ -280,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>
|
||||
}
|
||||
/>
|
||||
|
@ -291,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>
|
||||
|
|
|
@ -80,7 +80,7 @@ export const PaybackCreated = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.PAYBACK_CREATED,
|
||||
|
|
|
@ -37,7 +37,7 @@ export const Category = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.CATEGORY,
|
||||
|
|
|
@ -30,6 +30,7 @@ export const Product = observer(() => {
|
|||
store.supplier.getData(),
|
||||
store.category.getData(),
|
||||
store.product.getDataSubCategories(),
|
||||
store.product.getProductPartner()
|
||||
]);
|
||||
await store.product.getData();
|
||||
modalLoader.setLoading(false);
|
||||
|
@ -53,7 +54,7 @@ export const Product = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.PRODUCT,
|
||||
|
|
|
@ -18,7 +18,7 @@ export const ProductDetail = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.PRODUCT,
|
||||
|
|
|
@ -41,7 +41,7 @@ export const Subcategory = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.SUBCATEGORY,
|
||||
|
|
|
@ -138,12 +138,12 @@ export const Profile = observer(() => {
|
|||
<div>
|
||||
<Title strong level={3}>History User Transaction</Title>
|
||||
|
||||
<Button style={{marginBottom: '1rem'}} onClick={() => {
|
||||
{/* <Button style={{marginBottom: '1rem'}} onClick={() => {
|
||||
console.log('clicked filter')
|
||||
}}>
|
||||
<FilterOutlined/>
|
||||
Filter
|
||||
</Button>
|
||||
</Button> */}
|
||||
<Table
|
||||
columns={columns}
|
||||
bordered
|
||||
|
|
|
@ -46,7 +46,7 @@ export const Transaction = observer(() => {
|
|||
const routeData = [
|
||||
{
|
||||
route: LINKS.HOME,
|
||||
name: "Home",
|
||||
name: "Beranda",
|
||||
},
|
||||
{
|
||||
route: LINKS.TRANSACTION,
|
||||
|
|
|
@ -27,7 +27,7 @@ export class Partner {
|
|||
async getData() {
|
||||
try {
|
||||
const response = await http.get(`/users/partner?page=${this.page}&pageSize=${this.pageSize}`);
|
||||
|
||||
//console.log(response)
|
||||
this.data = response.body.data.map((item, idx) => {
|
||||
item.key = idx;
|
||||
return item
|
||||
|
@ -59,11 +59,12 @@ export class Partner {
|
|||
}
|
||||
}
|
||||
|
||||
// async updateStatus(id, data) {
|
||||
// const response = await http.put(`/users/partner/${id}`).send(data);
|
||||
// await this.getData();
|
||||
// return response;
|
||||
// }
|
||||
async updatePassword(id, data) {
|
||||
const response = await http.put(`/users/change-password-partner/${id}`).send(data);
|
||||
console.log(response)
|
||||
await this.getData();
|
||||
return response;
|
||||
}
|
||||
|
||||
async delete(id) {
|
||||
try {
|
||||
|
|
|
@ -26,9 +26,11 @@ export class Product {
|
|||
dataPriceHistory = [];
|
||||
totalDataPriceHistory = 0;
|
||||
pagePriceHistory = 0;
|
||||
pageProductPartner = 0;
|
||||
pageSizePriceHistory = 10
|
||||
|
||||
dataDetailProduct = {};
|
||||
dataProductPartner=[]
|
||||
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
|
@ -94,6 +96,16 @@ export class Product {
|
|||
}
|
||||
}
|
||||
|
||||
async getProductPartner(id) {
|
||||
try {
|
||||
const response = await http.get(`/product/by-categories?page=${this.pageProductPartner}&sub-category=${id}`);
|
||||
console.log(response)
|
||||
this.dataProductPartner = response.body.data
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async create(data) {
|
||||
try {
|
||||
const response = await http.post('/product').send(data);
|
||||
|
|
Loading…
Reference in New Issue
Block a user