All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Introduced new components for managing Payment Policies and Fulfillment Policies, enhancing the dashboard's functionality for financial management. - Added corresponding SVG icons for Payment Policy, Fulfillment Policy, and Return Policy to improve visual representation. - Updated App.css with new styles for file gallery previews, ensuring a cohesive layout and user experience across the dashboard. - Implemented new object forms and tables for Payment Policies, allowing for better data handling and user interaction.
91 lines
2.4 KiB
JavaScript
91 lines
2.4 KiB
JavaScript
import PropTypes from 'prop-types'
|
|
import ObjectInfo from '../../common/ObjectInfo'
|
|
import NewObjectForm from '../../common/NewObjectForm'
|
|
import WizardView from '../../common/WizardView'
|
|
|
|
const NewFulfillmentPolicy = ({ onOk, defaultValues }) => {
|
|
return (
|
|
<NewObjectForm
|
|
type={'fulfillmentPolicy'}
|
|
defaultValues={{ handlingTime: 1, ...defaultValues }}
|
|
>
|
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
|
const steps = [
|
|
{
|
|
title: 'Required',
|
|
key: 'required',
|
|
content: (
|
|
<ObjectInfo
|
|
type='fulfillmentPolicy'
|
|
column={1}
|
|
bordered={false}
|
|
isEditing={true}
|
|
required={true}
|
|
objectData={objectData}
|
|
labelWidth={130}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Optional',
|
|
key: 'optional',
|
|
content: (
|
|
<ObjectInfo
|
|
type='fulfillmentPolicy'
|
|
column={1}
|
|
bordered={false}
|
|
isEditing={true}
|
|
required={false}
|
|
labelWidth={130}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Summary',
|
|
key: 'summary',
|
|
content: (
|
|
<ObjectInfo
|
|
type='fulfillmentPolicy'
|
|
column={1}
|
|
bordered={false}
|
|
visibleProperties={{
|
|
_id: false,
|
|
_reference: false,
|
|
createdAt: false,
|
|
updatedAt: false
|
|
}}
|
|
labelWidth={130}
|
|
isEditing={false}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
}
|
|
]
|
|
return (
|
|
<WizardView
|
|
steps={steps}
|
|
loading={submitLoading}
|
|
formValid={formValid}
|
|
title='New Fulfillment Policy'
|
|
onSubmit={async () => {
|
|
const result = await handleSubmit()
|
|
if (result) {
|
|
onOk()
|
|
}
|
|
}}
|
|
/>
|
|
)
|
|
}}
|
|
</NewObjectForm>
|
|
)
|
|
}
|
|
|
|
NewFulfillmentPolicy.propTypes = {
|
|
onOk: PropTypes.func.isRequired,
|
|
reset: PropTypes.bool,
|
|
defaultValues: PropTypes.object
|
|
}
|
|
|
|
export default NewFulfillmentPolicy
|