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