Compare commits
No commits in common. "d8862b65c99d683e023ab880c4a45a8a64b9ad84" and "b8adc777a4b08575449730fdca2e67345a7b74c6" have entirely different histories.
d8862b65c9
...
b8adc777a4
@ -8,11 +8,7 @@ const NewStockAudit = ({ onOk, reset, defaultValues }) => {
|
|||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type='stockAudit'
|
type='stockAudit'
|
||||||
reset={reset}
|
reset={reset}
|
||||||
defaultValues={{
|
defaultValues={{ state: { type: 'draft' }, auditLines: [], ...defaultValues }}
|
||||||
state: { type: 'draft' },
|
|
||||||
auditLines: [],
|
|
||||||
...defaultValues
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -43,7 +39,6 @@ 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,14 +1,19 @@
|
|||||||
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={`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.`}
|
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.`}
|
||||||
onOk={handlePost}
|
onOk={handlePost}
|
||||||
okText='Post'
|
okText='Post'
|
||||||
okLoading={postLoading}
|
okLoading={postLoading}
|
||||||
|
|||||||
@ -8,11 +8,7 @@ const NewStockAuditLevel = ({ onOk, reset, defaultValues }) => {
|
|||||||
<NewObjectForm
|
<NewObjectForm
|
||||||
type='stockAuditLevel'
|
type='stockAuditLevel'
|
||||||
reset={reset}
|
reset={reset}
|
||||||
defaultValues={{
|
defaultValues={{ auditLines: [], ...defaultValues }}
|
||||||
auditLines: [],
|
|
||||||
state: { type: 'draft' },
|
|
||||||
...defaultValues
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
@ -43,8 +39,7 @@ 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: true,
|
required: false,
|
||||||
columnWidth: 200
|
columnWidth: 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -217,7 +217,8 @@ 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) => (row?.allItems || row?.allSkus ? null : row?.itemSku),
|
value: (row) =>
|
||||||
|
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,18 +140,16 @@ export const StockTransfer = {
|
|||||||
filters: [
|
filters: [
|
||||||
'state',
|
'state',
|
||||||
'state.type',
|
'state.type',
|
||||||
'fromLocation',
|
|
||||||
'toLocation',
|
|
||||||
'postedAt',
|
'postedAt',
|
||||||
|
'name',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'_reference'
|
'_reference'
|
||||||
],
|
],
|
||||||
sorters: ['createdAt', 'postedAt', 'state', 'updatedAt'],
|
sorters: ['name', 'createdAt', 'postedAt', 'state', 'updatedAt'],
|
||||||
columns: [
|
columns: [
|
||||||
'_reference',
|
'_reference',
|
||||||
'fromLocation',
|
'name',
|
||||||
'toLocation',
|
|
||||||
'state',
|
'state',
|
||||||
'postedAt',
|
'postedAt',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
@ -192,11 +190,12 @@ export const StockTransfer = {
|
|||||||
columnWidth: 175
|
columnWidth: 175
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'state',
|
name: 'name',
|
||||||
label: 'State',
|
label: 'Name',
|
||||||
type: 'state',
|
type: 'text',
|
||||||
readOnly: true,
|
required: true,
|
||||||
columnWidth: 260
|
columnWidth: 220,
|
||||||
|
columnFixed: 'left'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'postedAt',
|
name: 'postedAt',
|
||||||
@ -206,22 +205,11 @@ export const StockTransfer = {
|
|||||||
columnWidth: 175
|
columnWidth: 175
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'fromLocation',
|
name: 'state',
|
||||||
label: 'From location',
|
label: 'State',
|
||||||
type: 'object',
|
type: 'state',
|
||||||
objectType: 'stockLocation',
|
readOnly: true,
|
||||||
showHyperlink: true,
|
columnWidth: 260
|
||||||
required: true,
|
|
||||||
columnWidth: 220
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'toLocation',
|
|
||||||
label: 'To location',
|
|
||||||
type: 'object',
|
|
||||||
objectType: 'stockLocation',
|
|
||||||
showHyperlink: true,
|
|
||||||
required: true,
|
|
||||||
columnWidth: 220
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -230,15 +218,21 @@ export const StockTransfer = {
|
|||||||
type: 'objectChildren',
|
type: 'objectChildren',
|
||||||
required: false,
|
required: false,
|
||||||
canAddRemove: true,
|
canAddRemove: true,
|
||||||
size: 'medium',
|
columns: [
|
||||||
|
'fromStockType',
|
||||||
|
'fromStock',
|
||||||
|
'quantity',
|
||||||
|
'toStockLocation',
|
||||||
|
'toStockType',
|
||||||
|
'toStock'
|
||||||
|
],
|
||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
name: 'fromStockType',
|
name: 'fromStockType',
|
||||||
label: 'Stock type',
|
label: 'From 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']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -248,13 +242,7 @@ 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',
|
||||||
@ -263,12 +251,6 @@ 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
|
||||||
},
|
},
|
||||||
@ -304,6 +286,23 @@ 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',
|
||||||
@ -311,7 +310,8 @@ 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