diff --git a/src/component/CommissionComponent.js b/src/component/CommissionComponent.js index d8ac7d6..94d7abf 100644 --- a/src/component/CommissionComponent.js +++ b/src/component/CommissionComponent.js @@ -44,6 +44,8 @@ export const CommissionComponent = observer((props) => { }, ]; + if (store.authentication.userData.role === "Customer Service") columns.pop(); + const handleCancel = () => { setIdData(""); store.commission.visibleModalCommission = false; diff --git a/src/component/PartnerComponent.js b/src/component/PartnerComponent.js index 4f34369..ed31f0a 100644 --- a/src/component/PartnerComponent.js +++ b/src/component/PartnerComponent.js @@ -123,6 +123,8 @@ export const PartnerComponent = observer((props) => { ), }, ]; + + if (store.authentication.userData.role === "Customer Service") columns.pop(); const deleteData = async (id) => { try { diff --git a/src/component/SupplierComponent.js b/src/component/SupplierComponent.js index 81f5478..874539d 100644 --- a/src/component/SupplierComponent.js +++ b/src/component/SupplierComponent.js @@ -130,6 +130,8 @@ export const SupplierComponent = observer((props) => { }, ]; + if (store.authentication.userData.role === "Customer Service") columns.pop(); + const deleteData = async (id) => { try { console.log(id); diff --git a/src/pages/App/DesktopLayout.js b/src/pages/App/DesktopLayout.js index 5d55b25..884d31b 100644 --- a/src/pages/App/DesktopLayout.js +++ b/src/pages/App/DesktopLayout.js @@ -25,7 +25,7 @@ import { DollarCircleOutlined, UsergroupAddOutlined, UnorderedListOutlined, - FormOutlined + FormOutlined, } from "@ant-design/icons"; import { AppRoute, LINKS } from "../../routes/app"; import { useStore } from "../../utils/useStore"; @@ -129,7 +129,8 @@ export const DesktopLayout = observer(() => { }} > - {store.authentication.userData.role === "Admin" && ( + {(store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service") && ( @@ -145,7 +146,8 @@ export const DesktopLayout = observer(() => { )} - {store.authentication.userData.role === "Admin" && ( + {(store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service") && ( } @@ -201,7 +203,8 @@ export const DesktopLayout = observer(() => { )} */} - {store.authentication.userData.role === "Admin" && ( + {(store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service") && ( } @@ -228,7 +231,8 @@ export const DesktopLayout = observer(() => { )} - {store.authentication.userData.role === "Admin" && ( + {(store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service") && ( } @@ -308,14 +312,16 @@ export const DesktopLayout = observer(() => { )} - {store.authentication.userData.role !== "Admin" && ( - - - - Dibuat oleh Saya - - - )} + {store.authentication.userData.role !== "Admin" || + (store.authentication.userData.role !== + "Customer Service" && ( + + + + Dibuat oleh Saya + + + ))} )} {store.authentication.userData.role !== "Admin" && ( diff --git a/src/pages/App/MenuList.js b/src/pages/App/MenuList.js index 4c21761..031d504 100644 --- a/src/pages/App/MenuList.js +++ b/src/pages/App/MenuList.js @@ -56,7 +56,8 @@ export const MenuList = observer((props) => { overflowedIndicator={0} forceSubMenuRender={true} > - {store.authentication.userData.role === "Admin" && ( + {(store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service") && ( @@ -72,47 +73,48 @@ export const MenuList = observer((props) => { )} - {store.authentication.userData.role === "Admin" && ( - } - title="Keanggotaan" - > - - - - Daftar Anggota - - - - - - Konfirm Retail - - - - )} - {store.authentication.userData.role === "Supervisor" && ( - } - title="Keanggotaan" - > - - - - Daftar Anggota - - - - - - Konfirm Retail - - - - )} - {/* {store.authentication.userData.role === "Sales" && ( + {(store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service") && ( + } + title="Keanggotaan" + > + + + + Daftar Anggota + + + + + + Konfirm Retail + + + + )} + {store.authentication.userData.role === "Supervisor" && ( + } + title="Keanggotaan" + > + + + + Daftar Anggota + + + + + + Konfirm Retail + + + + )} + {/* {store.authentication.userData.role === "Sales" && ( } @@ -142,7 +144,8 @@ export const MenuList = observer((props) => { )} - {store.authentication.userData.role === "Admin" && ( + {(store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service") && ( } title="Config"> @@ -164,7 +167,8 @@ export const MenuList = observer((props) => { )} - {store.authentication.userData.role === "Admin" && ( + {(store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service") && ( } @@ -176,22 +180,20 @@ export const MenuList = observer((props) => { Produk - {store.authentication.userData.role === "Admin" && ( - - - - Sub Kategori - - - )} - {store.authentication.userData.role === "Admin" && ( - - - - Kategori - - - )} + + + + + Sub Kategori + + + + + + + Kategori + + )} {store.authentication.userData.role === "Admin Partner" && ( @@ -240,14 +242,15 @@ export const MenuList = observer((props) => { )} - {store.authentication.userData.role !== "Admin" && ( - - - - Dibuat oleh Saya - - - )} + {store.authentication.userData.role !== "Admin" || + (store.authentication.userData.role !== "Customer Service" && ( + + + + Dibuat oleh Saya + + + ))} )} {store.authentication.userData.role !== "Admin" && ( diff --git a/src/pages/Config/Partner.js b/src/pages/Config/Partner.js index 9e85a1d..279c0b3 100644 --- a/src/pages/Config/Partner.js +++ b/src/pages/Config/Partner.js @@ -1,14 +1,14 @@ -import React, {useContext, useEffect, useState} from "react"; -import {Button, Card, Col, Input, Row, Tabs,message} from "antd"; -import {FilterOutlined, PlusSquareOutlined,} from "@ant-design/icons"; -import {BreadcumbComponent} from "../../component/BreadcumbComponent"; -import {useStore} from "../../utils/useStore"; -import {observer} from "mobx-react-lite"; -import {PartnerComponent} from "../../component/PartnerComponent"; -import {LINKS} from "../../routes/app"; -import {ModalLoaderContext} from "../../utils/modal"; +import React, { useContext, useEffect, useState } from "react"; +import { Button, Card, Col, Input, Row, Tabs, message } from "antd"; +import { FilterOutlined, PlusSquareOutlined } from "@ant-design/icons"; +import { BreadcumbComponent } from "../../component/BreadcumbComponent"; +import { useStore } from "../../utils/useStore"; +import { observer } from "mobx-react-lite"; +import { PartnerComponent } from "../../component/PartnerComponent"; +import { LINKS } from "../../routes/app"; +import { ModalLoaderContext } from "../../utils/modal"; -const {Search} = Input; +const { Search } = Input; export const Partner = observer(() => { const store = useStore(); @@ -40,22 +40,22 @@ export const Partner = observer(() => { }, { route: LINKS.PARTNER, - name: Rekanan, + name: Rekanan, }, ]; return (
- + - + {/* */} - + {/* { marginBottom: store.ui.mediaQuery.isMobile ? 10 : 0, }} /> */} - + {store.authentication.userData.role !== "Customer Service" && ( + + )} - +
); diff --git a/src/pages/Config/Supplier.js b/src/pages/Config/Supplier.js index 3cd403b..773dcb8 100644 --- a/src/pages/Config/Supplier.js +++ b/src/pages/Config/Supplier.js @@ -1,4 +1,4 @@ -import React, {useContext, useEffect, useState} from "react"; +import React, { useContext, useEffect, useState } from "react"; import { Button, Card, @@ -21,7 +21,7 @@ import { useStore } from "../../utils/useStore"; import { observer } from "mobx-react-lite"; import { SupplierComponent } from "../../component/SupplierComponent"; import { LINKS } from "../../routes/app"; -import {ModalLoaderContext} from "../../utils/modal"; +import { ModalLoaderContext } from "../../utils/modal"; const { Search } = Input; @@ -80,11 +80,13 @@ export const Supplier = observer(() => { }} onSearch={(value) => console.log(value)} /> */} - + {store.authentication.userData.role !== "Customer Service" && ( + + )} diff --git a/src/pages/Home/Home.js b/src/pages/Home/Home.js index 4d41f87..3d0eea6 100644 --- a/src/pages/Home/Home.js +++ b/src/pages/Home/Home.js @@ -48,11 +48,12 @@ export const Home = observer(() => { ? await store.membership.getData() : await store.membership.getDataBySuperior(); }; - + return (
{store.ui.mediaQuery.isDesktop && - store.authentication.userData.role === "Admin" && ( + (store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service") && ( { )} - {store.ui.mediaQuery.isMobile && - store.authentication.userData.role === "Admin" && ( + {store.ui.mediaQuery.isMobile && + (store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service") && ( { marginBottom: store.ui.mediaQuery.isMobile ? 10 : 0, }} /> */} - + + {store.authentication.userData.role !== "Customer Service" && ( + + )} {store.ui.mediaQuery.isDesktop && ( diff --git a/src/pages/Product/Category.js b/src/pages/Product/Category.js index d1ef4ba..5bc0cb6 100644 --- a/src/pages/Product/Category.js +++ b/src/pages/Product/Category.js @@ -1,13 +1,12 @@ -import React, {useContext, useEffect, useState} from "react"; -import {Button, Card, Col, Input, Row, Tabs,message} from "antd"; -import {FilterOutlined, PlusSquareOutlined} from "@ant-design/icons"; -import {BreadcumbComponent} from "../../component/BreadcumbComponent"; -import {useStore} from "../../utils/useStore"; -import {observer} from "mobx-react-lite"; -import {LINKS} from "../../routes/app"; -import {CategoryComponent} from "../../component/CategoryComponent"; -import {ModalLoaderContext} from "../../utils/modal"; - +import React, { useContext, useEffect, useState } from "react"; +import { Button, Card, Col, Input, Row, Tabs, message } from "antd"; +import { FilterOutlined, PlusSquareOutlined } from "@ant-design/icons"; +import { BreadcumbComponent } from "../../component/BreadcumbComponent"; +import { useStore } from "../../utils/useStore"; +import { observer } from "mobx-react-lite"; +import { LINKS } from "../../routes/app"; +import { CategoryComponent } from "../../component/CategoryComponent"; +import { ModalLoaderContext } from "../../utils/modal"; export const Category = observer(() => { const store = useStore(); @@ -49,11 +48,13 @@ export const Category = observer(() => { - + {store.authentication.userData.role !== "Customer Service" && ( + + )} diff --git a/src/pages/Product/Subcategory.js b/src/pages/Product/Subcategory.js index b17dcb1..d435bd5 100644 --- a/src/pages/Product/Subcategory.js +++ b/src/pages/Product/Subcategory.js @@ -55,11 +55,15 @@ export const Subcategory = observer(() => { - + {store.authentication.userData.role !== "Customer Service" && ( + + )} diff --git a/src/pages/Profile/Profile.js b/src/pages/Profile/Profile.js index 600130d..c5e0e32 100644 --- a/src/pages/Profile/Profile.js +++ b/src/pages/Profile/Profile.js @@ -14,6 +14,7 @@ import { List, Image, Tag, + Tabs, } from "antd"; import moment from "moment"; import { BreadcumbComponent } from "../../component/BreadcumbComponent"; @@ -23,14 +24,15 @@ import { observer } from "mobx-react-lite"; import { FilterOutlined } from "@ant-design/icons"; import { format, parseISO } from "date-fns"; import { appConfig } from "../../config/app"; - import { ModalLoaderContext } from "../../utils/modal"; - +import { useParams } from "react-router-dom"; +const { TabPane } = Tabs; const { Title, Text } = Typography; const { RangePicker } = DatePicker; export const Profile = observer(() => { const store = useStore(); const [form] = Form.useForm(); + const { id } = useParams(); const modalLoader = useContext(ModalLoaderContext); const [filterStart, setFilterStart] = useState([]); const [filterEnd, setFilterEnd] = useState([]); @@ -59,11 +61,16 @@ export const Profile = observer(() => { await Promise.allSettled([ store.authentication.getProfile(), store.transaction.getDataHistoryTransaction(), + store.transaction.getDataHistoryTopUpProfile( + store.authentication.profileData?.id + + ), ]); modalLoader.setLoading(false); })(); }, []); + const handleRemoveFilter = async () => { store.transaction.filterStart = null; store.transaction.filterEnd = null; @@ -210,6 +217,35 @@ export const Profile = observer(() => { }, ]; + const column = [ + { + title: "Pengirim", + dataIndex: "sender_name", + key: "sender_name", + }, + { + title: "Nominal", + dataIndex: "amount", + key: "amount", + render: (text) => + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), + }, + { + title: "Transaction Date", + dataIndex: "transaction_date", + key: "transaction_date", + render: (text, record) => { + return ( + + {format(parseISO(record.transaction_date), "dd MMMM yyyy")} + + ); + }, + }, + ]; const styleSaldoTitle = store.ui.mediaQuery.isDesktop ? { display: "flex", @@ -357,152 +393,267 @@ export const Profile = observer(() => { -
- - Riwayat Transaksi - - - {store.ui.mediaQuery.isDesktop && ( - + + + {store.ui.mediaQuery.isDesktop && ( +
{ + let pageNumber = page.current; + store.transaction.pageSize = page.pageSize; + store.transaction.page = pageNumber - 1; + modalLoader.setLoading(true); + await store.transaction.getDataHistoryTopUpProfile( + store.authentication.profileData?.id + ); + modalLoader.setLoading(false); + }} + /> + )} + {store.ui.mediaQuery.isMobile && ( +
+ { + console.log(page, "Page"); + console.log(pageSize, "Page size"); + store.transaction.pageSize = pageSize; + store.transaction.page = page - 1; + modalLoader.setLoading(true); + await store.transaction.getDataHistoryTopUpProfile( + store.authentication.profileData?.id + ); + modalLoader.setLoading(false); + }, + pageSize: store.transaction.pageSize, + total: store.transaction.total_dataHistoryTopUpProfile, + current: store.transaction.page + 1, + style: { marginBottom: "1rem", marginRight: "1rem" }, + }} + style={{ padding: 0 }} + renderItem={(item) => { + return ( +
+ + +

+ + Pengirim : {item.sender_name} + {" "} +
+ + Amount :{" "} + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item.amount || 0)} + {" "} +
+ + Transaction Date :{" "} + {format( + parseISO(item.transaction_date), + "dd-MM-yyyy" + )} + {" "} +
+

+
+ } + /> + + +
+ ); + }} + /> + + )} + + + + {store.ui.mediaQuery.isDesktop && ( +
{ + let pageNumber = page.current; + store.transaction.pageSizeHistoryTransaction = + page.pageSize; + store.transaction.pageHistoryTransaction = pageNumber - 1; modalLoader.setLoading(true); await store.transaction.getDataHistoryTransaction(); modalLoader.setLoading(false); - }, - pageSize: store.transaction.pageSizeHistoryTransaction, - total: store.transaction.total_dataHistoryTransaction, - current: store.transaction.pageHistoryTransaction + 1, - style: { marginBottom: "1rem", marginRight: "1rem" }, - }} - style={{ padding: 0 }} - renderItem={(item) => { - return ( -
- - -

- Price : {item.price}
- - Tujuan : {item.transaction_destination} - {" "} -
- - Kode Transaksi : {item.transaction_code} - {" "} -
- - Status :{" "} - { - + )} + {store.ui.mediaQuery.isMobile && ( +

+ { + console.log(page, "Page"); + console.log(pageSize, "Page size"); + store.transaction.pageSizeHistoryTransaction = + pageSize; + store.transaction.pageHistoryTransaction = page - 1; + modalLoader.setLoading(true); + await store.transaction.getDataHistoryTransaction(); + modalLoader.setLoading(false); + }, + pageSize: store.transaction.pageSizeHistoryTransaction, + total: store.transaction.total_dataHistoryTransaction, + current: store.transaction.pageHistoryTransaction + 1, + style: { marginBottom: "1rem", marginRight: "1rem" }, + }} + style={{ padding: 0 }} + renderItem={(item) => { + return ( +
+ + +

+ Price : {item.price}
+ + Tujuan : {item.transaction_destination} + {" "} +
+ + Kode Transaksi : {item.transaction_code} + {" "} +
+ + Status :{" "} + { + + {item.status === 1 + ? "Sukses" + : item.status === 0 + ? "Dalam Proses" + : "Gagal"} + } - > - {item.status === 1 - ? "Sukses" - : item.status === 0 - ? "Dalam Proses" - : "Gagal"} - - } - {" "} -
- - No.Seri : {item.seri_number} - {" "} -
- - Alasan Gagal : {item.failed_reason} - {" "} -
- - IDTrx Mitra :{" "} - {item.partner_transaction_code} - {" "} -
- - Transaction Date :{" "} - {format( - parseISO(item.created_at), - "dd-MM-yyyy" - )} - {" "} -
-

-
- } - /> - - -
- ); - }} - /> - )} -
+ {" "} +
+ + No.Seri : {item.seri_number} + {" "} +
+ + Alasan Gagal : {item.failed_reason} + {" "} +
+ + IDTrx Mitra :{" "} + {item.partner_transaction_code} + {" "} +
+ + Transaction Date :{" "} + {format( + parseISO(item.created_at), + "dd-MM-yyyy" + )} + {" "} +
+

+ + } + /> + + + + ); + }} + /> + + )} + + -