- Updated filters in multiple models such as AppPassword, AuditLog, Client, Courier, and others to include '_reference' and other relevant fields like 'createdAt' and 'updatedAt'. - This change improves data handling and consistency across the application, ensuring that all necessary fields are available for filtering.
158 lines
3.1 KiB
JavaScript
158 lines
3.1 KiB
JavaScript
import PartStockIcon from '../../components/Icons/PartStockIcon'
|
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|
|
|
export const PartStock = {
|
|
name: 'partStock',
|
|
label: 'Part Stock',
|
|
labelPlural: 'Part Stocks',
|
|
url: '/dashboard/inventory/partstocks',
|
|
prefix: 'PTS',
|
|
icon: PartStockIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) => `/dashboard/inventory/partstocks/info?partStockId=${_id}`
|
|
}
|
|
],
|
|
filters: [
|
|
'partSku',
|
|
'state',
|
|
'startingQuantity',
|
|
'currentQuantity',
|
|
'partSku._id',
|
|
'stockLocation',
|
|
'stockLocation._id',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'_reference'
|
|
],
|
|
sorters: [
|
|
'partSku',
|
|
'startingQuantity',
|
|
'currentQuantity',
|
|
'state',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
columns: [
|
|
'_reference',
|
|
'state',
|
|
'startingQuantity',
|
|
'currentQuantity',
|
|
'partSku',
|
|
'stockLocation',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'partStock',
|
|
showCopy: true,
|
|
readOnly: true,
|
|
columnWidth: 140
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'partStock',
|
|
showCopy: true,
|
|
readOnly: true,
|
|
columnWidth: 180
|
|
},
|
|
{
|
|
name: 'state',
|
|
label: 'State',
|
|
type: 'state',
|
|
readOnly: true,
|
|
columnWidth: 260
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: 'sourceType',
|
|
label: 'Source Type',
|
|
type: 'objectType',
|
|
readOnly: false,
|
|
columnWidth: 200,
|
|
required: true,
|
|
masterFilter: ['subJob', 'stockTransfer']
|
|
},
|
|
{
|
|
name: 'partSku',
|
|
label: 'Part SKU',
|
|
type: 'object',
|
|
objectType: 'partSku',
|
|
required: true,
|
|
showHyperlink: true,
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'stockLocation',
|
|
label: 'Stock location',
|
|
type: 'object',
|
|
objectType: 'stockLocation',
|
|
required: false,
|
|
showHyperlink: true,
|
|
columnWidth: 200
|
|
},
|
|
|
|
{
|
|
name: 'source',
|
|
label: 'Source',
|
|
type: 'object',
|
|
readOnly: false,
|
|
required: true,
|
|
columnWidth: 200,
|
|
objectType: (objectData) => {
|
|
return objectData?.sourceType
|
|
},
|
|
showHyperlink: true
|
|
},
|
|
{
|
|
name: 'currentQuantity',
|
|
label: 'Current Quantity',
|
|
type: 'number',
|
|
readOnly: true,
|
|
columnWidth: 200,
|
|
required: true,
|
|
value: (objectData) => {
|
|
if (objectData?.state?.type === 'new') {
|
|
return objectData?.startingQuantity
|
|
} else {
|
|
return objectData.currentQuantity
|
|
}
|
|
}
|
|
}
|
|
],
|
|
stats: [
|
|
{
|
|
name: 'totalCurrentQuantity.sum',
|
|
label: 'Total Current Quantity',
|
|
type: 'number',
|
|
roundNumber: 2,
|
|
cardWidth: 200
|
|
}
|
|
]
|
|
}
|