All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Integrated BulkObjectActions component across various management and dashboard components for improved batch processing capabilities. - Updated components including Invoices, PaymentPolicies, Payments, TaxRecords, and multiple Inventory and Management sections to include bulk action functionality. - Enhanced user experience by allowing users to perform actions on multiple items simultaneously, streamlining workflows and improving efficiency.
251 lines
5.5 KiB
JavaScript
251 lines
5.5 KiB
JavaScript
import { createElement, lazy } from 'react'
|
|
|
|
const DocumentJobInfo = lazy(
|
|
() =>
|
|
import('../../components/Dashboard/Management/DocumentJobs/DocumentJobInfo')
|
|
)
|
|
const NewDocumentJob = lazy(
|
|
() =>
|
|
import('../../components/Dashboard/Management/DocumentJobs/NewDocumentJob')
|
|
)
|
|
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 DocumentJobIcon from '../../components/Icons/DocumentJobIcon'
|
|
import dayjs from 'dayjs'
|
|
import ListIcon from '../../components/Icons/ListIcon'
|
|
import DuplicateIcon from '../../components/Icons/DuplicateIcon'
|
|
|
|
export const DocumentJob = {
|
|
name: 'documentJob',
|
|
label: 'Document Job',
|
|
labelPlural: 'Document Jobs',
|
|
url: '/dashboard/management/documentjobs',
|
|
prefix: 'DJB',
|
|
icon: DocumentJobIcon,
|
|
actions: [
|
|
{
|
|
name: 'new',
|
|
type: 'modal',
|
|
pageName: 'list',
|
|
modalWidth: 900,
|
|
label: 'New Document Job',
|
|
icon: PlusIcon,
|
|
content: (objectData, { onOk } = {}) => {
|
|
return createElement(NewDocumentJob, {
|
|
defaultValues: objectData,
|
|
onOk,
|
|
reset: true
|
|
})
|
|
}
|
|
},
|
|
{
|
|
name: 'duplicate',
|
|
type: 'alias',
|
|
objectType: 'documentJob',
|
|
aliasAction: 'new',
|
|
pageName: 'info',
|
|
label: 'Duplicate',
|
|
icon: DuplicateIcon,
|
|
objectData: (objectData) => objectData
|
|
},
|
|
{
|
|
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(DocumentJobInfo)
|
|
}
|
|
],
|
|
columns: [
|
|
'_reference',
|
|
'name',
|
|
'quantity',
|
|
'state',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
filters: [
|
|
'name',
|
|
'quantity',
|
|
'width',
|
|
'height',
|
|
'state',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'_reference'
|
|
],
|
|
sorters: ['name', 'quantity', '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: 200
|
|
},
|
|
{
|
|
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: 200
|
|
},
|
|
{
|
|
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
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: 'quantity',
|
|
label: 'Quantity',
|
|
type: 'number',
|
|
required: true,
|
|
min: 1,
|
|
step: 1,
|
|
columnWidth: 125,
|
|
value: (objectData) => {
|
|
if (
|
|
objectData?.createdAt == undefined &&
|
|
objectData?.quantity == null
|
|
) {
|
|
return 1
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|