From bbb23f3bbfea81ddd25582872945442ca3a91845 Mon Sep 17 00:00:00 2001 From: estifanos Date: Wed, 12 Aug 2026 07:35:43 +0000 Subject: [PATCH] feat: replace Table with AdvancedTable for improved license type management in PaymentConfigPage --- .../pages/PaymentConfigPage.tsx | 185 ++++++++++-------- 1 file changed, 104 insertions(+), 81 deletions(-) diff --git a/apps/backoffice/src/app/features/payment-config/pages/PaymentConfigPage.tsx b/apps/backoffice/src/app/features/payment-config/pages/PaymentConfigPage.tsx index 4f425cfe7..fabcb20f4 100644 --- a/apps/backoffice/src/app/features/payment-config/pages/PaymentConfigPage.tsx +++ b/apps/backoffice/src/app/features/payment-config/pages/PaymentConfigPage.tsx @@ -3,7 +3,6 @@ import { Alert, Badge, Button, - Card, Center, Group, Loader, @@ -12,7 +11,6 @@ import { Paper, Stack, Switch, - Table, Text, TextInput, ThemeIcon, @@ -26,7 +24,13 @@ import { IconInfoCircle, IconLock, } from '@tabler/icons-react'; -import { notify, ModalFooter } from '@ema-platform/ui'; +import { + notify, + ModalFooter, + AdvancedTable, + useServerTable, + type AdvancedColumn, +} from '@ema-platform/ui'; import { extractErrorMessage, localized, @@ -58,6 +62,7 @@ export function PaymentConfigPage() { const { data, isLoading, error } = useGetLicenseTypesQuery(); const { data: capabilities } = useGetPaymentCapabilitiesQuery(); const [editing, setEditing] = useState(null); + const { setPageIndex, pageSize, setPageSize, paginate } = useServerTable(); if (isLoading) { return ( @@ -82,6 +87,92 @@ export function PaymentConfigPage() { const types = [...(data?.items ?? [])].sort( (a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0), ); + const page = paginate(types); + + const columns: AdvancedColumn[] = [ + { + header: 'Licence type', + cell: ({ row }) => ( + <> + + {localized(row.original.name)} + + + {row.original.key} + + + ), + }, + { + header: 'New application', + cell: ({ row }) => ( + + {feeText(row.original.feeNewApplication, row.original.feeCurrency)} + + ), + }, + { + header: 'Renewal', + cell: ({ row }) => { + const type = row.original; + if (type.feeNewApplication === null) { + // No charge at all, so "same as new" would be noise. + return ( + + — + + ); + } + if (type.feeRenewal === null) { + return ( + + + {feeText(type.feeNewApplication, type.feeCurrency)}{' '} + + (same as new) + + + + ); + } + return ( + + {feeText(type.feeRenewal, type.feeCurrency)} + + ); + }, + }, + { + header: 'Charged?', + cell: ({ row }) => + row.original.issuesCertificate ? ( + + On approval + + ) : ( + + + Not charged + + + ), + }, + { + header: '', + size: 90, + align: 'right', + cell: ({ row }) => ( + + ), + }, + ]; return ( @@ -111,84 +202,16 @@ export function PaymentConfigPage() { - - - - - - Licence type - New application - Renewal - Charged? - - - - - {types.map((type) => ( - - - - {localized(type.name)} - - - {type.key} - - - - - {feeText(type.feeNewApplication, type.feeCurrency)} - - - - {type.feeNewApplication === null ? ( - // No charge at all, so "same as new" would be noise. - - — - - ) : type.feeRenewal === null ? ( - - - {feeText(type.feeNewApplication, type.feeCurrency)}{' '} - - (same as new) - - - - ) : ( - - {feeText(type.feeRenewal, type.feeCurrency)} - - )} - - - {type.issuesCertificate ? ( - - On approval - - ) : ( - - - Not charged - - - )} - - - - - - ))} - -
-
-
+