diff --git a/src/component/CategoryComponent.js b/src/component/CategoryComponent.js index 2866c89..70fc4f1 100644 --- a/src/component/CategoryComponent.js +++ b/src/component/CategoryComponent.js @@ -8,7 +8,7 @@ import { Space, Table, List, - Divider + Divider, } from "antd"; import { observer } from "mobx-react-lite"; import { useHistory } from "react-router-dom"; @@ -40,12 +40,12 @@ export const CategoryComponent = observer((props) => { key: "code", }, { - title: "Category Name", + title: "Kategori", dataIndex: "name", key: "name", }, { - title: "Action", + title: "Tindakan", key: "action", render: (text, record) => ( @@ -55,6 +55,8 @@ export const CategoryComponent = observer((props) => { }, ]; + if (store.authentication.userData.role === "Customer Service") columns.pop(); + const deleteData = async (id) => { try { console.log(id); @@ -209,7 +211,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..d4c7584 100644 --- a/src/component/CommissionComponent.js +++ b/src/component/CommissionComponent.js @@ -23,18 +23,18 @@ export const CommissionComponent = observer((props) => { const columns = [ { - title: "Name", + title: "Nama", dataIndex: "name", key: "name", }, { - title: "Amount", + title: "Nominal", dataIndex: "commission", key: "commission", render: (text) => {text}%, }, { - title: "Action", + title: "Tindakan", key: "action", render: (text, record) => ( @@ -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; @@ -93,7 +95,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..b4ea10f 100644 --- a/src/component/PartnerComponent.js +++ b/src/component/PartnerComponent.js @@ -71,7 +71,7 @@ export const PartnerComponent = observer((props) => { const columns = [ { - title: "Name", + title: "Nama", dataIndex: "name", key: "name", }, @@ -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) => ( @@ -124,6 +124,8 @@ export const PartnerComponent = observer((props) => { }, ]; + if (store.authentication.userData.role === "Customer Service") columns.pop(); + const deleteData = async (id) => { try { modalLoader.setLoading(true); @@ -143,12 +145,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 +275,7 @@ export const PartnerComponent = observer((props) => {
Nama : {item.name}
Npwp : {item.npwp}
- Address : {item.address} + Alamat : {item.address}
, , , ]; @@ -349,8 +349,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}

@@ -387,7 +387,7 @@ export const ProductComponent = observer((props) => { visible={store.product.visibleModalProduct} title={idData ? "Edit Product" : "Create a new Product"} okText={idData ? "Edit" : "Create"} - cancelText="Cancel" + cancelText="Batal" onCancel={() => { form.resetFields(); handleCancel(); diff --git a/src/component/SubcategoryComponent.js b/src/component/SubcategoryComponent.js index 7074c20..1abbf07 100644 --- a/src/component/SubcategoryComponent.js +++ b/src/component/SubcategoryComponent.js @@ -42,22 +42,22 @@ export const SubcategoryComponent = observer((props) => { const columns = [ { - title: "Code", + title: "Kode", dataIndex: "code", key: "code", }, { - title: "Sub Category Name", + title: "Sub Kategori", dataIndex: "name", key: "name", }, { - title: "Category", + title: "Kategori", dataIndex: "categoryName", key: "categoryName", }, { - title: "Action", + title: "Tindakan", key: "action", render: (text, record) => ( @@ -67,6 +67,8 @@ export const SubcategoryComponent = observer((props) => { }, ]; + if (store.authentication.userData.role === "Customer Service") columns.pop(); + const handleCancel = () => { setIdData(""); store.subcategory.visibleModalSubcategory = false; @@ -214,7 +216,7 @@ export const SubcategoryComponent = observer((props) => { visible={store.subcategory.visibleModalSubcategory} title={idData ? "Edit Sub Category" : "Create a new sub category"} okText={idData ? "Edit" : "Create"} - cancelText="Cancel" + cancelText="Batal" onCancel={() => { form.resetFields(); handleCancel(); diff --git a/src/component/SupplierComponent.js b/src/component/SupplierComponent.js index c193caa..a715ef8 100644 --- a/src/component/SupplierComponent.js +++ b/src/component/SupplierComponent.js @@ -65,7 +65,7 @@ export const SupplierComponent = observer((props) => { const columns = [ { - title: "Name", + title: "Nama", dataIndex: "name", key: "name", }, @@ -112,7 +112,7 @@ export const SupplierComponent = observer((props) => { ), }, { - title: "Action", + title: "Tindakan", key: "action", width: "20%", render: (text, record) => ( @@ -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); @@ -151,12 +153,12 @@ export const SupplierComponent = observer((props) => { icon: , okText: "Yes", okType: "primary", - cancelText: "Cancel", + cancelText: "Batal", onOk() { return deleteData(id); }, onCancel() { - console.log("Cancel"); + console.log("Batal"); }, }); }; @@ -342,7 +344,7 @@ export const SupplierComponent = observer((props) => { visible={store.supplier.visibleModalSupplier} title={idData ? "Edit Supplier" : "Create a new Supplier"} okText={idData ? "Edit" : "Create"} - cancelText="Cancel" + cancelText="Batal" onCancel={() => { form.resetFields(); handleCancel(); diff --git a/src/component/TopupsaldoModal.js b/src/component/TopupsaldoModal.js index f2abe07..85a2b82 100644 --- a/src/component/TopupsaldoModal.js +++ b/src/component/TopupsaldoModal.js @@ -34,7 +34,7 @@ export const TopupsaldoModal = observer((props) => { visible={store.supplier.visibleModalTransaction} title="Top Up Saldo" okText="Top Up" - cancelText="Cancel" + cancelText="Batal" onCancel={() => { form.resetFields(); handleCancelTransaction(); @@ -66,7 +66,7 @@ export const TopupsaldoModal = observer((props) => { { }} > - {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") && ( } @@ -154,7 +156,7 @@ export const DesktopLayout = observer(() => { - List Anggota + Daftar Anggota @@ -174,7 +176,7 @@ export const DesktopLayout = observer(() => { - List Anggota + Daftar Anggota @@ -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") && ( } @@ -309,13 +313,13 @@ export const DesktopLayout = observer(() => { )} {store.authentication.userData.role !== "Admin" && ( - - - - Dibuat oleh Saya - - - )} + + + + Dibuat oleh Saya + + + )} )} {store.authentication.userData.role !== "Admin" && ( diff --git a/src/pages/App/MenuList.js b/src/pages/App/MenuList.js index 770498b..8cec5e6 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,7 +73,48 @@ export const MenuList = observer((props) => { )} - {store.authentication.userData.role === "Admin" && ( + {(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" && ( } @@ -81,47 +123,7 @@ export const MenuList = observer((props) => { - List Anggota - - - - - - Konfirm Retail - - - - )} - {store.authentication.userData.role === "Supervisor" && ( - } - title="Keanggotaan" - > - - - - List Anggota - - - - - - Konfirm Retail - - - - )} - {/* {store.authentication.userData.role === "Sales" && ( - } - title="Keanggotaan" - > - - - - List Anggota + Daftar Anggota @@ -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" && ( @@ -241,13 +243,13 @@ export const MenuList = observer((props) => { )} {store.authentication.userData.role !== "Admin" && ( - - - - Dibuat oleh Saya - - - )} + + + + 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") && ( { const [filterStart, setFilterStart] = useState([]); const [filterEnd, setFilterEnd] = useState([]); const [visibleHis, setVisibleHis] = useState(true); + const [actionFilter, setAction] = useState(false); useEffect(() => { (async () => { @@ -161,7 +162,12 @@ export const DetailUser = observer(() => { }; const columns = [ { - title: "Amount", + title: "Pengirim", + dataIndex: "sender_name", + key: "sender_name", + }, + { + title: "Nominal", dataIndex: "amount", key: "amount", render: (text) => @@ -171,7 +177,7 @@ export const DetailUser = observer(() => { }).format(text), }, { - title: "Transaction Date", + title: "Tanggal Transaksi", dataIndex: "transaction_date", key: "transaction_date", render: (text, record) => { @@ -191,7 +197,7 @@ export const DetailUser = observer(() => { key: "name", }, { - title: "Price", + title: "Harga", dataIndex: "price", key: "price", render: (text) => @@ -321,19 +327,31 @@ export const DetailUser = observer(() => { form.resetFields(); setFilterStart([]); setFilterEnd([]); - await store.transaction.getDetailHistoryTransaction( - store.authentication.dataProfit.id - ); + actionFilter === true + ? await store.transaction.getDataHistoryTopUp(id) + : await store.transaction.getDetailHistoryTransaction( + store.authentication.dataProfit.id + ); + // await store.transaction.getDetailHistoryTransaction( + // store.authentication.dataProfit.id + // ); store.transaction.visibleModalFilterTransaction = false; + setAction(false); }; const handleCancelFilter = async () => { store.transaction.filterStart = null; store.transaction.filterEnd = null; store.transaction.visibleModalFilterTransaction = false; - await store.transaction.getDetailHistoryTransaction( - store.authentication.dataProfit.id - ); + actionFilter === true + ? await store.transaction.getDataHistoryTopUp(id) + : await store.transaction.getDetailHistoryTransaction( + store.authentication.dataProfit.id + ); + // await store.transaction.getDetailHistoryTransaction( + // store.authentication.dataProfit.id + // ); + setAction(false); }; const handleSubmitFilter = async () => { @@ -345,13 +363,16 @@ export const DetailUser = observer(() => { "YYYY-MM-DD HH:mm:ss" ); modalLoader.setLoading(true); - await store.transaction.getDetailHistoryTransaction( - store.authentication.dataProfit.id - ); + actionFilter === true + ? await store.transaction.getDataHistoryTopUp(id) + : await store.transaction.getDetailHistoryTransaction( + store.authentication.dataProfit.id + ); modalLoader.setLoading(false); store.transaction.filterStart = null; store.transaction.filterEnd = null; store.transaction.visibleModalFilterTransaction = false; + setAction(false); }; const footerLayoutFilter = [ , , , ]; return ( @@ -391,8 +412,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) || @@ -509,12 +536,12 @@ export const DetailUser = observer(() => { {store.authentication.dataProfit.username} - + {/* Role {store.authentication.dataProfit.roles?.name} - + */} Phone Number @@ -537,8 +564,8 @@ export const DetailUser = observer(() => { {store.authentication.dataProfit.is_active === true - ? "Active" - : "Inactive"} + ? "Aktif" + : "Inaktif"} {store.authentication.userData.role === "Admin" && @@ -558,7 +585,7 @@ export const DetailUser = observer(() => { ? `${appConfig.apiUrl}/config/image/${store.authentication.dataProfit.userDetail?.image_identity}` : "https://st4.depositphotos.com/14953852/24787/v/600/depositphotos_247872612-stock-illustration-no-image-available-icon-vector.jpg" } - style={{ width: "10vw" }} + style={{ width: "8vw" }} /> @@ -578,7 +605,7 @@ export const DetailUser = observer(() => { ? `${appConfig.apiUrl}/config/image/${item}` : "https://st4.depositphotos.com/14953852/24787/v/600/depositphotos_247872612-stock-illustration-no-image-available-icon-vector.jpg" } - style={{ width: "10vw", marginRight: 15 }} + style={{ width: "8vw", marginRight: 10 }} /> ) ) @@ -683,7 +710,7 @@ export const DetailUser = observer(() => { - Profit + Keuntungan @@ -707,31 +734,124 @@ export const DetailUser = observer(() => { - - { - let pageNumber = page.current; - store.transaction.pageSize = page.pageSize; - store.transaction.page = pageNumber - 1; - modalLoader.setLoading(true); - await getData(); - modalLoader.setLoading(false); - }} - /> + + {store.ui.mediaQuery.isDesktop && ( +
+ +
{ + let pageNumber = page.current; + store.transaction.pageSize = page.pageSize; + store.transaction.page = pageNumber - 1; + modalLoader.setLoading(true); + await getData(); + modalLoader.setLoading(false); + }} + /> + + )} + {store.ui.mediaQuery.isMobile && ( +
+ + { + store.transaction.pageSize = pageSize; + store.transaction.page = page - 1; + modalLoader.setLoading(true); + await getData(); + modalLoader.setLoading(false); + }, + pageSize: store.transaction.pageSize, + total: store.transaction.total_data, + current: store.transaction.page + 1, + style: { marginBottom: "1rem", marginRight: "1rem" }, + }} + dataSource={store.transaction.dataHistoryTopUp} + style={{ padding: 0 }} + renderItem={(item) => { + return ( +
+ + +

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

+
+ } + /> + + +
+ ); + }} + /> + + )} - + {store.ui.mediaQuery.isDesktop && (
, , , ]; const handleCancelTransaction = () => { @@ -168,10 +169,10 @@ export const Membership = observer(() => { const columns = [ { - title: "Name", + title: "Nama", dataIndex: "name", key: "name", - render: (text, record) => record?.name ?? record?.username, + render: (text, record) => record?.name ?? record?.user_detail?.name, }, { title: "Username", @@ -196,7 +197,7 @@ export const Membership = observer(() => { }).format(text), }, { - title: "Action", + title: "Tindakan", key: "action", render: (text, record) => ( @@ -225,6 +226,7 @@ export const Membership = observer(() => { }, ]; + if (store.authentication.userData.role === "Customer Service") columns.pop(); const routeData = [ { route: LINKS.HOME, @@ -344,14 +346,17 @@ export const Membership = observer(() => { marginBottom: store.ui.mediaQuery.isMobile ? 10 : 0, }} /> */} - + + {store.authentication.userData.role !== "Customer Service" && ( + + )} {store.ui.mediaQuery.isDesktop && ( @@ -359,16 +364,18 @@ export const Membership = observer(() => { key="1" hasEmpty columns={columns} - style={{ cursor: "pointer" }} + //style={{ cursor: "pointer" }} dataSource={ - store.authentication.userData.role === "Admin" + store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service" ? store.membership.dataMember : store.membership.data } pagination={{ pageSize: store.membership.pageSize, total: - store.authentication.userData.role === "Admin" + store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service" ? store.membership.dataTotal : store.membership.total_data, current: store.membership.page + 1, @@ -401,14 +408,16 @@ export const Membership = observer(() => { }, pageSize: store.membership.pageSize, total: - store.authentication.userData.role === "Admin" + store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service" ? store.membership.dataTotal : store.membership.total_data, current: store.membership.page + 1, style: { marginBottom: "1rem", marginRight: "1rem" }, }} dataSource={ - store.authentication.userData.role === "Admin" + store.authentication.userData.role === "Admin" || + store.authentication.userData.role === "Customer Service" ? store.membership.dataMember : store.membership.data } @@ -496,7 +505,7 @@ export const Membership = observer(() => { visible={isVisibleTopUpModal} title="Top Up Saldo" okText="Top Up" - cancelText="Cancel" + cancelText="Batal" onCancel={() => { form.resetFields(); handleCancelTransaction(); @@ -517,7 +526,7 @@ export const Membership = observer(() => {
{ form.resetFields(); onCancel(); diff --git a/src/pages/Payback/Payback.js b/src/pages/Payback/Payback.js index 7b59a33..1c0d954 100644 --- a/src/pages/Payback/Payback.js +++ b/src/pages/Payback/Payback.js @@ -67,12 +67,12 @@ export const Payback = observer(() => { const columns = [ { - title: "Name", + title: "Nama", dataIndex: "userData_name", key: "userData_name", }, { - title: "Picture", + title: "Gambar", dataIndex: "image_prove", key: "image_prove", render: (text, record) => ( @@ -84,7 +84,7 @@ export const Payback = observer(() => { ), }, { - title: "Amount", + title: "Nominal", dataIndex: "amount", key: "amount", width: "20%", @@ -95,7 +95,7 @@ export const Payback = observer(() => { }).format(text), }, { - title: "Action", + title: "Tindakan", dataIndex: "amount", key: "action", width: "10%", @@ -108,13 +108,13 @@ export const Payback = observer(() => { title: `Are you sure Accept this submission?`, icon: , okText: "Accept", - cancelText: "Cancel", + cancelText: "Batal", okType: "primary", onOk() { handleAction(record.id, "accept"); }, onCancel() { - console.log("Cancel"); + console.log("Batal"); }, }); }} @@ -133,13 +133,13 @@ export const Payback = observer(() => { title: `Are you sure Reject this submission?`, icon: , okText: "Reject", - cancelText: "Cancel", + cancelText: "Batal", okType: "primary", onOk() { handleAction(record.id, "reject"); }, onCancel() { - console.log("Cancel"); + console.log("Batal"); }, }); }} @@ -244,7 +244,7 @@ export const Payback = observer(() => { modalLoader.setLoading(false); store.payback.visibleModalFilterPayback = false; }; - + const footerLayoutFilter = [ , , , ]; return ( @@ -377,13 +377,13 @@ export const Payback = observer(() => { title: `Are you sure Accept this submission?`, icon: , okText: "Accept", - cancelText: "Cancel", + cancelText: "Batal", okType: "primary", onOk() { handleAction(item.id, "accept"); }, onCancel() { - console.log("Cancel"); + console.log("Batal"); }, }); }} @@ -402,13 +402,13 @@ export const Payback = observer(() => { title: `Are you sure Reject this submission?`, icon: , okText: "Reject", - cancelText: "Cancel", + cancelText: "Batal", okType: "primary", onOk() { handleAction(item.id, "reject"); }, onCancel() { - console.log("Cancel"); + console.log("Batal"); }, }); }} @@ -478,7 +478,7 @@ export const Payback = observer(() => {
- Sender + Pengirim diff --git a/src/pages/Payback/PaybackCreated.js b/src/pages/Payback/PaybackCreated.js index 5f8957d..24e2fcd 100644 --- a/src/pages/Payback/PaybackCreated.js +++ b/src/pages/Payback/PaybackCreated.js @@ -56,7 +56,7 @@ export const PaybackCreated = observer(() => { const columns = [ { - title: "Picture", + title: "Gambar", dataIndex: "image_prove", key: "image_prove", render: (text, record) => ( @@ -68,7 +68,7 @@ export const PaybackCreated = observer(() => { ), }, { - title: "Amount", + title: "Nominal", dataIndex: "amount", key: "amount", render: (text) => @@ -103,8 +103,8 @@ export const PaybackCreated = observer(() => { : record.status === 2 ? "Failed" : record.status === 3 - ? "Approved" - : "Rejected"} + ? "Disetujui" + : "Ditolak"} ), }, @@ -313,8 +313,8 @@ export const PaybackCreated = observer(() => { : item.status === 2 ? "Failed" : item.status === 3 - ? "Approved" - : "Rejected"} + ? "Disetujui" + : "Ditolak"} 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} > - +
{ const store = useStore(); @@ -49,11 +48,13 @@ export const Category = observer(() => {
- + {store.authentication.userData.role !== "Customer Service" && ( + + )} diff --git a/src/pages/Product/Product.js b/src/pages/Product/Product.js index 0809763..3cadd9c 100644 --- a/src/pages/Product/Product.js +++ b/src/pages/Product/Product.js @@ -250,7 +250,7 @@ export const Product = observer(() => { visible={visibleModalUpload} title={"Upload Excel Product"} okText={"Create"} - cancelText="Cancel" + cancelText="Batal" onCancel={() => { form.resetFields(); handleCancel(); 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 5096b0b..cc6a0cf 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,17 +24,19 @@ 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([]); + const [actionFilter, setAction] = useState(false); const routeData = [ { @@ -56,10 +59,14 @@ export const Profile = observer(() => { useEffect(() => { (async () => { modalLoader.setLoading(true); + await Promise.allSettled([ store.authentication.getProfile(), store.transaction.getDataHistoryTransaction(), ]); + await store.transaction.getDataHistoryTopUpProfile( + store.authentication.profileData?.id + ); modalLoader.setLoading(false); })(); }, []); @@ -70,8 +77,14 @@ export const Profile = observer(() => { form.resetFields(); setFilterStart([]); setFilterEnd([]); - await store.transaction.getDataHistoryTransaction(); + //await store.transaction.getDataHistoryTransaction(); + actionFilter === true + ? await store.transaction.getDataHistoryTopUpProfile( + store.authentication.profileData?.id + ) + : await store.transaction.getDataHistoryTransaction(); store.transaction.visibleModalFilterTransaction = false; + setAction(false); }; const handleCancelFilter = async () => { @@ -79,24 +92,35 @@ export const Profile = observer(() => { //form.resetFields(); store.transaction.filterEnd = null; store.transaction.visibleModalFilterTransaction = false; - await store.transaction.getDataHistoryTransaction(); + actionFilter === true + ? await store.transaction.getDataHistoryTopUpProfile( + store.authentication.profileData?.id + ) + : await store.transaction.getDataHistoryTransaction(); + setAction(false); + //await store.transaction.getDataHistoryTransaction(); }; const handleSubmitFilter = async () => { const data = form.getFieldsValue(); - const awal = (store.transaction.filterStart = moment( - data.start_date - ).format("YYYY-MM-DD HH:mm:ss")); - const akhir = (store.transaction.filterEnd = moment(data.end_date).format( + store.transaction.filterStart = moment(data.start_date).format( "YYYY-MM-DD HH:mm:ss" - )); + ); + store.transaction.filterEnd = moment(data.end_date).format( + "YYYY-MM-DD HH:mm:ss" + ); modalLoader.setLoading(true); - await store.transaction.getDataHistoryTransaction(); + actionFilter === true + ? await store.transaction.getDataHistoryTopUpProfile( + store.authentication.profileData?.id + ) + : await store.transaction.getDataHistoryTransaction(); modalLoader.setLoading(false); store.transaction.filterStart = null; store.transaction.filterEnd = null; //form.resetFields(); store.transaction.visibleModalFilterTransaction = false; + setAction(false); }; const footerLayoutFilter = [ @@ -108,10 +132,10 @@ export const Profile = observer(() => { color: "#fff", }} > - Remove Filter + Hapus Filter , , , ]; const columns = [ { - title: "Name Produk", + title: "Nama Produk", dataIndex: "name", key: "name", }, { - title: "Price", + title: "Harga", dataIndex: "price", key: "price", render: (text) => @@ -172,10 +196,10 @@ export const Profile = observer(() => { } > {record.status === 1 - ? "Success" + ? "Sukses" : record.status === 0 - ? "Pending" - : "Failed"} + ? "Dalam Proses" + : "Gagal"} ); }, @@ -210,6 +234,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: "Tanggal Transaksi", + 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", @@ -240,7 +293,7 @@ export const Profile = observer(() => { - Name + Nama @@ -248,7 +301,7 @@ export const Profile = observer(() => { - Phone Number + No. Telepon @@ -261,14 +314,14 @@ export const Profile = observer(() => { {store.authentication.profileData?.username} - + {/* Role{store.authentication.profileData.roles?.name} - + */} - Superior + Upline @@ -357,152 +410,268 @@ export const Profile = observer(() => { -
- - History Transaction - - - {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 - ? "Success" - : item.status === 0 - ? "Pending" - : "Failed"} - - } - {" "} -
- - 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" + )} + {" "} +
+

+ + } + /> + + + + ); + }} + /> + + )} + + -
{ store.transaction.filterStart = null; store.transaction.filterEnd = null; store.transaction.visibleModalFilterTransaction = false; - await store.transaction.getDataHistoryTransaction(); + actionFilter === true + ? await store.transaction.getDataHistoryTopUpProfile( + store.authentication.profileData?.id + ) + : await store.transaction.getDataHistoryTransaction(); }} > diff --git a/src/pages/Transaction/Product.js b/src/pages/Transaction/Product.js index 9c2933d..ff73f3c 100644 --- a/src/pages/Transaction/Product.js +++ b/src/pages/Transaction/Product.js @@ -122,13 +122,13 @@ export const Product = observer(() => {
- Sub Category + Jenis Produk
handleChangeTabs(val)} + style={{ marginBottom: "10px", width: "100%" }} + > + {store.transaction.dataCategories.map((item, index) => ( + + ))} + + + + + + + Kategori + + + + + + + + + + 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 d212316..62eefd4 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; @@ -40,6 +40,9 @@ export class Transaction { dataHistoryTopUp = []; total_dataHistoryTopUp = 0; + dataHistoryTopUpProfile = []; + total_dataHistoryTopUpProfile = 0; + dataTransaction = []; dataTransactionB2B = []; dataTransactionPartner = []; @@ -155,7 +158,7 @@ export class Transaction { async getDataHistoryTopUp(id) { try { const response = await http.get( - `/transaction/history-deposit?page=${this.pageHistoryTopUp}&pageSize=${this.pageSizeHistoryTopUp}&user-destination=${id}` + `/transaction/history-deposit?page=${this.pageHistoryTopUp}&pageSize=${this.pageSizeHistoryTopUp}&user-destination=${id}&start=${this.filterStart}&end=${this.filterEnd}` ); console.log(response,'get data history') this.dataHistoryTopUp = response.body.data ?? []; @@ -165,6 +168,19 @@ 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}&start=${this.filterStart}&end=${this.filterEnd}` + ); + console.log(response,'get data history Profile') + this.dataHistoryTopUpProfile = response.body.data ?? []; + this.total_dataHistoryTopUpProfile = response?.body?.count ?? 0; + } catch (e) { + console.error(e); + } + } + async create(data) { try { const response = await http.post("/product").send(data);