- Added a new 'updatedAt' field to the DocumentSize model for tracking updates, ensuring it is read-only and properly formatted. - Removed the previous 'updatedAt' field and adjusted the visibility logic for the 'width' field based on the 'infiniteHeight' property, enhancing user experience.
144 lines
3.2 KiB
JavaScript
144 lines
3.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 DocumentSizeIcon from '../../components/Icons/DocumentSizeIcon'
|
|
|
|
export const DocumentSize = {
|
|
name: 'documentSize',
|
|
label: 'Document Size',
|
|
labelPlural: 'Document Sizes',
|
|
url: '/dashboard/management/documentsizes',
|
|
prefix: 'DSZ',
|
|
icon: DocumentSizeIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentsizes/info?documentSizeId=${_id}`
|
|
},
|
|
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
row: true,
|
|
icon: EditIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentsizes/info?documentSizeId=${_id}&action=edit`,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentsizes/info?documentSizeId=${_id}&action=finishEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
url: (_id) =>
|
|
`/dashboard/management/documentsizes/info?documentSizeId=${_id}&action=cancelEdit`,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
}
|
|
],
|
|
columns: [
|
|
'_reference',
|
|
'name',
|
|
'width',
|
|
'height',
|
|
'infiniteHeight',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
filters: ['name', '_id', 'width', 'height', 'infiniteHeight'],
|
|
sorters: [
|
|
'name',
|
|
'width',
|
|
'height',
|
|
'infiniteHeight',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'documentSize',
|
|
showCopy: true,
|
|
columnWidth: 140
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'documentSize',
|
|
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'
|
|
},
|
|
{
|
|
name: 'infiniteHeight',
|
|
label: 'Infinite Height',
|
|
required: true,
|
|
columnWidth: 150,
|
|
type: 'bool'
|
|
},
|
|
{
|
|
name: 'width',
|
|
label: 'Width',
|
|
required: true,
|
|
columnWidth: 150,
|
|
type: 'number',
|
|
suffix: 'mm'
|
|
},
|
|
{
|
|
name: 'height',
|
|
label: 'Height',
|
|
required: true,
|
|
columnWidth: 150,
|
|
type: 'number',
|
|
suffix: 'mm',
|
|
visible: (objectData) => {
|
|
return !objectData.infiniteHeight
|
|
}
|
|
}
|
|
]
|
|
}
|