fixing transactionfee

This commit is contained in:
bagusajisaputroo
2025-04-14 12:07:54 +07:00
parent ab7a8bab9e
commit 3bbea4bff7
3 changed files with 125 additions and 52 deletions

View File

@ -181,7 +181,30 @@ const ManageTransferFeeContextProvider = ({ children }: { children: React.ReactN
meta: { headerClassName: 'w-[250px]' }
},
{
accessorFn: (row) => row.credit_destination?.fullname,
accessorFn: (row: { credit_to: string }) => {
const mapping: Record<string, string> = {
D: 'Destination Member',
S: 'Source Member',
I: 'Input Customer'
};
return mapping[row.credit_to] || 'Unknown';
},
id: 'credit_to',
header: ({ column }) => (
<DataGridColumnHeader title="Credit To" column={column} />
),
enableSorting: true,
enableHiding: false,
meta: { headerClassName: 'w-[250px]' }
},
{
accessorFn: (row) => {
if (row.credit_to === 'S' || row.credit_to === 'D' || !row.credit_destination) {
return 'N/A';
}
return row.credit_destination?.fullname;
},
id: 'credit_destination',
header: ({ column }) => <DataGridColumnHeader title="Credit Destination" column={column} />,
enableSorting: true,
@ -196,37 +219,102 @@ const ManageTransferFeeContextProvider = ({ children }: { children: React.ReactN
enableHiding: false,
meta: { headerClassName: 'w-[250px]' }
},
{
accessorFn: (row: { deduct_from: string }) => {
const mapping: Record<string, string> = {
D: 'Destination Member',
S: 'Source Member',
};
return mapping[row.deduct_from];
},
id: 'deduct_from',
header: ({ column }) => (
<DataGridColumnHeader title="Deduct From" column={column} />
),
enableSorting: true,
enableHiding: false,
meta: { headerClassName: 'w-[250px]' }
},
{
accessorFn: (row) => row.deduct_from_account?.description,
id: 'deduct_from_account',
header: ({ column }) => <DataGridColumnHeader title="Credit Destination Account" column={column} />,
header: ({ column }) => <DataGridColumnHeader title="Deduct From Account" column={column} />,
enableSorting: true,
enableHiding: false,
meta: { headerClassName: 'w-[250px]' }
},
{
accessorFn: (row) => row.priority,
id: 'priority',
header: ({ column }) => <DataGridColumnHeader title="Priority" column={column} />,
enableSorting: true,
enableHiding: false,
cell: ({ row }) => {
const isActive = row.original.priority === 'Y';
return (
<span
className={`px-2 py-1 text-xs font-semibold rounded-full ${
isActive ? 'bg-green-100 text-green-600' : 'bg-red-100 text-red-600'
}`}
>
{isActive ? 'Yes' : 'No'}
</span>
);
},
meta: {
headerClassName: 'w-[100px]',
cellClassName: 'text-center'
}
},
{
accessorFn: (row) => (row.priority === 'Y' ? 'Yes' : 'No'),
id: 'priority',
header: ({ column }) => <DataGridColumnHeader title="Priority" column={column} />,
enableSorting: true,
enableHiding: false,
meta: { headerClassName: 'w-[100px]' }
},
{
accessorFn: (row) => (row.status === 'Y' ? 'Active' : 'Inactive'),
accessorFn: (row) => row.status,
id: 'status',
header: ({ column }) => <DataGridColumnHeader title="Status" column={column} />,
enableSorting: true,
enableHiding: false,
meta: { headerClassName: 'w-[150px]' }
cell: ({ row }) => {
const isActive = row.original.status === 'Y';
return (
<span
className={`px-2 py-1 text-xs font-semibold rounded-full ${
isActive ? 'bg-green-100 text-green-600' : 'bg-red-100 text-red-600'
}`}
>
{isActive ? 'Active' : 'Inactive'}
</span>
);
},
meta: {
headerClassName: 'w-[100px]',
cellClassName: 'text-center'
}
},
{
accessorFn: (row) => (row.status_include === 'Y' ? 'Yes' : 'No'),
accessorFn: (row) => row.status_include,
id: 'status_include',
header: ({ column }) => <DataGridColumnHeader title="Status Include" column={column} />,
enableSorting: true,
enableHiding: false,
meta: { headerClassName: 'w-[150px]' }
cell: ({ row }) => {
const isActive = row.original.status_include === 'Y';
return (
<span
className={`px-2 py-1 text-xs font-semibold rounded-full ${
isActive ? 'bg-green-100 text-green-600' : 'bg-red-100 text-red-600'
}`}
>
{isActive ? 'Yes' : 'No'}
</span>
);
},
meta: {
headerClassName: 'w-[100px]',
cellClassName: 'text-center'
}
},
{
id: 'actions',