Skip to content

Commit

Permalink
Update for report / label template tables (#8019)
Browse files Browse the repository at this point in the history
- Pass through extra information
- Specify column titles
  • Loading branch information
SchrodingersGat authored Aug 28, 2024
1 parent bcaf298 commit 93e06a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { t } from '@lingui/macro';

import { YesNoButton } from '../../../../components/buttons/YesNoButton';
import { ApiEndpoints } from '../../../../enums/ApiEndpoints';
import { ModelType } from '../../../../enums/ModelType';
import { TemplateTable } from '../../../../tables/settings/TemplateTable';
Expand All @@ -10,8 +13,15 @@ export default function ReportTemplateTable() {
templateEndpoint: ApiEndpoints.report_list,
printingEndpoint: ApiEndpoints.report_print,
additionalFormFields: {
page_size: {},
landscape: {}
page_size: {
label: t`Page Size`
},
landscape: {
label: t`Landscape`,
modelRenderer: (instance: any) => (
<YesNoButton value={instance.landscape} />
)
}
}
}}
/>
Expand Down
5 changes: 4 additions & 1 deletion src/frontend/src/tables/settings/TemplateTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ export function TemplateTable({
},
...Object.entries(additionalFormFields || {})?.map(([key, field]) => ({
accessor: key,
...field,
title: field.label,
sortable: false,
switchable: true
switchable: true,
render: field.modelRenderer
})),
BooleanColumn({ accessor: 'enabled', title: t`Enabled` })
];
Expand Down

0 comments on commit 93e06a0

Please sign in to comment.