| | |
| | | } |
| | | }, [sprite, reset]); |
| | | |
| | | const deviceType = sprite?.data?.type; |
| | | |
| | | const rowValue = watch('row'); |
| | | const bayValue = watch('bay'); |
| | | |
| | | useEffect(() => { |
| | | if (deviceType === DEVICE_TYPE.SHELF) { |
| | | if (rowValue != null && bayValue != null && rowValue !== '' && bayValue !== '') { |
| | | setValue('no', `${rowValue}-${bayValue}`); |
| | | } else { |
| | | setValue('no', ''); |
| | | } |
| | | }, [rowValue, bayValue, setValue]); |
| | | } |
| | | }, [ |
| | | setValue, |
| | | deviceType, |
| | | rowValue, |
| | | bayValue, |
| | | ]); |
| | | |
| | | const onFormSubmit = (data) => { |
| | | if (sprite && sprite.data) { |
| | |
| | | <> |
| | | <Box component="form" onSubmit={handleSubmit(onFormSubmit)} noValidate sx={{ mt: 0 }}> |
| | | <Grid container spacing={1.4}> |
| | | {sprite?.data?.type === DEVICE_TYPE.SHELF && ( |
| | | {deviceType === DEVICE_TYPE.SHELF && ( |
| | | <> |
| | | <Grid item xs={6}> |
| | | <Controller |
| | |
| | | </> |
| | | )} |
| | | |
| | | {sprite?.data?.type === DEVICE_TYPE.CHARGE && ( |
| | | {deviceType === DEVICE_TYPE.CHARGE && ( |
| | | <> |
| | | </> |
| | | )} |
| | | |
| | | {sprite?.data?.type === DEVICE_TYPE.STATION && ( |
| | | {deviceType === DEVICE_TYPE.STATION && ( |
| | | <> |
| | | </> |
| | | )} |
| | | |
| | | {sprite?.data?.type === DEVICE_TYPE.POINT && ( |
| | | {deviceType === DEVICE_TYPE.POINT && ( |
| | | <> |
| | | </> |
| | | )} |
| | | |
| | | <Grid item xs={12}> |
| | | <Divider /> |
| | | </Grid> |