- Updated lazy loading syntax for component imports across multiple models to enhance code clarity. - Reformatted content return statements in various components for better readability. - Adjusted column widths for date fields from 175 to 200 to improve layout consistency across models. - Ensured consistent formatting and structure in model definitions for better maintainability.
320 lines
6.9 KiB
JavaScript
320 lines
6.9 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',
|
|
'currentDocumentSize',
|
|
'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: 200
|
|
},
|
|
{
|
|
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: 200
|
|
},
|
|
{
|
|
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: 'connection.username',
|
|
label: 'Username',
|
|
type: 'text',
|
|
required: false,
|
|
visible: (objectData) => objectData?.connection?.interface === 'cups',
|
|
columnWidth: 150
|
|
},
|
|
{
|
|
name: 'connection.password',
|
|
label: 'Password',
|
|
type: 'secret',
|
|
required: false,
|
|
visible: (objectData) => objectData?.connection?.interface === 'cups',
|
|
columnWidth: 150
|
|
},
|
|
{
|
|
name: 'currentDocumentSize',
|
|
label: 'Current Document Size',
|
|
required: false,
|
|
type: 'object',
|
|
objectType: 'documentSize',
|
|
showHyperlink: true,
|
|
columnWidth: 200
|
|
},
|
|
{
|
|
name: 'rotateOrientation',
|
|
label: 'Rotate Orientation',
|
|
required: false,
|
|
type: 'bool',
|
|
columnWidth: 150
|
|
},
|
|
{
|
|
name: 'supportedDocumentSizes',
|
|
label: 'Supported Document Sizes',
|
|
required: false,
|
|
type: 'objectList',
|
|
objectType: 'documentSize',
|
|
showHyperlink: true,
|
|
columnWidth: 260
|
|
},
|
|
{
|
|
name: 'tags',
|
|
label: 'Tags',
|
|
required: false,
|
|
type: 'tags',
|
|
columnWidth: 200
|
|
}
|
|
]
|
|
}
|