diff --git a/src/pages/account/manage-currency/blocks/ListToolBar.tsx b/src/pages/account/manage-currency/blocks/ListToolBar.tsx index aa01dbb..53af0d6 100644 --- a/src/pages/account/manage-currency/blocks/ListToolBar.tsx +++ b/src/pages/account/manage-currency/blocks/ListToolBar.tsx @@ -15,7 +15,7 @@ const ListToolbar = () => { table.getColumn('name')?.setFilterValue(event.target.value)} /> diff --git a/src/pages/account/manage-currency/hooks/ManageCurrencyContext.tsx b/src/pages/account/manage-currency/hooks/ManageCurrencyContext.tsx index e4bb43b..c5cd102 100644 --- a/src/pages/account/manage-currency/hooks/ManageCurrencyContext.tsx +++ b/src/pages/account/manage-currency/hooks/ManageCurrencyContext.tsx @@ -3,7 +3,7 @@ import { Toaster } from '@/components/ui/sonner'; import { apiConfig } from '@/config/api.config'; import { useCallApi } from '@/hooks'; import { ColumnDef } from '@tanstack/react-table'; -import { createContext, useCallback, useMemo, useState } from 'react'; +import { createContext, useCallback, useEffect, useMemo, useState } from 'react'; import ListToolbar from '../blocks/ListToolBar'; interface SelectedUser { @@ -56,6 +56,52 @@ const ManageCurrencyContextProvider = ({ children }: { children: React.ReactNode const [currencies, setCurrencies] = useState([]); const { GetData } = useCallApi(); + useEffect(() => { + const dummyData: CurrencyProps[] = [ + { + id: '1', + name: 'US Dollar', + code: 'USD', + prefix: '$', + trailer: '', + format: '#,##0.00', + grouping_separator: ',', + decimal_separator: '.' + }, + { + id: '2', + name: 'Euro', + code: 'EUR', + prefix: '€', + trailer: '', + format: '#.##0,00', + grouping_separator: '.', + decimal_separator: ',' + }, + { + id: '3', + name: 'Japanese Yen', + code: 'JPY', + prefix: '¥', + trailer: '', + format: '#,##0', + grouping_separator: ',', + decimal_separator: '.' + }, + { + id: '4', + name: 'Indonesia Rupiah', + code: 'IDR', + prefix: 'Rp', + trailer: '', + format: '#,##0', + grouping_separator: '.', + decimal_separator: ',' + } + ]; + setCurrencies(dummyData); + }, []); + const handleEditDialog = useCallback((show: boolean, selected_user: string | null) => { setSelectedUser(show ? selected_user : null); setShowEditDialog(show); @@ -108,7 +154,7 @@ const ManageCurrencyContextProvider = ({ children }: { children: React.ReactNode } }, { - accessorFn: (row) => row.Trailer, + accessorFn: (row) => row.trailer, id: 'trailer', header: ({ column }) => , enableSorting: true, @@ -171,11 +217,11 @@ const ManageCurrencyContextProvider = ({ children }: { children: React.ReactNode ], [handleAddDialog, handleEditDialog] ); - + console.log(currencies); return (
-

Manage Access Type

+

Manage Currency

- } - sorting={[{ id: 'id', desc: true }]} - serverSide={true} - > - {children} - + + {currencies.length > 0 ? ( + } + sorting={[{ id: 'id', desc: true }]} + serverSide={true} + > + {children} + + ) : ( +

loading

+ )}
);