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