diff --git a/src/pages/App/DesktopLayout.js b/src/pages/App/DesktopLayout.js
index 1b47af9..4316984 100644
--- a/src/pages/App/DesktopLayout.js
+++ b/src/pages/App/DesktopLayout.js
@@ -10,6 +10,8 @@ import {
DatabaseOutlined,
FileAddOutlined,
FileSyncOutlined,
+ FileProtectOutlined,
+ ShoppingCartOutlined,
} from "@ant-design/icons";
import { AppRoute, LINKS } from "../../routes/app";
import { useStore } from "../../utils/useStore";
@@ -122,12 +124,12 @@ export const DesktopLayout = observer(() => {
{store.authentication.userData.role !== "Retail" && (
-
+
Membership
)}
- {store.authentication.userData.role !== "Retail" && (
+ {store.authentication.userData.role === "Admin" && (
}
@@ -154,10 +156,10 @@ export const DesktopLayout = observer(() => {
)}
- {store.authentication.userData.role !== "Retail" && (
+ {store.authentication.userData.role === "Admin" && (
}
+ icon={}
title="Product"
>
@@ -180,28 +182,28 @@ export const DesktopLayout = observer(() => {
)}
- {store.authentication.userData.role !== "Retail" && (
+ {store.authentication.userData.role !== "Admin" && (
-
+
Product
)}
+ {store.authentication.userData.role === "Retail" && (
+
+
+
+ Transaction
+
+
+ )}
-
+
Payback
- {store.authentication.userData.role === "Retail" && (
-
-
-
- Transaction
-
-
- )}
diff --git a/src/pages/App/MenuList.js b/src/pages/App/MenuList.js
index afc5508..f7796cd 100644
--- a/src/pages/App/MenuList.js
+++ b/src/pages/App/MenuList.js
@@ -12,6 +12,7 @@ import {
MoneyCollectOutlined,
ProfileOutlined,
ProjectOutlined,
+ ShoppingCartOutlined,
UserOutlined,
} from "@ant-design/icons";
import { observer } from "mobx-react-lite";
@@ -59,7 +60,7 @@ export const MenuList = observer((props) => {
)}
- {store.authentication.userData.role !== "Retail" && (
+ {store.authentication.userData.role === "Admin" && (
} title="Config">
@@ -81,7 +82,7 @@ export const MenuList = observer((props) => {
)}
- {store.authentication.userData.role !== "Retail" && (
+ {store.authentication.userData.role === "Admin" && (
} title="Product">
@@ -103,10 +104,18 @@ export const MenuList = observer((props) => {
)}
- {store.authentication.userData.role === ("Retail" || "Admin") && (
+ {store.authentication.userData.role !== "Admin" && (
+
+
+
+ Product
+
+
+ )}
+ {store.authentication.userData.role === "Retail" && (
-
+
Transaction
@@ -117,14 +126,6 @@ export const MenuList = observer((props) => {
Payback
- {store.authentication.userData.role === ("Retail" || "Admin") && (
-
-
-
- Transaction
-
-
- )}
diff --git a/src/pages/Membership/Membership.js b/src/pages/Membership/Membership.js
index 8bcf4e6..3db8042 100644
--- a/src/pages/Membership/Membership.js
+++ b/src/pages/Membership/Membership.js
@@ -45,7 +45,8 @@ export const Membership = observer(() => {
setIsLoading(true);
await getData();
store.role.getData();
- await store.supplier.getData();
+ if (store.authentication.userData.role === "Admin")
+ await store.supplier.getData();
setIsLoading(false);
} catch (e) {
setIsLoading(false);
@@ -85,10 +86,11 @@ export const Membership = observer(() => {
const handleSubmitTransaction = async (data) => {
setConfirmLoading(true);
try {
- let input = data;
data.destination = destination;
- await store.transaction.distributeAdmin(data);
+ (await store.authentication.userData.role) === "Admin"
+ ? store.transaction.distributeAdmin(data)
+ : store.transaction.distribute(data);
message.success("Success Top Up");
//await store.supplier.getData()
} catch (e) {
@@ -266,11 +268,6 @@ export const Membership = observer(() => {
};
return (
- {/*
- Some contents...
- Some contents...
- Some contents...
- */}
@@ -410,19 +407,21 @@ export const Membership = observer(() => {
}}
>
-
-
+ {store.authentication.userData.role === "Admin" && (
+
+
+
+ )}
{
- const store = useStore();
- const [visibleModal, setVisibleModal] = useState(false);
- const [confirmLoading, setConfirmLoading] = useState(false);
- const [initialData, setInitialData] = useState({});
+ const store = useStore();
+ const [visibleModal, setVisibleModal] = useState(false);
+ const [confirmLoading, setConfirmLoading] = useState(false);
+ const [initialData, setInitialData] = useState({});
- // useEffect(() => {
- // // const init = async () => {
- // // try {
- // // setIsLoading(true);
- // // await store.membership.getData();
- // // await store.role.getData();
- // // setIsLoading(false);
- // // } catch (e) {
- // // setIsLoading(false);
- // // }
- // // };
- //
- // // init();
- // }, []);
+ // useEffect(() => {
+ // // const init = async () => {
+ // // try {
+ // // setIsLoading(true);
+ // // await store.membership.getData();
+ // // await store.role.getData();
+ // // setIsLoading(false);
+ // // } catch (e) {
+ // // setIsLoading(false);
+ // // }
+ // // };
+ //
+ // // init();
+ // }, []);
- const dummyData = [
- {
- key: '1',
- id: 1,
- name: "John Doe",
- picture: "https://presidenproperti.com/wp-content/uploads/2018/11/blog-ph.jpg",
- amount: "Rp. 1.000.000",
- },
- {
- key: '2',
- id: 1,
- name: "John Doe",
- picture: "https://presidenproperti.com/wp-content/uploads/2018/11/blog-ph.jpg",
- amount: "Rp. 1.000.000",
- },
- {
- key: '3',
- id: 1,
- name: "John Doe",
- picture: "https://presidenproperti.com/wp-content/uploads/2018/11/blog-ph.jpg",
- amount: "Rp. 1.000.000",
- },
- {
- key: '4',
- id: 1,
- name: "John Doe",
- picture: "https://presidenproperti.com/wp-content/uploads/2018/11/blog-ph.jpg",
- amount: "Rp. 1.000.000",
- },
- ]
+ const dummyData = [
+ {
+ key: "1",
+ id: 1,
+ name: "John Doe",
+ picture:
+ "https://presidenproperti.com/wp-content/uploads/2018/11/blog-ph.jpg",
+ amount: "Rp. 1.000.000",
+ },
+ {
+ key: "2",
+ id: 1,
+ name: "John Doe",
+ picture:
+ "https://presidenproperti.com/wp-content/uploads/2018/11/blog-ph.jpg",
+ amount: "Rp. 1.000.000",
+ },
+ {
+ key: "3",
+ id: 1,
+ name: "John Doe",
+ picture:
+ "https://presidenproperti.com/wp-content/uploads/2018/11/blog-ph.jpg",
+ amount: "Rp. 1.000.000",
+ },
+ {
+ key: "4",
+ id: 1,
+ name: "John Doe",
+ picture:
+ "https://presidenproperti.com/wp-content/uploads/2018/11/blog-ph.jpg",
+ amount: "Rp. 1.000.000",
+ },
+ ];
- const columns = [
- {
- title: "Name",
- dataIndex: "name",
- key: "name",
- },
- {
- title: "Picture",
- dataIndex: "picture",
- key: "picture",
- render: (text, record) => (
-
- ),
- },
- {
- title: "Amount",
- dataIndex: "amount",
- key: "amount",
- },
- {
- title: "Action",
- key: "action",
- width: 100,
- render: (text, record) => (
-
-
-
-
- ),
- },
- ];
+ const columns = [
+ {
+ title: "Name",
+ dataIndex: "name",
+ key: "name",
+ },
+ {
+ title: "Picture",
+ dataIndex: "picture",
+ key: "picture",
+ render: (text, record) => (
+
+ ),
+ },
+ {
+ title: "Amount",
+ dataIndex: "amount",
+ key: "amount",
+ },
+ {
+ title: "Action",
+ key: "action",
+ width: 100,
+ render: (text, record) => (
+
+
+
+
+ ),
+ },
+ ];
- const routeData = [
- {
- route: LINKS.HOME,
- name: "Home",
- },
- {
- route: LINKS.PAYBACK,
- name: Payback,
- },
- ];
+ if(store.authentication.userData.role === "Retail") columns.pop();
- const onSubmit = async (data) => {
- setConfirmLoading(true);
- try {
- // await store.membership.create(data);
- // message.success("Success Add New Member");
- // await store.membership.getData();
- } catch (e) {
- console.error(e, "apa errornya");
- message.error("Failed Add Member");
- }
- setConfirmLoading(false);
- setVisibleModal(false);
- };
+ const routeData = [
+ {
+ route: LINKS.HOME,
+ name: "Home",
+ },
+ {
+ route: LINKS.PAYBACK,
+ name: Payback,
+ },
+ ];
- const handleAction = async (record, type) => {
+ const onSubmit = async (data) => {
+ setConfirmLoading(true);
+ try {
+ // await store.membership.create(data);
+ // message.success("Success Add New Member");
+ // await store.membership.getData();
+ } catch (e) {
+ console.error(e, "apa errornya");
+ message.error("Failed Add Member");
+ }
+ setConfirmLoading(false);
+ setVisibleModal(false);
+ };
- };
+ const handleAction = async (record, type) => {};
- return (
-
- {/*
- Some contents...
- Some contents...
- Some contents...
- */}
-
-
-
-
-
-
-
-
-
-
-
-
- {store.ui.mediaQuery.isDesktop && (
-
{
- // let pageNumber = page.current;
- // store.membership.pageSize = page.pageSize;
- // store.membership.page = pageNumber - 1;
- // // store.membership.isLoading = true;
- // await store.membership.getData();
- // // store.membership.isLoading = false;
- // }}
- />
- )}
-
- {store.ui.mediaQuery.isMobile && (
- {
- // store.membership.pageSize = page.pageSize;
- // store.membership.page = page.current;
- // store.membership.getData();
- // },
- // pageSize: store.membership.pageSize,
- // total: store.membership.total_data,
- // current: store.membership.page,
- // style: {marginBottom: "1rem", marginRight: "1rem"},
- // }}
- dataSource={dummyData}
- style={{padding: 0}}
- renderItem={(item) => {
- return (
-
-
-
-
-
- }
- />
-
-
-
-
- );
- }}
- />
- )}
-
-
-
- {
- await onSubmit(data);
+ return (
+
+
+
+
+
+
+
+
+
+ {
+ />
+ {store.authentication.userData.role !== "Admin" && (
+
+ )}
+
+
+ {store.ui.mediaQuery.isDesktop && (
+
{
+ // let pageNumber = page.current;
+ // store.membership.pageSize = page.pageSize;
+ // store.membership.page = pageNumber - 1;
+ // // store.membership.isLoading = true;
+ // await store.membership.getData();
+ // // store.membership.isLoading = false;
+ // }}
/>
+ )}
+
+ {store.ui.mediaQuery.isMobile && (
+ {
+ // store.membership.pageSize = page.pageSize;
+ // store.membership.page = page.current;
+ // store.membership.getData();
+ // },
+ // pageSize: store.membership.pageSize,
+ // total: store.membership.total_data,
+ // current: store.membership.page,
+ // style: {marginBottom: "1rem", marginRight: "1rem"},
+ // }}
+ dataSource={dummyData}
+ style={{ padding: 0 }}
+ renderItem={(item) => {
+ return (
+
+
+
+
+
+ }
+ />
+
+
+
+
+ );
+ }}
+ />
+ )}
- );
+
+
+ {
+ await onSubmit(data);
+ }}
+ onCancel={() => {
+ setInitialData({});
+ setVisibleModal(false);
+ }}
+ />
+
+ );
});