From 7f9692a3d9f84bd99b23ac31583e858db5b65e7d Mon Sep 17 00:00:00 2001 From: Joao Ramos Date: Sat, 23 Dec 2023 14:38:18 +0000 Subject: [PATCH 1/2] Replaced display of payment id with corporate's id --- src/pages/payment-record.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/payment-record.tsx b/src/pages/payment-record.tsx index e123779f..bb685ea6 100644 --- a/src/pages/payment-record.tsx +++ b/src/pages/payment-record.tsx @@ -415,8 +415,8 @@ export default function PaymentRecord() { return []; }; const defaultColumns = [ - columnHelper.accessor("id", { - header: "ID", + columnHelper.accessor("corporate", { + header: "Corporate ID", cell: (info) => info.getValue(), }), columnHelper.accessor("corporate", { From 9e23e3e608e7c5f406b78e444ae1ac40e0c84589 Mon Sep 17 00:00:00 2001 From: Joao Ramos Date: Thu, 28 Dec 2023 18:28:18 +0000 Subject: [PATCH 2/2] Added support for currency in the CSV --- src/pages/payment-record.tsx | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/pages/payment-record.tsx b/src/pages/payment-record.tsx index dcc7ed50..74702e6d 100644 --- a/src/pages/payment-record.tsx +++ b/src/pages/payment-record.tsx @@ -486,8 +486,7 @@ export default function PaymentRecord() { case 'amount': { const value = info.getValue(); const numberValue = toFixedNumber(value, 2) - const currency = CURRENCIES.find((x) => x.currency === info.row.original.currency)?.label - return { value: `${numberValue} ${currency}` }; + return { value: numberValue } } case 'date': { const value = info.getValue(); @@ -501,6 +500,11 @@ export default function PaymentRecord() { value: user?.corporateInformation.companyInformation.name || user?.name, }; } + case 'currency': { + return { + value: info.row.original.currency, + }; + } case 'isPaid': case 'corporateId': default: { @@ -550,7 +554,9 @@ export default function PaymentRecord() { id: "amount", cell: (info) => { const { value } = columHelperValue(info.column.id, info); - return {value}; + const currency = CURRENCIES.find((x) => x.currency === info.row.original.currency)?.label + const finalValue = `${value} ${currency}`; + return {finalValue}; } }), columnHelper.accessor("agent", { @@ -580,7 +586,9 @@ export default function PaymentRecord() { id: "agentValue", cell: (info) => { const { value } = columHelperValue(info.column.id, info); - return {value}; + const currency = CURRENCIES.find((x) => x.currency === info.row.original.currency)?.label + const finalValue = `${value} ${currency}`; + return {finalValue}; }, }), columnHelper.accessor("isPaid", { @@ -678,7 +686,6 @@ export default function PaymentRecord() { const data = whitelistedColumns.map((data) => ({ key: data.column.columnDef.id, label: data.column.columnDef.header, - index: data.index, })) as SimpleCSVColumn[]; return [ @@ -688,12 +695,19 @@ export default function PaymentRecord() { }, []); const { rows } = table.getRowModel(); - + + const finalColumns = [ + ...columns, + { + key: 'currency', + label: 'Currency', + }, + ]; return { - columns, - rows: rows.map((row) => { - return columns.reduce((accm, { key, index }) => { + columns: finalColumns, + rows: rows.map((row) => { + return finalColumns.reduce((accm, { key }) => { const { value } = columHelperValue(key, { row, getValue: () => row.getValue(key),