- Updated filters in multiple models such as AppPassword, AuditLog, Client, Courier, and others to include '_reference' and other relevant fields like 'createdAt' and 'updatedAt'. - This change improves data handling and consistency across the application, ensuring that all necessary fields are available for filtering.
246 lines
5.3 KiB
JavaScript
246 lines
5.3 KiB
JavaScript
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|
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',
|
|
labelPlural: 'Document Printers',
|
|
url: '/dashboard/management/documentprinters',
|
|
prefix: 'DPR',
|
|
icon: DocumentPrinterIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentprinters/info?documentPrinterId=${_id}`
|
|
},
|
|
|
|
{
|
|
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: [
|
|
'_reference',
|
|
'name',
|
|
'state',
|
|
'host',
|
|
'tags',
|
|
'connectedAt',
|
|
'updatedAt'
|
|
],
|
|
filters: [
|
|
'name',
|
|
'tags',
|
|
'active',
|
|
'isGlobal',
|
|
'state',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'_reference'
|
|
],
|
|
sorters: [
|
|
'name',
|
|
'documentSize',
|
|
'connectedAt',
|
|
'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
|
|
}
|
|
]
|
|
}
|