Perbaikan Project PPOB

This commit is contained in:
ajat91.sudrajat 2022-01-13 14:16:30 +07:00
parent a346ffd8f1
commit d5f3d59a32
12 changed files with 76 additions and 187 deletions

View File

@ -175,7 +175,7 @@ export const CategoryComponent = observer((props) => {
}} }}
> >
<List.Item.Meta <List.Item.Meta
className={["cariparkir-container"].join(" ")} className={[""].join(" ")}
title={item.code} title={item.code}
description={ description={
<div style={{}}> <div style={{}}>

View File

@ -265,7 +265,7 @@ export const PartnerComponent = observer((props) => {
}} }}
> >
<List.Item.Meta <List.Item.Meta
className={["cariparkir-container"].join(" ")} className={[""].join(" ")}
title={item.code} title={item.code}
description={ description={
<div style={{}}> <div style={{}}>
@ -275,7 +275,7 @@ export const PartnerComponent = observer((props) => {
<small>Npwp : {item.npwp}</small> <br /> <small>Npwp : {item.npwp}</small> <br />
<small>Address : {item.address}</small> <small>Address : {item.address}</small>
</div> </div>
<Space size="middle"> <Space size="small">
<Button <Button
type={ type={
item?.status === true ? "danger" : "primary" item?.status === true ? "danger" : "primary"
@ -359,7 +359,7 @@ export const PartnerComponent = observer((props) => {
rules={[ rules={[
idData idData
? { required: false } ? { required: false }
: { required: true, message: "Please input password name!" }, : { required: true, message: "Please input name!" },
]} ]}
> >
<Input /> <Input />

View File

@ -343,7 +343,7 @@ export const ProductComponent = observer((props) => {
}} }}
> >
<List.Item.Meta <List.Item.Meta
className={["cariparkir-container"].join(" ")} className={[""].join(" ")}
title={item.product_code} title={item.product_code}
description={ description={
<div style={{}}> <div style={{}}>

View File

@ -178,7 +178,7 @@ export const SubcategoryComponent = observer((props) => {
}} }}
> >
<List.Item.Meta <List.Item.Meta
className={["cariparkir-container"].join(" ")} className={[""].join(" ")}
title={item.code} title={item.code}
description={ description={
<div style={{}}> <div style={{}}>

View File

@ -281,7 +281,7 @@ export const SupplierComponent = observer((props) => {
}} }}
> >
<List.Item.Meta <List.Item.Meta
className={["cariparkir-container"].join(" ")} className={[""].join(" ")}
title={item.code} title={item.code}
description={ description={
<div style={{}}> <div style={{}}>

View File

@ -280,7 +280,7 @@ export const DetailUser = observer(() => {
"detail gambar" "detail gambar"
); );
return ( return (
<div className={["ppob-container"].join(" ")}> <div className={[""].join(" ")}>
<BreadcumbComponent data={routeData} /> <BreadcumbComponent data={routeData} />
<Card> <Card>
<Row style={{ marginBottom: 10 }}> <Row style={{ marginBottom: 10 }}>

View File

@ -1,141 +0,0 @@
import React from 'react';
import { Image, Modal, Upload, message } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { http } from "../utils/http";
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
export class PicturesWall extends React.Component {
state = {
previewVisible: false,
previewImage: '',
previewTitle: '',
fileList: [],
};
handleCancel = () => this.setState({ previewVisible: false });
handlePreview = async file => {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
this.setState({
previewImage: file.url || file.preview,
previewTitle: file.name || file.url.substring(file.url.lastIndexOf('/') + 1),
previewVisible: true,
});
};
handlePreviewCancel = () => {
this.setState({
previewVisible: false,
});
};
handleChange = ({ fileList }, info) => {
// if (this.props.maxUpload) {
// if (fileList.length > this.props.maxUpload) {
// fileList.splice(0, 1)
// }
// }
// if (info.file.status !== 'uploading') {
// console.log(info.file, info.fileList);
// }
// if (info.file.status === 'done') {
// message.success(`${info.file.name} file uploaded successfully`);
// } else if (info.file.status === 'error') {
// message.error(`${info.file.name} file upload failed.`);
// }
this.setState({ fileList })
};
render() {
const { previewVisible, previewImage, fileList, previewTitle, handlePreviewCancel } = this.state;
const uploadButton = (
<div>
<PlusOutlined />
<div style={{ marginTop: 8 }}>Upload</div>
</div>
);
return (
<>
<Upload
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
listType="picture-card"
fileList={fileList}
accept={'.png, .jpg, .jpeg, .PNG, .JPG, .JPEG'}
onPreview={this.handlePreview}
onChange={this.handleChange}
beforeUpload={(file) => {
console.log({ file })
http.uploadAntd({
file,
onError() {
},
onProgress(event) {
console.log({ event })
},
onSuccess: (res) => {
if (this.props.onUpload) {
const { fileList } = this.state
const index = fileList.findIndex(d => d.uid === file.uid)
if (fileList.length > this.props.maxUpload) {
this.setState({
fileList: []
}) && this.props.onUpload()
message.error('Upload foto tidak boleh melebihi batas maksimal!');
} else {
fileList[index].path = res.body.path
this.setState({
...fileList
})
this.props.onUpload(fileList)
}
}
}
})
return false;
}}
{...(this.props.uploadProps || {})}
>
{/* {fileList.length > this.props.maxUpload ?
this.setState({
fileList: []
}) && this.props.onUpload() && null
:
''} */}
{fileList.length >= this.props.maxUpload ? '' : uploadButton}
</Upload>
<Modal
visible={previewVisible}
title={previewTitle}
footer={null}
onCancel={this.handleCancel}
>
<Image
onClick={this.handleCancel}
src={previewImage}
/>
</Modal>
</>
);
}
}
export default PicturesWall;

View File

@ -366,7 +366,7 @@ export const Payback = observer(() => {
}} }}
> >
<List.Item.Meta <List.Item.Meta
className={["cariparkir-container"].join(" ")} className={[""].join(" ")}
title={item.userData_name} title={item.userData_name}
description={ description={
<div style={{}}> <div style={{}}>

View File

@ -304,11 +304,39 @@ export const PaybackCreated = observer(() => {
}} }}
> >
<List.Item.Meta <List.Item.Meta
className={["cariparkir-container"].join(" ")} className={[""].join(" ")}
title={item.name} title={item.name}
description={ description={
<div style={{}}> <div style={{}}>
<small>Amount: {item.amount}</small> <small>Amount: {item.amount}</small>
<br/>
<div style={{marginTop:5}}>
<small>Status : </small>
<Tag
color={
item.status === 0
? "purple"
: item.status === 1
? "blue"
: item.status === 2
? "warning"
: item.status === 3
? "success"
: "red"
}
>
{item.status === 0
? "Pending"
: item.status === 1
? "Success"
: item.status === 2
? "Failed"
: item.status === 3
? "Approved"
: "Rejected"}
</Tag>
</div>
</div> </div>
} }
/> />

View File

@ -46,7 +46,7 @@ export const Category = observer(() => {
]; ];
return ( return (
<div className={["ppob-container"].join(" ")}> <div className={[""].join(" ")}>
<BreadcumbComponent data={routeData} /> <BreadcumbComponent data={routeData} />
<Card> <Card>
<Row style={{ marginBottom: 20 }}> <Row style={{ marginBottom: 20 }}>

View File

@ -152,7 +152,7 @@ export const Product = observer(() => {
}; };
return ( return (
<div className={["ppob-container"].join(" ")}> <div className={[""].join(" ")}>
<BreadcumbComponent data={routeData}/> <BreadcumbComponent data={routeData}/>
<Card> <Card>
<div> <div>

View File

@ -1,5 +1,5 @@
import React, { useContext, useEffect } from "react"; import React, { useContext, useEffect } from "react";
import {Card, Col, Row, Table, Typography} from "antd"; import { Card, Col, Row, Table, Typography, Tag } from "antd";
import { BreadcumbComponent } from "../../component/BreadcumbComponent"; import { BreadcumbComponent } from "../../component/BreadcumbComponent";
import { LINKS } from "../../routes/app"; import { LINKS } from "../../routes/app";
import { useStore } from "../../utils/useStore"; import { useStore } from "../../utils/useStore";
@ -25,7 +25,7 @@ export const ProductDetail = observer(() => {
name: <span style={{ fontWeight: "bold" }}>Produk</span>, name: <span style={{ fontWeight: "bold" }}>Produk</span>,
}, },
{ {
route: LINKS.PRODUCT_DETAIL.replace(':id', `${id}`), route: LINKS.PRODUCT_DETAIL.replace(":id", `${id}`),
name: <span style={{ fontWeight: "bold" }}>Detail Produk</span>, name: <span style={{ fontWeight: "bold" }}>Detail Produk</span>,
}, },
]; ];
@ -78,7 +78,9 @@ export const ProductDetail = observer(() => {
key: "endDate", key: "endDate",
render: (text) => { render: (text) => {
return ( return (
<Text>{text ? format(parseISO(text), "dd MMMM yyyy") : "Sampai Sekarang"}</Text> <Text>
{text ? format(parseISO(text), "dd MMMM yyyy") : "Sampai Sekarang"}
</Text>
); );
}, },
}, },
@ -99,7 +101,7 @@ export const ProductDetail = observer(() => {
: null; : null;
return ( return (
<div className={["ppob-container"].join(" ")}> <div className={[""].join(" ")}>
<BreadcumbComponent data={routeData} /> <BreadcumbComponent data={routeData} />
<Card> <Card>
<Title strong>Product Detail</Title> <Title strong>Product Detail</Title>