Tom Butcher 50abb22054
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
Update FilamentStock and StockEvent models for improved data handling
- Reformatted the filters in FilamentStock for better readability.
- Changed the 'required' property of the stock location in FilamentStock to true, ensuring that stock location is mandatory.
- Added 'updatedAt' column to StockEvent for enhanced tracking of stock events.
2026-07-26 18:37:47 +01:00

89 lines
1.9 KiB
JavaScript

import StockEventIcon from '../../components/Icons/StockEventIcon'
export const StockEvent = {
name: 'stockEvent',
label: 'Stock Event',
labelPlural: 'Stock Events',
url: '/dashboard/inventory/stockevents',
prefix: 'SEV',
icon: StockEventIcon,
actions: [],
columns: ['_reference', 'owner', 'parent', 'value', 'createdAt', 'updatedAt'],
filters: ['_id', 'owner', 'parent'],
sorters: ['createdAt'],
properties: [
{
name: '_id',
label: 'ID',
type: 'id',
objectType: 'stockEvent',
columnFixed: 'left',
value: null,
showCopy: true,
columnWidth: 140
},
{
name: 'createdAt',
label: 'Created At',
type: 'dateTime',
value: null,
readOnly: true,
columnWidth: 175
},
{
name: '_reference',
label: 'Reference',
type: 'reference',
columnFixed: 'left',
objectType: 'stockEvent',
value: null,
showCopy: true,
readOnly: true,
columnWidth: 180
},
{
name: 'updatedAt',
label: 'Updated At',
type: 'dateTime',
value: null,
readOnly: true,
columnWidth: 175
},
{
name: 'owner',
label: 'Owner',
type: 'object',
objectType: (objectData) => {
return objectData.ownerType
},
columnFixed: 'left',
columnWidth: 200,
value: null,
showCopy: true,
showHyperlink: true
},
{
name: 'parent',
label: 'Parent',
type: 'object',
objectType: (objectData) => {
return objectData?.parentType
},
value: null,
columnWidth: 200,
showCopy: true,
showHyperlink: true
},
{
name: 'value',
label: 'Value',
columnWidth: 120,
type: 'variance',
showCopy: true,
suffix: (objectData) => {
return objectData.unit
}
}
]
}