From 9fe9720c752b176f7092c0b62d9974baf8fb86e4 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 May 2025 19:03:14 +0700 Subject: [PATCH 01/19] fix member --- src/pages/members/manage-members/blocks/DetailMember.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/members/manage-members/blocks/DetailMember.tsx b/src/pages/members/manage-members/blocks/DetailMember.tsx index 0389e8e..4682056 100644 --- a/src/pages/members/manage-members/blocks/DetailMember.tsx +++ b/src/pages/members/manage-members/blocks/DetailMember.tsx @@ -39,9 +39,9 @@ const DetailMember = ({ showAddDialog, setShowAddDialog, handleSubmit, initialDa const [sucos, setSucos] = useState([]); const [groups, setGroups] = useState([]); const [identity_type] = useState([ - { id: 'eleitoral_id', name: 'Eleitoral ID' }, - { id: 'bihete_de_identidade', name: 'Bihete de Identidade' }, - { id: 'passport', name: 'Passport' }, + { id: 'Eleitoral ID', name: 'Eleitoral ID' }, + { id: 'Bihete de Identidade', name: 'Bihete de Identidade' }, + { id: 'Passport', name: 'Passport' }, ]); const [genders] = useState([ { name: 'Male',id: 'M' }, { name: 'Female',id: 'F' }]) const [previewImg, setPreviewImg] = useState({ From 777a326c6498fb345087ef6afc2c98c5363d2336 Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Mon, 12 May 2025 20:59:09 +0700 Subject: [PATCH 02/19] add wallet name on wallet history --- .../wallet-history/blocks/ListToolbar.tsx | 1 + .../hooks/ManageWalletHistoryContext.tsx | 73 +++++++++++++------ 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx b/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx index b5775c1..2cacce6 100644 --- a/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx +++ b/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx @@ -83,6 +83,7 @@ const ListToolbar = () => { order_direction: 'ASC' }); setWallets(response?.data.list || []); + // console.log('Wallets: ', response?.data); } catch (error) { console.error('Error fetching wallets', error); } diff --git a/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx b/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx index c2a99d3..ccc854e 100644 --- a/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx +++ b/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx @@ -6,7 +6,6 @@ import { ColumnDef } from '@tanstack/react-table'; import React, { createContext, useCallback, useMemo, useState } from 'react'; import ListToolbar from '../blocks/ListToolbar'; -// Helper function for number formatting with currency format const formatNumber = (num: number, currencyCode: string = 'USD'): string => { return num.toLocaleString('en-US', { style: 'currency', @@ -79,30 +78,39 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } const columns = useMemo[]>( () => [ + { + accessorKey: 'id_wallet', + header: ({ column }) => , + enableSorting: false, + enableHiding: false, + meta: { + headerClassName: 'w-[200px]' + } + }, + { + accessorKey: 'name', + header: ({ column }) => , + enableSorting: false, + enableHiding: false, + meta: { + headerClassName: 'w-[200px]', + cellClassName: 'p-[20px]' + } + }, { accessorKey: 'msisdn', header: ({ column }) => , - enableSorting: true, + enableSorting: false, enableHiding: false, meta: { headerClassName: 'w-[550px]', cellClassName: 'p-[20px]' } }, - { - accessorKey: 'id_wallet', - header: ({ column }) => , - enableSorting: false, - enableHiding: true, // Hide this column from view but use it for filtering - meta: { - headerClassName: 'w-[200px]' - } - }, { accessorKey: 'amount', header: ({ column }) => , cell: ({ row }) => { - // Get currency code from the nested data structure if available const currencyCode = row.original.balance_type?.currency?.code || 'USD'; return formatNumber(row.original.amount, currencyCode); }, @@ -127,7 +135,6 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } accessorKey: 'amount_this_month', header: ({ column }) => , cell: ({ row }) => { - // Get currency code from the nested data structure if available const currencyCode = row.original.balance_type?.currency?.code || 'USD'; return formatNumber(row.original.amount_this_month, currencyCode); }, @@ -213,18 +220,18 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } const sortField = sorting.length > 0 ? sorting[0].id : 'created_at'; const sortDirection = sorting.length > 0 ? (sorting[0].desc ? 'ASC' : 'DESC') : 'DESC'; - // Initialize filter object let filterParams: any = {}; - // Process filter array if (Array.isArray(filter)) { filter.forEach((f: any) => { - // Handle MSISDN search + if (f.id === 'name' && f.value) { + filterParams.name = { like: `%${f.value.toLowerCase()}%` }; + } + if (f.id === 'msisdn' && f.value) { filterParams.msisdn = { like: `%${f.value.toLowerCase()}%` }; } - // Handle date range filter if (f.id === 'CreatedAt' && f.value?.from && f.value?.to) { filterParams.created_at = { from: `${f.value.from} 00:00:00`, @@ -232,7 +239,6 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } }; } - // Handle wallet ID filter if (f.id === 'id_wallet' && f.value) { filterParams.id_wallet = f.value; } @@ -247,14 +253,37 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } order_direction: sortDirection, filter: JSON.stringify(filterParams) }); - + // console.log(response); if (!response || !response.data) { console.warn('No data received:', response); return { data: [], totalCount: 0 }; } - setWallets(response?.data.list); - return { data: response?.data.list, totalCount: response?.data.total_count }; + const walletsResponse = await GetData(`${API_URL_WALLET}/dashboard/wallet/`, { + limit: 100, + page: 1, + with_deleted: false, + order_field: 'created_at', + order_direction: 'ASC' + }); + + const walletsMap = walletsResponse?.data?.list + ? walletsResponse.data.list.reduce((acc: any, wallet: any) => { + acc[wallet.ID] = wallet.name; + return acc; + }, {}) + : {}; + + const enrichedData = response?.data.list.map((item: any) => ({ + ...item, + name: walletsMap[item.id_wallet] || 'Unknown Wallet' + })); + + setWallets(enrichedData); + return { + data: enrichedData, + totalCount: response?.data.total_count + }; } catch (error) { console.error('Error fetching Wallet', error); return { data: [], totalCount: 0 }; @@ -293,4 +322,4 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } }; export { ManageWalletContext, ManageWalletContextProvider }; -export type { WalletProps }; \ No newline at end of file +export type { WalletProps }; From a0983b9ef59bcee94ce4c30c1f4d5da7d37d42b9 Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Mon, 12 May 2025 21:11:48 +0700 Subject: [PATCH 03/19] update --- .../history-transaction/blocks/DetailTransaction.tsx | 2 ++ .../transaction/history-transaction/blocks/ListToolbar.tsx | 1 + .../history-transaction/hooks/TransactionContext.tsx | 1 + 3 files changed, 4 insertions(+) diff --git a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx index 2862059..0736560 100644 --- a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx +++ b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx @@ -281,6 +281,8 @@ const DetailTransaction = () => { kind = 'TOP UP'; } else if (transactionDetails?.kind === 'R') { kind = 'RETURN'; + }else if (transactionDetails?.kind === 'E') { + kind = 'REWARD'; } return kind; })()} diff --git a/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx b/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx index ef55958..342c24e 100644 --- a/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx +++ b/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx @@ -177,6 +177,7 @@ const ListToolbar = () => { TOP UP RETURN TOP UP PARTNER + REWARD diff --git a/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx b/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx index 5332a60..f0f679a 100644 --- a/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx +++ b/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx @@ -77,6 +77,7 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => { case 'U': return 'TOP UP'; case 'R': return 'RETURN'; case 'N': return 'TOP UP PARTNER'; + case 'R': return 'REWARD'; default: return '_'; } }, From 2dcff774f12566f646962951a290af2494307399 Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Mon, 12 May 2025 21:13:51 +0700 Subject: [PATCH 04/19] add "E" on status kind transfertype --- src/pages/transfer/transfertype/blocks/AddDialog.tsx | 1 + src/pages/transfer/transfertype/blocks/EditDialog.tsx | 1 + .../transfer/transfertype/hooks/ManageTransferTypeContext.tsx | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/transfer/transfertype/blocks/AddDialog.tsx b/src/pages/transfer/transfertype/blocks/AddDialog.tsx index e164a1b..2c4ec65 100644 --- a/src/pages/transfer/transfertype/blocks/AddDialog.tsx +++ b/src/pages/transfer/transfertype/blocks/AddDialog.tsx @@ -559,6 +559,7 @@ const AddDialog = () => { Withdraw Top Up Top Up Patner + Reward {errors.status_kind && ( diff --git a/src/pages/transfer/transfertype/blocks/EditDialog.tsx b/src/pages/transfer/transfertype/blocks/EditDialog.tsx index 1fd1936..cf761c8 100644 --- a/src/pages/transfer/transfertype/blocks/EditDialog.tsx +++ b/src/pages/transfer/transfertype/blocks/EditDialog.tsx @@ -757,6 +757,7 @@ const EditDialog = () => { Withdraw Top Up Top Up Patner + Reward {errors.status_kind && ( diff --git a/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx b/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx index afb3628..1614b59 100644 --- a/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx +++ b/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx @@ -276,7 +276,8 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React P: { label: 'Purchase', className: 'bg-green-100 text-green-600' }, W: { label: 'Withdraw', className: 'bg-fuchsia-100 text-fuchsia-600' }, U: { label: 'Top Up', className: 'bg-yellow-100 text-yellow-600' }, - N: { label: 'Top Up Patner', className: 'bg-purple-100 text-purple-600' } + N: { label: 'Top Up Patner', className: 'bg-purple-100 text-purple-600' }, + E: {label: 'Reward', className: 'bg-rose-100 text-rose-600'} }; const kindInfo = mapping[kind] || { From 971e80a20c09646d32dd826a078083513b384989 Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Mon, 12 May 2025 21:14:19 +0700 Subject: [PATCH 05/19] update --- .../approval-transaction/blocks/DetailApprovalTransaction.tsx | 4 ++++ .../history-transaction/blocks/DetailTransaction.tsx | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx b/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx index 319d75f..53541be 100644 --- a/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx +++ b/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx @@ -261,6 +261,8 @@ const DetailApprovalTransaction = () => { kind = 'TOP UP'; } else if (transactionDetails?.kind === 'R') { kind = 'RETURN'; + }else if (transactionDetails?.kind === 'E') { + kind = 'REWARD'; } return kind; })()} @@ -445,6 +447,8 @@ const DetailApprovalTransaction = () => { kind = 'TOP UP'; } else if (transactionDetails?.kind === 'R') { kind = 'RETURN'; + }else if (transactionDetails?.kind === 'E') { + kind = 'REWARD'; } return kind; })()} diff --git a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx index 0736560..b03adce 100644 --- a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx +++ b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx @@ -463,6 +463,8 @@ const DetailTransaction = () => { kind = 'TOP UP'; } else if (transactionDetails?.kind === 'R') { kind = 'RETURN'; + }else if (transactionDetails?.kind === 'E') { + kind = 'REWARD'; } return kind; })()} From fd56025c47f1563da1ce05a7c1ef6a4a2cdc3c41 Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Mon, 12 May 2025 22:02:05 +0700 Subject: [PATCH 06/19] update --- .../history-transaction/blocks/DetailTransaction.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx index b03adce..6a9dd4f 100644 --- a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx +++ b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx @@ -338,7 +338,7 @@ const DetailTransaction = () => { )} - {/* {activeTab === 'detail' && transactionDetails?.kind === 'P' && ( */} + {activeTab === 'detail' && (

Product Information @@ -391,7 +391,7 @@ const DetailTransaction = () => {

- {/* )} */} + )} {activeTab === 'detail' && transactionDetails?.kind != 'P' && transactionDetails?.transfer != null && (
@@ -496,11 +496,11 @@ const DetailTransaction = () => {

Full Name

-

{transactionDetails?.origin_customer?.fullname ?? transactionDetails?.origin_customer?.origin_name}

+

{transactionDetails?.origin_customer?.origin_name}

Phone Number

-

{transactionDetails?.origin_customer?.msisdn ?? transactionDetails?.origin_msisdn}

+

{transactionDetails?.origin_msisdn}

Email

From 02fbcbc42ec107927706bc98b09b238789de8480 Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Mon, 12 May 2025 22:03:45 +0700 Subject: [PATCH 07/19] update --- .../history-transaction/hooks/TransactionContext.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx b/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx index f0f679a..bfd2355 100644 --- a/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx +++ b/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx @@ -77,7 +77,7 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => { case 'U': return 'TOP UP'; case 'R': return 'RETURN'; case 'N': return 'TOP UP PARTNER'; - case 'R': return 'REWARD'; + case 'E': return 'REWARD'; default: return '_'; } }, From 2ef9c8a4e43c5268c535cee15ccdccb7e09835bb Mon Sep 17 00:00:00 2001 From: wayanrivan Date: Mon, 12 May 2025 22:06:44 +0700 Subject: [PATCH 08/19] update dashboard --- src/pages/dashboards/home/blocks/TransactionPieChart.tsx | 1 + src/pages/dashboards/home/blocks/TransactionValue.tsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/pages/dashboards/home/blocks/TransactionPieChart.tsx b/src/pages/dashboards/home/blocks/TransactionPieChart.tsx index 5e2f3b5..904b962 100644 --- a/src/pages/dashboards/home/blocks/TransactionPieChart.tsx +++ b/src/pages/dashboards/home/blocks/TransactionPieChart.tsx @@ -43,6 +43,7 @@ const TransactionPieChart = ({ startdate, enddate }: Props) => { { name: 'Purchase', value: parseFloat((responseTransactionValue?.data?.P ?? 0).toFixed(2)), color: '#baf7c5' }, { name: 'Withdraw', value: parseFloat((responseTransactionValue?.data?.W ?? 0).toFixed(2)), color: '#f56565' }, { name: 'Top Up Partner', value: parseFloat((responseTransactionValue?.data?.N ?? 0).toFixed(2)), color: '#f7fa52' }, + { name: 'Reward', value: parseFloat((responseTransactionValue?.data?.E ?? 0).toFixed(2)), color: '#f7fa52' }, ]; return ( diff --git a/src/pages/dashboards/home/blocks/TransactionValue.tsx b/src/pages/dashboards/home/blocks/TransactionValue.tsx index 5c69564..451decc 100644 --- a/src/pages/dashboards/home/blocks/TransactionValue.tsx +++ b/src/pages/dashboards/home/blocks/TransactionValue.tsx @@ -64,6 +64,9 @@ const TransactionValue = ({ startdate, enddate }: Props) => { case "N": type = "Top Up Partner"; break; + case "E": + type = "Reward"; + break; default: type = "Unknown"; break; From 8dca6c875eeddef69bdb52f05de7d383be46f07b Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Mon, 12 May 2025 22:19:04 +0700 Subject: [PATCH 09/19] fix group name on wallet history --- .../hooks/ManageWalletHistoryContext.tsx | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx b/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx index ccc854e..2a7a907 100644 --- a/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx +++ b/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx @@ -192,8 +192,7 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } } }, { - accessorFn: (row) => row.group.name, - id: 'group_name', + accessorKey: 'group_name', header: ({ column }) => , enableSorting: false, enableHiding: false, @@ -253,12 +252,13 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } order_direction: sortDirection, filter: JSON.stringify(filterParams) }); - // console.log(response); + if (!response || !response.data) { console.warn('No data received:', response); return { data: [], totalCount: 0 }; } + // Fetch wallets to map wallet names const walletsResponse = await GetData(`${API_URL_WALLET}/dashboard/wallet/`, { limit: 100, page: 1, @@ -267,6 +267,15 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } order_direction: 'ASC' }); + // Fetch groups to map group names + const groupsResponse = await GetData(`${API_URL_WALLET}/dashboard/group/`, { + limit: 100, + page: 1, + with_deleted: false, + order_field: 'created_at', + order_direction: 'ASC' + }); + const walletsMap = walletsResponse?.data?.list ? walletsResponse.data.list.reduce((acc: any, wallet: any) => { acc[wallet.ID] = wallet.name; @@ -274,9 +283,17 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } }, {}) : {}; + const groupsMap = groupsResponse?.data?.list + ? groupsResponse.data.list.reduce((acc: any, group: any) => { + acc[group.ID] = group.name; + return acc; + }, {}) + : {}; + const enrichedData = response?.data.list.map((item: any) => ({ ...item, - name: walletsMap[item.id_wallet] || 'Unknown Wallet' + name: walletsMap[item.id_wallet] || 'Unknown Wallet', + group_name: groupsMap[item.id_group] || 'Unknown Group' })); setWallets(enrichedData); @@ -322,4 +339,4 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } }; export { ManageWalletContext, ManageWalletContextProvider }; -export type { WalletProps }; +export type { WalletProps }; \ No newline at end of file From f81c28b843a6b6ce02ab4c4e2d7515c9169bd218 Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Mon, 12 May 2025 22:19:35 +0700 Subject: [PATCH 10/19] update wallet history --- .../wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx b/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx index 2a7a907..71d4d39 100644 --- a/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx +++ b/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx @@ -258,7 +258,6 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } return { data: [], totalCount: 0 }; } - // Fetch wallets to map wallet names const walletsResponse = await GetData(`${API_URL_WALLET}/dashboard/wallet/`, { limit: 100, page: 1, @@ -267,7 +266,6 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } order_direction: 'ASC' }); - // Fetch groups to map group names const groupsResponse = await GetData(`${API_URL_WALLET}/dashboard/group/`, { limit: 100, page: 1, From 75dfe1b59ff54f52b1cbc59c583749580296fbaf Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Tue, 13 May 2025 02:03:25 +0700 Subject: [PATCH 11/19] fixing currency field on wallet history --- .../hooks/ManageWalletHistoryContext.tsx | 90 ++++++++++++------- 1 file changed, 57 insertions(+), 33 deletions(-) diff --git a/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx b/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx index 71d4d39..84a7a5f 100644 --- a/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx +++ b/src/pages/wallet/wallet-history/hooks/ManageWalletHistoryContext.tsx @@ -6,10 +6,8 @@ import { ColumnDef } from '@tanstack/react-table'; import React, { createContext, useCallback, useMemo, useState } from 'react'; import ListToolbar from '../blocks/ListToolbar'; -const formatNumber = (num: number, currencyCode: string = 'USD'): string => { +const formatNumber = (num: number): string => { return num.toLocaleString('en-US', { - style: 'currency', - currency: currencyCode, minimumFractionDigits: 2, maximumFractionDigits: 2 }); @@ -110,10 +108,7 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } { accessorKey: 'amount', header: ({ column }) => , - cell: ({ row }) => { - const currencyCode = row.original.balance_type?.currency?.code || 'USD'; - return formatNumber(row.original.amount, currencyCode); - }, + cell: ({ row }) => formatNumber(row.original.amount), enableSorting: false, enableHiding: false, meta: { @@ -134,10 +129,7 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } { accessorKey: 'amount_this_month', header: ({ column }) => , - cell: ({ row }) => { - const currencyCode = row.original.balance_type?.currency?.code || 'USD'; - return formatNumber(row.original.amount_this_month, currencyCode); - }, + cell: ({ row }) => formatNumber(row.original.amount_this_month), enableSorting: false, enableHiding: false, meta: { @@ -161,19 +153,18 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } headerClassName: 'w-[200px]' } }, + // { + // accessorFn: (row) => row.balance_type?.name, + // id: 'balance_type_name', + // header: ({ column }) => , + // enableSorting: false, + // enableHiding: false, + // meta: { + // headerClassName: 'w-[200px]' + // } + // }, { - accessorFn: (row) => row.balance_type.name, - id: 'balance_type_name', - header: ({ column }) => , - enableSorting: false, - enableHiding: false, - meta: { - headerClassName: 'w-[200px]' - } - }, - { - accessorFn: (row) => row.balance_type.currency.name, - id: 'currency_name', + accessorKey: 'currency_name', header: ({ column }) => , enableSorting: false, enableHiding: false, @@ -182,8 +173,7 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } } }, { - accessorFn: (row) => row.balance_type.currency.code, - id: 'currency_code', + accessorKey: 'currency_code', header: ({ column }) => , enableSorting: false, enableHiding: false, @@ -201,7 +191,7 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } } }, { - accessorFn: (row) => row.group.is_bank, + accessorFn: (row) => row.group?.is_bank, id: 'is_bank', header: ({ column }) => , enableSorting: false, @@ -274,9 +264,20 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } order_direction: 'ASC' }); + const currenciesResponse = await GetData(`${API_URL_WALLET}/dashboard/currency/`, { + limit: 100, + page: 1, + with_deleted: false, + order_field: 'created_at', + order_direction: 'ASC' + }); + const walletsMap = walletsResponse?.data?.list ? walletsResponse.data.list.reduce((acc: any, wallet: any) => { - acc[wallet.ID] = wallet.name; + acc[wallet.ID] = { + name: wallet.name, + id_currency: wallet.id_currency + }; return acc; }, {}) : {}; @@ -288,11 +289,34 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } }, {}) : {}; - const enrichedData = response?.data.list.map((item: any) => ({ - ...item, - name: walletsMap[item.id_wallet] || 'Unknown Wallet', - group_name: groupsMap[item.id_group] || 'Unknown Group' - })); + const currenciesMap = currenciesResponse?.data?.list + ? currenciesResponse.data.list.reduce((acc: any, currency: any) => { + acc[currency.ID] = { + name: currency.name, + code: currency.code + }; + return acc; + }, {}) + : {}; + + const enrichedData = response?.data.list.map((item: any) => { + const walletInfo = walletsMap[item.id_wallet] || { + name: 'Unknown Wallet', + id_currency: null + }; + const currencyInfo = currenciesMap[walletInfo.id_currency] || { + name: 'Unknown Currency', + code: 'USD' + }; + + return { + ...item, + name: walletInfo.name, + group_name: groupsMap[item.id_group] || 'Unknown Group', + currency_name: currencyInfo.name, + currency_code: currencyInfo.code + }; + }); setWallets(enrichedData); return { @@ -337,4 +361,4 @@ const ManageWalletContextProvider = ({ children }: { children: React.ReactNode } }; export { ManageWalletContext, ManageWalletContextProvider }; -export type { WalletProps }; \ No newline at end of file +export type { WalletProps }; From 22e3624965b5d53b210e6eab1b660c7da981f207 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 13 May 2025 14:10:09 +0700 Subject: [PATCH 12/19] add agent balance --- .../members/agent-balance/AgentBalance.tsx | 278 ++++++++++++++++++ src/pages/members/agent-balance/Column.tsx | 146 +++++++++ .../members/agent-balance/ListToolbar.tsx | 82 ++++++ .../members/manage-members/ManageMembers.tsx | 22 +- src/routing/AppRoutingSetup.tsx | 2 + 5 files changed, 525 insertions(+), 5 deletions(-) create mode 100644 src/pages/members/agent-balance/AgentBalance.tsx create mode 100644 src/pages/members/agent-balance/Column.tsx create mode 100644 src/pages/members/agent-balance/ListToolbar.tsx diff --git a/src/pages/members/agent-balance/AgentBalance.tsx b/src/pages/members/agent-balance/AgentBalance.tsx new file mode 100644 index 0000000..9b98258 --- /dev/null +++ b/src/pages/members/agent-balance/AgentBalance.tsx @@ -0,0 +1,278 @@ +import { DataTable } from '@/components/ui/DataTable'; +import { getColumns } from './Column'; +import { apiConfig } from '@/config/api.config'; +import axios, { AxiosResponse } from 'axios'; +import { Helmet } from 'react-helmet'; +import { + DialogContent, + MenuItem, + Radio, + RadioGroup, + FormControlLabel, + FormControl, + Dialog, + DialogTitle, + Typography, + Button, + Box, + Breadcrumbs, + Link +} from '@mui/material'; +import { useState, useEffect } from 'react'; +import CloseIcon from '@mui/icons-material/Close'; +import Divider from '@mui/material/Divider'; +import ConfirmDialog from '@/components/confirm'; +import { toast } from 'sonner'; +import { Container, DataGridLoader, DataGridProvider, LoaderTransparant } from '@/components'; +import { ListToolBar } from './ListToolbar'; +import { RefreshCw } from 'lucide-react'; +import { setgroups } from 'process'; +const BASE_URL = apiConfig.service_customer; + +let initBalance = { + id: '', + msisdn: '', + fullname: '', + username: '', + agent_name: '', + balance_emoney: '', + balance_merchant: '', + balance_point: '', + balance_deposit: '' +}; + +const AgentBalance = () => { + const [isDialogOpen, setIsDialogOpen] = useState(false); + const [loading, setLoading] = useState(false); + const [dataBalance, setDataBalance] = useState([]); + const [formData, setFormData] = useState(initBalance); + const [pageIndex, setPageIndex] = useState(1); + const [pageSize, setPageSize] = useState(10); + const [dialogType, setDialogType] = useState(''); + const [dialogOpen, setDialogOpen] = useState(false); + const [isReloading, setIsReloading] = useState(false); + + useEffect(() => { + fetchAgentBalance(); + }, []); + + async function fetchAgentBalance(): Promise { + setIsReloading(true); + try { + let balances = await axios.get(`${BASE_URL}/customer/agent-balance`, { + params: { + limit: 20, + page: 1, + with_deleted: false, + order_field: 'created_at', + order_direction: 'DESC' + } + }); + let temp = 1; + let resBalance = balances.data.data.list.map((el: any) => { + el.no = temp++; + return el; + }); + setDataBalance(resBalance); + } catch (error: any) { + alert(error.message); + console.log(error); + } finally { + setIsReloading(false); + } + } + + const openDialog = () => setIsDialogOpen(true); + const closeDialog = () => { + setIsDialogOpen(false); + setFormData(initBalance); + }; + + // const handleChange = (e: React.ChangeEvent) => { + // setFormData({ + // ...formData, + // [e.target.name]: e.target.value + // }); + // }; + + // const handleSubmit = async (e: React.FormEvent) => { + // e.preventDefault(); + // // if (!formData.groupName) return toast.warning(`Group name can not be empty!`); + // setIsDialogOpen(false); + // setDialogOpen(true); + // }; + + function createGroup() { + setDialogType('create'); + openDialog(); + } + + const handleUpdate = (group: any) => { + setDialogType('update'); + setIsDialogOpen(true); + }; + + const handleReload = () => { + setIsReloading(true); + fetchAgentBalance(); + }; + + // const handleYes = async () => { + // setIsReloading(true); + // try { + // if (dialogType === 'create') { + // await axios.post(`${BASE_URL}/groups/create`, { + // name: formData.groupName, + // status: formData.status, + // description: formData.description, + // created_at: new Date() + // }); + // toast.success(`Success create group`); + // } + // } catch (error: any) { + // console.log(error); + // toast.error(error.message); + // } finally { + // setDialogOpen(false); + // closeDialog(); + // await fetchAgentBalance(); + // setLoading(false); + // } + // }; + + // function setShowAddDialog(el: any) { + // setIsDialogOpen(el); + // } + + if (loading) return ; + + return ( + <> + + TPAY | Agent Balance + + + {/* setDialogOpen(false)} + title="Confirm Action" + content={''} + onYes={handleYes} + onNo={() => setDialogOpen(false)} + /> */} +

Agent Balances

+ + + Dashboard + + + + Members + + + + Agent Balances + + + {/*
*/} + +
+ {isReloading && ( + + )} + + } + layout={{ card: true }} + serverSide={false} + onRowSelectionChange={(selected, table: any) => { + const selectedRow = table.getSelectedRowModel().rows[0]; + if (selectedRow) handleUpdate(selectedRow.original); + }} + /> +
+ {/*
*/} + + {/* + +
+ + {dialogType === 'create' ? 'Create New Group' : 'Update Group'} + + + + +
+ +
+
+
+ + +
+
+ + + + } + label="Yes" + /> + } + label="No" + /> + + +
+
+ + +
+ +
+
+
+
*/} +
+ + ); +}; + +export default AgentBalance; diff --git a/src/pages/members/agent-balance/Column.tsx b/src/pages/members/agent-balance/Column.tsx new file mode 100644 index 0000000..a188e8b --- /dev/null +++ b/src/pages/members/agent-balance/Column.tsx @@ -0,0 +1,146 @@ +import { KeenIcon } from '@/components'; +import { Button } from '@/components/ui/button'; +import { ColumnDef } from '@tanstack/react-table'; +import { ArrowUpDown } from 'lucide-react'; +import moment from 'moment'; + +export type AgentBalance = { + id: string, + msisdn: string, + fullname: string, + username: string, + agent_name: string, + balance_emoney: string, + balance_merchant: string, + balance_point: string, + balance_deposit: string +}; + +export const getColumns = (handleUpdate: (data: any) => void): ColumnDef[] => [ + { + accessorKey: 'no', + header: ({ column }) => { + return ( + + ); + } + }, + { + accessorKey: 'msisdn', + header: ({ column }) => { + return ( + + ); + } + }, + { + accessorKey: 'fullname', + header: ({ column }) => { + return ( + + ); + } + }, + { + accessorKey: 'username', + header: ({ column }) => { + return ( + + ); + } + }, + { + accessorKey: 'agent_name', + header: ({ column }) => { + return ( + + ); + } + }, + { + accessorKey: 'balance_emoney', + header: ({ column }) => { + return ( + + ); + } + }, + { + accessorKey: 'balance_merchant', + header: ({ column }) => { + return ( + + ); + } + }, + { + accessorKey: 'balance_point', + header: ({ column }) => { + return ( + + ); + } + }, + { + accessorKey: 'balance_deposit', + header: ({ column }) => { + return ( + + ); + } + }, +]; diff --git a/src/pages/members/agent-balance/ListToolbar.tsx b/src/pages/members/agent-balance/ListToolbar.tsx new file mode 100644 index 0000000..5e9f421 --- /dev/null +++ b/src/pages/members/agent-balance/ListToolbar.tsx @@ -0,0 +1,82 @@ +import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components'; +import { Button } from '@/components/ui/button'; +import React, { useState } from 'react'; + +interface ListToolBarProps { + createGroup: () => void; + onReload: () => void; + isReloading: boolean; +} + +const ListToolBar = ({ createGroup, onReload, isReloading }: ListToolBarProps) => { + const { table } = useDataGrid(); + const [usernameFilter, setUsernameFilter] = useState(''); + const [msisdn, setMsisdn] = useState(''); + const [fullname, setFullname] = useState(''); + const [merchantName, setMerchantName] = useState(''); + + const handleUsernameChange = (e: React.ChangeEvent) => { + setUsernameFilter(e.target.value); + table.getColumn('username')?.setFilterValue(e.target.value); + }; + + const filtermsisdn = (e: React.ChangeEvent) => { + setMsisdn(e.target.value); + table.getColumn('msisdn')?.setFilterValue(e.target.value); + }; + + const filterfullname = (e: React.ChangeEvent) => { + setFullname(e.target.value); + table.getColumn('fullname')?.setFilterValue(e.target.value); + }; + + const filtermerchantname = (e: React.ChangeEvent) => { + setMerchantName(e.target.value); + table.getColumn('agent_name')?.setFilterValue(e.target.value); + }; + + return ( +
+
+
+
+ + + + +
+
+ {/* */} + + + +
+
+
+
+ ); +}; + +export { ListToolBar }; diff --git a/src/pages/members/manage-members/ManageMembers.tsx b/src/pages/members/manage-members/ManageMembers.tsx index 01d9785..3739311 100644 --- a/src/pages/members/manage-members/ManageMembers.tsx +++ b/src/pages/members/manage-members/ManageMembers.tsx @@ -18,7 +18,7 @@ const BASE_URL_CUSTOMER = apiConfig.service_customer; const BASE_URL = apiConfig.service_customer; const ManageMembers = () => { - const [loading, setLoading] = useState(false); + // const [loading, setLoading] = useState(false); const [members, setMembers] = useState([]); const [selectedMember, setSelectedMember] = useState(''); const [member, setMember] = useState(initialMember); @@ -28,6 +28,9 @@ const ManageMembers = () => { const [dialogType, setDialogType] = useState(''); const [groups, setGroups] = useState([]); const [isReloading, setIsReloading] = useState(false); + const [currentPage, setCurrentPage] = useState(0); + const [totalItems, setTotalItems] = useState(10); + const closeDialog = () => { setIsDialogOpen(false); setMember(initialMember); @@ -36,6 +39,7 @@ const ManageMembers = () => { useEffect(() => { fetchCustomers(); + fetchMasters(); }, []); async function fetchCustomers(): Promise { @@ -44,7 +48,7 @@ const ManageMembers = () => { let customers = await axios.get(`${BASE_URL}/customer/list`, { params: { limit: 30, - page: 1, + page: 1 + currentPage, with_deleted: false, order_field: 'created_at', order_direction: 'DESC' @@ -61,8 +65,17 @@ const ManageMembers = () => { return el; }); setMembers(resMembers); - // setIsReloading(false); + } catch (error: any) { + toast.error(error.message); + console.log(error); + } finally { + setIsReloading(false); + } + } + async function fetchMasters(): Promise { + setIsReloading(true); + try { let getProfession: any = await axios.get(`${BASE_URL_MASTER_DATA}/profession/list`, { params: { limit: 50, @@ -87,7 +100,6 @@ const ManageMembers = () => { toast.error(error.message); console.log(error); } finally { - // setLoading(false); setIsReloading(false); } } @@ -269,7 +281,7 @@ const ManageMembers = () => { )} { } /> } /> } /> + } /> } /> From f923386f1457f57033799f718c8b33691427851e Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Tue, 13 May 2025 21:57:34 +0700 Subject: [PATCH 13/19] fix DN to donation on transfertype --- src/pages/transfer/transfertype/blocks/ListToolBar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/transfer/transfertype/blocks/ListToolBar.tsx b/src/pages/transfer/transfertype/blocks/ListToolBar.tsx index 3580abb..f1e90d5 100644 --- a/src/pages/transfer/transfertype/blocks/ListToolBar.tsx +++ b/src/pages/transfer/transfertype/blocks/ListToolBar.tsx @@ -43,7 +43,8 @@ const typeLabelMap: Record = { DM: 'Disbursment Master Agent', DA: 'Disbursment Agent', WI: 'Withdraw Merchant', - IC: 'Income Merchant' + IC: 'Income Merchant', + DN: 'Donation' }; const ListToolbar = () => { From 791f2dc9add44f6a1e58fdbb820f71629a0d352d Mon Sep 17 00:00:00 2001 From: bagusajisaputroo Date: Tue, 13 May 2025 22:21:17 +0700 Subject: [PATCH 14/19] add group name filter on wallet history --- .../wallet-history/blocks/ListToolbar.tsx | 51 ++++++++++++++++++- .../hooks/ManageWalletHistoryContext.tsx | 26 ++++------ 2 files changed, 58 insertions(+), 19 deletions(-) diff --git a/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx b/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx index 2cacce6..6eb8298 100644 --- a/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx +++ b/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx @@ -19,6 +19,11 @@ interface WalletProps { name: string; } +interface GroupProps { + ID: string; + name: string; +} + const getOneMonthsAgo = () => { const today = new Date(); return new Date(today.getFullYear(), today.getMonth() - 1, today.getDate()); @@ -37,7 +42,11 @@ const ListToolbar = () => { const [walletId, setWalletId] = useState( (table.getColumn('id_wallet')?.getFilterValue() as string) ?? '' ); + const [groupId, setGroupId] = useState( + (table.getColumn('id_group')?.getFilterValue() as string) ?? '' + ); const [wallets, setWallets] = useState([]); + const [groups, setGroups] = useState([]); useEffect(() => { const today = new Date(); @@ -67,6 +76,11 @@ const ListToolbar = () => { table.setPageIndex(0); }, [walletId, table]); + useEffect(() => { + table.getColumn('id_group')?.setFilterValue(groupId); + table.setPageIndex(0); + }, [groupId, table]); + useEffect(() => { if (dateRange.from && dateRange.to) { handleFilterByDate(); @@ -83,14 +97,29 @@ const ListToolbar = () => { order_direction: 'ASC' }); setWallets(response?.data.list || []); - // console.log('Wallets: ', response?.data); } catch (error) { console.error('Error fetching wallets', error); } }; + const fetchGroups = async () => { + try { + const response = await GetData(`${API_URL_WALLET}/dashboard/group/`, { + limit: 100, + page: 1, + with_deleted: false, + order_field: 'created_at', + order_direction: 'ASC' + }); + setGroups(response?.data.list || []); + } catch (error) { + console.error('Error fetching groups', error); + } + }; + useEffect(() => { fetchWallets(); + fetchGroups(); }, []); const handleClearAllFilters = () => { @@ -103,10 +132,12 @@ const ListToolbar = () => { setSearchValue(''); setWalletId(''); + setGroupId(''); setDateRange(resetDateRange); table.getColumn('msisdn')?.setFilterValue(''); table.getColumn('id_wallet')?.setFilterValue(''); + table.getColumn('id_group')?.setFilterValue(''); table.getColumn('CreatedAt')?.setFilterValue(resetDateRange); setTimeout(() => { @@ -115,7 +146,6 @@ const ListToolbar = () => { }, 0); }; - const handleRefresh = () => { const today = new Date(); const threeMonthsAgo = getOneMonthsAgo(); @@ -126,6 +156,7 @@ const ListToolbar = () => { setSearchValue(''); setWalletId(''); + setGroupId(''); setDateRange(resetDateRange); table.setColumnFilters([{ id: 'CreatedAt', value: resetDateRange }]); @@ -181,6 +212,22 @@ const ListToolbar = () => {
+ +
+ +
+ + }} variant="destructive" color="warning" disabled={detailKyc.status_approve!=='W'?true:false}>Reject + }} variant="destructive" color="warning" disabled={detailKyc.status_approve==='Waiting Approval'?false:true}>Reject + }} variant="default" color="primary" disabled={detailKyc.status_approve==='Waiting Approval'?false:true}>Approve
) : (
)} From c13b4ac11f27bbf43716ce8d1b9c749b85dbe7b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 May 2025 13:24:32 +0700 Subject: [PATCH 17/19] wording deletion --- .../kyc-delete-member/hooks/ManageKycDeletionContext.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/members/kyc-delete-member/hooks/ManageKycDeletionContext.tsx b/src/pages/members/kyc-delete-member/hooks/ManageKycDeletionContext.tsx index e146b23..b994f5c 100644 --- a/src/pages/members/kyc-delete-member/hooks/ManageKycDeletionContext.tsx +++ b/src/pages/members/kyc-delete-member/hooks/ManageKycDeletionContext.tsx @@ -159,7 +159,8 @@ const ManageKycDeletionContextProvider = ({ children }: { children: React.ReactN }) if (approveReject?.status == true) { - toast.success('Success update status approval') + if (status_approve === 'Y') toast.success('Update status approve success') + if (status_approve === 'N') toast.success('Update status reject success') handleDetailDialog(false, null) } else { toast.warning(`${approveReject?.message}`) From c88191920d942f2f2f215fdec1978eeb15ed46f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 May 2025 17:58:59 +0700 Subject: [PATCH 18/19] add dialog confirm --- .../kyc-delete-member/blocks/DetailDialog.tsx | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/pages/members/kyc-delete-member/blocks/DetailDialog.tsx b/src/pages/members/kyc-delete-member/blocks/DetailDialog.tsx index 30fec74..47c0661 100644 --- a/src/pages/members/kyc-delete-member/blocks/DetailDialog.tsx +++ b/src/pages/members/kyc-delete-member/blocks/DetailDialog.tsx @@ -18,15 +18,37 @@ import { useManageKycDeletionContext } from '../hooks'; import { apiConfig } from '@/config/api.config'; import { useDataGrid } from '@/components'; import { useState } from 'react'; +import ConfirmDialog from '@/components/confirm'; const API_URL = apiConfig.service_customer; const DetailDialog = () => { const { showDetailDialog, setShowDetailDialog, detailKyc, handleApproveReject } = useManageKycDeletionContext(); const [genders] = useState([ { name: 'Male',id: 'M' }, { name: 'Female',id: 'F' }]) + const [dialogOpen, setDialogOpen] = useState(false); + const [dialogType, setDialogType] = useState(''); const { reload } = useDataGrid(); + async function handleYes() { + await handleApproveReject(detailKyc.id, dialogType) + setDialogOpen(false) + reload() + } + + function onSubmit(type:string) { + setDialogType(type) + setDialogOpen(true) + } + return ( + setDialogOpen(false)} + title="Confirm Action" + content={`Are you sure you want to ${dialogType === 'Y' ? 'Approve' : 'Reject'}?`} + onYes={handleYes} + onNo={() => setDialogOpen(false)} + /> Customer Deletion Details @@ -49,12 +71,14 @@ const DetailDialog = () => {
From 7cd6774bec2f6cbf916f5ec4463c44f199d5c43e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 May 2025 18:20:19 +0700 Subject: [PATCH 19/19] kyc upgrade --- 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 4682056..5a73e27 100644 --- a/src/pages/members/manage-members/blocks/DetailMember.tsx +++ b/src/pages/members/manage-members/blocks/DetailMember.tsx @@ -162,8 +162,8 @@ const DetailMember = ({ showAddDialog, setShowAddDialog, handleSubmit, initialDa function buttonOnSubmit(e:any) { e.preventDefault(); if (dialogType === 'update') { - if (page === 'kyc' && formData.destinationGroup === "Premium" && !formData.approval_description_premium) return toast.warning(`Approval Premium Description needed!`) - if (page === 'kyc' && formData.destinationGroup === "Agent" && !formData.approval_description_premium) return toast.warning(`Approval Agent Description needed!`) + // if (page === 'kyc' && formData.destinationGroup === "Premium" && !formData.approval_description_premium) return toast.warning(`Approval Premium Description needed!`) + // if (page === 'kyc' && formData.destinationGroup === "Agent" && !formData.approval_description_premium) return toast.warning(`Approval Agent Description needed!`) if (!formData.msisdn||!formData.email||!formData.fullname||!formData.username||!formData.mother_fullname||!formData.address||!formData.nationality||!formData.date_birth||!formData.gender) { return toast.warning(`Required fields cannot be empty: msisdn, email, fullname, username, mother Full Name, Address, Nationality, Date Of Birth, Gender.!`) }