| | |
| | | import CustomerTopToolBar from "@/page/components/EditTopToolBar"; |
| | | import MemoInput from "@/page/components/MemoInput"; |
| | | import StatusSelectInput from "@/page/components/StatusSelectInput"; |
| | | import TreeSelectInput from "@/page/components/TreeSelectInput"; |
| | | |
| | | const FormToolbar = () => { |
| | | const { getValues } = useFormContext(); |
| | |
| | | const handleChange = (event, newValue) => { |
| | | setValue(newValue); |
| | | }; |
| | | const validateForm = (values) => { |
| | | const errors = {}; |
| | | if (!values.shipperId) { |
| | | errors.shipperId = translate('form.matnr.shipper'); |
| | | } |
| | | if (!values.groupId) { |
| | | errors.groupId = translate('form.matnr.groupId'); |
| | | } |
| | | return errors; |
| | | }; |
| | | return ( |
| | | <Edit |
| | | redirect="list" |
| | |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | validate={validateForm} |
| | | // validate={(values) => { }} |
| | | > |
| | | <Grid container width={{ xs: '20%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid container rowSpacing={3} columnSpacing={3}> |
| | | |
| | | <Grid item xs={12} md={10}> |
| | | <Typography variant="h6" gutterBottom> |
| | |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | source="shipperId" |
| | | reference="shipper" |
| | | perPage={REFERENCE_INPUT_PAGESIZE} |
| | | > |
| | | <ReferenceInput source="shipperId" reference="companys" filter={{ type: 'shipper' }}> |
| | | <AutocompleteInput |
| | | validate={[required()]} |
| | | label="table.field.matnr.shipperId" |
| | |
| | | </ReferenceInput> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | {/* <ReferenceInput |
| | | source="groupId" |
| | | reference="matnrGroup" |
| | | perPage={REFERENCE_INPUT_PAGESIZE} |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.matnr.groupId" |
| | | optionText="code" |
| | | optionText="label" |
| | | validate={[required()]} |
| | | filterToQuery={(val) => ({ code: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | </ReferenceInput> */} |
| | | |
| | | <TreeSelectInput |
| | | label="table.field.matnr.groupId" |
| | | resource={'matnrGroup'} |
| | | source="groupId" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | source="rglarId" |
| | | reference="rglarId" |
| | | reference="batchRegular" |
| | | perPage={REFERENCE_INPUT_PAGESIZE} |
| | | > |
| | | <AutocompleteInput |
| | |
| | | filterToQuery={(val) => ({ code: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | </Grid> |
| | | </Grid> */} |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.matnr.erpCode" |
| | | source="erpCode" |
| | | label="table.field.matnr.platCode" |
| | | source="platCode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |