- Updated multiple models to change the column identifier from '_id' to '_reference' for consistency across the database schema. - Adjusted relevant filters and properties to align with the new column naming convention.
208 lines
4.8 KiB
JavaScript
208 lines
4.8 KiB
JavaScript
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|
import ReloadIcon from '../../components/Icons/ReloadIcon'
|
|
import EditIcon from '../../components/Icons/EditIcon'
|
|
import DocumentPrinterIcon from '../../components/Icons/DocumentPrinterIcon'
|
|
import CheckIcon from '../../components/Icons/CheckIcon'
|
|
import XMarkIcon from '../../components/Icons/XMarkIcon'
|
|
|
|
export const DocumentPrinter = {
|
|
name: 'documentPrinter',
|
|
label: 'Document Printer',
|
|
prefix: 'DPR',
|
|
icon: DocumentPrinterIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentprinters/info?documentPrinterId=${_id}`
|
|
},
|
|
|
|
{
|
|
name: 'reload',
|
|
label: 'Reload',
|
|
icon: ReloadIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentprinters/info?documentPrinterId=${_id}&action=reload`
|
|
},
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentprinters/info?documentPrinterId=${_id}&action=edit`,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentprinters/info?documentPrinterId=${_id}&action=finishEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentprinters/info?documentPrinterId=${_id}&action=cancelEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
}
|
|
],
|
|
columns: [
|
|
'name',
|
|
'_reference',
|
|
'state',
|
|
'host',
|
|
'tags',
|
|
'connectedAt',
|
|
'updatedAt'
|
|
],
|
|
filters: ['name', '_id'],
|
|
sorters: ['name', 'documentSize', 'connectedAt', 'updatedAt'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'documentPrinter',
|
|
showCopy: true
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'name',
|
|
label: 'Name',
|
|
required: true,
|
|
type: 'text',
|
|
columnWidth: 200,
|
|
columnFixed: 'left'
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'state',
|
|
label: 'Status',
|
|
type: 'state',
|
|
objectType: 'printer',
|
|
showName: false,
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'connectedAt',
|
|
label: 'Connected At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'online',
|
|
label: 'Online',
|
|
type: 'bool',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'active',
|
|
label: 'Active',
|
|
type: 'bool',
|
|
required: true
|
|
},
|
|
{
|
|
name: 'vendor',
|
|
label: 'Vendor',
|
|
type: 'object',
|
|
objectType: 'vendor',
|
|
required: false,
|
|
showHyperlink: true
|
|
},
|
|
{
|
|
name: 'host',
|
|
label: 'Host',
|
|
required: true,
|
|
type: 'object',
|
|
objectType: 'host',
|
|
showHyperlink: true
|
|
},
|
|
{
|
|
name: 'connection.interface',
|
|
label: 'Interface',
|
|
type: 'select',
|
|
options: [
|
|
{ label: 'CUPS', value: 'cups' },
|
|
{ label: 'Epson Receipt', value: 'epsonReceipt' },
|
|
{ label: 'Star Receipt', value: 'starReceipt' }
|
|
],
|
|
required: true
|
|
},
|
|
{
|
|
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
|
|
},
|
|
{
|
|
name: 'connection.host',
|
|
label: 'Host Name',
|
|
type: 'text',
|
|
required: true
|
|
},
|
|
{
|
|
name: 'connection.port',
|
|
label: 'Port',
|
|
type: 'number',
|
|
required: false,
|
|
disabled: (objectData) => {
|
|
return (
|
|
objectData?.connection?.protocol == 'system' ||
|
|
objectData?.connection?.protocol == 'serial'
|
|
)
|
|
}
|
|
},
|
|
{
|
|
name: 'currentDocumentSize',
|
|
label: 'Current Document Size',
|
|
required: false,
|
|
type: 'object',
|
|
objectType: 'documentSize',
|
|
showHyperlink: true
|
|
},
|
|
{
|
|
name: 'tags',
|
|
label: 'Tags',
|
|
required: false,
|
|
type: 'tags'
|
|
}
|
|
]
|
|
}
|