import FilamentStockIcon from '../../components/Icons/FilamentStockIcon' import InfoCircleIcon from '../../components/Icons/InfoCircleIcon' export const FilamentStock = { name: 'filamentStock', label: 'Filament Stock', prefix: 'FLS', icon: FilamentStockIcon, actions: [ { name: 'info', label: 'Info', default: true, row: true, icon: InfoCircleIcon, url: (_id) => `/dashboard/inventory/filamentstocks/info?filamentStockId=${_id}` } ], columns: [ '_reference', 'state', 'currentWeight', 'startingWeight', 'filamentSku', 'stockLocation', 'createdAt', 'updatedAt' ], filters: ['_id'], sorters: ['createdAt', 'updatedAt'], group: ['filamentSku'], properties: [ { name: '_id', label: 'ID', type: 'id', columnFixed: 'left', objectType: 'filamentStock', showCopy: true, columnWidth: 140 }, { name: 'createdAt', label: 'Created At', type: 'dateTime', readOnly: true, columnWidth: 175 }, { name: '_reference', label: 'Reference', type: 'reference', columnFixed: 'left', objectType: 'filamentStock', showCopy: true, readOnly: true }, { name: 'state', label: 'State', type: 'state', objectType: 'filamentStock', readOnly: true, columnWidth: 250 }, { name: 'updatedAt', label: 'Updated At', type: 'dateTime', readOnly: true, columnWidth: 175 }, { name: 'filamentSku', label: 'Filament SKU', type: 'object', objectType: 'filamentSku', readOnly: true, initial: true, required: true, showHyperlink: true, columnWidth: 200 }, { name: 'stockLocation', label: 'Stock location', type: 'object', objectType: 'stockLocation', required: false, showHyperlink: true, columnWidth: 200 }, { name: 'currentWeight', label: 'Current Weight', type: 'netGross', suffix: 'g', readOnly: true, required: true, columnWidth: 300, value: (objectData) => { if (objectData?.state?.type === 'unconsumed') { return objectData?.startingWeight } else { return objectData.currentWeight } } }, { name: 'startingWeight', label: 'Starting Weight', type: 'netGross', suffix: 'g', readOnly: true, initial: true, required: true, columnWidth: 300, difference: (objectData) => { return objectData?.filamentSku?.filament?.emptySpoolWeight } } ], stats: [ { name: 'totalCurrentWeight.sum', label: 'Total Current Weight', type: 'number', roundNumber: 2, suffix: 'g', cardWidth: 200 } ] }