diff --git a/src/assets/icons/designicon.min.svg b/src/assets/icons/designicon.min.svg new file mode 100644 index 0000000..78ee640 --- /dev/null +++ b/src/assets/icons/designicon.min.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/designicon.svg b/src/assets/icons/designicon.svg new file mode 100644 index 0000000..22e71f0 --- /dev/null +++ b/src/assets/icons/designicon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/database/ObjectModels.js b/src/database/ObjectModels.js index b3e7586..0650ad2 100644 --- a/src/database/ObjectModels.js +++ b/src/database/ObjectModels.js @@ -18,6 +18,9 @@ import { AuditLog } from './models/AuditLog' import { User } from './models/User' import { NoteType } from './models/NoteType' import { Note } from './models/Note' +import { DocumentSize } from './models/DocumentSize.js' +import { DocumentTemplate } from './models/DocumentTemplate.js' +import { DocumentPrinter } from './models/DocumentPrinter.js' import QuestionCircleIcon from '../components/Icons/QuestionCircleIcon' export const objectModels = [ @@ -40,7 +43,10 @@ export const objectModels = [ AuditLog, User, NoteType, - Note + Note, + DocumentSize, + DocumentTemplate, + DocumentPrinter ] // Re-export individual models for direct access @@ -64,12 +70,21 @@ export { AuditLog, User, NoteType, - Note + Note, + DocumentSize, + DocumentTemplate, + DocumentPrinter } -export function getModelByName(name) { +export function getModelByName(name, ignoreCase = false) { + function formatName(formattedName) { + if (ignoreCase == true) { + formattedName = formattedName.toUpperCase() + } + return formattedName + } return ( - objectModels.find((meta) => meta.name === name) || { + objectModels.find((meta) => formatName(meta.name) === formatName(name)) || { name: 'unknown', label: 'Unknown', prefix: 'UNK', diff --git a/src/database/models/DocumentPrinter.js b/src/database/models/DocumentPrinter.js new file mode 100644 index 0000000..f71d656 --- /dev/null +++ b/src/database/models/DocumentPrinter.js @@ -0,0 +1,125 @@ +import InfoCircleIcon from '../../components/Icons/InfoCircleIcon' +import ReloadIcon from '../../components/Icons/ReloadIcon' +import EditIcon from '../../components/Icons/EditIcon' +import DocumentPrinterIcon from '../../components/Icons/DocumentPrinterIcon' + +export const DocumentPrinter = { + name: 'documentPrinter', + label: 'Document Printer', + prefix: 'DPR', + icon: DocumentPrinterIcon, + actions: [ + { + name: 'info', + label: 'Info', + default: true, + row: true, + icon: InfoCircleIcon, + url: (_id) => + `/dashboard/management/documentprinters/info?documentPrinterId=${_id}` + }, + + { + name: 'reload', + label: 'Reload', + icon: ReloadIcon, + url: (_id) => + `/dashboard/management/documentprinters/info?documentPrinterId=${_id}&action=reload` + }, + { + name: 'edit', + label: 'Edit', + row: true, + icon: EditIcon, + url: (_id) => + `/dashboard/management/documentprinters/info?documentPrinterId=${_id}&action=edit` + } + ], + columns: [ + 'name', + '_id', + 'documentSize', + 'documentSize._id', + 'createdAt', + 'updatedAt' + ], + filters: ['name', '_id'], + sorters: ['name', 'documentSize', 'createdAt', 'updatedAt'], + properties: [ + { + name: '_id', + label: 'ID', + type: 'id', + objectType: 'documentPrinter', + 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: '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: 'active', + label: 'Active', + required: true, + type: 'bool' + }, + { + name: 'tags', + label: 'Tags', + required: false, + type: 'tags' + }, + { name: 'global', label: 'Global', required: false, type: 'bool' }, + { + name: 'parent', + label: 'Parent', + required: false, + type: 'object', + objectType: 'documentPrinter', + disabled: (documentPrinter) => { + if (documentPrinter.global == true) { + documentPrinter.parent = null + } + return documentPrinter.global + } + }, + { + name: 'parent._id', + label: 'Parent ID', + required: false, + type: 'id', + objectType: 'documentPrinter' + } + ] +} diff --git a/src/database/models/DocumentSize.js b/src/database/models/DocumentSize.js new file mode 100644 index 0000000..9589efd --- /dev/null +++ b/src/database/models/DocumentSize.js @@ -0,0 +1,86 @@ +import InfoCircleIcon from '../../components/Icons/InfoCircleIcon' +import ReloadIcon from '../../components/Icons/ReloadIcon' +import EditIcon from '../../components/Icons/EditIcon' +import DocumentSizeIcon from '../../components/Icons/DocumentSizeIcon' + +export const DocumentSize = { + name: 'documentSize', + label: 'Document Size', + prefix: 'DSZ', + icon: DocumentSizeIcon, + actions: [ + { + name: 'info', + label: 'Info', + default: true, + row: true, + icon: InfoCircleIcon, + url: (_id) => + `/dashboard/management/documentsizes/info?documentSizeId=${_id}` + }, + + { + name: 'reload', + label: 'Reload', + icon: ReloadIcon, + url: (_id) => + `/dashboard/management/documentsizes/info?documentSizeId=${_id}&action=reload` + }, + { + name: 'edit', + label: 'Edit', + row: true, + icon: EditIcon, + url: (_id) => + `/dashboard/management/documentsizes/info?documentSizeId=${_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: 'documentSize', + 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: 'width', + label: 'Width', + required: true, + columnWidth: 150, + type: 'number', + suffix: 'mm' + }, + { + name: 'height', + label: 'Height', + required: true, + columnWidth: 150, + type: 'number', + suffix: 'mm' + } + ] +} diff --git a/src/database/models/DocumentTemplate.js b/src/database/models/DocumentTemplate.js new file mode 100644 index 0000000..2da5299 --- /dev/null +++ b/src/database/models/DocumentTemplate.js @@ -0,0 +1,189 @@ +import InfoCircleIcon from '../../components/Icons/InfoCircleIcon' +import ReloadIcon from '../../components/Icons/ReloadIcon' +import EditIcon from '../../components/Icons/EditIcon' +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` + } + ], + 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: false, + 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' + } + ] +}