rename entity on transfer
This commit is contained in:
@ -51,7 +51,7 @@ interface TransferType {
|
||||
walletOriginId: string;
|
||||
walletDestinationId: string;
|
||||
status: string;
|
||||
TransactionType_type: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface ContextProps {
|
||||
@ -134,7 +134,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
const columns = useMemo<ColumnDef<any>[]>(
|
||||
() => [
|
||||
{
|
||||
accessorFn: (row) => row.TransactionType_id,
|
||||
accessorFn: (row) => row.id,
|
||||
id: 'id',
|
||||
header: ({ column }) => (
|
||||
<DataGridColumnHeader title="Transaction Type ID" column={column} />
|
||||
@ -144,7 +144,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.TransactionType_name,
|
||||
accessorFn: (row) => row.name,
|
||||
id: 'name',
|
||||
header: ({ column }) => (
|
||||
<DataGridColumnHeader title="Transaction Type Name" column={column} />
|
||||
@ -154,7 +154,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.TransactionType_description,
|
||||
accessorFn: (row) => row.description,
|
||||
id: 'description',
|
||||
header: ({ column }) => <DataGridColumnHeader title="Description" column={column} />,
|
||||
enableSorting: false,
|
||||
@ -162,7 +162,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.WalletOrigin_name || 'N/A',
|
||||
accessorFn: (row) => row.wallet_origin?.name || 'N/A',
|
||||
id: 'wallet_origin',
|
||||
header: ({ column }) => <DataGridColumnHeader title="From Account" column={column} />,
|
||||
enableSorting: false,
|
||||
@ -170,7 +170,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.WalletDestination_name || 'N/A',
|
||||
accessorFn: (row) => row.wallet_destination.name || 'N/A',
|
||||
id: 'wallet_destination',
|
||||
header: ({ column }) => <DataGridColumnHeader title="To Account" column={column} />,
|
||||
enableSorting: false,
|
||||
@ -178,36 +178,36 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.TransactionType_maximum_amount,
|
||||
accessorFn: (row) => row.maximum_amount,
|
||||
id: 'maximum_amount',
|
||||
header: ({ column }) => <DataGridColumnHeader title="Maximum Amount" column={column} />,
|
||||
cell: ({ row }) => formatNumber(row.original.TransactionType_maximum_amount),
|
||||
cell: ({ row }) => formatNumber(row.original.maximum_amount),
|
||||
enableSorting: false,
|
||||
enableHiding: false,
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.TransactionType_minimum_amount,
|
||||
accessorFn: (row) => row.minimum_amount,
|
||||
id: 'minimum_amount',
|
||||
header: ({ column }) => <DataGridColumnHeader title="Minimum Amount" column={column} />,
|
||||
cell: ({ row }) => formatNumber(row.original.TransactionType_minimum_amount),
|
||||
cell: ({ row }) => formatNumber(row.original.minimum_amount),
|
||||
enableSorting: false,
|
||||
enableHiding: false,
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.TransactionType_max_transaction_per_day,
|
||||
accessorFn: (row) => row.max_transaction_per_day,
|
||||
id: 'max_transaction_per_day',
|
||||
header: ({ column }) => (
|
||||
<DataGridColumnHeader title="Max Transaction Per Day" column={column} />
|
||||
),
|
||||
cell: ({ row }) => formatInteger(row.original.TransactionType_max_transaction_per_day),
|
||||
cell: ({ row }) => formatInteger(row.original.max_transaction_per_day),
|
||||
enableSorting: false,
|
||||
enableHiding: false,
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row: { TransactionType_type: string }) => {
|
||||
accessorFn: (row: { type: string }) => {
|
||||
const mapping: Record<string, string> = {
|
||||
D: 'Disbursement',
|
||||
O: 'Other',
|
||||
@ -232,7 +232,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
DN: 'Donation'
|
||||
};
|
||||
|
||||
return mapping[row.TransactionType_type] || 'Unknown';
|
||||
return mapping[row.type] || 'Unknown';
|
||||
},
|
||||
id: 'type',
|
||||
header: ({ column }) => (
|
||||
@ -244,7 +244,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
},
|
||||
|
||||
{
|
||||
accessorFn: (row) => row.TransactionType_status,
|
||||
accessorFn: (row) => row.status,
|
||||
id: 'status',
|
||||
header: ({ column }) => <DataGridColumnHeader title="Status" column={column} />,
|
||||
enableSorting: false,
|
||||
@ -267,15 +267,14 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
cellClassName: 'text-center'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
accessorFn: (row) => row.TransactionType_status_kind,
|
||||
accessorFn: (row) => row.status_kind,
|
||||
id: 'status_kind',
|
||||
header: ({ column }) => <DataGridColumnHeader title="Status Kind" column={column} />,
|
||||
enableSorting: false,
|
||||
enableHiding: false,
|
||||
cell: ({ row }) => {
|
||||
const kind = row.original.TransactionType_status_kind;
|
||||
const kind = row.original.status_kind;
|
||||
|
||||
const mapping: Record<string, { label: string; className: string }> = {
|
||||
R: { label: 'Return', className: 'bg-blue-100 text-blue-600' },
|
||||
@ -314,7 +313,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
meta: { headerClassName: 'w-[250px]', cellClassName: 'text-center' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.TransactionType_status_approval,
|
||||
accessorFn: (row) => row.status_approval,
|
||||
id: 'status_approval',
|
||||
header: ({ column }) => <DataGridColumnHeader title="Approval Status" column={column} />,
|
||||
enableSorting: false,
|
||||
@ -345,13 +344,13 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
<>
|
||||
<button
|
||||
className="btn btn-sm btn-icon btn-clear btn-light"
|
||||
onClick={() => handleEditDialog(true, row.TransactionType_id)}
|
||||
onClick={() => handleEditDialog(true, row.id)}
|
||||
>
|
||||
<KeenIcon icon="notepad-edit" />
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-sm btn-icon btn-clear btn-light"
|
||||
onClick={() => handleDeleteDialog(true, row.TransactionType_id)}
|
||||
onClick={() => handleDeleteDialog(true, row.id)}
|
||||
>
|
||||
<KeenIcon icon="trash" />
|
||||
</button>
|
||||
@ -363,7 +362,7 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
],
|
||||
[handleEditDialog, handleDeleteDialog]
|
||||
);
|
||||
// console.log(selectedTransferType)
|
||||
|
||||
const doGetTransferTypeListData = async (
|
||||
page: number,
|
||||
limit: number,
|
||||
@ -401,7 +400,6 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const response = await GetData(`${API_URL}/transactiontype/list`, {
|
||||
limit: limit,
|
||||
page: page + 1,
|
||||
|
||||
Reference in New Issue
Block a user