Some checks failed
farmcontrol/farmcontrol-ui/pipeline/head There was a failure building this commit
- Updated multiple components including InvoiceInfo, PaymentInfo, TaxRecordInfo, and various stock-related components to use getModelByName for constructing master filters. - Improved code consistency and readability by replacing hardcoded parent ID references with dynamic model prefixes. - Cleaned up unnecessary whitespace and optimized component structure for better maintainability.
138 lines
2.8 KiB
JavaScript
138 lines
2.8 KiB
JavaScript
import NoteIcon from '../../components/Icons/NoteIcon'
|
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
|
import EditIcon from '../../components/Icons/EditIcon'
|
|
import CheckIcon from '../../components/Icons/CheckIcon'
|
|
import XMarkIcon from '../../components/Icons/XMarkIcon'
|
|
|
|
export const Note = {
|
|
name: 'note',
|
|
label: 'Note',
|
|
labelPlural: 'Notes',
|
|
prefix: 'NTE',
|
|
icon: NoteIcon,
|
|
actions: [
|
|
{
|
|
name: 'info',
|
|
label: 'Info',
|
|
default: true,
|
|
row: true,
|
|
icon: InfoCircleIcon,
|
|
url: (_id) => `/dashboard/management/notes/info?noteId=${_id}`
|
|
},
|
|
{
|
|
name: 'edit',
|
|
label: 'Edit',
|
|
icon: EditIcon,
|
|
visible: (objectData) => {
|
|
return !(objectData?._isEditing && objectData?._isEditing == true)
|
|
}
|
|
},
|
|
{
|
|
name: 'cancelEdit',
|
|
label: 'Cancel Edits',
|
|
icon: XMarkIcon,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
},
|
|
{
|
|
name: 'finishEdit',
|
|
label: 'Save Edits',
|
|
icon: CheckIcon,
|
|
visible: (objectData) => {
|
|
return objectData?._isEditing && objectData?._isEditing == true
|
|
}
|
|
}
|
|
],
|
|
columns: [
|
|
'_reference',
|
|
'user',
|
|
'parentType',
|
|
'parent',
|
|
'noteType',
|
|
'createdAt',
|
|
'updatedAt'
|
|
],
|
|
filters: [
|
|
'_id',
|
|
'user',
|
|
'parentType',
|
|
'parent',
|
|
'parent',
|
|
'noteType',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'_reference'
|
|
],
|
|
sorters: ['createdAt', 'updatedAt', 'parentType', 'noteType'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'note',
|
|
showCopy: true
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'note',
|
|
showCopy: true,
|
|
readOnly: true,
|
|
columnWidth: 180
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true
|
|
},
|
|
{
|
|
name: 'user',
|
|
label: 'User',
|
|
type: 'object',
|
|
objectType: 'user',
|
|
showHyperlink: true
|
|
},
|
|
{
|
|
name: 'parentType',
|
|
label: 'Parent Type',
|
|
type: 'objectType',
|
|
required: true
|
|
},
|
|
{
|
|
name: 'parent',
|
|
label: 'Parent',
|
|
type: 'object',
|
|
objectType: (objectData) => {
|
|
return objectData.parentType
|
|
},
|
|
showHyperlink: true,
|
|
required: true
|
|
},
|
|
{
|
|
name: 'content',
|
|
label: 'Content',
|
|
type: 'markdown',
|
|
required: true,
|
|
span: 2
|
|
},
|
|
{
|
|
name: 'noteType',
|
|
label: 'Note Type',
|
|
type: 'object',
|
|
objectType: 'noteType',
|
|
showHyperlink: true,
|
|
required: true
|
|
}
|
|
]
|
|
}
|