diff --git a/src/auth/_models.ts b/src/auth/_models.ts index a580966..8bf87ed 100644 --- a/src/auth/_models.ts +++ b/src/auth/_models.ts @@ -9,6 +9,7 @@ export interface AuthModel { company: any; user: any; // api_token: string; + statusbalance: string; } export interface UserModel { diff --git a/src/auth/providers/JWTProvider.tsx b/src/auth/providers/JWTProvider.tsx index 934d228..8cba25e 100644 --- a/src/auth/providers/JWTProvider.tsx +++ b/src/auth/providers/JWTProvider.tsx @@ -43,24 +43,6 @@ const AuthProvider = ({ children }: PropsWithChildren) => { const [auth, setAuth] = useState(authHelper.getAuth()); const [currentUser, setCurrentUser] = useState(); - const verify = async () => { - if (auth) { - try { - const { data: user } = await getUser(); - const createCacheUser = { - name: user.name, - email: user.email, - username: user.username, - role_name: auth.role_name - }; - localStorage.setItem('user', JSON.stringify(createCacheUser)); - } catch { - saveAuth(undefined); - setCurrentUser(undefined); - } - } - }; - const saveAuth = (auth: AuthModel | undefined) => { setAuth(auth); if (auth) { @@ -73,11 +55,20 @@ const AuthProvider = ({ children }: PropsWithChildren) => { const login = async (username: string, password: string) => { try { const { data: auth } = await axios - .post(LOGIN_URL, { username, password }) // , { headers: { 'Access-Control-Allow-Origin': "*" }} + .post(LOGIN_URL, { username, password }) .then((response) => response.data); - saveAuth({ ...auth.token, id: auth.user.id, role_name: auth.role_name, user: auth.user }); + const enhancedAuth: AuthModel = { + ...auth.token, + id: auth.user.id, + role_name: auth.role_name, + user: auth.user, + statusbalance: auth.role?.status_balance ?? null // SAFE ACCESS + }; + + saveAuth(enhancedAuth); setCurrentUser(auth.user); + const createActivity = { module: 'Login', description: `Login`, @@ -85,6 +76,7 @@ const AuthProvider = ({ children }: PropsWithChildren) => { }; doSaveLogActivity(createActivity); } catch (error: any) { + console.error('Login error:', error); throw error; } }; @@ -108,6 +100,33 @@ const AuthProvider = ({ children }: PropsWithChildren) => { return { data: _axios }; }; + const verify = async () => { + if (auth) { + try { + const { data: user } = await getUser(); + + // Perbarui auth yang sekarang dengan statusbalance + saveAuth({ + ...auth, + statusbalance: user.role.status_balance + }); + + const createCacheUser = { + name: user.name, + email: user.email, + username: user.username, + role_name: auth.role_name, + statusbalance: user.role.status_balance + }; + + localStorage.setItem('user', JSON.stringify(createCacheUser)); + } catch { + saveAuth(undefined); + setCurrentUser(undefined); + } + } + }; + const logout = async () => { const createActivity = { module: 'Logout', @@ -130,7 +149,6 @@ const AuthProvider = ({ children }: PropsWithChildren) => { currentUser, setCurrentUser, login, - // register, requestPasswordResetLink, changePassword, getUser, @@ -143,4 +161,4 @@ const AuthProvider = ({ children }: PropsWithChildren) => { ); }; -export { AuthContext, AuthProvider }; +export { AuthContext, AuthProvider }; \ No newline at end of file diff --git a/src/pages/dashboards/home/DashboardHomePage.tsx b/src/pages/dashboards/home/DashboardHomePage.tsx index 0353ee8..a42faee 100644 --- a/src/pages/dashboards/home/DashboardHomePage.tsx +++ b/src/pages/dashboards/home/DashboardHomePage.tsx @@ -268,7 +268,7 @@ const DashboardHomePage = () => { ) : null}
- {bankaccount?.data && bankaccount?.data.length > 0 ? ( + {bankaccount?.data && bankaccount?.data.length > 0 && getAuth()?.statusbalance=='Y' ? ( bankaccount?.data.map((bankaccountdatas: { amount: string, creditlimit: string, monthlylimit: string; wallet: string; }, index: number) => ( { { name: 'Top Up P24', value: parseFloat((responseTransactionValue?.data?.B ?? 0).toFixed(2)), color: '#FADA7A' }, { name: 'Transfer Agent', value: parseFloat((responseTransactionValue?.data?.A ?? 0).toFixed(2)), color: '#B1C29E' }, { name: 'Withdrawal Agent', value: parseFloat((responseTransactionValue?.data?.M ?? 0).toFixed(2)), color: '#FCE7C8' }, + { name: 'Top Up Agent', value: parseFloat((responseTransactionValue?.data?.O ?? 0).toFixed(2)), color: '#F0A04B' }, + { name: 'Transfer P24', value: parseFloat((responseTransactionValue?.data?.S ?? 0).toFixed(2)), color: '#FADA7A' }, + { name: 'Withdraw Merchant', value: parseFloat((responseTransactionValue?.data?.I ?? 0).toFixed(2)), color: '#B1C29E' }, + { name: 'Donation', value: parseFloat((responseTransactionValue?.data?.D ?? 0).toFixed(2)), color: '#FCE7C8' }, + { name: 'Fee', value: parseFloat((responseTransactionValue?.data?.F ?? 0).toFixed(2)), color: '#F0A04B' }, + { name: 'Reversal', value: parseFloat((responseTransactionValue?.data?.V ?? 0).toFixed(2)), color: '#FADA7A' }, + { name: 'Cashback Cash', value: parseFloat((responseTransactionValue?.data?.C ?? 0).toFixed(2)), color: '#B1C29E' }, + { name: 'Cashback Point', value: parseFloat((responseTransactionValue?.data?.H ?? 0).toFixed(2)), color: '#FCE7C8' }, ]; return ( diff --git a/src/pages/dashboards/home/blocks/TransactionValue.tsx b/src/pages/dashboards/home/blocks/TransactionValue.tsx index 3892b15..97f1fc8 100644 --- a/src/pages/dashboards/home/blocks/TransactionValue.tsx +++ b/src/pages/dashboards/home/blocks/TransactionValue.tsx @@ -71,7 +71,7 @@ const TransactionValue = ({ startdate, enddate }: Props) => { type = "Purchase Loja" break; case "B": - type ="Top Up P24"; + type = "Top Up P24"; break; case "A": type = " Transfer Agent"; @@ -79,6 +79,30 @@ const TransactionValue = ({ startdate, enddate }: Props) => { case "M": type = "Withdrawal Agent"; break; + case 'O': + type = 'TOP UP AGENT'; + break; + case 'S': + type = 'TRANSFER P24'; + break; + case 'I': + type = 'WIJTDRAW MERCHANT'; + break; + case 'D': + type = 'DONATION'; + break; + case 'F': + type = 'FEE'; + break; + case 'V': + type = 'REVERSAL'; + break; + case 'C': + type = 'CASHBACK CASH'; + break; + case 'H': + type = 'CASHBACK POINT'; + break; default: type = "Unknown"; break; diff --git a/src/pages/disbursement/history-transaction/blocks/UploadBatchDialog.tsx b/src/pages/disbursement/history-transaction/blocks/UploadBatchDialog.tsx index 15bc730..688d4ac 100644 --- a/src/pages/disbursement/history-transaction/blocks/UploadBatchDialog.tsx +++ b/src/pages/disbursement/history-transaction/blocks/UploadBatchDialog.tsx @@ -135,15 +135,11 @@ const UploadBatchDialog = () => { with_deleted: false, order_field: 'id', order_direction: 'ASC', - filter: JSON.stringify({}) + filter: JSON.stringify({ type: "D" }) }); - const validTypes = ['DM', 'DA', 'DE']; const records: TransferType[] = response?.data?.list ?? []; - - const filtered = records.filter((item) => validTypes.includes(item.type)); - - setTransferTypes(filtered); + setTransferTypes(records); } catch (error) { console.error('Failed to fetch transfer types', error); } @@ -225,7 +221,7 @@ const UploadBatchDialog = () => { setFormField((prev) => ({ ...prev, id_transaction_type: val })) } > - + @@ -256,4 +252,4 @@ const UploadBatchDialog = () => { ); }; -export { UploadBatchDialog }; +export { UploadBatchDialog }; \ No newline at end of file diff --git a/src/pages/master/walletRule/blocks/AddDialog.tsx b/src/pages/master/walletRule/blocks/AddDialog.tsx index c9e4d72..92c70cb 100644 --- a/src/pages/master/walletRule/blocks/AddDialog.tsx +++ b/src/pages/master/walletRule/blocks/AddDialog.tsx @@ -293,7 +293,7 @@ const AddDialog = () => {
{
row.credit_limit, id: 'credit_limit', - header: ({ column }) => , + header: ({ column }) => , enableSorting: true, enableHiding: false, cell: ({ row }) => currencyFormat(row.original.credit_limit), diff --git a/src/pages/notification/blocks/ListToolbar.tsx b/src/pages/notification/blocks/ListToolbar.tsx index 3aca567..9676676 100644 --- a/src/pages/notification/blocks/ListToolbar.tsx +++ b/src/pages/notification/blocks/ListToolbar.tsx @@ -5,22 +5,23 @@ import { useCallback, useEffect, useState } from 'react'; import { toast } from 'sonner'; import { DateRangePicker } from '@/pages/dashboards/home/blocks'; -const formatDate = (date: Date): string => date.toISOString().split('T')[0]; +const formatDate = (date: Date): string => date.toLocaleDateString('sv-SE'); +const formatDateTime = (date: Date): string => date.toISOString(); +const getLocalDateString = (date: Date): string => { + return date.toLocaleDateString('sv-SE'); +}; const ListToolBar = () => { const { table, reload } = useDataGrid(); const { handleAddDialog } = useManageNotificationContext(); - const [dateRange, setDateRange] = useState({ from: '', to: '' }); + const [dateRange, setDateRange] = useState({ + from: getLocalDateString(new Date()), + to: getLocalDateString(new Date()) + }); const [searchValue, setSearchValue] = useState( (table.getColumn('content')?.getFilterValue() as string) ?? '' ); - useEffect(() => { - const today = new Date(); - const formatted = formatDate(today); - setDateRange({ from: formatted, to: formatted }); - }, []); - useEffect(() => { const timer = setTimeout(() => { table.getColumn('content')?.setFilterValue(searchValue); @@ -31,13 +32,25 @@ const ListToolBar = () => { useEffect(() => { const today = new Date(); - const formatted = formatDate(today); - const initialDateRange = { from: formatted, to: formatted }; + // Set waktu ke awal hari (00:00:00) + const startOfDay = new Date(today); + startOfDay.setHours(0, 0, 0, 0); + // Set waktu ke akhir hari (23:59:59) + const endOfDay = new Date(today); + endOfDay.setHours(23, 59, 59, 999); + + const initialDateRange = { + from: formatDate(startOfDay), // << Gunakan formatDate di sini + to: formatDate(endOfDay) + }; setDateRange(initialDateRange); try { - table.getColumn('created_at')?.setFilterValue(initialDateRange); + table.getColumn('created_at')?.setFilterValue({ + from: formatDateTime(startOfDay), + to: formatDateTime(endOfDay) + }); } catch (error) { toast.error('Error applying initial date filter'); console.error('Initial date filter error:', error); @@ -46,16 +59,28 @@ const ListToolBar = () => { const handleClearAllFilters = () => { const today = new Date(); + + const startOfDay = new Date(today); + startOfDay.setHours(0, 0, 0, 0); + + const endOfDay = new Date(today); + endOfDay.setHours(23, 59, 59, 999); + + // Set ulang filter tanggal dengan waktu const resetDateRange = { - from: formatDate(today), - to: formatDate(today) + from: formatDate(startOfDay), // YYYY-MM-DD untuk input date + to: formatDate(endOfDay) }; setSearchValue(''); setDateRange(resetDateRange); table.getColumn('content')?.setFilterValue(''); - table.getColumn('created_at')?.setFilterValue(resetDateRange); + + table.getColumn('created_at')?.setFilterValue({ + from: formatDateTime(startOfDay), + to: formatDateTime(endOfDay) + }); setTimeout(() => { table.setPageIndex(0); @@ -75,9 +100,24 @@ const ListToolBar = () => { useEffect(() => { const checkNewDay = () => { const now = new Date(); - const formattedNow = formatDate(now); - if (formattedNow !== dateRange.from || formattedNow !== dateRange.to) { - setDateRange({ from: formattedNow, to: formattedNow }); + const currentDate = formatDate(now); // Tetap gunakan formatDate untuk perbandingan tanggal saja + + // Periksa apakah tanggal sekarang berbeda dengan tanggal yang difilter + if (currentDate !== formatDate(new Date(dateRange.from))) { + const startOfDay = new Date(now); + startOfDay.setHours(0, 0, 0, 0); + const endOfDay = new Date(now); + endOfDay.setHours(23, 59, 59, 999); + + setDateRange({ + from: formatDate(startOfDay), // hanya YYYY-MM-DD + to: formatDate(endOfDay) + }); + + table.getColumn('created_at')?.setFilterValue({ + from: formatDateTime(startOfDay), + to: formatDateTime(endOfDay) + }); } }; @@ -95,7 +135,16 @@ const ListToolBar = () => { type="date" placeholder="From" value={dateRange.from} - onChange={(event) => setDateRange({ ...dateRange, from: event.target.value })} + onChange={(e) => { + setDateRange({ ...dateRange, from: e.target.value }); + // Untuk filter, konversi ke Date object dengan waktu awal hari + const date = new Date(e.target.value); + date.setHours(0, 0, 0, 0); + table.getColumn('created_at')?.setFilterValue({ + from: date.toISOString(), + to: new Date(dateRange.to).toISOString() + }); + }} name="from" /> @@ -106,7 +155,16 @@ const ListToolBar = () => { type="date" placeholder="To" value={dateRange.to} - onChange={(event) => setDateRange({ ...dateRange, to: event.target.value })} + onChange={(e) => { + setDateRange({ ...dateRange, to: e.target.value }); + // Untuk filter, konversi ke Date object dengan waktu akhir hari + const date = new Date(e.target.value); + date.setHours(23, 59, 59, 999); + table.getColumn('created_at')?.setFilterValue({ + from: new Date(dateRange.from).toISOString(), + to: date.toISOString() + }); + }} name="to" /> diff --git a/src/pages/settings/user/manage-position/blocks/AddDialog.tsx b/src/pages/settings/user/manage-position/blocks/AddDialog.tsx index a0ea607..da73584 100644 --- a/src/pages/settings/user/manage-position/blocks/AddDialog.tsx +++ b/src/pages/settings/user/manage-position/blocks/AddDialog.tsx @@ -18,6 +18,7 @@ import { useCallApi } from '@/hooks'; import { Checkbox } from '@/components/ui/checkbox'; import { doSaveLogActivity } from '@/actions/GlobalActions'; import { set } from 'date-fns'; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; const API_URL = apiConfig.service_dashboard; @@ -61,7 +62,8 @@ const MenuItemComponent: React.FC<{ }; const initialState = { - name: '' + name: '', + status_balance: '', }; const AddDialog = () => { @@ -86,13 +88,15 @@ const AddDialog = () => { const [isSubmitting, setIsSubmitting] = useState(false); const resetForm = () => { - setFormField(() => ({ name: '' })); + setFormField(initialState); setErrors(() => ({})); setSelectMenus([]); }; const validateForm = () => { - const requiredFields = [{ key: 'name', label: 'Position Name' }]; + const requiredFields = [ + { key: 'name', label: 'Position Name' }, + { key: 'status_balance', label: 'Status Balance' }]; const newErrors: Record = {}; let isValid = true; requiredFields.forEach(({ key, label }) => { @@ -128,7 +132,8 @@ const AddDialog = () => { const response = await PostData(`${API_URL}/user_role/create`, { name: formField.name, roles: selectMenus, - status: 'Y' + status: 'Y', + status_balance: formField.status_balance }); if (response?.status) { @@ -203,6 +208,33 @@ const AddDialog = () => {
+
+
+ +
+ + {errors.status && ( + {errors.status} + )} +
+
+
{menus.map((menu) => ( diff --git a/src/pages/settings/user/manage-position/blocks/EditDialog.tsx b/src/pages/settings/user/manage-position/blocks/EditDialog.tsx index 0bcc443..88da385 100644 --- a/src/pages/settings/user/manage-position/blocks/EditDialog.tsx +++ b/src/pages/settings/user/manage-position/blocks/EditDialog.tsx @@ -79,11 +79,15 @@ const EditDialog = () => { const [selectMenus, setSelectMenus] = useState([]); const [formField, setFormField] = useState({ name: '', - status: '' + status: '', + status_balance: '' }); const [errors, setErrors] = useState>({}); const validateForm = () => { - const requiredFields = [{ key: 'name', label: 'Position Name' }]; + const requiredFields = [ + { key: 'name', label: 'Position Name' }, + { key: 'status_balance', label: 'Status Balance' } + ]; const newErrors: Record = {}; let isValid = true; requiredFields.forEach(({ key, label }) => { @@ -131,7 +135,8 @@ const EditDialog = () => { const response = await PutData(`${API_URL}/user_role/update/${selectedPosition.id}`, { name: formField.name, roles: selectMenus, - status: formField.status + status: formField.status, + status_balance: formField.status_balance }); if (response?.status) { @@ -163,7 +168,8 @@ const EditDialog = () => { setFormField((prev) => ({ ...prev, name: selectedPosition.name, - status: selectedPosition.status + status: selectedPosition.status, + status_balance: selectedPosition.status_balance })); setSelectMenus(selectedPosition.roles); @@ -236,6 +242,26 @@ const EditDialog = () => {
+
+
+ + +
+ +
+
+
{menus.map((menu) => ( diff --git a/src/pages/settings/user/manage-position/hooks/ManagePositionContext.tsx b/src/pages/settings/user/manage-position/hooks/ManagePositionContext.tsx index 1fa5c30..dc62bdc 100644 --- a/src/pages/settings/user/manage-position/hooks/ManagePositionContext.tsx +++ b/src/pages/settings/user/manage-position/hooks/ManagePositionContext.tsx @@ -23,6 +23,7 @@ interface selectedPosition { name: string; roles: string[]; status: string; + status_balance: string; } const initialProps: ContextProps = { diff --git a/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx b/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx index 03e2708..1378a2e 100644 --- a/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx +++ b/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx @@ -683,11 +683,11 @@ const DetailApprovalTransaction = () => { - + + - @@ -861,14 +861,14 @@ const DetailApprovalTransaction = () => { + - {transactionDetails?.p24 && transactionDetails?.p24.length > 0 ? ( - transactionDetails.p24.map((log: { status: string,request_endpoint: string, type: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => ( + transactionDetails.p24.map((log: { status: string, request_endpoint: string, type: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => ( + - diff --git a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx index 904d901..f9133d4 100644 --- a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx +++ b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx @@ -175,6 +175,24 @@ const DetailTransaction = () => { {/* )} */} + {transactionDetails?.kind == 'P' && ( + + )} + + {transactionDetails?.kind == 'P' && ( + + )} + + - @@ -922,14 +953,14 @@ const DetailTransaction = () => { + - {transactionDetails?.p24 && transactionDetails?.p24.length > 0 ? ( - transactionDetails.p24.map((log: { status: string,request_endpoint: string, type: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => ( + transactionDetails.p24.map((log: { status: string, request_endpoint: string, type: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => (
Transaction StatusStatus Request Date Response DateRequest Body Response BodyResponse Code Request Endpoint
Status Request Date Response DateRequest Body Response BodyResponse Code Request Endpoint
{(() => { @@ -912,6 +912,22 @@ const DetailApprovalTransaction = () => { hour12: false }) : ''} +
+                                                                    {(() => {
+                                                                        try {
+                                                                            if (log.request_body === null) {
+                                                                                return '';
+                                                                            }
+                                                                            const parsed = JSON.parse(log.request_body);
+                                                                            return JSON.stringify(parsed, null, 2) ?? '';
+                                                                        } catch (e) {
+                                                                            return log.request_body ?? ''; // fallback: tampilkan as-is jika gagal parse
+                                                                        }
+                                                                    })()}
+                                                                
+ +
                                                                     {(() => {
@@ -927,22 +943,7 @@ const DetailApprovalTransaction = () => {
                                                                     })()}
                                                                 
-
-                                                                    {(() => {
-                                                                        try {
-                                                                            if (log.request_body === null) {
-                                                                                return '';
-                                                                            }
-                                                                            const parsed = JSON.parse(log.request_body);
-                                                                            return JSON.stringify(parsed, null, 2) ?? '';
-                                                                        } catch (e) {
-                                                                            return log.response_body ?? ''; // fallback: tampilkan as-is jika gagal parse
-                                                                        }
-                                                                    })()}
-                                                                
-
{log.request_endpoint ?? ''}Status Request Date Response DateRequest Body Response BodyResponse Code Request Endpoint
Status Request Date Response DateRequest Body Response BodyResponse Code Request Endpoint
{(() => { @@ -992,10 +1023,10 @@ const DetailTransaction = () => {
                                                                     {(() => {
                                                                         try {
-                                                                            if (log.request_body === null) {
+                                                                            if (log.response_body === null) {
                                                                                 return '';
                                                                             }
-                                                                            const parsed = JSON.parse(log.request_body);
+                                                                            const parsed = JSON.parse(log.response_body);
                                                                             return JSON.stringify(parsed, null, 2) ?? '';
                                                                         } catch (e) {
                                                                             return log.response_body ?? ''; // fallback: tampilkan as-is jika gagal parse
diff --git a/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx b/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx
index bfd82a7..2a56ce4 100644
--- a/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx
+++ b/src/pages/transaction/history-transaction/blocks/ListToolbar.tsx
@@ -170,6 +170,7 @@ const ListToolbar = () => {
               
             
             
+
               TRANSFER
               PURCHASE
               WITHDRAW
@@ -181,6 +182,14 @@ const ListToolbar = () => {
               TOP UP P24
               TRANSFER AGENT
               WITHDRAWAL AGENT
+              TOP UP AGENT
+              TRANSFER P24
+              WITHDRAW MERCHANT
+              DONATION
+              FEE
+              REVERSAL
+              CASHBACK CASH
+              CASHBACK POINT
             
           
 
diff --git a/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx b/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx
index 8f2a12c..6069da8 100644
--- a/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx
+++ b/src/pages/transaction/history-transaction/hooks/TransactionContext.tsx
@@ -82,6 +82,14 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => {
             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 '_';
           }
         },
diff --git a/src/pages/transfer/transfertype/blocks/AddDialog.tsx b/src/pages/transfer/transfertype/blocks/AddDialog.tsx
index 8977d5c..c6790ec 100644
--- a/src/pages/transfer/transfertype/blocks/AddDialog.tsx
+++ b/src/pages/transfer/transfertype/blocks/AddDialog.tsx
@@ -568,6 +568,15 @@ const AddDialog = () => {
                           Top Up P24
                           Transfer Agent
                           Withdraw Agent
+                          Top Up Agent
+                          Transfer P24
+                          Withdraw Merchant
+                          Donation
+                          Fee
+                          Raversal
+                          Cashback Cash
+                          Cashback Point
+                          Withdraw Admin
                         
                       
                       {errors.status_kind && (
diff --git a/src/pages/transfer/transfertype/blocks/EditDialog.tsx b/src/pages/transfer/transfertype/blocks/EditDialog.tsx
index a9c771c..8a15db6 100644
--- a/src/pages/transfer/transfertype/blocks/EditDialog.tsx
+++ b/src/pages/transfer/transfertype/blocks/EditDialog.tsx
@@ -766,7 +766,16 @@ const EditDialog = () => {
                               Top Up P24
                               Transfer Agent
                               Withdraw Agent
-                            
+                              Top Up Agent
+                              Transfer P24
+                              Withdraw Merchant
+                              Donation
+                              Fee
+                              Raversal
+                              Cashback Cash
+                              Cashback Point
+                              Withdraw Admin
+                            {' '}
                           
                           {errors.status_kind && (
                             {errors.status_kind}
diff --git a/src/pages/transfer/transfertype/blocks/ListToolBar.tsx b/src/pages/transfer/transfertype/blocks/ListToolBar.tsx
index b281c29..832c484 100644
--- a/src/pages/transfer/transfertype/blocks/ListToolBar.tsx
+++ b/src/pages/transfer/transfertype/blocks/ListToolBar.tsx
@@ -62,14 +62,14 @@ const ListToolbar = () => {
 
   const handleKeyDown = (event: React.KeyboardEvent) => {
     if (event.key === 'Enter') {
-      table.getColumn('name')?.setFilterValue(searchValue);
+table.getColumn('name')?.setFilterValue(`%${searchValue}%`);
       table.setPageIndex(0);
     }
   };
 
   useEffect(() => {
     const timer = setTimeout(() => {
-      table.getColumn('name')?.setFilterValue(searchValue);
+table.getColumn('name')?.setFilterValue(`%${searchValue}%`);
       table.setPageIndex(0);
     }, 200);
     return () => clearTimeout(timer);
@@ -210,6 +210,15 @@ const ListToolbar = () => {
                   Top Up P24
                   Transfer Agent
                   Withdraw Agent
+                  Top Up Agent
+                  Transfer P24
+                  Withdraw Merchant
+                  Donation
+                  Fee
+                  Raversal
+                  Cashback Cash
+                  Cashback Point
+                  Withdraw Admin
                 
               
             
diff --git a/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx b/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx
index 736d83b..569156e 100644
--- a/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx
+++ b/src/pages/transfer/transfertype/hooks/ManageTransferTypeContext.tsx
@@ -34,8 +34,8 @@ const formatInteger = (num: number): string => {
   return num.toLocaleString('en-US', {
     style: 'decimal',
     maximumFractionDigits: 0
-  })
-}
+  });
+};
 
 interface AccountProps {
   id: string;
@@ -224,9 +224,9 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
             TM: 'Top Up Master Agent',
             TA: 'Top Up Agent',
             PL: 'Purchase Loja',
-            DE: 'Disbursment Escrow',
-            DM: 'Disbursment Master Agent',
-            DA: 'Disbursment Agent',
+            DE: 'Disbursement Escrow',
+            DM: 'Disbursement Master Agent',
+            DA: 'Disbursement Agent',
             WI: 'Withdraw Merchant',
             IC: 'Income Merchant',
             DN: 'Donation'
@@ -287,7 +287,16 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
             L: { label: 'Purchase Loja', className: 'bg-rose-100 text-rose-600' },
             B: { label: 'Top Up P24', className: 'bg-rose-100 text-rose-600' },
             A: { label: 'Transfer Agent', className: 'bg-rose-100 text-rose-600' },
-            M: { label: 'Withdraw Agent', className: 'bg-rose-100 text-rose-600' }
+            M: { label: 'Withdraw Agent', className: 'bg-rose-100 text-rose-600' },
+            O: { label: 'Top Up Agent', className: 'bg-rose-100 text-rose-600' },
+            S: { label: 'Transfer P24', className: 'bg-rose-100 text-rose-600' },
+            I: { label: 'Withdraw Merchant', className: 'bg-rose-100 text-rose-600' },
+            D: { label: 'Donation', className: 'bg-rose-100 text-rose-600' },
+            F: { label: 'Fee', className: 'bg-rose-100 text-rose-600' },
+            V: { label: 'Raversal', className: 'bg-rose-100 text-rose-600' },
+            C: { label: 'Cashback Cash', className: 'bg-rose-100 text-rose-600' },
+            H: { label: 'Cashback Point', className: 'bg-rose-100 text-rose-600' },
+            J: { label: 'Withdraw Admin', className: 'bg-rose-100 text-rose-600' },
           };
 
           const kindInfo = mapping[kind] || {
@@ -366,7 +375,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
     let filterObject: Record = {};
 
     if (debouncedSearchTerm) {
-      filterObject['any'] = debouncedSearchTerm.toLowerCase();
+      filterObject['name'] = `%${debouncedSearchTerm.toLowerCase()}%`;
     }
 
     if (columnFilters.length > 0) {
diff --git a/src/pages/wallet/wallet-history/WalletHistory.tsx b/src/pages/wallet/wallet-history/WalletHistory.tsx
index d914746..641ba29 100644
--- a/src/pages/wallet/wallet-history/WalletHistory.tsx
+++ b/src/pages/wallet/wallet-history/WalletHistory.tsx
@@ -7,11 +7,11 @@ const WalletHistory = () => {
   return (
     <>
       
-        TPAY | Wallet History
+        TPAY | Wallet Statement
       
       
         
-          

Wallet History

+

Wallet Statement

Dashboard @@ -22,7 +22,7 @@ const WalletHistory = () => { - Wallet History + Wallet Statement diff --git a/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx b/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx index 6eb8298..44ccbb8 100644 --- a/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx +++ b/src/pages/wallet/wallet-history/blocks/ListToolbar.tsx @@ -38,7 +38,6 @@ const ListToolbar = () => { const [searchValue, setSearchValue] = useState( (table.getColumn('msisdn')?.getFilterValue() as string) ?? '' ); - const [dateRange, setDateRange] = useState({ from: '', to: '' }); const [walletId, setWalletId] = useState( (table.getColumn('id_wallet')?.getFilterValue() as string) ?? '' ); @@ -48,12 +47,6 @@ const ListToolbar = () => { const [wallets, setWallets] = useState([]); const [groups, setGroups] = useState([]); - useEffect(() => { - const today = new Date(); - const threeMonthsAgo = getOneMonthsAgo(); - setDateRange({ from: formatDate(threeMonthsAgo), to: formatDate(today) }); - }, []); - useEffect(() => { const timer = setTimeout(() => { table.getColumn('msisdn')?.setFilterValue(searchValue); @@ -62,15 +55,6 @@ const ListToolbar = () => { return () => clearTimeout(timer); }, [searchValue, table]); - const handleFilterByDate = useCallback(() => { - try { - table.getColumn('CreatedAt')?.setFilterValue(dateRange); - } catch (error) { - toast.error('Error applying date filter'); - console.error('Error applying date filter:', error); - } - }, [dateRange, table]); - useEffect(() => { table.getColumn('id_wallet')?.setFilterValue(walletId); table.setPageIndex(0); @@ -81,12 +65,6 @@ const ListToolbar = () => { table.setPageIndex(0); }, [groupId, table]); - useEffect(() => { - if (dateRange.from && dateRange.to) { - handleFilterByDate(); - } - }, [dateRange, handleFilterByDate]); - const fetchWallets = async () => { try { const response = await GetData(`${API_URL_WALLET}/dashboard/wallet/`, { @@ -129,23 +107,22 @@ const ListToolbar = () => { from: formatDate(oneMonthAgo), to: formatDate(today) }; - + 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(() => { table.setPageIndex(0); reload(); }, 0); }; - + const handleRefresh = () => { const today = new Date(); const threeMonthsAgo = getOneMonthsAgo(); @@ -157,7 +134,6 @@ const ListToolbar = () => { setSearchValue(''); setWalletId(''); setGroupId(''); - setDateRange(resetDateRange); table.setColumnFilters([{ id: 'CreatedAt', value: resetDateRange }]); table.setPageIndex(0); @@ -169,24 +145,6 @@ const ListToolbar = () => {
- - - -