| | |
| | | const theme = useTheme(); |
| | | const translate = useTranslate(); |
| | | |
| | | const { control, handleSubmit, reset, watch } = useForm({ |
| | | const { control, handleSubmit, reset, watch, setValue } = useForm({ |
| | | defaultValues: { |
| | | taskMode: 'MOVE', |
| | | startCode: '', |
| | |
| | | |
| | | useEffect(() => { |
| | | reset(); |
| | | }, [curAgvNo]); |
| | | }, [curAgvNo, reset]); |
| | | |
| | | const onSubmit = (data) => { |
| | | if (curAgvNo) { |
| | |
| | | setInputValue: setEndStaInputValue, |
| | | } = useCoolHook('/sta/page', 'staNo'); |
| | | |
| | | useEffect(() => { |
| | | const fieldsToClear = ['startCode', 'endCode', 'startLocNo', 'endLocNo', 'startStaNo', 'endStaNo']; |
| | | |
| | | fieldsToClear.forEach(field => { |
| | | if (!showField(field)) { |
| | | setValue(field, ''); |
| | | } |
| | | }); |
| | | }, [taskMode, setValue, showField]); |
| | | |
| | | return ( |
| | | <> |
| | |
| | | debouncedFetch(inputValue); |
| | | }, [inputValue, debouncedFetch]); |
| | | |
| | | const resetInput = () => setInputValue(''); |
| | | |
| | | return { |
| | | options, |
| | | setInputValue, |
| | | resetInput, |
| | | }; |
| | | } |
| | | |