From e26fb13813f185653700aa13918ca2d64de16f8b Mon Sep 17 00:00:00 2001 From: "ajat91.sudrajat" Date: Wed, 2 Feb 2022 10:16:10 +0700 Subject: [PATCH 1/6] Bug fixing --- src/component/ProductComponent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/component/ProductComponent.js b/src/component/ProductComponent.js index 854f78d..9238976 100644 --- a/src/component/ProductComponent.js +++ b/src/component/ProductComponent.js @@ -350,8 +350,8 @@ export const ProductComponent = observer((props) => {

{item.product_name}
- Harga Beli : {item.current_price_price} -
+ {/* Harga Beli : {item.current_price_price} +
*/} Harga Jual : {item.mark_up_price}

From e8c4b9a2bf2dbbc1297db365b99580f14bc136f2 Mon Sep 17 00:00:00 2001 From: ilham Date: Thu, 3 Feb 2022 03:14:59 +0700 Subject: [PATCH 2/6] fix some wording --- src/component/CategoryComponent.js | 4 ++-- src/component/CommissionComponent.js | 6 ++--- src/component/PartnerComponent.js | 14 ++++++------ src/component/ProductComponent.js | 8 +++---- src/component/SubcategoryComponent.js | 4 ++-- src/component/SupplierComponent.js | 8 +++---- src/component/TopupsaldoModal.js | 4 ++-- src/constants/payback.js | 6 ++--- src/pages/App/DesktopLayout.js | 4 ++-- src/pages/App/MenuList.js | 6 ++--- src/pages/Membership/DetailUser.js | 2 +- src/pages/Membership/Konfirmasi.js | 18 +++++++-------- src/pages/Membership/Membership.js | 6 ++--- src/pages/Membership/MembershipModal.js | 2 +- src/pages/Payback/Payback.js | 30 ++++++++++++------------- src/pages/Payback/PaybackCreated.js | 12 +++++----- src/pages/Payback/PaybackModal.js | 4 ++-- src/pages/Product/Product.js | 2 +- src/pages/Profile/Profile.js | 20 ++++++++--------- src/pages/Transaction/Product.js | 16 ++++++------- 20 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/component/CategoryComponent.js b/src/component/CategoryComponent.js index 2866c89..9377b1f 100644 --- a/src/component/CategoryComponent.js +++ b/src/component/CategoryComponent.js @@ -45,7 +45,7 @@ export const CategoryComponent = observer((props) => { key: "name", }, { - title: "Action", + title: "Tindakan", key: "action", render: (text, record) => ( @@ -209,7 +209,7 @@ export const CategoryComponent = observer((props) => { visible={store.category.visibleModalCategory} title={idData ? "Edit Category" : "Create a new Category"} okText={idData ? "Edit" : "Create"} - cancelText="Cancel" + cancelText="Batal" onCancel={() => { form.resetFields(); handleCancel(); diff --git a/src/component/CommissionComponent.js b/src/component/CommissionComponent.js index f63f249..d8ac7d6 100644 --- a/src/component/CommissionComponent.js +++ b/src/component/CommissionComponent.js @@ -28,13 +28,13 @@ export const CommissionComponent = observer((props) => { key: "name", }, { - title: "Amount", + title: "Nominal", dataIndex: "commission", key: "commission", render: (text) => {text}%, }, { - title: "Action", + title: "Tindakan", key: "action", render: (text, record) => ( @@ -93,7 +93,7 @@ export const CommissionComponent = observer((props) => { visible={store.commission.visibleModalCommission} title={"Edit Commission"} okText={"Edit"} - cancelText="Cancel" + cancelText="Batal" onCancel={() => { form.resetFields(); handleCancel(); diff --git a/src/component/PartnerComponent.js b/src/component/PartnerComponent.js index a9ca3c1..4f34369 100644 --- a/src/component/PartnerComponent.js +++ b/src/component/PartnerComponent.js @@ -86,7 +86,7 @@ export const PartnerComponent = observer((props) => { key: "npwp", }, { - title: "Address", + title: "Alamat", dataIndex: "address", key: "address", }, @@ -104,7 +104,7 @@ export const PartnerComponent = observer((props) => { ), }, { - title: "Action", + title: "Tindakan", key: "action", render: (text, record) => ( @@ -143,12 +143,12 @@ export const PartnerComponent = observer((props) => { icon: , okText: "Yes", okType: "primary", - cancelText: "Cancel", + cancelText: "Batal", onOk() { return deleteData(id); }, onCancel() { - console.log("Cancel"); + console.log("Batal"); }, }); }; @@ -273,7 +273,7 @@ export const PartnerComponent = observer((props) => {
Nama : {item.name}
Npwp : {item.npwp}
- Address : {item.address} + Alamat : {item.address}
diff --git a/src/pages/Payback/PaybackModal.js b/src/pages/Payback/PaybackModal.js index da2b529..43c597c 100644 --- a/src/pages/Payback/PaybackModal.js +++ b/src/pages/Payback/PaybackModal.js @@ -100,7 +100,7 @@ export const PaybackModal = ({ initialData }) => { visible={store.payback.visibleModalPayback} title={"Create a new Created"} okText={"Create"} - cancelText="Cancel" + cancelText="Batal" onCancel={handleCancel} onOk={() => { form @@ -120,7 +120,7 @@ export const PaybackModal = ({ initialData }) => { name="form_in_modal" initialValues={initialData} > - +
{ visible={visibleModalUpload} title={"Upload Excel Product"} okText={"Create"} - cancelText="Cancel" + cancelText="Batal" onCancel={() => { form.resetFields(); handleCancel(); diff --git a/src/pages/Profile/Profile.js b/src/pages/Profile/Profile.js index 5096b0b..600130d 100644 --- a/src/pages/Profile/Profile.js +++ b/src/pages/Profile/Profile.js @@ -172,10 +172,10 @@ export const Profile = observer(() => { } > {record.status === 1 - ? "Success" + ? "Sukses" : record.status === 0 - ? "Pending" - : "Failed"} + ? "Dalam Proses" + : "Gagal"} ); }, @@ -240,7 +240,7 @@ export const Profile = observer(() => { - Name + Nama @@ -248,7 +248,7 @@ export const Profile = observer(() => { - Phone Number + No. Telepon @@ -268,7 +268,7 @@ export const Profile = observer(() => { {store.authentication.profileData.roles?.name} - Superior + Upline @@ -359,7 +359,7 @@ export const Profile = observer(() => {
- History Transaction + Riwayat Transaksi , , , ]} > Date: Thu, 3 Feb 2022 03:22:41 +0700 Subject: [PATCH 3/6] fix: detail user --- src/pages/Membership/DetailUser.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/Membership/DetailUser.js b/src/pages/Membership/DetailUser.js index 417c64d..435ba80 100644 --- a/src/pages/Membership/DetailUser.js +++ b/src/pages/Membership/DetailUser.js @@ -160,6 +160,11 @@ export const DetailUser = observer(() => { modalLoader.setLoading(false); }; const columns = [ + { + title: "Pengirim", + dataIndex: "sender_name", + key: "sender_name" + }, { title: "Nominal", dataIndex: "amount", From 238eeb92ceb960d50f6d2f2d4c76879796388181 Mon Sep 17 00:00:00 2001 From: "ajat91.sudrajat" Date: Thu, 3 Feb 2022 12:14:23 +0700 Subject: [PATCH 4/6] Tambah Role Customer Service --- src/component/CommissionComponent.js | 2 + src/component/PartnerComponent.js | 2 + src/component/SupplierComponent.js | 2 + src/pages/App/DesktopLayout.js | 32 +- src/pages/App/MenuList.js | 139 ++++----- src/pages/Config/Partner.js | 40 +-- src/pages/Config/Supplier.js | 16 +- src/pages/Home/Home.js | 10 +- src/pages/Membership/Membership.js | 19 +- src/pages/Product/Category.js | 31 +- src/pages/Product/Subcategory.js | 14 +- src/pages/Profile/Profile.js | 431 ++++++++++++++++++--------- src/store/transaction.js | 16 + 13 files changed, 476 insertions(+), 278 deletions(-) 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" + )} + {" "} +
+

+ + } + /> + + + + ); + }} + /> + + )} + + -
Date: Thu, 3 Feb 2022 13:28:50 +0700 Subject: [PATCH 5/6] Perbaikan Tampilan Mobile Menu Transaksi --- src/pages/Transaction/Transaction.js | 303 +++++++++++++++++++++++++-- src/store/transaction.js | 2 +- 2 files changed, 289 insertions(+), 16 deletions(-) diff --git a/src/pages/Transaction/Transaction.js b/src/pages/Transaction/Transaction.js index cb902a5..a1f9567 100644 --- a/src/pages/Transaction/Transaction.js +++ b/src/pages/Transaction/Transaction.js @@ -10,6 +10,8 @@ import { Modal, Row, DatePicker, + Form, + Input, } from "antd"; import { BreadcumbComponent } from "../../component/BreadcumbComponent"; import { Product } from "./Product"; @@ -24,12 +26,16 @@ export const Transaction = observer(() => { const { Title } = Typography; const { Option } = Select; const modalLoader = useContext(ModalLoaderContext); + const [form] = Form.useForm(); + const [visibleModalBuy, setVisibleModalBuy] = useState(false); + const [barang, setBarang] = useState({}); useEffect(() => { const init = async () => { try { modalLoader.setLoading(true); await store.transaction.getDataCategories(); + await store.transaction.getDataSubCategories(); modalLoader.setLoading(false); } catch (e) { modalLoader.setLoading(false); @@ -44,22 +50,96 @@ export const Transaction = observer(() => { init(); }, []); - const handleChangeTabs = async (key) => { + const routeData = [ + { + route: LINKS.TRANSACTION, + name: "Transaksi", + }, + ]; + + + const handleChangeTabs = async (item) => { modalLoader.setLoading(true); store.transaction.dataSubCategories = []; store.transaction.data = []; store.transaction.filterSubCategory = null; - store.transaction.filterCategory = key; + store.transaction.filterCategory = item; await store.transaction.getDataSubCategories(); modalLoader.setLoading(false); }; - const routeData = [ - { - route: LINKS.TRANSACTION, - name: "Transaksi" - }, - ]; + const handleChangeSubcategory = async (item) => { + store.transaction.filterSubCategory = item; + modalLoader.setLoading(true); + await store.transaction.getData(); + modalLoader.setLoading(false); + }; + + + const handleBuyProduct = async (data, productCode) => { + modalLoader.setLoading(true); + try { + const response = await store.transaction.buyProd({ + ...data, + productCode: productCode, + }); + + if (response.status === 201) { + message.success(response?.body?.message || "Berhasil Beli Produk"); + } else { + message.error(response?.body?.error || "Gagal Beli Produk", 3); + } + } catch (e) { + console.log("testingan"); + console.log(e.response, "testingan"); + console.log(e.result, "testingan1"); + if (e.response?.body?.error) { + message.error(e.response.body.error); + setVisibleModalBuy(false); + modalLoader.setLoading(false); + return; + } + console.log(e, "apa errornya"); + message.error("Gagal Beli Product"); + } + setVisibleModalBuy(false); + modalLoader.setLoading(false); + }; + + const handleBuyStag = async (data, productCode) => { + modalLoader.setLoading(true); + try { + const response = await store.transaction.buyProduct({ + ...data, + productCode: productCode, + }); + if (response.status === 201) { + message.success(response?.body?.message || "Berhasil Beli Produk"); + } else { + message.error(response?.body?.error || "Gagal Beli Produk", 3); + } + } catch (e) { + console.log("testingan"); + console.log(e.response, "testingan"); + console.log(e.result, "testingan1"); + if (e.response?.body?.error) { + message.error(e.response.body.error); + setVisibleModalBuy(false); + modalLoader.setLoading(false); + return; + } + console.log(e, "apa errornya"); + message.error("Gagal Beli Product"); + } + // setDataProd(false); + // setDataStag(false); + setVisibleModalBuy(false); + modalLoader.setLoading(false); + }; + const handleCancel = () => { + form.resetFields(); + setVisibleModalBuy(false); + }; return (
@@ -75,13 +155,206 @@ export const Transaction = observer(() => { Filter */} - - {store.transaction.dataCategories.map((item, index) => ( - - - - ))} - + {store.ui.mediaQuery.isDesktop && ( + + {store.transaction.dataCategories.map((item, index) => ( + + + + ))} + + )} + + {store.ui.mediaQuery.isMobile && ( +
+ + + Kategori + + + +
+ + + + + + + Sub Category + + + + + + + + + + Produk & Nominal + + + {/* */} + + + {store.transaction.data.length != 0 && ( + + {store.transaction.data.map((item, index) => ( + + { + setVisibleModalBuy(true); + setBarang(item); + }} + hoverable + style={{ + cursor: "pointer", + marginLeft: 10, + borderColor: "salmon", + height: 100, + marginBottom: 10, + }} + > + + {item?.product_name} + +
+ + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(item?.price)} + +
+ + ))} + + )} + { + form.resetFields(); + setVisibleModalBuy(false); + }} + // footer={footerLayoutFilter} + footer={[ + , + , + , + ]} + > + + + + + + + + )} ); diff --git a/src/store/transaction.js b/src/store/transaction.js index 145b6c8..4c481de 100644 --- a/src/store/transaction.js +++ b/src/store/transaction.js @@ -23,7 +23,7 @@ export class Transaction { pageSizeSubCategories = 10; dataSubCategories = []; total_dataSubCategories = 0; - filterSubCategory = null; + //filterSubCategory = null; pageHistoryTransaction = 0; pageSizeHistoryTransaction = 10; From b18e2dc61984c47bc1f90ab0a3ee936d7492e8e0 Mon Sep 17 00:00:00 2001 From: "ajat91.sudrajat" Date: Thu, 3 Feb 2022 13:58:51 +0700 Subject: [PATCH 6/6] Hide Fitur --- src/pages/Membership/DetailUser.js | 146 +++++++++++++++-------------- src/store/transaction.js | 2 +- 2 files changed, 77 insertions(+), 71 deletions(-) diff --git a/src/pages/Membership/DetailUser.js b/src/pages/Membership/DetailUser.js index 435ba80..d3eed8f 100644 --- a/src/pages/Membership/DetailUser.js +++ b/src/pages/Membership/DetailUser.js @@ -163,7 +163,7 @@ export const DetailUser = observer(() => { { title: "Pengirim", dataIndex: "sender_name", - key: "sender_name" + key: "sender_name", }, { title: "Nominal", @@ -396,8 +396,8 @@ export const DetailUser = observer(() => { Detail User { wrap={true} style={{ textAlign: "center" }} > - - - + {store.authentication.userData.role === "Admin" && ( + + + + + + )} {((store.authentication.userData.role === "Sales" && store.membership.dataDetail.is_rejected === true && store.membership.dataDetail.is_active === false) || diff --git a/src/store/transaction.js b/src/store/transaction.js index 4c481de..a934936 100644 --- a/src/store/transaction.js +++ b/src/store/transaction.js @@ -171,7 +171,7 @@ export class Transaction { async getDataHistoryTopUpProfile(id) { try { const response = await http.get( - `/transaction/history-deposit-profile?page=${this.page}&pageSize=${this.pageSize}&user-destination=${id}` + `/transaction/history-deposit-profile?page=${this.page}&pageSize=${this.pageSize}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}` ); console.log(response,'get data history Profile') this.dataHistoryTopUpProfile = response.body.data ?? [];