- Updated NewFilamentStock, NewPartStock, NewPurchaseOrder, NewStockAudit, NewCourierService, NewCourier, NewDocumentPrinter, NewDocumentSize, NewDocumentTemplate, NewPart, NewProduct, NewTaxRate, NewTaxRecord, NewVendor, NewGCodeFile, NewJob, and NewPrinter components to accept a defaultValues prop. - Merged defaultValues with existing default values in each component to allow for more customizable form initialization.
85 lines
2.1 KiB
JavaScript
85 lines
2.1 KiB
JavaScript
import PropTypes from 'prop-types'
|
|
import ObjectInfo from '../../common/ObjectInfo'
|
|
import NewObjectForm from '../../common/NewObjectForm'
|
|
import WizardView from '../../common/WizardView'
|
|
|
|
const NewVendor = ({ onOk, defaultValues }) => {
|
|
return (
|
|
<NewObjectForm
|
|
type={'vendor'}
|
|
defaultValues={{ active: true, ...defaultValues }}
|
|
>
|
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
|
const steps = [
|
|
{
|
|
title: 'Required',
|
|
key: 'required',
|
|
content: (
|
|
<ObjectInfo
|
|
type='vendor'
|
|
column={1}
|
|
bordered={false}
|
|
isEditing={true}
|
|
required={true}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Optional',
|
|
key: 'optional',
|
|
content: (
|
|
<ObjectInfo
|
|
type='vendor'
|
|
column={1}
|
|
bordered={false}
|
|
isEditing={true}
|
|
required={false}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Summary',
|
|
key: 'summary',
|
|
content: (
|
|
<ObjectInfo
|
|
type='vendor'
|
|
column={1}
|
|
bordered={false}
|
|
visibleProperties={{
|
|
_id: false,
|
|
createdAt: false,
|
|
updatedAt: false
|
|
}}
|
|
isEditing={false}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
}
|
|
]
|
|
return (
|
|
<WizardView
|
|
steps={steps}
|
|
loading={submitLoading}
|
|
formValid={formValid}
|
|
title='New Vendor'
|
|
onSubmit={() => {
|
|
handleSubmit()
|
|
onOk()
|
|
}}
|
|
/>
|
|
)
|
|
}}
|
|
</NewObjectForm>
|
|
)
|
|
}
|
|
|
|
NewVendor.propTypes = {
|
|
onOk: PropTypes.func.isRequired,
|
|
reset: PropTypes.bool,
|
|
defaultValues: PropTypes.object
|
|
}
|
|
|
|
export default NewVendor
|