- 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.
176 lines
4.2 KiB
JavaScript
176 lines
4.2 KiB
JavaScript
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|
import EditIcon from '../../components/Icons/EditIcon'
|
|
import CheckIcon from '../../components/Icons/CheckIcon'
|
|
import XMarkIcon from '../../components/Icons/XMarkIcon'
|
|
import DocumentJobIcon from '../../components/Icons/DocumentJobIcon'
|
|
import dayjs from 'dayjs'
|
|
|
|
export const DocumentJob = {
|
|
name: 'documentJob',
|
|
label: 'Document Job',
|
|
labelPlural: 'Document Jobs',
|
|
url: '/dashboard/management/documentjobs',
|
|
prefix: 'DJB',
|
|
icon: DocumentJobIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentjobs/info?documentJobId=${_id}`
|
|
},
|
|
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentjobs/info?documentJobId=${_id}&action=edit`,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentjobs/info?documentJobId=${_id}&action=finishEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentjobs/info?documentJobId=${_id}&action=cancelEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
}
|
|
],
|
|
columns: ['_reference', 'name', 'state', 'createdAt', 'updatedAt'],
|
|
filters: [
|
|
'name',
|
|
'width',
|
|
'height',
|
|
'state',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'_reference'
|
|
],
|
|
sorters: ['name', 'state', 'createdAt', 'updatedAt'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'documentJob',
|
|
showCopy: true,
|
|
columnWidth: 140
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'documentJob',
|
|
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',
|
|
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: 'state',
|
|
label: 'Status',
|
|
type: 'state',
|
|
objectType: 'printer',
|
|
showName: false,
|
|
readOnly: true,
|
|
columnWidth: 260
|
|
},
|
|
{
|
|
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
|
|
},
|
|
showHyperlink: true
|
|
},
|
|
{
|
|
name: 'documentTemplate',
|
|
label: 'Template',
|
|
required: true,
|
|
columnWidth: 150,
|
|
type: 'object',
|
|
objectType: 'documentTemplate',
|
|
showHyperlink: true,
|
|
masterFilter: (objectData) => {
|
|
return {
|
|
active: true,
|
|
global: false,
|
|
objectType: objectData.objectType
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: 'documentPrinter',
|
|
label: 'Printer',
|
|
required: true,
|
|
columnWidth: 150,
|
|
type: 'object',
|
|
objectType: 'documentPrinter',
|
|
showHyperlink: true,
|
|
masterFilter: () => {
|
|
return {
|
|
active: true,
|
|
online: true
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|