130 lines
3.4 KiB
JavaScript
130 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 NewPartSku = ({ onOk, reset, defaultValues }) => {
|
|
return (
|
|
<NewObjectForm
|
|
type='partSku'
|
|
reset={reset}
|
|
defaultValues={defaultValues}
|
|
>
|
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
|
const steps = [
|
|
{
|
|
title: 'Required',
|
|
key: 'required',
|
|
content: (
|
|
<ObjectInfo
|
|
type='partSku'
|
|
column={1}
|
|
labelWidth={70}
|
|
bordered={false}
|
|
isEditing={true}
|
|
required={true}
|
|
objectData={objectData}
|
|
visibleProperties={{
|
|
description: false,
|
|
priceMode: false,
|
|
cost: false,
|
|
costWithTax: false,
|
|
costTaxRate: false,
|
|
price: false,
|
|
priceWithTax: false,
|
|
margin: false,
|
|
amount: false,
|
|
priceTaxRate: false,
|
|
vendor: false
|
|
}}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Pricing',
|
|
key: 'pricing',
|
|
content: (
|
|
<ObjectInfo
|
|
type='partSku'
|
|
column={1}
|
|
labelWidth={100}
|
|
visibleProperties={{
|
|
_id: false,
|
|
createdAt: false,
|
|
updatedAt: false,
|
|
barcode: false,
|
|
part: false,
|
|
name: false,
|
|
description: false
|
|
}}
|
|
bordered={false}
|
|
isEditing={true}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Optional',
|
|
key: 'optional',
|
|
content: (
|
|
<ObjectInfo
|
|
type='partSku'
|
|
column={1}
|
|
labelWidth={100}
|
|
visibleProperties={{
|
|
barcode: true,
|
|
description: true
|
|
}}
|
|
bordered={false}
|
|
isEditing={true}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Summary',
|
|
key: 'summary',
|
|
content: (
|
|
<ObjectInfo
|
|
type='partSku'
|
|
column={1}
|
|
visibleProperties={{
|
|
createdAt: false,
|
|
updatedAt: false,
|
|
_id: false
|
|
}}
|
|
labelWidth={100}
|
|
bordered={false}
|
|
isEditing={false}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
}
|
|
]
|
|
return (
|
|
<WizardView
|
|
steps={steps}
|
|
loading={submitLoading}
|
|
formValid={formValid}
|
|
title='New Part SKU'
|
|
onSubmit={async () => {
|
|
const result = await handleSubmit()
|
|
if (result) {
|
|
onOk()
|
|
}
|
|
}}
|
|
/>
|
|
)
|
|
}}
|
|
</NewObjectForm>
|
|
)
|
|
}
|
|
|
|
NewPartSku.propTypes = {
|
|
onOk: PropTypes.func.isRequired,
|
|
reset: PropTypes.bool,
|
|
defaultValues: PropTypes.object
|
|
}
|
|
|
|
export default NewPartSku
|