From b11fe62bd62311b37dfbd9c99102528783ba5f3a Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Thu, 22 May 2025 09:25:54 +0700 Subject: [PATCH 1/7] update filter in showdetailwalletdialog.tsx --- .../home/blocks/ShowDetailWalletDialog.tsx | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/pages/dashboards/home/blocks/ShowDetailWalletDialog.tsx b/src/pages/dashboards/home/blocks/ShowDetailWalletDialog.tsx index c4ec9ad..654817c 100644 --- a/src/pages/dashboards/home/blocks/ShowDetailWalletDialog.tsx +++ b/src/pages/dashboards/home/blocks/ShowDetailWalletDialog.tsx @@ -102,11 +102,26 @@ const ShowDetailWalletDialog: React.FC = ({ const handleApplyFilters = () => { const appliedFilters: any = {}; - if (dateRange.from) appliedFilters.date_from = dateRange.from+" 00:00:00"; - if (dateRange.to) appliedFilters.date_to = dateRange.to+" 23:59:59"; - if (selectedTransferType) appliedFilters.transaction_type_id = selectedTransferType; - if (selectedCategory) appliedFilters.category = selectedCategory; - if (searchValue) appliedFilters.transaction_code = searchValue; + if (dateRange.from && dateRange.to) { + const fromDate = new Date(`${dateRange.from}T00:00:00Z`); + const toDate = new Date(`${dateRange.to}T23:59:59Z`); + appliedFilters.date = { + from: fromDate.toISOString(), + to: toDate.toISOString(), + }; + } + + if (selectedTransferType) { + appliedFilters.transaction_type_id = selectedTransferType; + } + + if (selectedCategory) { + appliedFilters.category = selectedCategory; + } + + if (searchValue) { + appliedFilters.transaction_code = searchValue; + } setFilters(appliedFilters); }; @@ -207,7 +222,7 @@ const ShowDetailWalletDialog: React.FC = ({ with_deleted: false, order_field: "created_at", order_direction: 'DESC', - filter: filters + filter: JSON.stringify(filters) }); // console.log(filters); From 718fca4c76e70d729d00345e2512a00a52a079d7 Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Thu, 22 May 2025 10:18:15 +0700 Subject: [PATCH 2/7] fix disbursement detail --- .../blocks/DetailTransaction.tsx | 291 +++++++++--------- 1 file changed, 153 insertions(+), 138 deletions(-) diff --git a/src/pages/disbursement/history-transaction/blocks/DetailTransaction.tsx b/src/pages/disbursement/history-transaction/blocks/DetailTransaction.tsx index b288d0a..81eeec5 100644 --- a/src/pages/disbursement/history-transaction/blocks/DetailTransaction.tsx +++ b/src/pages/disbursement/history-transaction/blocks/DetailTransaction.tsx @@ -94,66 +94,65 @@ const DetailTransaction = () => { } }, [showDetailDialog]); -const handleExport = async () => { - if (!selectedTransactionId || !transactionDetails) return; + const handleExport = async () => { + if (!selectedTransactionId || !transactionDetails) return; - setIsExporting(true); - try { - const response = await fetch( - `${API_URL}/transaction/export?id_disbursment=${selectedTransactionId}`, - { - method: 'GET', - headers: { - Authorization: `Bearer ${getAuth()?.access_token}` + setIsExporting(true); + try { + const response = await fetch( + `${API_URL}/transaction/export?id_disbursment=${selectedTransactionId}`, + { + method: 'GET', + headers: { + Authorization: `Bearer ${getAuth()?.access_token}` + } + } + ); + + if (!response.ok) { + throw new Error('Failed to fetch file'); + } + + const blob = await response.blob(); + const contentDisposition = response.headers.get('content-disposition'); + + const executionDate = transactionDetails.execution_date; + const formattedDate = executionDate + ? moment(executionDate).format('YYYYMMDD_HHmm') + : moment().format('YYYYMMDD_HHmm'); + + let filename = `transaction_${formattedDate}.xlsx`; + + if (contentDisposition) { + const filenameMatch = contentDisposition.match(/filename\*?=(?:UTF-8'')?"?([^;"\n]*)"?/); + if (filenameMatch && filenameMatch[1]) { + filename = decodeURIComponent(filenameMatch[1]); } } - ); - if (!response.ok) { - throw new Error('Failed to fetch file'); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = filename; + a.click(); + window.URL.revokeObjectURL(url); + + toast.success('Export successful'); + } catch (error) { + console.error('Error exporting transaction:', error); + toast.error('Failed to export transaction'); + } finally { + setIsExporting(false); } - - const blob = await response.blob(); - const contentDisposition = response.headers.get('content-disposition'); - - const executionDate = transactionDetails.execution_date; - const formattedDate = executionDate - ? moment(executionDate).format('YYYYMMDD_HHmm') - : moment().format('YYYYMMDD_HHmm'); - - let filename = `transaction_${formattedDate}.xlsx`; - - if (contentDisposition) { - const filenameMatch = contentDisposition.match(/filename\*?=(?:UTF-8'')?"?([^;"\n]*)"?/); - if (filenameMatch && filenameMatch[1]) { - filename = decodeURIComponent(filenameMatch[1]); - } - } - - const url = window.URL.createObjectURL(blob); - const a = document.createElement('a'); - a.href = url; - a.download = filename; - a.click(); - window.URL.revokeObjectURL(url); - - toast.success('Export successful'); - } catch (error) { - console.error('Error exporting transaction:', error); - toast.error('Failed to export transaction'); - } finally { - setIsExporting(false); - } -}; - + }; return ( - + Transaction Details - +
{/* Summary Info */} {transactionDetails && ( @@ -213,7 +212,6 @@ const handleExport = async () => {
)} - {/* Log Table */}
{isLoading ? (
@@ -229,96 +227,113 @@ const handleExport = async () => {

Loading Logs Details...

) : ( - - - - - - - - - - - - - - - - - {transactionDetails?.log && transactionDetails.log.length > 0 ? ( - transactionDetails.log.map((log: any, index: number) => ( - - - - - - - - - - - + <> +
+ +
+
+
UsernameFullnameAmountStatusProcess DateInvoice NumberRemark 1Remark 2Remark 3Actions
- {log.customer?.username ?? 'Not Found'} - - {log.customer?.fullname ?? 'Not Found'} - {log.amount ?? '-'} - {renderStatusBadge(log.status) ?? '-'} - - {log.request_date && moment(log.request_date).isValid() - ? moment(log.request_date).format('DD/MM/YYYY HH:mm') - : '-'} - - {log.reference ?? '-'} - {log.remark_1 ?? '-'}{log.remark_2 ?? '-'}{log.remark_3 ?? '-'} - -
+ + + + + + + + + + + + - )) - ) : ( - - - - )} - -
UsernameFullnameAmountStatus + Process Date + + Invoice Number + Remark 1Remark 2Remark 3Actions
- No logs available -
+ + + {transactionDetails?.log && transactionDetails.log.length > 0 ? ( + transactionDetails.log.map((log: any, index: number) => ( + + + {log.customer?.username ?? 'Not Found'} + + + {log.customer?.fullname ?? 'Not Found'} + + + {log.amount ?? '-'} + + + {renderStatusBadge(log.status) ?? '-'} + + + {log.request_date && moment(log.request_date).isValid() + ? moment(log.request_date).format('DD/MM/YYYY HH:mm') + : '-'} + + + {log.reference ?? '-'} + + + {log.remark_1 ?? '-'} + + + {log.remark_2 ?? '-'} + + + {log.remark_3 ?? '-'} + + + + + + )) + ) : ( + + + No logs available + + + )} + + +
+ )} - - {/* Export Button - Moved to bottom right after table */} -
- -
@@ -326,4 +341,4 @@ const handleExport = async () => { ); }; -export default DetailTransaction; \ No newline at end of file +export default DetailTransaction; From d3cdfbfd98bbf3fc567f34b67639d242d5333863 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 22 May 2025 12:59:25 +0700 Subject: [PATCH 3/7] fix username update open --- src/pages/members/manage-members/blocks/DetailMember.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/members/manage-members/blocks/DetailMember.tsx b/src/pages/members/manage-members/blocks/DetailMember.tsx index 96dc614..477429f 100644 --- a/src/pages/members/manage-members/blocks/DetailMember.tsx +++ b/src/pages/members/manage-members/blocks/DetailMember.tsx @@ -209,7 +209,7 @@ const DetailMember = ({ showAddDialog, setShowAddDialog, handleSubmit, initialDa {(formData.id || dialogType === "create") ? generateList(formData, handleChange, groups, 'group_id', 'Group', true, dialogType === "update"||false): ''} {/* {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Group', 'group_name', 'text', true, true): ''} */} - {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Username', 'username', 'text', true, dialogType==='create'?false:true): ''} + {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Username', 'username', 'text', true, viewOnly): ''} {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Full Name', 'fullname', 'text', true, viewOnly): ''} {(formData.id || dialogType === "create") ? generateImage(formData, handleChange, 'Photo', 'photouser', previewImg, setPreviewImg): ''} {(formData.id || dialogType === "create") ? generateList(formData, handleChange, genders, 'gender', 'Gender', true, false): ''} @@ -218,7 +218,7 @@ const DetailMember = ({ showAddDialog, setShowAddDialog, handleSubmit, initialDa {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Email', 'email', 'text', true, viewOnly): ''} {/* {generateList(formData, handleChange, status, 'status', 'Status', null, true)} */} {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Mother Fullname', 'mother_fullname', 'text', true, viewOnly): ''} - {(formData.id || dialogType === "create") ? generateList(formData, handleChange, identity_type, 'identity_type', 'Identity Type', false, false): ''} + {(formData.id || dialogType === "create") ? generateList(formData, handleChange, identity_type, 'identity_type', 'Identity Type', false, viewOnly): ''} {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Address', 'address', 'text', true, viewOnly): ''} {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Identity Number', 'identity_number', 'text', false, viewOnly): ''}
From 8ee87d889c11ab68906559c20fde22dbf9b2e15b Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Thu, 22 May 2025 13:01:03 +0700 Subject: [PATCH 4/7] update card dashboard --- src/pages/dashboards/home/DashboardHomePage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/dashboards/home/DashboardHomePage.tsx b/src/pages/dashboards/home/DashboardHomePage.tsx index 71ba39a..9ee6e5d 100644 --- a/src/pages/dashboards/home/DashboardHomePage.tsx +++ b/src/pages/dashboards/home/DashboardHomePage.tsx @@ -261,11 +261,11 @@ const DashboardHomePage = () => { {/* Account Balance Cards */} - {currentRole === 'Escrow' || currentRole === 'Master Agent' ? ( + {/* {currentRole === 'Escrow' || currentRole === 'Master Agent' ? (
- ) : null} + ) : null} */}
{bankaccount?.data && bankaccount?.data.length > 0 From fd0a22d6a40fb6781b2c4bf67f32495b05fd872c Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Thu, 22 May 2025 13:07:28 +0700 Subject: [PATCH 5/7] update --- src/pages/dashboards/home/DashboardHomePage.tsx | 2 +- src/pages/dashboards/home/blocks/ShowDetailWalletDialog.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/dashboards/home/DashboardHomePage.tsx b/src/pages/dashboards/home/DashboardHomePage.tsx index 9ee6e5d..fbfa443 100644 --- a/src/pages/dashboards/home/DashboardHomePage.tsx +++ b/src/pages/dashboards/home/DashboardHomePage.tsx @@ -269,7 +269,7 @@ const DashboardHomePage = () => {
{bankaccount?.data && bankaccount?.data.length > 0 - && getAuth()?.statusbalance=='Y' + // && getAuth()?.statusbalance=='Y' ? ( bankaccount?.data.map((bankaccountdatas: { id_balance:string,amount: string, credit_limit: string, monthly_limit: string; wallet: string; }, index: number) => ( = ({ return ( - + Details Wallet Statement @@ -333,7 +333,7 @@ const ShowDetailWalletDialog: React.FC = ({ Date: Thu, 22 May 2025 13:37:09 +0700 Subject: [PATCH 6/7] fix mdetail member --- src/pages/members/manage-members/blocks/DetailMember.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/members/manage-members/blocks/DetailMember.tsx b/src/pages/members/manage-members/blocks/DetailMember.tsx index 477429f..f00a005 100644 --- a/src/pages/members/manage-members/blocks/DetailMember.tsx +++ b/src/pages/members/manage-members/blocks/DetailMember.tsx @@ -214,7 +214,7 @@ const DetailMember = ({ showAddDialog, setShowAddDialog, handleSubmit, initialDa {(formData.id || dialogType === "create") ? generateImage(formData, handleChange, 'Photo', 'photouser', previewImg, setPreviewImg): ''} {(formData.id || dialogType === "create") ? generateList(formData, handleChange, genders, 'gender', 'Gender', true, false): ''} {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Date of Birth', 'date_birth', 'date', true, viewOnly): ''} - {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Phone Number', 'msisdn', 'text', true, dialogType === "update"||false): ''} + {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Phone Number', 'msisdn', 'text', true, dialogType === "create"||false): ''} {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Email', 'email', 'text', true, viewOnly): ''} {/* {generateList(formData, handleChange, status, 'status', 'Status', null, true)} */} {(formData.id || dialogType === "create") ? generateInput(formData, handleChange, 'Mother Fullname', 'mother_fullname', 'text', true, viewOnly): ''} From 387ba436eae25858cde4b164c7ae489a64349582 Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Thu, 22 May 2025 15:49:06 +0700 Subject: [PATCH 7/7] update --- .../home/blocks/ShowDetailWalletDialog.tsx | 63 +++++++++++++++++-- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/src/pages/dashboards/home/blocks/ShowDetailWalletDialog.tsx b/src/pages/dashboards/home/blocks/ShowDetailWalletDialog.tsx index 43339f4..3197da3 100644 --- a/src/pages/dashboards/home/blocks/ShowDetailWalletDialog.tsx +++ b/src/pages/dashboards/home/blocks/ShowDetailWalletDialog.tsx @@ -75,14 +75,42 @@ const ShowDetailWalletDialog: React.FC = ({ useEffect(() => { fetchTransferType(); }, [fetchTransferType]); - + useEffect(() => { + const categoryMap: Record = { + T: 'TRANSFER', + P: 'PURCHASE', + W: 'WITHDRAW', + U: 'TOP UP', + R: 'RETURN', + N: 'TOP UP PARTNER', + E: 'REWARD', + L: 'PURCHASE LOJA', + B: 'TOP UP P24', + A: 'TRANSFER AGENT', + M: 'WITHDRAWAL AGENT', + O: 'TOP UP AGENT', + S: 'TRANSFER P24', + I: 'WIJTDRAW MERCHANT', + D: 'DONATION', + F: 'FEE', + V: 'REVERSAL', + C: 'CASHBACK CASH', + H: 'CASHBACK POINT', + }; + const uniqueCategories = Array.from( - new Set(transaction.map((tx) => tx.category).filter((cat) => !!cat)) + new Set( + transaction + .map((tx) => categoryMap[tx.category] || '_') // map code to label or default to '_' + .filter((cat) => !!cat && cat !== '_') // remove undefined/null or underscore + ) ); + setCategory(uniqueCategories); }, [transaction]); + const handleTransferTypeChange = (value: string) => { setSelectedTransferType(value === 'all' ? null : value); }; @@ -174,10 +202,37 @@ const ShowDetailWalletDialog: React.FC = ({ meta: { headerClassName: 'min-w-[100px]' }, }, { + accessorFn: (row: any) => { + switch (row.category) { + case 'T': return 'TRANSFER'; + case 'P': return 'PURCHASE'; + case 'W': return 'WITHDRAW'; + case 'U': return 'TOP UP'; + case 'R': return 'RETURN'; + case 'N': return 'TOP UP PARTNER'; + case 'E': return 'REWARD'; + case 'L': return 'PURCHASE LOJA'; + case 'B': return 'TOP UP P24'; + case 'A': return 'TRANSFER AGENT'; + case 'M': return 'WITHDRAWAL AGENT'; + case 'O': return 'TOP UP AGENT'; + case 'S': return 'TRANSFER P24'; + case 'I': return 'WIJTDRAW MERCHANT'; + case 'D': return 'DONATION'; + case 'F': return 'FEE'; + case 'V': return 'REVERSAL'; + case 'C': return 'CASHBACK CASH'; + case 'H': return 'CASHBACK POINT'; + default: return '_'; + } + }, accessorKey: 'category', header: ({ column }: any) => , enableSorting: false, - meta: { headerClassName: 'min-w-[80px]' }, + enableHiding: false, + meta: { + headerClassName: 'w-[250px]' + } }, { accessorKey: 'date', @@ -225,7 +280,7 @@ const ShowDetailWalletDialog: React.FC = ({ filter: JSON.stringify(filters) }); - // console.log(filters); + // console.log(response); if (!response || !response.data) { console.warn('No data received:', response);