| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import React from "react"; |
| | | import { |
| | | Edit, |
| | | SimpleForm, |
| | |
| | | ) |
| | | } |
| | | |
| | | const GuaranteeEdit = () => { |
| | | const GuaranteeEditForm = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | return ( |
| | | <Edit |
| | | redirect="list" |
| | | mutationMode={EDIT_MODE} |
| | | actions={<CustomerTopToolBar />} |
| | | aside={<EditBaseAside />} |
| | | <SimpleForm |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | > |
| | | <SimpleForm |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | // validate={(values) => { }} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={12} md={8}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.guarantee.uuid" |
| | | source="uuid" |
| | | parse={v => v} |
| | | autoFocus |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.guarantee.name" |
| | | source="name" |
| | | parse={v => v} |
| | | validate={[required()]} |
| | | /> |
| | | </Stack> |
| | | <ScopeField /> |
| | | <Box mt={2}> |
| | | <CronField /> |
| | | </Box> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.guarantee.requiredCount" |
| | | source="requiredCount" |
| | | validate={[required()]} |
| | | min={1} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.guarantee.minSoc" |
| | | source="minSoc" |
| | | validate={[required()]} |
| | | min={1} |
| | | max={100} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.guarantee.leadTime" |
| | | source="leadTime" |
| | | validate={[required()]} |
| | | min={1} |
| | | /> |
| | | </Stack> |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={12} md={8}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.guarantee.name" |
| | | source="name" |
| | | parse={v => v} |
| | | validate={[required()]} |
| | | autoFocus |
| | | /> |
| | | </Stack> |
| | | <ScopeField /> |
| | | <Box mt={2}> |
| | | <CronField /> |
| | | </Box> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.guarantee.requiredCount" |
| | | source="requiredCount" |
| | | validate={[required()]} |
| | | min={1} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.guarantee.minSoc" |
| | | source="minSoc" |
| | | validate={[required()]} |
| | | min={1} |
| | | max={100} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.guarantee.leadTime" |
| | | source="leadTime" |
| | | validate={[required()]} |
| | | min={1} |
| | | /> |
| | | </Stack> |
| | | |
| | | </Grid> |
| | | <Grid item xs={12} md={4}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.common')} |
| | | </Typography> |
| | | <StatusSelectInput /> |
| | | <Box mt="2em" /> |
| | | <MemoInput /> |
| | | </Grid> |
| | | </Grid> |
| | | </SimpleForm> |
| | | </Edit > |
| | | <Grid item xs={12} md={4}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.common')} |
| | | </Typography> |
| | | <StatusSelectInput /> |
| | | <Box mt="2em" /> |
| | | <MemoInput /> |
| | | </Grid> |
| | | </Grid> |
| | | </SimpleForm> |
| | | ) |
| | | } |
| | | |
| | |
| | | scopeValue: data.scopeType === DEFAULT_SCOPE_TYPE ? null : data.scopeValue, |
| | | })} |
| | | > |
| | | <GuaranteeEdit /> |
| | | <GuaranteeEditForm /> |
| | | </Edit> |
| | | ); |
| | | |