Update for report / label template tables (#8019)

- Pass through extra information
- Specify column titles
This commit is contained in:
Oliver 2024-08-28 15:15:51 +10:00 committed by GitHub
parent bcaf298ce3
commit 93e06a0db5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,6 @@
import { t } from '@lingui/macro';
import { YesNoButton } from '../../../../components/buttons/YesNoButton';
import { ApiEndpoints } from '../../../../enums/ApiEndpoints'; import { ApiEndpoints } from '../../../../enums/ApiEndpoints';
import { ModelType } from '../../../../enums/ModelType'; import { ModelType } from '../../../../enums/ModelType';
import { TemplateTable } from '../../../../tables/settings/TemplateTable'; import { TemplateTable } from '../../../../tables/settings/TemplateTable';
@ -10,8 +13,15 @@ export default function ReportTemplateTable() {
templateEndpoint: ApiEndpoints.report_list, templateEndpoint: ApiEndpoints.report_list,
printingEndpoint: ApiEndpoints.report_print, printingEndpoint: ApiEndpoints.report_print,
additionalFormFields: { additionalFormFields: {
page_size: {}, page_size: {
landscape: {} label: t`Page Size`
},
landscape: {
label: t`Landscape`,
modelRenderer: (instance: any) => (
<YesNoButton value={instance.landscape} />
)
}
} }
}} }}
/> />

View File

@ -161,8 +161,11 @@ export function TemplateTable({
}, },
...Object.entries(additionalFormFields || {})?.map(([key, field]) => ({ ...Object.entries(additionalFormFields || {})?.map(([key, field]) => ({
accessor: key, accessor: key,
...field,
title: field.label,
sortable: false, sortable: false,
switchable: true switchable: true,
render: field.modelRenderer
})), })),
BooleanColumn({ accessor: 'enabled', title: t`Enabled` }) BooleanColumn({ accessor: 'enabled', title: t`Enabled` })
]; ];