From 78626fd6e949e30fa329585debf80d26187791e2 Mon Sep 17 00:00:00 2001 From: "ajat91.sudrajat" Date: Wed, 22 Dec 2021 17:52:05 +0700 Subject: [PATCH] Role Access --- src/component/ProductComponent.js | 169 +++++++++++++++++------------ src/pages/Membership/DetailUser.js | 2 +- src/pages/Membership/Membership.js | 58 +++++++--- src/pages/Product/Product.js | 89 +++++++++------ 4 files changed, 199 insertions(+), 119 deletions(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index fcd3c2f..36f9042 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -1,18 +1,33 @@ -import React, {useContext, useState} from "react"; -import {Button, Col, Divider, Form, Input, List, message, Modal, Row, Select, Table, Tag, Typography,} from "antd"; -import {observer} from "mobx-react-lite"; -import {ExclamationCircleOutlined} from "@ant-design/icons"; -import {useHistory} from "react-router-dom"; -import {useStore} from "../utils/useStore"; -import {LINKS} from "../routes/app"; -import {ModalLoaderContext} from "../utils/modal"; +import React, { useContext, useState } from "react"; +import { + Button, + Col, + Divider, + Form, + Input, + InputNumber, + List, + message, + Modal, + Row, + Select, + Table, + Tag, + Typography, +} from "antd"; +import { observer } from "mobx-react-lite"; +import { ExclamationCircleOutlined } from "@ant-design/icons"; +import { useHistory } from "react-router-dom"; +import { useStore } from "../utils/useStore"; +import { LINKS } from "../routes/app"; +import { ModalLoaderContext } from "../utils/modal"; -const {Title, Text} = Typography; +const { Title, Text } = Typography; export const ProductComponent = observer((props) => { const store = useStore(); const [form] = Form.useForm(); - const {Option} = Select; + const { Option } = Select; const history = useHistory(); const [idData, setIdData] = useState(""); const [filterSupplier, setFilterSupplier] = useState([]); @@ -49,20 +64,20 @@ export const ProductComponent = observer((props) => { dataIndex: "current_price_price", key: "current_price_price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Harga Jual", dataIndex: "mark_up_price", key: "mark_up_price", render: (text) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, // { // title: "Gangguan", @@ -94,14 +109,14 @@ export const ProductComponent = observer((props) => { title: "Action", key: "action", render: (text, record) => ( - + ), }, ]; @@ -207,12 +222,12 @@ export const ProductComponent = observer((props) => { const footerLayoutFilter = [ , @@ -302,9 +317,7 @@ export const ProductComponent = observer((props) => { {item.product_name}
Harga Beli : {item.current_price_price}
- - Harga Jual : {item.mark_up_price} - + Harga Jual : {item.mark_up_price}

@@ -318,10 +331,14 @@ export const ProductComponent = observer((props) => { }} > - {item?.product_status === "ACTIVE" ? " Tersedia" : "Tidak"} + {item?.product_status === "ACTIVE" + ? " Tersedia" + : "Tidak"}

@@ -367,14 +384,26 @@ export const ProductComponent = observer((props) => { label="Price" rules={[{ required: true, message: "Please input price!" }]} > - + + `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + } + parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} + /> - + + `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + } + parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} + /> { > @@ -422,18 +451,18 @@ export const ProductComponent = observer((props) => { Filter Supplier @@ -442,16 +471,16 @@ export const ProductComponent = observer((props) => { Filter Categories @@ -460,18 +489,18 @@ export const ProductComponent = observer((props) => { Filter Sub-Categories diff --git a/src/pages/Membership/DetailUser.js b/src/pages/Membership/DetailUser.js index fe5bfdc..d2649d0 100644 --- a/src/pages/Membership/DetailUser.js +++ b/src/pages/Membership/DetailUser.js @@ -125,7 +125,7 @@ export const DetailUser = observer(() => {
- History User Transaction + History Top Up -
+
- - - - + }} + /> + {store.authentication.userData.role === "Admin" && ( +
+ + + + +
+ )}
- +
);