update detail transaction and transaction list
This commit is contained in:
@ -72,8 +72,12 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
}
|
||||
},
|
||||
{
|
||||
accessorFn: (row) =>
|
||||
new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(row.purchase.amount),
|
||||
accessorFn: (row) => {
|
||||
const purchaseAmount = row?.purchase?.amount;
|
||||
const transferAmount = row?.transfer?.amount;
|
||||
|
||||
return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(purchaseAmount ?? transferAmount ?? 0);
|
||||
},
|
||||
id: 'amount',
|
||||
header: ({ column }) => <DataGridColumnHeader title="Amount" column={column} />,
|
||||
enableSorting: false,
|
||||
@ -84,19 +88,13 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => {
|
||||
let fee;
|
||||
if (row.kind === 'P') {
|
||||
fee = row.purchase.fee_amount;
|
||||
} else {
|
||||
fee = row.transfer.fee_amount;
|
||||
}
|
||||
return fee.toLocaleString('en-US', {
|
||||
style: 'currency',
|
||||
currency: 'USD',
|
||||
});
|
||||
const purchaseAmount = row?.purchase?.fee_amount;
|
||||
const transferAmount = row?.transfer?.fee_amount;
|
||||
|
||||
return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(purchaseAmount ?? transferAmount ?? 0);
|
||||
},
|
||||
accessorKey: 'fee',
|
||||
header: ({ column }) => <DataGridColumnHeader title="Fee" column={column} />,
|
||||
id: 'feeamount',
|
||||
header: ({ column }) => <DataGridColumnHeader title="Fee Amount" column={column} />,
|
||||
enableSorting: false,
|
||||
enableHiding: false,
|
||||
meta: {
|
||||
@ -152,8 +150,8 @@ const TransactionProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const row = data.row.original;
|
||||
return (
|
||||
<div key={`actions-${row.id}`}>
|
||||
<button
|
||||
className="btn btn-sm btn-icon btn-clear btn-light"
|
||||
<button
|
||||
className="btn btn-sm btn-icon btn-clear btn-light"
|
||||
onClick={() => {
|
||||
setSelectedTransactionId(row.id);
|
||||
setShowDetailDialog(true);
|
||||
|
||||
Reference in New Issue
Block a user