Compare commits
2 Commits
b8adc777a4
...
d8862b65c9
| Author | SHA1 | Date | |
|---|---|---|---|
| d8862b65c9 | |||
| 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
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -1,19 +1,14 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import ObjectInfo from '../../common/ObjectInfo'
|
import ObjectInfo from '../../common/ObjectInfo'
|
||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import WizardView from '../../common/WizardView'
|
||||||
|
|
||||||
const defaultTransferName = () =>
|
|
||||||
`Transfer ${dayjs().format('YYYY-MM-DD HH:mm:ss')}`
|
|
||||||
|
|
||||||
const NewStockTransfer = ({ onOk, reset }) => {
|
const NewStockTransfer = ({ onOk, reset }) => {
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type={'stockTransfer'}
|
type={'stockTransfer'}
|
||||||
reset={reset}
|
reset={reset}
|
||||||
defaultValues={{
|
defaultValues={{
|
||||||
name: defaultTransferName(),
|
|
||||||
state: { type: 'draft' },
|
state: { type: 'draft' },
|
||||||
lines: []
|
lines: []
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -30,7 +30,7 @@ const PostStockTransfer = ({ onOk, objectData }) => {
|
|||||||
return (
|
return (
|
||||||
<MessageDialogView
|
<MessageDialogView
|
||||||
title={'Post this stock transfer?'}
|
title={'Post this stock transfer?'}
|
||||||
description={`Receiving will move stock to the target locations, create destination stock rows, record stock events owned by this transfer, and fill in the "to" stock on each line.`}
|
description={`Posting will move stock from the transfer's from location to its to location, create destination stock rows, record stock events owned by this transfer, and fill in the "to" stock on each line.`}
|
||||||
onOk={handlePost}
|
onOk={handlePost}
|
||||||
okText='Post'
|
okText='Post'
|
||||||
okLoading={postLoading}
|
okLoading={postLoading}
|
||||||
|
|||||||
@ -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) {
|
||||||
|
|||||||
@ -140,16 +140,18 @@ export const StockTransfer = {
|
|||||||
filters: [
|
filters: [
|
||||||
'state',
|
'state',
|
||||||
'state.type',
|
'state.type',
|
||||||
|
'fromLocation',
|
||||||
|
'toLocation',
|
||||||
'postedAt',
|
'postedAt',
|
||||||
'name',
|
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
],
|
],
|
||||||
sorters: ['name', 'createdAt', 'postedAt', 'state', 'updatedAt'],
|
sorters: ['createdAt', 'postedAt', 'state', 'updatedAt'],
|
||||||
columns: [
|
columns: [
|
||||||
'_reference',
|
'_reference',
|
||||||
'name',
|
'fromLocation',
|
||||||
|
'toLocation',
|
||||||
'state',
|
'state',
|
||||||
'postedAt',
|
'postedAt',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
@ -190,12 +192,11 @@ export const StockTransfer = {
|
|||||||
columnWidth: 175
|
columnWidth: 175
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'name',
|
name: 'state',
|
||||||
label: 'Name',
|
label: 'State',
|
||||||
type: 'text',
|
type: 'state',
|
||||||
required: true,
|
readOnly: true,
|
||||||
columnWidth: 220,
|
columnWidth: 260
|
||||||
columnFixed: 'left'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'postedAt',
|
name: 'postedAt',
|
||||||
@ -205,11 +206,22 @@ export const StockTransfer = {
|
|||||||
columnWidth: 175
|
columnWidth: 175
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'state',
|
name: 'fromLocation',
|
||||||
label: 'State',
|
label: 'From location',
|
||||||
type: 'state',
|
type: 'object',
|
||||||
readOnly: true,
|
objectType: 'stockLocation',
|
||||||
columnWidth: 260
|
showHyperlink: true,
|
||||||
|
required: true,
|
||||||
|
columnWidth: 220
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'toLocation',
|
||||||
|
label: 'To location',
|
||||||
|
type: 'object',
|
||||||
|
objectType: 'stockLocation',
|
||||||
|
showHyperlink: true,
|
||||||
|
required: true,
|
||||||
|
columnWidth: 220
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -218,21 +230,15 @@ export const StockTransfer = {
|
|||||||
type: 'objectChildren',
|
type: 'objectChildren',
|
||||||
required: false,
|
required: false,
|
||||||
canAddRemove: true,
|
canAddRemove: true,
|
||||||
columns: [
|
size: 'medium',
|
||||||
'fromStockType',
|
|
||||||
'fromStock',
|
|
||||||
'quantity',
|
|
||||||
'toStockLocation',
|
|
||||||
'toStockType',
|
|
||||||
'toStock'
|
|
||||||
],
|
|
||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
name: 'fromStockType',
|
name: 'fromStockType',
|
||||||
label: 'From type',
|
label: 'Stock type',
|
||||||
type: 'objectType',
|
type: 'objectType',
|
||||||
required: true,
|
required: true,
|
||||||
columnWidth: 180,
|
columnWidth: 180,
|
||||||
|
disabled: (row, parentData) => parentData?.fromLocation?._id == null,
|
||||||
masterFilter: ['filamentStock', 'partStock', 'productStock']
|
masterFilter: ['filamentStock', 'partStock', 'productStock']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -242,7 +248,13 @@ export const StockTransfer = {
|
|||||||
objectType: (row) => row?.fromStockType,
|
objectType: (row) => row?.fromStockType,
|
||||||
required: true,
|
required: true,
|
||||||
showHyperlink: true,
|
showHyperlink: true,
|
||||||
columnWidth: 230
|
columnWidth: 230,
|
||||||
|
masterFilter: (_row, parentData) => {
|
||||||
|
const fromLocation =
|
||||||
|
parentData?.fromLocation?._id ?? parentData?.fromLocation
|
||||||
|
if (!fromLocation) return {}
|
||||||
|
return { stockLocation: fromLocation }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'quantity',
|
name: 'quantity',
|
||||||
@ -251,6 +263,12 @@ export const StockTransfer = {
|
|||||||
required: true,
|
required: true,
|
||||||
min: 0,
|
min: 0,
|
||||||
columnWidth: 140,
|
columnWidth: 140,
|
||||||
|
disabled: (row, parentData) => {
|
||||||
|
return (
|
||||||
|
parentData?.fromLocation?._id == null ||
|
||||||
|
row?.fromStock?._id == undefined
|
||||||
|
)
|
||||||
|
},
|
||||||
suffix: (row) =>
|
suffix: (row) =>
|
||||||
row?.fromStockType === 'filamentStock' ? 'g net' : null
|
row?.fromStockType === 'filamentStock' ? 'g net' : null
|
||||||
},
|
},
|
||||||
@ -286,23 +304,6 @@ export const StockTransfer = {
|
|||||||
suffix: (row) =>
|
suffix: (row) =>
|
||||||
row?.fromStockType === 'filamentStock' ? 'g net' : null
|
row?.fromStockType === 'filamentStock' ? 'g net' : null
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'toStockLocation',
|
|
||||||
label: 'To location',
|
|
||||||
type: 'object',
|
|
||||||
objectType: 'stockLocation',
|
|
||||||
required: true,
|
|
||||||
showHyperlink: true,
|
|
||||||
columnWidth: 230
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'toStockType',
|
|
||||||
label: 'To type',
|
|
||||||
type: 'objectType',
|
|
||||||
readOnly: true,
|
|
||||||
columnWidth: 180,
|
|
||||||
visible: (row) => Boolean(row?.toStockType)
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'toStock',
|
name: 'toStock',
|
||||||
label: 'To stock',
|
label: 'To stock',
|
||||||
@ -310,8 +311,7 @@ export const StockTransfer = {
|
|||||||
objectType: (row) => row?.toStockType,
|
objectType: (row) => row?.toStockType,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
showHyperlink: true,
|
showHyperlink: true,
|
||||||
columnWidth: 230,
|
columnWidth: 230
|
||||||
visible: (row) => Boolean(row?.toStock)
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user