Perbaikan Project PPOB

This commit is contained in:
ajat91.sudrajat 2022-01-13 15:06:54 +07:00
parent 8857911dcd
commit 38d744ce2f
7 changed files with 305 additions and 211 deletions

View File

@ -252,6 +252,17 @@ export const DetailUser = observer(() => {
}, },
]; ];
const dataRoute = [
{
route: LINKS.MEMBERSHIP,
name: "Keanggotaan"
},
{
route: LINKS.USER_DETAIL.replace(":id", id),
name: <span style={{ fontWeight: "bold" }}>Detail User</span>,
},
];
const styleSaldoTitle = store.ui.mediaQuery.isDesktop const styleSaldoTitle = store.ui.mediaQuery.isDesktop
? { ? {
display: "flex", display: "flex",
@ -275,13 +286,14 @@ export const DetailUser = observer(() => {
store.authentication.dataProfit.userDetail?.image_identity, store.authentication.dataProfit.userDetail?.image_identity,
"detail" "detail"
); );
console.log( console.log(store.authentication.listImage, "detail gambar");
store.authentication.listImage,
"detail gambar"
);
return ( return (
<div className={[""].join(" ")}> <div className={[""].join(" ")}>
<BreadcumbComponent data={routeData} /> <BreadcumbComponent
data={
store.authentication.userData.role === "Admin" ? routeData : dataRoute
}
/>
<Card> <Card>
<Row style={{ marginBottom: 10 }}> <Row style={{ marginBottom: 10 }}>
<Title strong level={2}> <Title strong level={2}>
@ -338,7 +350,8 @@ export const DetailUser = observer(() => {
store.membership.dataDetail.userDetail.image_identity store.membership.dataDetail.userDetail.image_identity
); );
console.log( console.log(
store.membership.dataDetail.userDetail.image_store,"ini store" store.membership.dataDetail.userDetail.image_store,
"ini store"
); );
console.log(store.membership.dataDetail.username); console.log(store.membership.dataDetail.username);
setVisibleModal(true); setVisibleModal(true);
@ -523,7 +536,6 @@ export const DetailUser = observer(() => {
</Space> </Space>
</Col> </Col>
)} )}
</Row> </Row>
<Row style={{ marginBottom: 20 }}> <Row style={{ marginBottom: 20 }}>

View File

@ -30,7 +30,6 @@ import { LINKS } from "../../routes/app";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { ModalLoaderContext } from "../../utils/modal"; import { ModalLoaderContext } from "../../utils/modal";
export const Membership = observer(() => { export const Membership = observer(() => {
const history = useHistory(); const history = useHistory();
const { Option } = Select; const { Option } = Select;
@ -253,12 +252,19 @@ export const Membership = observer(() => {
name: <span style={{ fontWeight: "bold" }}>Keanggotaan</span>, name: <span style={{ fontWeight: "bold" }}>Keanggotaan</span>,
}, },
]; ];
const dataRoute = [
{
route: LINKS.MEMBERSHIP,
name: "Keanggotaan"
},
];
const onSubmit = async (data, image, imageStore) => { const onSubmit = async (data, image, imageStore) => {
data.superior = true; data.superior = true;
console.log(imageStore, "Apa imageStore") console.log(imageStore, "Apa imageStore");
if (!imageStore) { if (!imageStore) {
imageStore = [] imageStore = [];
} }
if (initialData.id) { if (initialData.id) {
@ -325,7 +331,11 @@ export const Membership = observer(() => {
}; };
return ( return (
<div className={["ppob-container"].join(" ")}> <div className={["ppob-container"].join(" ")}>
<BreadcumbComponent data={routeData} /> <BreadcumbComponent
data={
store.authentication.userData.role === "Admin" ? routeData : dataRoute
}
/>
<Card> <Card>
<div> <div>
<Row style={{ marginBottom: 20 }}> <Row style={{ marginBottom: 20 }}>

View File

@ -182,6 +182,13 @@ export const Payback = observer(() => {
}, },
]; ];
const dataRoute = [
{
route: LINKS.PAYBACK,
name: "Konfirmasi Pembayaran"
},
];
const handleAction = async (id, type) => { const handleAction = async (id, type) => {
modalLoader.setLoading(true); modalLoader.setLoading(true);
try { try {
@ -236,8 +243,12 @@ export const Payback = observer(() => {
const data = form.getFieldsValue(); const data = form.getFieldsValue();
//console.log(data); //console.log(data);
store.payback.filterMembership = filterMembership; store.payback.filterMembership = filterMembership;
store.payback.filterStart = data.start_date ? (moment(data.start_date).format('YYYY-MM-DD') + ' 00:00:00') : null; store.payback.filterStart = data.start_date
store.payback.filterEnd = data.end_date ? (moment(data.end_date).format('YYYY-MM-DD') + ' 23:59:59') : null; ? moment(data.start_date).format("YYYY-MM-DD") + " 00:00:00"
: null;
store.payback.filterEnd = data.end_date
? moment(data.end_date).format("YYYY-MM-DD") + " 23:59:59"
: null;
modalLoader.setLoading(true); modalLoader.setLoading(true);
await store.payback.getDataConfirmation(); await store.payback.getDataConfirmation();
modalLoader.setLoading(false); modalLoader.setLoading(false);
@ -281,7 +292,11 @@ export const Payback = observer(() => {
]; ];
return ( return (
<div className={["ppob-container"].join(" ")}> <div className={["ppob-container"].join(" ")}>
<BreadcumbComponent data={routeData} /> <BreadcumbComponent
data={
store.authentication.userData.role === "Admin" ? routeData : dataRoute
}
/>
<Card> <Card>
<div> <div>
<Row style={{ marginBottom: 20 }}> <Row style={{ marginBottom: 20 }}>

View File

@ -133,6 +133,14 @@ export const PaybackCreated = observer(() => {
name: <span style={{ fontWeight: "bold" }}>Buat Pembayaran</span>, name: <span style={{ fontWeight: "bold" }}>Buat Pembayaran</span>,
}, },
]; ];
const dataRoute = [
{
route: LINKS.PAYBACK_CREATED,
name: "Buat Pembayaran"
},
];
const handleRemoveFilter = async () => { const handleRemoveFilter = async () => {
store.payback.filterStart = null; store.payback.filterStart = null;
store.payback.filterEnd = null; store.payback.filterEnd = null;
@ -209,7 +217,11 @@ export const PaybackCreated = observer(() => {
return ( return (
<div className={["ppob-container"].join(" ")}> <div className={["ppob-container"].join(" ")}>
<BreadcumbComponent data={routeData} /> <BreadcumbComponent
data={
store.authentication.userData.role === "Admin" ? routeData : dataRoute
}
/>
<Card> <Card>
<div> <div>
<Row style={{ marginBottom: 20 }}> <Row style={{ marginBottom: 20 }}>
@ -336,7 +348,6 @@ export const PaybackCreated = observer(() => {
: "Rejected"} : "Rejected"}
</Tag> </Tag>
</div> </div>
</div> </div>
} }
/> />

View File

@ -1,6 +1,21 @@
import React, { useContext, useEffect, useState } from "react"; import React, { useContext, useEffect, useState } from "react";
import {Button, Card, Col, Form, Input, message, Modal, Row, Select, Upload} from "antd"; import {
import {FilterOutlined, PlusOutlined, UploadOutlined,} from "@ant-design/icons"; Button,
Card,
Col,
Form,
Input,
message,
Modal,
Row,
Select,
Upload,
} from "antd";
import {
FilterOutlined,
PlusOutlined,
UploadOutlined,
} from "@ant-design/icons";
import { BreadcumbComponent } from "../../component/BreadcumbComponent"; import { BreadcumbComponent } from "../../component/BreadcumbComponent";
import { useStore } from "../../utils/useStore"; import { useStore } from "../../utils/useStore";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
@ -30,7 +45,7 @@ export const Product = observer(() => {
store.supplier.getData(), store.supplier.getData(),
store.category.getData(), store.category.getData(),
store.product.getDataSubCategories(), store.product.getDataSubCategories(),
store.product.getProductPartner() store.product.getProductPartner(),
]); ]);
await store.product.getData(); await store.product.getData();
modalLoader.setLoading(false); modalLoader.setLoading(false);
@ -62,14 +77,22 @@ export const Product = observer(() => {
}, },
]; ];
const dataRoute = [
{
route: LINKS.PRODUCT,
name: "Produk",
},
];
const beforeUpload = (file) => { const beforeUpload = (file) => {
let isLt2M; let isLt2M;
let allowedFile = [ let allowedFile = [
"text/csv", "application/csv", "text/csv",
"application/csv",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.ms-excel.sheet.binary.macroEnabled.12", "application/vnd.ms-excel.sheet.binary.macroEnabled.12",
"application/vnd.ms-excel", "application/vnd.ms-excel",
"application/vnd.ms-excel.sheet.macroEnabled.12" "application/vnd.ms-excel.sheet.macroEnabled.12",
]; ];
let isValid = allowedFile.includes(file.type); let isValid = allowedFile.includes(file.type);
if (!isValid) { if (!isValid) {
@ -93,12 +116,14 @@ export const Product = observer(() => {
message.error("Failed upload excel!"); message.error("Failed upload excel!");
} }
setFileList([{ setFileList([
uid: '-1', {
uid: "-1",
name: response.body.filename, name: response.body.filename,
status: 'done', status: "done",
url: '', url: "",
}]); },
]);
setExcel(response.body.filename); setExcel(response.body.filename);
} catch (e) { } catch (e) {
setLoading(false); setLoading(false);
@ -107,10 +132,10 @@ export const Product = observer(() => {
}; };
const handleChange = (info) => { const handleChange = (info) => {
if (info.file.status === 'uploading') { if (info.file.status === "uploading") {
setLoading(true); setLoading(true);
} else { } else {
setLoading(false) setLoading(false);
} }
}; };
@ -140,7 +165,7 @@ export const Product = observer(() => {
const handleSubmit = async (data) => { const handleSubmit = async (data) => {
const request = { const request = {
fileName: excel, fileName: excel,
supplierCode: data.supplierCode supplierCode: data.supplierCode,
}; };
const responseUploadProduct = await handleUploadProduct(request); const responseUploadProduct = await handleUploadProduct(request);
@ -153,7 +178,14 @@ export const Product = observer(() => {
return ( return (
<div className={[""].join(" ")}> <div className={[""].join(" ")}>
<BreadcumbComponent data={routeData}/> <BreadcumbComponent
data={
store.authentication.userData.role === "Admin" ||
store.authentication.userData.role === "Admin Partner"
? routeData
: dataRoute
}
/>
<Card> <Card>
<div> <div>
<Row style={{ marginBottom: 20 }}> <Row style={{ marginBottom: 20 }}>
@ -184,7 +216,8 @@ export const Product = observer(() => {
}} }}
/> */} /> */}
{store.authentication.userData.role == "Admin" && <div {store.authentication.userData.role == "Admin" && (
<div
style={{ style={{
display: store.ui.mediaQuery.isMobile ? "" : "flex", display: store.ui.mediaQuery.isMobile ? "" : "flex",
justifyContent: "flex-end", justifyContent: "flex-end",
@ -202,7 +235,8 @@ export const Product = observer(() => {
> >
Tambah Produk Tambah Produk
</Button> </Button>
</div>} </div>
)}
</div> </div>
</Col> </Col>
</Row> </Row>
@ -236,7 +270,9 @@ export const Product = observer(() => {
<Form.Item <Form.Item
name="fileName" name="fileName"
label="Upload Excel Product" label="Upload Excel Product"
rules={[{required: true, message: "Please Upload Excel Product!"}]} rules={[
{ required: true, message: "Please Upload Excel Product!" },
]}
> >
<Upload <Upload
fileList={fileList} fileList={fileList}
@ -274,7 +310,7 @@ export const Product = observer(() => {
rules={[{ required: true, message: "Please input Supplier Code!" }]} rules={[{ required: true, message: "Please input Supplier Code!" }]}
> >
<Select> <Select>
{store.supplier.data.map(data => ( {store.supplier.data.map((data) => (
<Option key={data.id} value={data.code}> <Option key={data.id} value={data.code}>
{data.name} {data.name}
</Option> </Option>

View File

@ -38,7 +38,7 @@ export const Profile = observer(() => {
const routeData = [ const routeData = [
{ {
route: LINKS.HOME, route: LINKS.HOME,
name: "Home", name: "Beranda",
}, },
{ {
route: LINKS.PROFILE, route: LINKS.PROFILE,
@ -46,6 +46,13 @@ export const Profile = observer(() => {
}, },
]; ];
const dataRoute = [
{
route: LINKS.PROFILE,
name: "Profil",
},
];
useEffect(() => { useEffect(() => {
(async () => { (async () => {
modalLoader.setLoading(true); modalLoader.setLoading(true);
@ -214,7 +221,14 @@ export const Profile = observer(() => {
return ( return (
<div className={["ppob-container"].join(" ")}> <div className={["ppob-container"].join(" ")}>
<BreadcumbComponent data={routeData} /> <BreadcumbComponent
data={
store.authentication.userData.role === "Admin" ||
store.authentication.userData.role === "Admin Partner"
? routeData
: dataRoute
}
/>
<Card> <Card>
<Title strong>Profile</Title> <Title strong>Profile</Title>
<Row style={{ marginBottom: 20 }}> <Row style={{ marginBottom: 20 }}>

View File

@ -55,13 +55,9 @@ export const Transaction = observer(() => {
}; };
const routeData = [ const routeData = [
{
route: LINKS.HOME,
name: "Beranda",
},
{ {
route: LINKS.TRANSACTION, route: LINKS.TRANSACTION,
name: <span style={{ fontWeight: "bold" }}>Transaksi</span>, name: "Transaksi"
}, },
]; ];