154 lines
3.5 KiB
JavaScript
154 lines
3.5 KiB
JavaScript
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|
import ReloadIcon from '../../components/Icons/ReloadIcon'
|
|
import EditIcon from '../../components/Icons/EditIcon'
|
|
import DocumentJobIcon from '../../components/Icons/DocumentJobIcon'
|
|
import dayjs from 'dayjs'
|
|
|
|
export const DocumentJob = {
|
|
name: 'documentJob',
|
|
label: 'Document Job',
|
|
prefix: 'DJB',
|
|
icon: DocumentJobIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentjobs/info?documentJobId=${_id}`
|
|
},
|
|
|
|
{
|
|
name: 'reload',
|
|
label: 'Reload',
|
|
icon: ReloadIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentjobs/info?documentJobId=${_id}&action=reload`
|
|
},
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentjobs/info?documentJobId=${_id}&action=edit`
|
|
}
|
|
],
|
|
columns: ['name', '_id', 'width', 'height', 'createdAt', 'updatedAt'],
|
|
filters: ['name', '_id', 'width', 'height'],
|
|
sorters: ['name', 'width', 'height', 'createdAt', 'updatedAt'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'documentJob',
|
|
showCopy: true
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'name',
|
|
label: 'Name',
|
|
required: true,
|
|
type: 'text',
|
|
columnWidth: 200,
|
|
columnFixed: 'left',
|
|
value: (objectData) => {
|
|
if (objectData?.createdAt == undefined) {
|
|
return `${objectData?.documentTemplate?.name || 'No template'} ${dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')} (${objectData?.object?.name || objectData?.object?._id})`
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'state',
|
|
label: 'Status',
|
|
type: 'state',
|
|
objectType: 'printer',
|
|
showName: false,
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'objectType',
|
|
label: 'Object Type',
|
|
required: true,
|
|
columnWidth: 150,
|
|
type: 'objectType'
|
|
},
|
|
{
|
|
name: 'object',
|
|
label: 'Object',
|
|
required: true,
|
|
columnWidth: 150,
|
|
type: 'object',
|
|
objectType: (objectData) => {
|
|
return objectData?.objectType
|
|
}
|
|
},
|
|
{
|
|
name: 'object._id',
|
|
label: 'Object ID',
|
|
type: 'id',
|
|
showHyperlink: true,
|
|
objectType: (objectData) => {
|
|
return objectData?.objectType
|
|
}
|
|
},
|
|
{
|
|
name: 'documentTemplate',
|
|
label: 'Template',
|
|
required: true,
|
|
columnWidth: 150,
|
|
type: 'object',
|
|
objectType: 'documentTemplate',
|
|
masterFilter: (objectData) => {
|
|
return {
|
|
active: true,
|
|
global: false,
|
|
objectType: objectData.objectType
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: 'documentTemplate._id',
|
|
label: 'Template ID',
|
|
type: 'id',
|
|
showHyperlink: true,
|
|
objectType: 'documentTemplate'
|
|
},
|
|
{
|
|
name: 'documentPrinter',
|
|
label: 'Printer',
|
|
required: true,
|
|
columnWidth: 150,
|
|
type: 'object',
|
|
objectType: 'documentPrinter',
|
|
masterFilter: () => {
|
|
return {
|
|
active: true,
|
|
online: true
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: 'documentPrinter._id',
|
|
label: 'Printer ID',
|
|
type: 'id',
|
|
showHyperlink: true,
|
|
objectType: 'documentPrinter'
|
|
}
|
|
]
|
|
}
|