All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
125 lines
3.3 KiB
JavaScript
125 lines
3.3 KiB
JavaScript
import PropTypes from 'prop-types'
|
|
import ObjectInfo from '../../common/ObjectInfo'
|
|
import NewObjectForm from '../../common/NewObjectForm'
|
|
import WizardView from '../../common/WizardView'
|
|
|
|
const NewFilamentSku = ({ onOk, reset, defaultValues }) => {
|
|
return (
|
|
<NewObjectForm
|
|
type='filamentSku'
|
|
reset={reset}
|
|
defaultValues={defaultValues}
|
|
>
|
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
|
const steps = [
|
|
{
|
|
title: 'Required',
|
|
key: 'required',
|
|
content: (
|
|
<ObjectInfo
|
|
type='filamentSku'
|
|
column={1}
|
|
labelWidth={70}
|
|
bordered={false}
|
|
isEditing={true}
|
|
required={true}
|
|
objectData={objectData}
|
|
visibleProperties={{
|
|
description: false,
|
|
cost: false,
|
|
costWithTax: false,
|
|
costTaxRate: false,
|
|
vendor: false
|
|
}}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Color & Cost',
|
|
key: 'colorCost',
|
|
content: (
|
|
<ObjectInfo
|
|
type='filamentSku'
|
|
column={1}
|
|
labelWidth={100}
|
|
visibleProperties={{
|
|
_id: false,
|
|
createdAt: false,
|
|
updatedAt: false,
|
|
barcode: false,
|
|
filament: false,
|
|
name: false,
|
|
description: false
|
|
}}
|
|
bordered={false}
|
|
isEditing={true}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Optional',
|
|
key: 'optional',
|
|
content: (
|
|
<ObjectInfo
|
|
type='filamentSku'
|
|
column={1}
|
|
labelWidth={100}
|
|
visibleProperties={{
|
|
barcode: true,
|
|
description: true
|
|
}}
|
|
bordered={false}
|
|
isEditing={true}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Summary',
|
|
key: 'summary',
|
|
content: (
|
|
<ObjectInfo
|
|
type='filamentSku'
|
|
column={1}
|
|
visibleProperties={{
|
|
createdAt: false,
|
|
updatedAt: false,
|
|
_id: false,
|
|
_reference: false
|
|
}}
|
|
labelWidth={100}
|
|
bordered={false}
|
|
isEditing={false}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
}
|
|
]
|
|
return (
|
|
<WizardView
|
|
steps={steps}
|
|
loading={submitLoading}
|
|
formValid={formValid}
|
|
title='New Filament SKU'
|
|
onSubmit={async () => {
|
|
const result = await handleSubmit()
|
|
if (result) {
|
|
onOk()
|
|
}
|
|
}}
|
|
/>
|
|
)
|
|
}}
|
|
</NewObjectForm>
|
|
)
|
|
}
|
|
|
|
NewFilamentSku.propTypes = {
|
|
onOk: PropTypes.func.isRequired,
|
|
reset: PropTypes.bool,
|
|
defaultValues: PropTypes.object
|
|
}
|
|
|
|
export default NewFilamentSku
|