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
|
<NewObjectForm
|
||||||
type='stockAudit'
|
type='stockAudit'
|
||||||
reset={reset}
|
reset={reset}
|
||||||
defaultValues={{ state: { type: 'draft' }, auditLines: [], ...defaultValues }}
|
defaultValues={{
|
||||||
|
state: { type: 'draft' },
|
||||||
|
auditLines: [],
|
||||||
|
...defaultValues
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -39,6 +43,7 @@ const NewStockAudit = ({ onOk, reset, defaultValues }) => {
|
|||||||
_id: false,
|
_id: false,
|
||||||
_reference: false,
|
_reference: false,
|
||||||
createdAt: false,
|
createdAt: false,
|
||||||
|
postedAt: false,
|
||||||
updatedAt: false,
|
updatedAt: false,
|
||||||
auditLines: false
|
auditLines: false
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -8,7 +8,11 @@ const NewStockAuditLevel = ({ onOk, reset, defaultValues }) => {
|
|||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type='stockAuditLevel'
|
type='stockAuditLevel'
|
||||||
reset={reset}
|
reset={reset}
|
||||||
defaultValues={{ auditLines: [], ...defaultValues }}
|
defaultValues={{
|
||||||
|
auditLines: [],
|
||||||
|
state: { type: 'draft' },
|
||||||
|
...defaultValues
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -39,7 +43,8 @@ const NewStockAuditLevel = ({ onOk, reset, defaultValues }) => {
|
|||||||
_id: false,
|
_id: false,
|
||||||
_reference: false,
|
_reference: false,
|
||||||
createdAt: false,
|
createdAt: false,
|
||||||
updatedAt: false
|
updatedAt: false,
|
||||||
|
auditLines: false
|
||||||
}}
|
}}
|
||||||
isEditing={false}
|
isEditing={false}
|
||||||
objectData={objectData}
|
objectData={objectData}
|
||||||
|
|||||||
@ -160,7 +160,7 @@ export const StockAuditLevel = {
|
|||||||
name: 'tags',
|
name: 'tags',
|
||||||
label: 'Tags',
|
label: 'Tags',
|
||||||
type: 'tags',
|
type: 'tags',
|
||||||
required: false,
|
required: true,
|
||||||
columnWidth: 200
|
columnWidth: 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -217,8 +217,7 @@ export const StockAuditLevel = {
|
|||||||
showHyperlink: true,
|
showHyperlink: true,
|
||||||
columnWidth: 220,
|
columnWidth: 220,
|
||||||
disabled: (row) => row?.allItems === true || row?.allSkus === true,
|
disabled: (row) => row?.allItems === true || row?.allSkus === true,
|
||||||
value: (row) =>
|
value: (row) => (row?.allItems || row?.allSkus ? null : row?.itemSku),
|
||||||
row?.allItems || row?.allSkus ? null : row?.itemSku,
|
|
||||||
masterFilter: (row) => {
|
masterFilter: (row) => {
|
||||||
const itemId = row?.item?._id ?? row?.item
|
const itemId = row?.item?._id ?? row?.item
|
||||||
if (row?.itemType === 'filament' && itemId) {
|
if (row?.itemType === 'filament' && itemId) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user