- Consolidated JavaScript completion sources into a new module, improving organization and maintainability. - Updated the `fcTemplateLang` to utilize the new `javascriptCompletionSources` for enhanced autocomplete capabilities. - Removed redundant imports and streamlined the code in various components, including Invoices, Payments, TaxRecords, and Inventory sections, by replacing dropdown actions with a unified `ObjectActions` component. - Improved the handling of object actions across multiple inventory and finance components, enhancing user experience and code consistency.
137 lines
3.1 KiB
JavaScript
137 lines
3.1 KiB
JavaScript
import { createElement, lazy } from 'react'
|
|
|
|
const StockAuditInfo = lazy(
|
|
() => import('../../components/Dashboard/Inventory/StockAudits/StockAuditInfo')
|
|
)
|
|
const NewStockAudit = lazy(
|
|
() => import('../../components/Dashboard/Inventory/StockAudits/NewStockAudit')
|
|
)
|
|
import StockAuditIcon from '../../components/Icons/StockAuditIcon'
|
|
import PlusIcon from '../../components/Icons/PlusIcon'
|
|
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 StockAudit = {
|
|
name: 'stockAudit',
|
|
label: 'Stock Audit',
|
|
labelPlural: 'Stock Audits',
|
|
url: '/dashboard/inventory/stockaudits',
|
|
prefix: 'SAU',
|
|
icon: StockAuditIcon,
|
|
actions: [
|
|
{
|
|
name: 'new',
|
|
type: 'modal',
|
|
pageName: 'list',
|
|
modalWidth: 800,
|
|
label: 'New Stock Audit',
|
|
icon: PlusIcon,
|
|
content: (objectData, { onOk } = {}) => {
|
|
return createElement(NewStockAudit, { defaultValues: objectData, onOk, reset: true })
|
|
}
|
|
},
|
|
{
|
|
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(StockAuditInfo)
|
|
}
|
|
],
|
|
columns: ['_reference', 'state', 'createdAt', 'updatedAt'],
|
|
filters: [
|
|
'status',
|
|
'type',
|
|
'createdBy',
|
|
'state',
|
|
'createdAt',
|
|
'updatedAt',
|
|
'_reference'
|
|
],
|
|
sorters: ['createdAt','updatedAt','state'],
|
|
group: ['state'],
|
|
properties: [
|
|
{
|
|
name: '_id',
|
|
label: 'ID',
|
|
type: 'id',
|
|
objectType: 'stockAudit',
|
|
showCopy: true,
|
|
readOnly: true,
|
|
columnWidth: 140
|
|
},
|
|
{
|
|
name: 'createdAt',
|
|
label: 'Created At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
},
|
|
{
|
|
name: '_reference',
|
|
label: 'Reference',
|
|
type: 'reference',
|
|
columnFixed: 'left',
|
|
objectType: 'stockAudit',
|
|
showCopy: true,
|
|
readOnly: true,
|
|
columnWidth: 180
|
|
},
|
|
{
|
|
name: 'state',
|
|
label: 'State',
|
|
type: 'state',
|
|
readOnly: true,
|
|
columnWidth: 260
|
|
},
|
|
{
|
|
name: 'updatedAt',
|
|
label: 'Updated At',
|
|
type: 'dateTime',
|
|
readOnly: true,
|
|
columnWidth: 175
|
|
}
|
|
]
|
|
}
|