| | |
| | | name="endCode" |
| | | control={control} |
| | | render={({ field, fieldState }) => { |
| | | const selectedOption = codeOptions.find(option => option.id === field.value) || null; |
| | | return ( |
| | | <Autocomplete |
| | | options={codeOptions} |
| | | getOptionLabel={(option) => option.label} |
| | | isOptionEqualToValue={(option, value) => option.id === value.id} |
| | | value={selectedOption} |
| | | onInputChange={(event, value) => { |
| | | setCodeInputValue(value); |
| | | }} |
| | | onChange={(event, value) => { |
| | | field.onChange(value?.id); |
| | | field.onChange(value ? value.id : null); |
| | | }} |
| | | renderInput={(params) => ( |
| | | <TextField |