115 lines
2.4 KiB
JavaScript
115 lines
2.4 KiB
JavaScript
import PartStockIcon from '../../components/Icons/PartStockIcon'
|
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|
|
|
export const PartStock = {
|
|
name: 'partStock',
|
|
label: 'Part Stock',
|
|
prefix: 'PTS',
|
|
icon: PartStockIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) => `/dashboard/inventory/partstocks/info?partStockId=${_id}`
|
|
}
|
|
],
|
|
url: (id) => `/dashboard/inventory/partstocks/info?partStockId=${id}`,
|
|
filters: ['_id', 'part', 'startingQuantity', 'currentQuantity'],
|
|
sorters: ['part', 'startingQuantity', 'currentQuantity'],
|
|
columns: [
|
|
'_id',
|
|
'state',
|
|
'startingQuantity',
|
|
'currentQuantity',
|
|
'part',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'partStock',
|
|
showCopy: true,
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'state',
|
|
label: 'State',
|
|
type: 'state',
|
|
readOnly: true,
|
|
columnWidth: 120
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'sourceType',
|
|
label: 'Source Type',
|
|
type: 'objectType',
|
|
readOnly: false,
|
|
columnWidth: 200,
|
|
required: true,
|
|
masterFilter: ['subJob']
|
|
},
|
|
{
|
|
name: 'part',
|
|
label: 'Part',
|
|
type: 'object',
|
|
objectType: 'part',
|
|
required: true,
|
|
showHyperlink: true
|
|
},
|
|
|
|
{
|
|
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
|
|
}
|
|
]
|
|
}
|