- Added new invoicing fields: invoicedAmount, invoicedAmountWithTax, invoicedAmountRemaining, and invoicedAmountWithTaxRemaining to the Shipment model. - Updated NewShipment component to include the new invoicing fields in its initial state configuration for better shipment tracking and management.
126 lines
3.4 KiB
JavaScript
126 lines
3.4 KiB
JavaScript
import PropTypes from 'prop-types'
|
|
import ObjectInfo from '../../common/ObjectInfo'
|
|
import NewObjectForm from '../../common/NewObjectForm'
|
|
import WizardView from '../../common/WizardView'
|
|
|
|
const NewShipment = ({ onOk, reset, defaultValues }) => {
|
|
return (
|
|
<NewObjectForm
|
|
type={'shipment'}
|
|
reset={reset}
|
|
defaultValues={{ state: { type: 'draft' }, ...defaultValues }}
|
|
>
|
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
|
const steps = [
|
|
{
|
|
title: 'Required',
|
|
key: 'required',
|
|
content: (
|
|
<ObjectInfo
|
|
type='shipment'
|
|
column={1}
|
|
bordered={false}
|
|
isEditing={true}
|
|
required={true}
|
|
objectData={objectData}
|
|
visibleProperties={{
|
|
amount: false,
|
|
taxRate: false,
|
|
taxAmount: false,
|
|
amountWithTax: false,
|
|
syncAmount: false
|
|
}}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Pricing',
|
|
key: 'pricing',
|
|
content: (
|
|
<ObjectInfo
|
|
type='shipment'
|
|
column={1}
|
|
bordered={false}
|
|
isEditing={true}
|
|
objectData={objectData}
|
|
visibleProperties={{
|
|
amount: true,
|
|
taxRate: true,
|
|
taxAmount: true,
|
|
amountWithTax: true,
|
|
syncAmount: true
|
|
}}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Optional',
|
|
key: 'optional',
|
|
content: (
|
|
<ObjectInfo
|
|
type='shipment'
|
|
column={1}
|
|
bordered={false}
|
|
isEditing={true}
|
|
objectData={objectData}
|
|
visibleProperties={{
|
|
trackingNumber: true
|
|
}}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Summary',
|
|
key: 'summary',
|
|
content: (
|
|
<ObjectInfo
|
|
type='shipment'
|
|
column={1}
|
|
bordered={false}
|
|
visibleProperties={{
|
|
_id: false,
|
|
_reference: false,
|
|
createdAt: false,
|
|
updatedAt: false,
|
|
shippedAt: false,
|
|
expectedAt: false,
|
|
deliveredAt: false,
|
|
taxRecord: false,
|
|
invoicedAmount: false,
|
|
invoicedAmountWithTax: false,
|
|
invoicedAmountRemaining: false,
|
|
invoicedAmountWithTaxRemaining: false
|
|
}}
|
|
isEditing={false}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
}
|
|
]
|
|
return (
|
|
<WizardView
|
|
steps={steps}
|
|
loading={submitLoading}
|
|
formValid={formValid}
|
|
title='New Shipment'
|
|
onSubmit={async () => {
|
|
const result = await handleSubmit()
|
|
if (result) {
|
|
onOk()
|
|
}
|
|
}}
|
|
/>
|
|
)
|
|
}}
|
|
</NewObjectForm>
|
|
)
|
|
}
|
|
|
|
NewShipment.propTypes = {
|
|
onOk: PropTypes.func.isRequired,
|
|
reset: PropTypes.bool,
|
|
defaultValues: PropTypes.object
|
|
}
|
|
|
|
export default NewShipment
|