mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Update for report / label template tables (#8019)
- Pass through extra information - Specify column titles
This commit is contained in:
		@@ -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';
 | 
			
		||||
@@ -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} />
 | 
			
		||||
            )
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }}
 | 
			
		||||
    />
 | 
			
		||||
 
 | 
			
		||||
@@ -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` })
 | 
			
		||||
    ];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user