Merge branch 'develop' into 'devops-staging'

Bug Fixing

See merge request empatnusabangsa/ppob/ppob-frontend!137
This commit is contained in:
ajat sudrajat 2022-02-04 14:14:00 +00:00
commit 80d2c17719
6 changed files with 236 additions and 77 deletions

View File

@ -195,9 +195,11 @@ export const CategoryComponent = observer((props) => {
margin: 0, margin: 0,
}} }}
> >
<Button onClick={() => handleEditButton(item)}> {store.authentication.userData.role === "Admin" && (
Edit <Button onClick={() => handleEditButton(item)}>
</Button> Edit
</Button>
)}
</p> </p>
</div> </div>
</List.Item> </List.Item>

View File

@ -213,7 +213,12 @@ export const ProductComponent = observer((props) => {
store.product.filterSubCategory = null; store.product.filterSubCategory = null;
setFilterSupplier([]); setFilterSupplier([]);
setFilterSubCategories([]); setFilterSubCategories([]);
await store.product.getData(); store.authentication.userData.role === "Admin Partner"
? await store.product.getProductPartner(
store.authentication.profileData.id
)
: await store.product.getData();
//await store.product.getData();
store.product.visibleModalFilterProduct = false; store.product.visibleModalFilterProduct = false;
}; };
@ -221,17 +226,24 @@ export const ProductComponent = observer((props) => {
store.product.filterSubCategory = null; store.product.filterSubCategory = null;
store.product.filterSupplier = null; store.product.filterSupplier = null;
store.product.visibleModalFilterProduct = false; store.product.visibleModalFilterProduct = false;
await store.product.getData(); store.authentication.userData.role === "Admin Partner"
? await store.product.getProductPartner(
store.authentication.profileData.id
)
: await store.product.getData();
//await store.product.getData();
}; };
const handleSubmitFilter = async () => { const handleSubmitFilter = async () => {
store.product.filterSupplier = filterSupplier; store.product.filterSupplier = filterSupplier;
store.product.filterSubCategory = filterSubCategories; store.product.filterSubCategory = filterSubCategories;
modalLoader.setLoading(true); modalLoader.setLoading(true);
// store.authentication.userData.role === "Admin Partner" store.authentication.userData.role === "Admin Partner"
// ? await store.product.getData() ? await store.product.getProductPartner(
// : await store.product.getData() store.authentication.profileData.id
await store.product.getData(); )
: await store.product.getData();
//await store.product.getData();
modalLoader.setLoading(false); modalLoader.setLoading(false);
store.product.visibleModalFilterProduct = false; store.product.visibleModalFilterProduct = false;
//store.product.page=1 //store.product.page=1
@ -273,16 +285,19 @@ export const ProductComponent = observer((props) => {
{store.ui.mediaQuery.isDesktop && ( {store.ui.mediaQuery.isDesktop && (
<Table <Table
style={ style={
store.authentication.userData.role === "Admin" // store.authentication.userData.role === "Admin"
? { // ? {
cursor: "pointer", {
textAlign: "center", cursor: "pointer",
width: store.ui.mediaQuery.isMobile ? 250 : "", textAlign: "center",
} width: store.ui.mediaQuery.isMobile ? 250 : "",
: { }
textAlign: "center",
width: store.ui.mediaQuery.isMobile ? 250 : "", // }
} // : {
// textAlign: "center",
// width: store.ui.mediaQuery.isMobile ? 250 : "",
// }
} }
columns={columns} columns={columns}
dataSource={ dataSource={
@ -290,9 +305,7 @@ export const ProductComponent = observer((props) => {
? store.product.dataProductPartner ? store.product.dataProductPartner
: store.product.data : store.product.data
} }
onRow={ onRow={handleClickRow}
store.authentication.userData.role === "Admin" ? handleClickRow : ""
}
pagination={{ pagination={{
pageSize: store.product.pageSize, pageSize: store.product.pageSize,
total: total:
@ -322,7 +335,12 @@ export const ProductComponent = observer((props) => {
store.product.pageSize = pageSize; store.product.pageSize = pageSize;
store.product.page = page - 1; store.product.page = page - 1;
modalLoader.setLoading(true); modalLoader.setLoading(true);
await store.product.getData(); store.authentication.userData.role === "Admin Partner"
? await store.product.getProductPartner(
store.authentication.profileData.id
)
: await store.product.getData();
//await store.product.getData();
modalLoader.setLoading(false); modalLoader.setLoading(false);
}, },
pageSize: store.product.pageSize, pageSize: store.product.pageSize,
@ -357,6 +375,19 @@ export const ProductComponent = observer((props) => {
{/* <small>Harga Beli : {item.current_price_price}</small> {/* <small>Harga Beli : {item.current_price_price}</small>
<br /> */} <br /> */}
<small>Harga Jual : {item.mark_up_price}</small> <small>Harga Jual : {item.mark_up_price}</small>
<br />
<Button
onClick={async () => {
history.push(
LINKS.PRODUCT_DETAIL.replace(
":id",
item.product_id
)
);
}}
>
Detail
</Button>
</p> </p>
<p></p> <p></p>
</div> </div>
@ -457,8 +488,8 @@ export const ProductComponent = observer((props) => {
rules={[{ required: true, message: "Please select Status!" }]} rules={[{ required: true, message: "Please select Status!" }]}
> >
<Select placeholder="Select Sub Category" allowClear> <Select placeholder="Select Sub Category" allowClear>
<Option value="ACTIVE">ACTIVE</Option> <Option value="ACTIVE">AKTIF</Option>
<Option value="INACTIVE">INACTIVE</Option> <Option value="INACTIVE">INAKTIF</Option>
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
@ -482,7 +513,6 @@ export const ProductComponent = observer((props) => {
visible={store.product.visibleModalFilterProduct} visible={store.product.visibleModalFilterProduct}
title={"Filter"} title={"Filter"}
footer={footerLayoutFilter} footer={footerLayoutFilter}
onCancel={async () => { onCancel={async () => {
// setFilterSupplier([]); // setFilterSupplier([]);
// setFilterSubCategories([]); // setFilterSubCategories([]);

View File

@ -68,7 +68,7 @@ export const SubcategoryComponent = observer((props) => {
]; ];
if (store.authentication.userData.role === "Customer Service") columns.pop(); if (store.authentication.userData.role === "Customer Service") columns.pop();
const handleCancel = () => { const handleCancel = () => {
setIdData(""); setIdData("");
store.subcategory.visibleModalSubcategory = false; store.subcategory.visibleModalSubcategory = false;
@ -150,7 +150,7 @@ export const SubcategoryComponent = observer((props) => {
itemLayout="horizontal" itemLayout="horizontal"
position={"top"} position={"top"}
pagination={{ pagination={{
onChange: async (page,pageSize) => { onChange: async (page, pageSize) => {
store.subcategory.pageSize = pageSize; store.subcategory.pageSize = pageSize;
store.subcategory.page = page - 1; store.subcategory.page = page - 1;
modalLoader.setLoading(true); modalLoader.setLoading(true);
@ -200,9 +200,11 @@ export const SubcategoryComponent = observer((props) => {
margin: 0, margin: 0,
}} }}
> >
<Button onClick={() => handleEditButton(item)}> {store.authentication.userData.role === "Admin" && (
Edit <Button onClick={() => handleEditButton(item)}>
</Button> Edit
</Button>
)}
</p> </p>
</div> </div>
</List.Item> </List.Item>
@ -254,19 +256,19 @@ export const SubcategoryComponent = observer((props) => {
<Input /> <Input />
</Form.Item> </Form.Item>
{/* {!idData && ( */} {/* {!idData && ( */}
<Form.Item <Form.Item
name="categoryId" name="categoryId"
label="Categories" label="Categories"
rules={[{ required: true, message: "Please input category id!" }]} rules={[{ required: true, message: "Please input category id!" }]}
> >
<Select placeholder="Select Category" allowClear> <Select placeholder="Select Category" allowClear>
{store.category.data.map((item) => ( {store.category.data.map((item) => (
<Option value={item.id} key={item.id} defaultValue={item.name}> <Option value={item.id} key={item.id} defaultValue={item.name}>
{item.name} {item.name}
</Option> </Option>
))} ))}
</Select> </Select>
</Form.Item> </Form.Item>
{/* )} */} {/* )} */}
</Form> </Form>
</Modal> </Modal>

View File

@ -938,7 +938,7 @@ export const DetailUser = 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={{}}>

View File

@ -448,16 +448,19 @@ export const Membership = observer(() => {
<small>Username : {item.username}</small> <br /> <small>Username : {item.username}</small> <br />
<small>Role : {item.roles?.name}</small> <br /> <small>Role : {item.roles?.name}</small> <br />
<small>Saldo : {item.coa?.amount}</small> <br /> <small>Saldo : {item.coa?.amount}</small> <br />
<Button {store.authentication.userData.role ===
style={{ marginRight: 10, marginTop: 7 }} "Admin" && (
onClick={() => { <Button
setDestination(item?.id); style={{ marginRight: 10, marginTop: 7 }}
console.log(item?.id); onClick={() => {
setIsVisibleTopUpModal(true); setDestination(item?.id);
}} console.log(item?.id);
> setIsVisibleTopUpModal(true);
<DownloadOutlined /> Top Up Saldo }}
</Button> >
<DownloadOutlined /> Top Up Saldo
</Button>
)}
<Button <Button
onClick={async () => { onClick={async () => {
await store.transaction.getDataHistoryTopUp( await store.transaction.getDataHistoryTopUp(

View File

@ -1,5 +1,15 @@
import React, { useContext, useEffect } from "react"; import React, { useContext, useEffect } from "react";
import { Card, Col, Row, Table, Typography, Tag } from "antd"; import {
Card,
Col,
Row,
Table,
Typography,
Tag,
List,
Button,
Divider,
} 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";
@ -101,7 +111,7 @@ export const ProductDetail = observer(() => {
: null; : null;
return ( return (
<div className={[""].join(" ")}> <div className={["ppob-container"].join(" ")}>
<BreadcumbComponent data={routeData} /> <BreadcumbComponent data={routeData} />
<Card> <Card>
<Title strong>Product Detail</Title> <Title strong>Product Detail</Title>
@ -141,26 +151,138 @@ export const ProductDetail = observer(() => {
<Title strong level={3}> <Title strong level={3}>
Product Price History Product Price History
</Title> </Title>
<Table {store.ui.mediaQuery.isDesktop && (
columns={columns} <Table
dataSource={store.product.dataPriceHistory} columns={columns}
bordered dataSource={store.product.dataPriceHistory}
pagination={{ bordered
pageSize: store.product.pageSizePriceHistory, pagination={{
total: store.product.totalDataPriceHistory, pageSize: store.product.pageSizePriceHistory,
current: store.product.pagePriceHistory + 1, total: store.product.totalDataPriceHistory,
showSizeChanger: true, current: store.product.pagePriceHistory + 1,
simple: false, showSizeChanger: true,
}} simple: false,
onChange={async (page) => { }}
let pageNumber = page.current; onChange={async (page) => {
store.product.pageSizePriceHistory = page.pageSize; let pageNumber = page.current;
store.product.pagePriceHistory = pageNumber - 1; store.product.pageSizePriceHistory = page.pageSize;
modalLoader.setLoading(true); store.product.pagePriceHistory = pageNumber - 1;
await store.product.getPriceHistoryByProduct(id); modalLoader.setLoading(true);
modalLoader.setLoading(false); await store.product.getPriceHistoryByProduct(id);
}} modalLoader.setLoading(false);
/> }}
/>
)}
{store.ui.mediaQuery.isMobile && (
<List
itemLayout="horizontal"
position={"top"}
pagination={{
onChange: async (page, pageSize) => {
store.product.pageSizePriceHistory = pageSize;
store.product.pagePriceHistory = page - 1;
modalLoader.setLoading(true);
await store.product.getPriceHistoryByProduct(id);
modalLoader.setLoading(false);
},
pageSize: store.product.pageSizePriceHistory,
total: store.product.totalDataPriceHistory,
current: store.product.pagePriceHistory + 1,
style: { marginBottom: "1rem", marginRight: "1rem" },
}}
dataSource={store.product.dataPriceHistory}
style={{ padding: 0 }}
renderItem={(item) => {
return (
<div>
<List.Item
key={item.id}
style={{
backgroundColor: "#ffffff",
paddingTop: 0,
paddingBottom: 0,
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
}}
>
<List.Item.Meta
className={[""].join(" ")}
//title={item.mark_up_price}
description={
<div style={{}}>
<p>
<small>
Markup Price :{" "}
{new Intl.NumberFormat("id-ID", {
style: "currency",
currency: "IDR",
}).format(item.mark_up_price)}
</small>{" "}
<br />
<small>
Price:{" "}
{new Intl.NumberFormat("id-ID", {
style: "currency",
currency: "IDR",
}).format(item.price)}
</small>{" "}
<br />
<small>
{" "}
Tanggal Berlaku :
{item.startDate
? format(
parseISO(item.startDate),
"dd MMMM yyyy"
)
: "-"}
</small>{" "}
<br />
<small>
Tanggal Berakhir :{" "}
{item.endDate
? format(
parseISO(item.endDate),
"dd MMMM yyyy"
)
: "Sampai Sekarang"}
</small>{" "}
<br />
</p>
<p></p>
</div>
}
/>
{/* <div style={{ marginRight: 16 }}>
<p
style={{
fontSize: 9,
margin: 0,
}}
>
<Tag
color={
item?.product_status === "ACTIVE"
? "blue"
: "#E3E8EE"
}
style={{ color: "#4F566B" }}
>
{item?.product_status === "ACTIVE"
? " Tersedia"
: "Tidak"}
</Tag>
</p>
</div> */}
</List.Item>
<Divider plain style={{ margin: 0 }} />
</div>
);
}}
/>
)}
</div> </div>
</Col> </Col>
</Row> </Row>