216 lines
4.9 KiB
JavaScript
216 lines
4.9 KiB
JavaScript
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|
import ReloadIcon from '../../components/Icons/ReloadIcon'
|
|
import EditIcon from '../../components/Icons/EditIcon'
|
|
import CheckIcon from '../../components/Icons/CheckIcon'
|
|
import XMarkIcon from '../../components/Icons/XMarkIcon'
|
|
import DesignIcon from '../../components/Icons/DesignIcon'
|
|
import DocumentTemplateIcon from '../../components/Icons/DocumentTemplateIcon'
|
|
|
|
export const DocumentTemplate = {
|
|
name: 'documentTemplate',
|
|
label: 'Document Template',
|
|
prefix: 'DTP',
|
|
icon: DocumentTemplateIcon,
|
|
actions: [
|
|
{
|
|
name: 'design',
|
|
label: 'Design',
|
|
row: true,
|
|
icon: DesignIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documenttemplates/design?documentTemplateId=${_id}`
|
|
},
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documenttemplates/info?documentTemplateId=${_id}`
|
|
},
|
|
|
|
{
|
|
name: 'reload',
|
|
label: 'Reload',
|
|
icon: ReloadIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documenttemplates/info?documentTemplateId=${_id}&action=reload`
|
|
},
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documenttemplates/info?documentTemplateId=${_id}&action=edit`,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documenttemplates/info?documentTemplateId=${_id}&action=finishEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documenttemplates/info?documentTemplateId=${_id}&action=cancelEdit`,
|
|
visible: (objectData) => {
|
|
console.log(objectData?._isEditing)
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
}
|
|
],
|
|
columns: [
|
|
'name',
|
|
'_id',
|
|
'active',
|
|
'global',
|
|
'objectType',
|
|
'tags',
|
|
'parent',
|
|
'parent._id',
|
|
'documentSize',
|
|
'documentSize._id',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
filters: ['name', '_id', 'active', 'tags', 'objectType'],
|
|
group: ['documentSize', 'tags'],
|
|
sorters: [
|
|
'name',
|
|
'parent',
|
|
'documentSize',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'active',
|
|
'global',
|
|
'objectType'
|
|
],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'documentTemplate',
|
|
showCopy: true
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'name',
|
|
label: 'Name',
|
|
required: true,
|
|
type: 'text',
|
|
columnWidth: 200,
|
|
columnFixed: 'left'
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'objectType',
|
|
label: 'Object Type',
|
|
required: true,
|
|
type: 'objectType',
|
|
empty: (documentTemplate) => {
|
|
return documentTemplate.global
|
|
}
|
|
},
|
|
{
|
|
name: 'active',
|
|
label: 'Active',
|
|
required: true,
|
|
type: 'bool',
|
|
columnWidth: 150
|
|
},
|
|
{
|
|
name: 'tags',
|
|
label: 'Tags',
|
|
required: false,
|
|
type: 'tags'
|
|
},
|
|
{
|
|
name: 'global',
|
|
label: 'Global',
|
|
required: true,
|
|
type: 'bool',
|
|
columnWidth: 150
|
|
},
|
|
{
|
|
name: 'documentSize',
|
|
label: 'Document Size',
|
|
required: true,
|
|
type: 'object',
|
|
objectType: 'documentSize'
|
|
},
|
|
{
|
|
name: 'documentSize._id',
|
|
label: 'Document Size ID',
|
|
type: 'id',
|
|
objectType: 'documentSize',
|
|
showCopy: true,
|
|
showHyperlink: true
|
|
},
|
|
{
|
|
name: 'parent',
|
|
label: 'Parent',
|
|
required: false,
|
|
type: 'object',
|
|
masterFilter: { global: true, active: true },
|
|
objectType: 'documentTemplate',
|
|
empty: (documentTemplate) => {
|
|
return documentTemplate.global
|
|
}
|
|
},
|
|
{
|
|
name: 'parent._id',
|
|
label: 'Parent ID',
|
|
required: false,
|
|
type: 'id',
|
|
showHyperlink: true,
|
|
objectType: 'documentTemplate',
|
|
empty: (documentTemplate) => {
|
|
return documentTemplate.global
|
|
}
|
|
},
|
|
{
|
|
name: 'documentPrinters',
|
|
label: 'Document Printers',
|
|
required: false,
|
|
type: 'objectList',
|
|
objectType: 'documentPrinter'
|
|
},
|
|
{
|
|
name: 'content',
|
|
label: 'Content',
|
|
required: false,
|
|
type: 'codeBlock',
|
|
language: 'ejs'
|
|
},
|
|
{
|
|
name: 'testObject',
|
|
label: 'Test Object',
|
|
required: false,
|
|
type: 'codeBlock',
|
|
language: 'json'
|
|
}
|
|
]
|
|
}
|