- Added 'additionalCost' and 'additionalCostWithTax' fields to CourierService model. - Introduced 'connection.port' field in DocumentPrinter model. - Updated Filament model with 'density' and 'emptySpoolWeight' fields. - Enhanced Part, PartSku, Product, and ProductSku models by adding 'cost', 'costWithTax', 'price', 'margin', and 'priceWithTax' fields for improved pricing structure.
282 lines
6.1 KiB
JavaScript
282 lines
6.1 KiB
JavaScript
import { createElement, lazy } from 'react'
|
|
|
|
const DocumentPrinterInfo = lazy(
|
|
() => import('../../components/Dashboard/Management/DocumentPrinters/DocumentPrinterInfo')
|
|
)
|
|
const NewDocumentPrinter = lazy(
|
|
() => import('../../components/Dashboard/Management/DocumentPrinters/NewDocumentPrinter')
|
|
)
|
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
|
import EditIcon from '../../components/Icons/EditIcon'
|
|
import CheckIcon from '../../components/Icons/CheckIcon'
|
|
import XMarkIcon from '../../components/Icons/XMarkIcon'
|
|
import DocumentPrinterIcon from '../../components/Icons/DocumentPrinterIcon'
|
|
import ListIcon from '../../components/Icons/ListIcon'
|
|
|
|
export const DocumentPrinter = {
|
|
name: 'documentPrinter',
|
|
label: 'Document Printer',
|
|
labelPlural: 'Document Printers',
|
|
url: '/dashboard/management/documentprinters',
|
|
prefix: 'DPR',
|
|
icon: DocumentPrinterIcon,
|
|
actions: [
|
|
{
|
|
name: 'new',
|
|
type: 'modal',
|
|
pageName: 'list',
|
|
modalWidth: 700,
|
|
label: 'New Document Printer',
|
|
icon: PlusIcon,
|
|
content: (objectData, { onOk } = {}) => {
|
|
return createElement(NewDocumentPrinter, { defaultValues: objectData, onOk, reset: true })
|
|
}
|
|
},
|
|
{
|
|
name: 'list',
|
|
type: 'page',
|
|
pageName: 'list',
|
|
label: 'List',
|
|
icon: ListIcon
|
|
},
|
|
{
|
|
name: 'info',
|
|
type: 'page',
|
|
pageName: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon
|
|
},
|
|
{
|
|
name: 'edit',
|
|
type: 'page',
|
|
pageName: 'info',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
type: 'page',
|
|
pageName: 'info',
|
|
icon: XMarkIcon,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
type: 'page',
|
|
pageName: 'info',
|
|
icon: CheckIcon,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
],
|
|
pages: [
|
|
{
|
|
name: 'info',
|
|
content: () => createElement(DocumentPrinterInfo)
|
|
}
|
|
],
|
|
columns: [
|
|
'_reference',
|
|
'name',
|
|
'state',
|
|
'host',
|
|
'tags',
|
|
'connectedAt',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
filters: [
|
|
'name',
|
|
'tags',
|
|
'active',
|
|
'isGlobal',
|
|
'state',
|
|
'connection.port',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'_reference'
|
|
],
|
|
sorters: [
|
|
'name',
|
|
'documentSize',
|
|
'connectedAt',
|
|
'connection.port',
|
|
'updatedAt',
|
|
'state',
|
|
'createdAt'
|
|
],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'documentPrinter',
|
|
showCopy: true,
|
|
columnWidth: 140
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'documentPrinter',
|
|
showCopy: true,
|
|
readOnly: true,
|
|
columnWidth: 180
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: 'name',
|
|
label: 'Name',
|
|
required: true,
|
|
type: 'text',
|
|
columnWidth: 200,
|
|
columnFixed: 'left'
|
|
},
|
|
|
|
{
|
|
name: 'connectedAt',
|
|
label: 'Connected At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
|
|
{
|
|
name: 'state',
|
|
label: 'Status',
|
|
type: 'state',
|
|
objectType: 'printer',
|
|
showName: false,
|
|
readOnly: true,
|
|
columnWidth: 260
|
|
},
|
|
|
|
{
|
|
name: 'online',
|
|
label: 'Online',
|
|
type: 'bool',
|
|
readOnly: true,
|
|
columnWidth: 85
|
|
},
|
|
{
|
|
name: 'active',
|
|
label: 'Active',
|
|
type: 'bool',
|
|
required: true,
|
|
columnWidth: 125
|
|
},
|
|
{
|
|
name: 'vendor',
|
|
label: 'Vendor',
|
|
type: 'object',
|
|
objectType: 'vendor',
|
|
required: false,
|
|
showHyperlink: true,
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'host',
|
|
label: 'Host',
|
|
required: true,
|
|
type: 'object',
|
|
objectType: 'host',
|
|
showHyperlink: true,
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'connection.interface',
|
|
label: 'Interface',
|
|
type: 'select',
|
|
options: [
|
|
{ label: 'CUPS', value: 'cups' },
|
|
{ label: 'Epson Receipt', value: 'epsonReceipt' },
|
|
{ label: 'Star Receipt', value: 'starReceipt' }
|
|
],
|
|
required: true,
|
|
columnWidth: 150
|
|
},
|
|
{
|
|
name: 'connection.protocol',
|
|
label: 'Protocol',
|
|
type: 'select',
|
|
options: (objectData) => {
|
|
if (objectData?.connection?.interface == 'cups') {
|
|
return [
|
|
{ label: 'IPP', value: 'ipp' },
|
|
{ label: 'HTTP', value: 'http' }
|
|
]
|
|
}
|
|
return [
|
|
{ label: 'TCP', value: 'tcp' },
|
|
{ label: 'Serial', value: 'serial' },
|
|
{ label: 'System', value: 'system' }
|
|
]
|
|
},
|
|
required: true,
|
|
columnWidth: 130
|
|
},
|
|
{
|
|
name: 'connection.host',
|
|
label: 'Host Name',
|
|
type: 'text',
|
|
required: true,
|
|
columnWidth: 180
|
|
},
|
|
{
|
|
name: 'connection.port',
|
|
label: 'Port',
|
|
type: 'number',
|
|
required: false,
|
|
disabled: (objectData) => {
|
|
return (
|
|
objectData?.connection?.protocol == 'system' ||
|
|
objectData?.connection?.protocol == 'serial'
|
|
)
|
|
},
|
|
columnWidth: 85
|
|
},
|
|
{
|
|
name: 'currentDocumentSize',
|
|
label: 'Document Size',
|
|
required: false,
|
|
type: 'object',
|
|
objectType: 'documentSize',
|
|
showHyperlink: true,
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'tags',
|
|
label: 'Tags',
|
|
required: false,
|
|
type: 'tags',
|
|
columnWidth: 200
|
|
}
|
|
]
|
|
}
|