mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Report enhancements (#6714)
* Add "enabled" filter to template table * Cleanup * API endpoints - Add API endpoints for report snippet - List endpoint - Details endpoint * Update serializers - Add asset serializer - Update * Check for duplicate asset files - Prevent upload of duplicate asset files - Allow re-upload for same PK * Duplicate checks for ReportSnippet * Bump API version
This commit is contained in:
		| @@ -1,7 +1,7 @@ | ||||
| import { Trans, t } from '@lingui/macro'; | ||||
| import { Box, Group, LoadingOverlay, Stack, Text, Title } from '@mantine/core'; | ||||
| import { IconDots } from '@tabler/icons-react'; | ||||
| import { useCallback, useMemo, useState } from 'react'; | ||||
| import { ReactNode, useCallback, useMemo, useState } from 'react'; | ||||
| import { useNavigate } from 'react-router-dom'; | ||||
|  | ||||
| import { AddItemButton } from '../../components/buttons/AddItemButton'; | ||||
| @@ -29,6 +29,7 @@ import { useTable } from '../../hooks/UseTable'; | ||||
| import { apiUrl } from '../../states/ApiState'; | ||||
| import { TableColumn } from '../Column'; | ||||
| import { BooleanColumn } from '../ColumnRenderers'; | ||||
| import { TableFilter } from '../Filter'; | ||||
| import { InvenTreeTable } from '../InvenTreeTable'; | ||||
| import { RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; | ||||
|  | ||||
| @@ -257,18 +258,25 @@ export function TemplateTable({ | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   const tableActions = useMemo(() => { | ||||
|     let actions = []; | ||||
|  | ||||
|     actions.push( | ||||
|   const tableActions: ReactNode[] = useMemo(() => { | ||||
|     return [ | ||||
|       <AddItemButton | ||||
|         key={`add-${templateType}`} | ||||
|         onClick={() => newTemplate.open()} | ||||
|         tooltip={t`Add` + ' ' + templateTypeTranslation} | ||||
|       /> | ||||
|     ); | ||||
|     ]; | ||||
|   }, []); | ||||
|  | ||||
|     return actions; | ||||
|   const tableFilters: TableFilter[] = useMemo(() => { | ||||
|     return [ | ||||
|       { | ||||
|         name: 'enabled', | ||||
|         label: t`Enabled`, | ||||
|         description: t`Filter by enabled status`, | ||||
|         type: 'checkbox' | ||||
|       } | ||||
|     ]; | ||||
|   }, []); | ||||
|  | ||||
|   return ( | ||||
| @@ -294,6 +302,7 @@ export function TemplateTable({ | ||||
|         columns={columns} | ||||
|         props={{ | ||||
|           rowActions: rowActions, | ||||
|           tableFilters: tableFilters, | ||||
|           tableActions: tableActions, | ||||
|           onRowClick: (record) => openDetailDrawer(record.pk) | ||||
|         }} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user