mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
[PUI] Update table filters (#7544)
* Update part table filters * Update stock location table filters * Update part category table filters
This commit is contained in:
parent
ee7a9626e8
commit
ade6cfb878
@ -286,6 +286,11 @@ export function BomTable({
|
||||
label: t`Inherited`,
|
||||
description: t`Show inherited items`
|
||||
},
|
||||
{
|
||||
name: 'allow_variants',
|
||||
label: t`Allow Variants`,
|
||||
description: t`Show items which allow variant substitution`
|
||||
},
|
||||
{
|
||||
name: 'optional',
|
||||
label: t`Optional`,
|
||||
|
@ -64,6 +64,11 @@ export function PartCategoryTable({ parentId }: { parentId?: any }) {
|
||||
name: 'structural',
|
||||
label: t`Structural`,
|
||||
description: t`Show structural categories`
|
||||
},
|
||||
{
|
||||
name: 'starred',
|
||||
label: t`Subscribed`,
|
||||
description: t`Show categories to which the user is subscribed`
|
||||
}
|
||||
];
|
||||
}, []);
|
||||
|
@ -238,14 +238,37 @@ function partTableFilters(): TableFilter[] {
|
||||
{ value: 'true', label: t`Virtual` },
|
||||
{ value: 'false', label: t`Not Virtual` }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'is_template',
|
||||
label: t`Is Template`,
|
||||
description: t`Filter by parts which are templates`,
|
||||
type: 'boolean'
|
||||
},
|
||||
{
|
||||
name: 'has_pricing',
|
||||
label: t`Has Pricing`,
|
||||
description: t`Filter by parts which have pricing information`,
|
||||
type: 'boolean'
|
||||
},
|
||||
{
|
||||
name: 'unallocated_stock',
|
||||
label: t`Available Stock`,
|
||||
description: t`Filter by parts which have available stock`,
|
||||
type: 'boolean'
|
||||
},
|
||||
{
|
||||
name: 'starred',
|
||||
label: t`Subscribed`,
|
||||
description: t`Filter by parts to which the user is subscribed`,
|
||||
type: 'boolean'
|
||||
},
|
||||
{
|
||||
name: 'stocktake',
|
||||
label: t`Has Stocktake`,
|
||||
description: t`Filter by parts which have stocktake information`,
|
||||
type: 'boolean'
|
||||
}
|
||||
// unallocated_stock
|
||||
// starred
|
||||
// stocktake
|
||||
// is_template
|
||||
// virtual
|
||||
// has_pricing
|
||||
// TODO: Any others from table_filters.js?
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import { ApiEndpoints } from '../../enums/ApiEndpoints';
|
||||
import { ModelType } from '../../enums/ModelType';
|
||||
import { UserRoles } from '../../enums/Roles';
|
||||
import { stockLocationFields } from '../../forms/StockForms';
|
||||
import { useFilters } from '../../hooks/UseFilter';
|
||||
import {
|
||||
useCreateApiFormModal,
|
||||
useEditApiFormModal
|
||||
@ -26,6 +27,14 @@ export function StockLocationTable({ parentId }: { parentId?: any }) {
|
||||
const table = useTable('stocklocation');
|
||||
const user = useUserState();
|
||||
|
||||
const locationTypeFilters = useFilters({
|
||||
url: apiUrl(ApiEndpoints.stock_location_type_list),
|
||||
transform: (item) => ({
|
||||
value: item.pk,
|
||||
label: item.name
|
||||
})
|
||||
});
|
||||
|
||||
const tableFilters: TableFilter[] = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
@ -35,21 +44,26 @@ export function StockLocationTable({ parentId }: { parentId?: any }) {
|
||||
},
|
||||
{
|
||||
name: 'structural',
|
||||
label: t`structural`,
|
||||
label: t`Structural`,
|
||||
description: t`Show structural locations`
|
||||
},
|
||||
{
|
||||
name: 'external',
|
||||
label: t`external`,
|
||||
label: t`External`,
|
||||
description: t`Show external locations`
|
||||
},
|
||||
{
|
||||
name: 'has_location_type',
|
||||
label: t`Has location type`
|
||||
},
|
||||
{
|
||||
name: 'location_type',
|
||||
label: t`Location Type`,
|
||||
description: t`Filter by location type`,
|
||||
choices: locationTypeFilters.choices
|
||||
}
|
||||
// TODO: location_type
|
||||
];
|
||||
}, []);
|
||||
}, [locationTypeFilters.choices]);
|
||||
|
||||
const tableColumns: TableColumn[] = useMemo(() => {
|
||||
return [
|
||||
|
Loading…
Reference in New Issue
Block a user