Update Stock Audit Components with Default State and Required Fields
- Modified NewStockAudit and NewStockAuditLevel components to include a default state of 'draft' in their defaultValues, enhancing the initialization process. - Updated StockAuditLevel model to make the 'tags' field required, ensuring necessary data is captured. - Improved data handling in the StockAuditLevel model by refining the value function for better clarity and maintainability.
This commit is contained in:
parent
b8adc777a4
commit
458512bc2f
@ -8,7 +8,11 @@ const NewStockAudit = ({ onOk, reset, defaultValues }) => {
|
||||
<NewObjectForm
|
||||
type='stockAudit'
|
||||
reset={reset}
|
||||
defaultValues={{ state: { type: 'draft' }, auditLines: [], ...defaultValues }}
|
||||
defaultValues={{
|
||||
state: { type: 'draft' },
|
||||
auditLines: [],
|
||||
...defaultValues
|
||||
}}
|
||||
>
|
||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||
const steps = [
|
||||
@ -39,6 +43,7 @@ const NewStockAudit = ({ onOk, reset, defaultValues }) => {
|
||||
_id: false,
|
||||
_reference: false,
|
||||
createdAt: false,
|
||||
postedAt: false,
|
||||
updatedAt: false,
|
||||
auditLines: false
|
||||
}}
|
||||
|
||||
@ -8,7 +8,11 @@ const NewStockAuditLevel = ({ onOk, reset, defaultValues }) => {
|
||||
<NewObjectForm
|
||||
type='stockAuditLevel'
|
||||
reset={reset}
|
||||
defaultValues={{ auditLines: [], ...defaultValues }}
|
||||
defaultValues={{
|
||||
auditLines: [],
|
||||
state: { type: 'draft' },
|
||||
...defaultValues
|
||||
}}
|
||||
>
|
||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||
const steps = [
|
||||
@ -39,7 +43,8 @@ const NewStockAuditLevel = ({ onOk, reset, defaultValues }) => {
|
||||
_id: false,
|
||||
_reference: false,
|
||||
createdAt: false,
|
||||
updatedAt: false
|
||||
updatedAt: false,
|
||||
auditLines: false
|
||||
}}
|
||||
isEditing={false}
|
||||
objectData={objectData}
|
||||
|
||||
@ -160,7 +160,7 @@ export const StockAuditLevel = {
|
||||
name: 'tags',
|
||||
label: 'Tags',
|
||||
type: 'tags',
|
||||
required: false,
|
||||
required: true,
|
||||
columnWidth: 200
|
||||
},
|
||||
{
|
||||
@ -217,8 +217,7 @@ export const StockAuditLevel = {
|
||||
showHyperlink: true,
|
||||
columnWidth: 220,
|
||||
disabled: (row) => row?.allItems === true || row?.allSkus === true,
|
||||
value: (row) =>
|
||||
row?.allItems || row?.allSkus ? null : row?.itemSku,
|
||||
value: (row) => (row?.allItems || row?.allSkus ? null : row?.itemSku),
|
||||
masterFilter: (row) => {
|
||||
const itemId = row?.item?._id ?? row?.item
|
||||
if (row?.itemType === 'filament' && itemId) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user