diff --git a/src/component/SupplierComponent.js b/src/component/SupplierComponent.js index 18e9152..a0fb07b 100644 --- a/src/component/SupplierComponent.js +++ b/src/component/SupplierComponent.js @@ -10,7 +10,6 @@ import { Space, Table, Tag, - InputNumber, } from "antd"; import { observer } from "mobx-react-lite"; import { ExclamationCircleOutlined } from "@ant-design/icons"; @@ -38,13 +37,13 @@ export const SupplierComponent = observer((props) => { setIdData(data.id); }; - const handleTopup = async (data) => { - store.supplier.code = data.code; - console.log(data.code, "isi data"); + const handleTopup = (data) => { + console.log(data, "isi data"); form.setFieldsValue({ code: data.code, }); store.supplier.visibleModalTransaction = true; + store.supplier.code = data.code; }; const changeStatus = async (id, isActive) => { @@ -55,8 +54,8 @@ export const SupplierComponent = observer((props) => { const response = await store.supplier.changeStatus(id, status); modalLoader.setLoading(false); response?.body?.statusCode === 201 - ? message.success(`Success ${status2} Supplier`) - : message.error(`Failed ${status2} Supplier`); + ? message.success(`Success ${status2} Supplier`) + : message.error(`Failed ${status2} Supplier`); } catch (err) { modalLoader.setLoading(false); console.log("error", err); @@ -82,10 +81,10 @@ export const SupplierComponent = observer((props) => { key: ["coa", "amount"], width: "20%", render: (text, record) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Saldo di System", @@ -93,10 +92,10 @@ export const SupplierComponent = observer((props) => { key: ["coa_undistribute", "amount"], width: "20%", render: (text, record) => - new Intl.NumberFormat("id-ID", { - style: "currency", - currency: "IDR", - }).format(text), + new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format(text), }, { title: "Status", @@ -104,12 +103,12 @@ export const SupplierComponent = observer((props) => { key: "status", width: "5%", render: (text, record) => ( - - {record?.status === true ? " ACTIVE" : "INACTIVE"} - + + {record?.status === true ? " ACTIVE" : "INACTIVE"} + ), }, { @@ -117,16 +116,16 @@ export const SupplierComponent = observer((props) => { key: "action", width: "20%", render: (text, record) => ( - - - - - + + + + + ), }, ]; @@ -164,27 +163,7 @@ export const SupplierComponent = observer((props) => { }); }; - const handleCancelTransaction = () => { - store.supplier.visibleModalTransaction = false; - }; - - const handleSubmitTransaction = async (data) => { - try { - modalLoader.setLoading(true); - const response = await store.supplier.createTransaction(data); - message.success(response?.body?.message || "Success Top Up"); - } catch (e) { - console.log(e, "apa errornya"); - message.error(e.response?.body?.message || "Failed Top Up"); - } - - modalLoader.setLoading(false); - store.supplier.visibleModalTransaction = false; - form.resetFields(); - }; - const handleCancel = () => { - form.resetFields(); setIdData(""); store.supplier.visibleModalSupplier = false; }; @@ -196,12 +175,12 @@ export const SupplierComponent = observer((props) => { modalLoader.setLoading(true); const response = await store.supplier.update(idData, data); response?.body?.statusCode === 201 || response?.body?.statusCode === 200 - ? message.success( - response?.body?.message || "Berhasil Ubah Data Supplier" - ) - : message.error( - response?.body?.message || "Gagal Ubah Data Supplier" - ); + ? message.success( + response?.body?.message || "Berhasil Ubah Data Supplier" + ) + : message.error( + response?.body?.message || "Gagal Ubah Data Supplier" + ); } catch (e) { modalLoader.setLoading(false); message.error(e.response?.body?.message || "Gagal Ubah Data Supplier"); @@ -216,7 +195,7 @@ export const SupplierComponent = observer((props) => { const response = await store.supplier.create(data); if (response.status === 201) { message.success( - response?.body?.message || "Berhasil Tambah Supplier" + response?.body?.message || "Berhasil Tambah Supplier" ); await store.supplier.getData(); } else { @@ -228,9 +207,9 @@ export const SupplierComponent = observer((props) => { console.log(e.result, "testingan1"); if (e.response?.body?.error) { message.error( - e.response.body.error - ? "Supplier Tersebut Sudah Terdaftar" - : e.response.body.error + e.response.body.error + ? "Supplier Tersebut Sudah Terdaftar" + : e.response.body.error ); modalLoader.setLoading(false); store.supplier.visibleModalSupplier = false; @@ -249,245 +228,199 @@ export const SupplierComponent = observer((props) => { }; return ( -
- {store.ui.mediaQuery.isDesktop && ( - { - let pageNumber = page.current; - store.supplier.pageSize = page.pageSize; - store.supplier.page = pageNumber - 1; - modalLoader.setLoading(true); - await store.supplier.getData(); - modalLoader.setLoading(false); - }} - /> - )} - {store.ui.mediaQuery.isMobile && ( - { - store.supplier.pageSize = pageSize; - store.supplier.page = page - 1; - modalLoader.setLoading(true); - await store.supplier.getData(); - modalLoader.setLoading(false); - }, - pageSize: store.supplier.pageSize, - total: store.supplier.total_data, - current: store.supplier.page + 1, - style: { marginBottom: "1rem", marginRight: "1rem" }, - }} - dataSource={store.supplier.data} - style={{ padding: 0 }} - renderItem={(item) => { - return ( -
- - -

- Name : {item.name}
- Saldo Supplier : {item.coa.amount} -
- - Saldo System : {item.coa_undistribute.amount} - -
-

{ + let pageNumber = page.current; + store.supplier.pageSize = page.pageSize; + store.supplier.page = pageNumber - 1; + modalLoader.setLoading(true); + await store.supplier.getData(); + modalLoader.setLoading(false); + }} + /> + )} + {store.ui.mediaQuery.isMobile && ( + { + store.supplier.pageSize = pageSize; + store.supplier.page = page - 1; + modalLoader.setLoading(true); + await store.supplier.getData(); + modalLoader.setLoading(false); + }, + pageSize: store.supplier.pageSize, + total: store.supplier.total_data, + current: store.supplier.page + 1, + style: { marginBottom: "1rem", marginRight: "1rem" }, + }} + dataSource={store.supplier.data} + style={{ padding: 0 }} + renderItem={(item) => { + return ( +
+ changeStatus(item?.id, item?.status)} - > - {item?.status === true ? "INACTIVE" : "ACTIVE"} - - - - - {item?.status === true ? " ACTIVE" : "INACTIVE"} - -

-

+ > + +

+ Name : {item.name}
+ Saldo Supplier : {item.coa.amount} +
+ + Saldo System : {item.coa_undistribute.amount} + +
+ + + + + {item?.status === true ? " ACTIVE" : "INACTIVE"} + +

+

+
+ } + /> + + - } - /> - - - - ); - }} - /> - )} - { - handleCancel(); - }} - onOk={() => { - form - .validateFields() - .then((values) => { - console.log(values, "isi form"); - handleSubmit(values); + ); + }} + /> + )} + { form.resetFields(); - }) - .catch((info) => { - console.error("Validate Failed:", info); - }); - }} - > -
- - - - - - - - - - - - - - - - - - - {!idData && ( + handleCancel(); + }} + onOk={() => { + form + .validateFields() + .then((values) => { + console.log(values, "isi form"); + handleSubmit(values); + form.resetFields(); + }) + .catch((info) => { + console.error("Validate Failed:", info); + }); + }} + > + - )} - -
- { - form.resetFields(); - handleCancelTransaction(); - }} - onOk={() => { - form - .validateFields() - .then((values) => { - console.log(values, "isi form"); - handleSubmitTransaction(values); - form.resetFields(); - }) - .catch((info) => { - console.error("Validate Failed:", info); - }); - }} - > -
- - - - - - `Rp. ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") - } - parser={(value) => value.replace(/\Rp.\s?|(,*)/g, "")} - /> - - -
- + + + + + + + + + + + + + + + + {!idData && ( + + + + )} + +
+ + ); }); diff --git a/src/pages/Membership/DetailUser.js b/src/pages/Membership/DetailUser.js index a0fb07b..6c14b56 100644 --- a/src/pages/Membership/DetailUser.js +++ b/src/pages/Membership/DetailUser.js @@ -1,426 +1,1164 @@ -import React, { useContext, useState } from "react"; +import React, { useContext, useEffect, useState } from "react"; import { Button, - Divider, - Form, - Input, - List, + Card, + Col, message, - Modal, + Row, Space, Table, + Typography, + Tabs, + List, Tag, + Divider, + Image, + Modal, + Form, + DatePicker, } from "antd"; +import { UserOutlined, FilterOutlined,ExportOutlined } from "@ant-design/icons"; +import { BreadcumbComponent } from "../../component/BreadcumbComponent"; +import { LINKS } from "../../routes/app"; +import { useStore } from "../../utils/useStore"; import { observer } from "mobx-react-lite"; -import { ExclamationCircleOutlined } from "@ant-design/icons"; -import { useHistory } from "react-router-dom"; -import { useStore } from "../utils/useStore"; -import { LINKS } from "../routes/app"; -import { TopupsaldoModal } from "./TopupsaldoModal"; -import { ModalLoaderContext } from "../utils/modal"; +import { format, parseISO } from "date-fns"; +import { ModalLoaderContext } from "../../utils/modal"; +import { useParams } from "react-router-dom"; +import { appConfig } from "../../config/app"; +import { MembershipModal } from "./MembershipModal"; +import moment from "moment"; +import FileSaver from "file-saver"; -export const SupplierComponent = observer((props) => { +const { Title, Text } = Typography; +const { TabPane } = Tabs; +export const DetailUser = observer(() => { const store = useStore(); const [form] = Form.useForm(); - const history = useHistory(); - const [idData, setIdData] = useState(""); + const [formExport] = Form.useForm(); const modalLoader = useContext(ModalLoaderContext); + const { id } = useParams(); + const [visibleModal, setVisibleModal] = useState(false); + const [initialData, setInitialData] = useState({}); + const [confirmLoading, setConfirmLoading] = useState(false); + const [filterStart, setFilterStart] = useState([]); + const [filterEnd, setFilterEnd] = useState([]); + const [visibleHis, setVisibleHis] = useState(true); + const [actionFilter, setAction] = useState(false); + const [modalExport, setModalExport] = useState(false); - const handleEditButton = (data) => { - console.log(data, "isi data"); - form.setFieldsValue({ - name: data.name, - code: data.code, - status: data.status, - }); - store.supplier.visibleModalSupplier = true; - setIdData(data.id); + useEffect(() => { + (async () => { + modalLoader.setLoading(true); + await getData(); + modalLoader.setLoading(false); + })(); + + return () => { + store.membership.dataDetail = {}; + store.transaction.dataHistoryTopUp = []; + store.authentication.dataProfit = []; + store.transaction.dataDetailHistoryTransaction = []; + }; + }, []); + + const getData = async () => { + const isAdmin = store.authentication.userData.role === "Admin"; + await Promise.allSettled([ + store.transaction.getDataHistoryTopUp(id), + store.authentication.getProfit(id), + store.authentication.getProfile(), + store.transaction.getDetailHistoryTransaction(id), + store.membership.getDetail(id), + store.role.getData(isAdmin), + ]); }; - const handleTopup = (data) => { - console.log(data, "isi data"); - form.setFieldsValue({ - code: data.code, - }); - store.supplier.visibleModalTransaction = true; - store.supplier.code = data.code; - }; - - const changeStatus = async (id, isActive) => { - const status = isActive ? "inactive" : "active"; - const status2 = isActive ? "Inactivating" : "Activating"; + const changeStatus = async (id, is_active) => { + let status = is_active ? "inactive" : "active"; + let status2 = is_active ? "Inactivating" : "Activating"; + console.log(status, "status terbaru"); try { modalLoader.setLoading(true); - const response = await store.supplier.changeStatus(id, status); + const response = await store.membership.changeStatus(id, status); modalLoader.setLoading(false); - response?.body?.statusCode === 201 - ? message.success(`Success ${status2} Supplier`) - : message.error(`Failed ${status2} Supplier`); + response?.body?.statusCode === 201 || response?.body?.statusCode === 200 + ? message.success(`Success ${status2} Membership`) + : message.error(`Failed ${status2} Membership`); + await getData(); } catch (err) { modalLoader.setLoading(false); - console.log("error", err); - message.error(`Failed ${status2} Supplier`); + message.error(`Failed ${status2} Membership`); + } + }; + + const withdrawProfit = async (id) => { + try { + modalLoader.setLoading(true); + const response = await store.membership.withdrawProfit(id); + modalLoader.setLoading(false); + + response?.body?.statusCode === 201 || response?.body?.statusCode === 200 + ? message.success(`Success Withdraw Profit`) + : message.error(`Failed Withdraw Profit`); + await getData(); + } catch (err) { + modalLoader.setLoading(false); + message.error(`Failed Withdraw Profit`); + } + }; + + const onSubmit = async (data) => { + data.superior = true; + setConfirmLoading(true); + modalLoader.setLoading(true); + try { + let response; + if (initialData.isChangePassword) { + response = await store.membership.changePassword(initialData.id, data); + } else { + response = await store.membership.update(initialData.id, data); + } + + setVisibleModal(false); + + if (response?.body?.statusCode === 200) { + message.success( + initialData.isChangePassword + ? "Success Change Member Password" + : "Success Update Data Member" + ); + } else { + message.error( + initialData.isChangePassword + ? "Failed Change Member Password" + : "Failed Update Data Member" + ); + } + await getData(); + } catch (e) { + modalLoader.setLoading(false); + message.error( + initialData.isChangePassword + ? "Failed Update Member Password" + : "Failed Update Data Member" + ); + } + modalLoader.setLoading(false); + setConfirmLoading(false); + }; + + const handleResend = async (id) => { + modalLoader.setLoading(true); + try { + const response = await store.approval.resendUser(id); + console.log(response); + response.body.statusCode !== 201 && response.body.statusCode !== 200 + ? message.error(response?.body?.message || `Failed Approve`) + : message.success(response?.body?.message || `Success Approve`); + await getData(); + } catch (e) { + console.error(e, "apa errornya"); + message.error(e.response?.body?.message || "Fail Approve"); + } + modalLoader.setLoading(false); + }; + + const handleSubmitExport = async () => { + const date = formExport.getFieldsValue(); + const dataDate ={ + dateStart: moment(date.tanggal_export).format("YYYY-MM-DD") + } + modalLoader.setLoading(true); + try { + await store.transaction.exportTransaction(store.membership.dataDetail, dataDate) + // console.log('responseiniyak', response); + // message.success("Success export"); + setModalExport(false); + modalLoader.setLoading(false); + } catch (e) { + setModalExport(false); + console.error(e, "apa errornya"); + message.error(e.response?.body?.message || "Failed to export"); + modalLoader.setLoading(false); } }; const columns = [ { - title: "Nama", + 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 column = [ + { + title: "Nama Produk", dataIndex: "name", key: "name", }, { - title: "Kode", - dataIndex: "code", - key: "code", - width: "5%", + title: "Supplier", + dataIndex: "supplier_name", + key: "supplier_name", }, { - title: "Saldo di Supplier", - dataIndex: ["coa", "amount"], - key: ["coa", "amount"], - width: "20%", - render: (text, record) => + title: "Profit Produk", + dataIndex: "mark_up_price", + key: "mark_up_price", + }, + { + title: "Harga", + dataIndex: "price", + key: "price", + render: (text) => new Intl.NumberFormat("id-ID", { style: "currency", currency: "IDR", }).format(text), }, { - title: "Saldo di System", - dataIndex: ["coa_undistribute", "amount"], - key: ["coa_undistribute", "amount"], - width: "20%", - render: (text, record) => + title: "Sisa Saldo", + dataIndex: "balance_remaining", + key: "balance_remaining", + render: (text) => new Intl.NumberFormat("id-ID", { style: "currency", currency: "IDR", }).format(text), }, + { + title: "Pembeli", + dataIndex: "buyer", + key: "buyer", + }, + { + title: "Tujuan", + dataIndex: "transaction_destination", + key: "transaction_destination", + }, + { + title: "Kode Transaksi", + dataIndex: "transaction_code", + key: "transaction_code", + }, { title: "Status", dataIndex: "status", key: "status", - width: "5%", - render: (text, record) => ( - - {record?.status === true ? " ACTIVE" : "INACTIVE"} - - ), + render: (text, record) => { + return ( + + {record.status === 1 + ? "Success" + : record.status === 0 + ? "Pending" + : "Failed"} + + ); + }, }, { - title: "Tindakan", - key: "action", - width: "20%", - render: (text, record) => ( - - - - - - ), + title: "No Seri", + dataIndex: "seri_number", + key: "seri_number", + }, + { + title: "IDTrx Mitra", + dataIndex: "partner_transaction_code", + key: "partner_transaction_code", + }, + { + title: "Tanggal Transaksi", + dataIndex: "created_at", + key: "created_at", + width: "15%", + render: (text, record) => { + return ( + + {format(parseISO(record.created_at), "MM-dd-yyyy HH:mm:ss")} + + ); + }, + }, + { + title: "Alasan Gagal", + dataIndex: "failed_reason", + key: "failed_reason", + }, + ]; + if (store.authentication.userData.role !== "Admin") delete column[1]; + if (store.authentication.userData.role !== "Admin") delete column[2]; + if (store.authentication.userData.role !== "Admin") delete column[4]; + + const routeData = [ + { + route: LINKS.HOME, + name: "Beranda", + }, + { + route: LINKS.MEMBERSHIP, + name: Keanggotaan, + }, + { + route: LINKS.USER_DETAIL.replace(":id", id), + name: Detail User, }, ]; - if (store.authentication.userData.role === "Customer Service") columns.pop(); + const dataRoute = [ + { + route: LINKS.MEMBERSHIP, + name: "Keanggotaan", + }, + { + route: LINKS.USER_DETAIL.replace(":id", id), + name: Detail User, + }, + ]; - const deleteData = async (id) => { - try { - console.log(id); - modalLoader.setLoading(true); - await store.supplier.delete(id); - modalLoader.setLoading(false); - message.success("Data Berhasil Dihapus"); - history.push(LINKS.PRODUCT); - } catch (err) { - modalLoader.setLoading(false); - console.log("error", err); - message.error("Gagal menghapus"); - } - }; - - const handleDelete = (id) => { - Modal.confirm({ - title: "Are you sure delete this record?", - icon: , - okText: "Yes", - okType: "primary", - cancelText: "Batal", - onOk() { - return deleteData(id); - }, - onCancel() { - console.log("Batal"); - }, - }); - }; - - const handleCancel = () => { - setIdData(""); - store.supplier.visibleModalSupplier = false; - }; - - const handleSubmit = async (data) => { - console.log(data, "isi data2"); - if (idData !== "") { - try { - modalLoader.setLoading(true); - const response = await store.supplier.update(idData, data); - response?.body?.statusCode === 201 || response?.body?.statusCode === 200 - ? message.success( - response?.body?.message || "Berhasil Ubah Data Supplier" - ) - : message.error( - response?.body?.message || "Gagal Ubah Data Supplier" - ); - } catch (e) { - modalLoader.setLoading(false); - message.error(e.response?.body?.message || "Gagal Ubah Data Supplier"); + const styleSaldoTitle = store.ui.mediaQuery.isDesktop + ? { + display: "flex", + justifyContent: "center", } - - modalLoader.setLoading(false); - store.supplier.visibleModalSupplier = false; - setIdData(""); - form.resetFields(); - } else { - try { - const response = await store.supplier.create(data); - if (response.status === 201) { - message.success( - response?.body?.message || "Berhasil Tambah Supplier" - ); - await store.supplier.getData(); - } else { - message.error(response?.body?.error || "Gagal Tambah Supplier", 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 - ? "Supplier Tersebut Sudah Terdaftar" - : e.response.body.error - ); - modalLoader.setLoading(false); - store.supplier.visibleModalSupplier = false; - return; - } - console.log(e, "apa errornya"); - message.error("Gagal Tambah Supplier"); + : { fontSize: "0.75rem" }; + const styleSaldoContent = store.ui.mediaQuery.isDesktop + ? { + fontSize: "1.25rem", + display: "flex", + justifyContent: "center", } + : null; + const data = store.authentication.listImage; + console.log(data, "ini data"); + console.log( + store.authentication.dataProfit.userDetail?.image_identity, + "detail" + ); - modalLoader.setLoading(false); - store.supplier.visibleModalSupplier = false; - setIdData(""); - form.resetFields(); - await store.supplier.getData(); - } + const handleRemoveFilter = async () => { + store.transaction.filterStart = null; + store.transaction.filterEnd = null; + form.resetFields(); + setFilterStart([]); + setFilterEnd([]); + 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; + 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 () => { + const data = form.getFieldsValue(); + store.transaction.filterStart = moment(data.start_date).format( + "YYYY-MM-DD" + ) + " 00:00:00"; + store.transaction.filterEnd = moment(data.end_date).format( + "YYYY-MM-DD" + ) + " 23:59:59"; + modalLoader.setLoading(true); + 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 ( -
- {store.ui.mediaQuery.isDesktop && ( -
{ - let pageNumber = page.current; - store.supplier.pageSize = page.pageSize; - store.supplier.page = pageNumber - 1; - modalLoader.setLoading(true); - await store.supplier.getData(); - modalLoader.setLoading(false); - }} - /> - )} - {store.ui.mediaQuery.isMobile && ( - { - store.supplier.pageSize = pageSize; - store.supplier.page = page - 1; - modalLoader.setLoading(true); - await store.supplier.getData(); - modalLoader.setLoading(false); - }, - pageSize: store.supplier.pageSize, - total: store.supplier.total_data, - current: store.supplier.page + 1, - style: { marginBottom: "1rem", marginRight: "1rem" }, - }} - dataSource={store.supplier.data} - style={{ padding: 0 }} - renderItem={(item) => { - return ( +
+ + + + + Detail User + +
+ + {store.authentication.userData.role === "Admin" && ( + + + + + + )} + {((store.authentication.userData.role === "Sales" && + store.membership.dataDetail.is_rejected === true && + store.membership.dataDetail.is_active === false) || + (store.authentication.userData.role === "Supervisor" && + store.membership.dataDetail.is_rejected === true && + store.membership.dataDetail.is_active === false)) && ( + + )} + {store.authentication.userData.role === "Admin" && ( + <> + + + + )} + + + + + + + + Name + + + {store.authentication.dataProfit.userDetail?.name} + + + Username + + + {store.authentication.dataProfit.username} + + {/* + Role + + + {store.authentication.dataProfit.roles?.name} + */} + + Phone Number + + + + {store.authentication.dataProfit.userDetail?.phone_number} + + + + Id Number + + + + {store.authentication.dataProfit.userDetail?.identity_number} + + + + Code + + + + {store.authentication.dataProfit.partner?.code} + + + + Status + + + + {store.authentication.dataProfit.is_active === true + ? "Aktif" + : "Inaktif"} + + + {store.authentication.userData.role === "Admin" && + store.authentication.dataProfit.roles?.name !== + "Admin Partner" && ( + + + Foto Identitas + + + + + + + + {store.authentication.dataProfit.roles?.name === + "Retail" && ( + + Foto Toko + + + {store.authentication.listImage + ? store.authentication.listImage.map( + (item, index) => ( + + ) + ) + : ""} + + + + )} + + )} + {store.authentication.userData.role === "Sales" && ( + + + Foto Identitas + + + + + + + + + Foto Toko + + + {store.authentication.listImage + ? store.authentication.listImage.map( + (item, index) => ( + + ) + ) + : ""} + + + + + )} + {store.authentication.userData.role === "Supervisor" && ( + + + Foto Identitas + + + + + + + + + )} + + + + + + + + + + + Saldo + + + + + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format( + store.authentication.dataProfit.wallet || 0 + )} + + + + + + + + + + Keuntungan + + + + + {new Intl.NumberFormat("id-ID", { + style: "currency", + currency: "IDR", + }).format( + store.authentication.dataProfit?.profit || 0 + )} + + + + + + + + + + + + + + + {store.ui.mediaQuery.isDesktop && (
- { + store.transaction.visibleModalFilterTransaction = true; + store.transaction.page = 0; + setAction(true); }} > - -

- Name : {item.name}
- Saldo Supplier : {item.coa.amount} -
- - Saldo System : {item.coa_undistribute.amount} - -
- - - - - {item?.status === true ? " ACTIVE" : "INACTIVE"} - -

-

-
- } - /> - - + + Filter + +
{ + let pageNumber = page.current; + store.transaction.pageSize = page.pageSize; + store.transaction.page = pageNumber - 1; + modalLoader.setLoading(true); + await getData(); + modalLoader.setLoading(false); + }} + /> - ); - }} - /> - )} - { - form.resetFields(); - handleCancel(); + )} + {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 && ( +
+ +
1000 ? { + pageSizeOptions : [10, 20, 50, 100, 1000], + pageSize: store.transaction.pageSize, + total: store.transaction.total_data, + current: store.transaction.page + 1, + showSizeChanger: true, + simple: false, + } : + { + pageSize: store.transaction.pageSize, + total: store.transaction.total_data, + current: store.transaction.page + 1, + showSizeChanger: true, + simple: false, + } + + } + onChange={async (page) => { + 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.dataDetailHistoryTransactionDetailUser + } + style={{ padding: 0 }} + renderItem={(item) => { + return ( +
+ + +

+ Pembeli : {item.buyer}{" "} +
+ Price : {item.price}
+ + Tujuan : {item.transaction_destination} + {" "} +
+ + Kode Transaksi : {item.transaction_code} + {" "} +
+ + Status :{" "} + { + + {item.status === 1 + ? "Success" + : item.status === 0 + ? "Pending" + : "Failed"} + + } + {" "} +
+ + No.Seri : {item.seri_number} + {" "} +
+ + IDTrx Mitra :{" "} + {item.partner_transaction_code} + {" "} +
+ + Transaction Date :{" "} + {format( + parseISO(item.created_at), + "dd-MM-yyyy hh:mm:ss" + )} + {" "} +
+

+
+ } + /> + + +
+ ); + }} + /> + + )} + + + + +
+ + { + onSubmit(data); }} - onOk={() => { - form - .validateFields() - .then((values) => { - console.log(values, "isi form"); - handleSubmit(values); - form.resetFields(); - }) - .catch((info) => { - console.error("Validate Failed:", info); - }); + onCancel={() => { + setInitialData({}); + setVisibleModal(false); + }} + /> + { + //form.resetFields(); + store.transaction.filterStart = null; + store.transaction.filterEnd = null; + store.transaction.visibleModalFilterTransaction = false; + actionFilter === true + ? await store.transaction.getDataHistoryTopUp(id) + : await store.transaction.getDetailHistoryTransaction( + store.authentication.dataProfit.id + ); + //await store.transaction.getDetailHistoryTransaction(); }} > -
- - - - - - - - - - - - - - - - - - - {!idData && ( + +
+ - + - )} - + + + + + + + + { + setModalExport(false); + }} + > + + + + + + + + + - ); });