Merge branch 'master' of https://git.shiblysolution.id/TPAY/dashboard
This commit is contained in:
@ -13,20 +13,6 @@ export type Group = {
|
||||
};
|
||||
|
||||
export const getColumns = (handleUpdate: (data: any) => void): ColumnDef<Group>[] => [
|
||||
{
|
||||
accessorKey: 'no',
|
||||
header: ({ column }) => {
|
||||
return (
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
||||
>
|
||||
ID
|
||||
<ArrowUpDown className="ml-2 h-4 w-4" />
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
accessorKey: 'created_at',
|
||||
header: ({ column }) => {
|
||||
|
||||
@ -79,6 +79,14 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo
|
||||
[]
|
||||
);
|
||||
|
||||
const currencyFormat = (value: number) =>
|
||||
new Intl.NumberFormat('en-US', {
|
||||
style: 'currency',
|
||||
currency: 'USD',
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 0
|
||||
}).format(value);
|
||||
|
||||
const columns = useMemo<ColumnDef<any>[]>(
|
||||
() => [
|
||||
{
|
||||
@ -87,9 +95,7 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo
|
||||
header: ({ column }) => <DataGridColumnHeader title="Wallet Name" column={column} />,
|
||||
enableSorting: true,
|
||||
enableHiding: false,
|
||||
meta: {
|
||||
headerClassName: 'w-[250px]'
|
||||
}
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.group.name,
|
||||
@ -97,9 +103,7 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo
|
||||
header: ({ column }) => <DataGridColumnHeader title="Group Name" column={column} />,
|
||||
enableSorting: true,
|
||||
enableHiding: false,
|
||||
meta: {
|
||||
headerClassName: 'w-[250px]'
|
||||
}
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.balance_minimum,
|
||||
@ -107,9 +111,8 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo
|
||||
header: ({ column }) => <DataGridColumnHeader title="Balance Minimum" column={column} />,
|
||||
enableSorting: true,
|
||||
enableHiding: false,
|
||||
meta: {
|
||||
headerClassName: 'w-[250px]'
|
||||
}
|
||||
cell: ({ row }) => currencyFormat(row.original.balance_minimum),
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.balance_maximum,
|
||||
@ -117,9 +120,8 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo
|
||||
header: ({ column }) => <DataGridColumnHeader title="Balance Maximum" column={column} />,
|
||||
enableSorting: true,
|
||||
enableHiding: false,
|
||||
meta: {
|
||||
headerClassName: 'w-[250px]'
|
||||
}
|
||||
cell: ({ row }) => currencyFormat(row.original.balance_maximum),
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.credit_limit,
|
||||
@ -127,9 +129,8 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo
|
||||
header: ({ column }) => <DataGridColumnHeader title="Credit Limit" column={column} />,
|
||||
enableSorting: true,
|
||||
enableHiding: false,
|
||||
meta: {
|
||||
headerClassName: 'w-[250px]'
|
||||
}
|
||||
cell: ({ row }) => currencyFormat(row.original.credit_limit),
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.max_transaction_per_day,
|
||||
@ -139,9 +140,8 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo
|
||||
),
|
||||
enableSorting: true,
|
||||
enableHiding: false,
|
||||
meta: {
|
||||
headerClassName: 'w-[250px]'
|
||||
}
|
||||
cell: ({ row }) => currencyFormat(row.original.max_transaction_per_day),
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.monthly_limit,
|
||||
@ -149,9 +149,8 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo
|
||||
header: ({ column }) => <DataGridColumnHeader title="Monthly Limit" column={column} />,
|
||||
enableSorting: true,
|
||||
enableHiding: false,
|
||||
meta: {
|
||||
headerClassName: 'w-[250px]'
|
||||
}
|
||||
cell: ({ row }) => currencyFormat(row.original.monthly_limit),
|
||||
meta: { headerClassName: 'w-[250px]' }
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.status,
|
||||
@ -161,7 +160,6 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo
|
||||
enableHiding: false,
|
||||
cell: ({ row }) => {
|
||||
const isActive = row.original.status === 'Y';
|
||||
|
||||
return (
|
||||
<span
|
||||
className={`px-2 py-1 text-xs font-semibold rounded-full ${
|
||||
@ -192,12 +190,6 @@ const ManageWalletRuleContextProvider = ({ children }: { children: React.ReactNo
|
||||
>
|
||||
<KeenIcon icon="notepad-edit" />
|
||||
</button>
|
||||
{/* <button
|
||||
className="btn btn-sm btn-icon btn-clear btn-light"
|
||||
onClick={() => handleDeleteDialog(true, row)}
|
||||
>
|
||||
<KeenIcon icon="trash" />
|
||||
</button> */}
|
||||
</>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user