| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import React, { useMemo } from "react"; |
| | | import { |
| | | CreateBase, |
| | | useTranslate, |
| | |
| | | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const greaterThanZero = useMemo(() => (value) => { |
| | | if (value === undefined || value === null || value === '') { |
| | | return undefined; |
| | | } |
| | | return Number(value) >= 0 ? undefined : translate('validate.gtZero'); |
| | | }, [translate]); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | |
| | | <NumberInput |
| | | label="table.field.sta.capacity" |
| | | source="capacity" |
| | | validate={required()} |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.offset" |
| | | source="offset" |
| | | validate={required()} |
| | | /> |
| | | </Grid> */} |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.height" |
| | | source="height" |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.depth" |
| | | source="depth" |
| | | helperText={translate('page.sta.depthHint')} |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.angle" |
| | | source="angle" |
| | | validate={required()} |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.inboundWait" |
| | | source="inboundWait" |
| | | validate={greaterThanZero} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.outboundWait" |
| | | source="outboundWait" |
| | | validate={greaterThanZero} |
| | | /> |
| | | </Grid> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | |
| | | </ReferenceInput> |
| | | </Grid> */} |
| | | |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | | </Grid> |
| | | </Grid> */} |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <Stack direction="column" spacing={1} width={'100%'}> |
| | | <MemoInput /> |