@@ -20,7 +20,7 @@ import {
2020} from "@/modules/util" ;
2121import { ApplicationEventSummary } from "./ApplicationEventSummary" ;
2222import Accordion from "../common/Accordion" ;
23- import { getDurationNumberOptions } from "@/modules/const" ;
23+ import { getDurationOptions } from "@/modules/const" ;
2424import ConfirmationModal , { ModalRef } from "../common/ConfirmationModal" ;
2525import { MediumButton } from "@/styles/util" ;
2626import { ApplicationFormValues } from "./Form" ;
@@ -177,6 +177,7 @@ function ApplicationEventInner({
177177 return "" ;
178178 } ;
179179
180+ const durationOptions = getDurationOptions ( t ) ;
180181 return (
181182 < >
182183 < SubHeadLine >
@@ -219,11 +220,13 @@ function ApplicationEventInner({
219220 rules = { { required : true } }
220221 name = { `applicationSections.${ index } .ageGroup` }
221222 render = { ( { field } ) => (
222- < Select < OptionType >
223+ < Select
223224 value = {
224225 ageGroupOptions . find ( ( v ) => v . value === field . value ) ?? null
225226 }
226- onChange = { ( v : OptionType ) => field . onChange ( v . value ) }
227+ onChange = { ( v : ( typeof ageGroupOptions ) [ 0 ] ) =>
228+ field . onChange ( v . value )
229+ }
227230 required
228231 label = { t ( "application:Page1.ageGroup" ) }
229232 options = { ageGroupOptions }
@@ -237,12 +240,14 @@ function ApplicationEventInner({
237240 rules = { { required : true } }
238241 name = { `applicationSections.${ index } .purpose` }
239242 render = { ( { field } ) => (
240- < Select < OptionType >
243+ < Select
241244 label = { t ( "application:Page1.purpose" ) }
242245 value = {
243246 purposeOptions . find ( ( v ) => v . value === field . value ) ?? null
244247 }
245- onChange = { ( v : OptionType ) => field . onChange ( v . value ) }
248+ onChange = { ( v : ( typeof purposeOptions ) [ 0 ] ) =>
249+ field . onChange ( v . value )
250+ }
246251 required
247252 options = { purposeOptions }
248253 invalid = { errors . applicationSections ?. [ index ] ?. purpose != null }
@@ -332,6 +337,7 @@ function ApplicationEventInner({
332337 invalid = { errors . applicationSections ?. [ index ] ?. end != null }
333338 errorText = { getTranslatedError ( "end" ) }
334339 />
340+ { /* TODO should use ControlledSelect */ }
335341 < Controller
336342 control = { control }
337343 name = { `applicationSections.${ index } .minDuration` }
@@ -340,22 +346,21 @@ function ApplicationEventInner({
340346 < Select
341347 id = { field . name }
342348 value = {
343- getDurationNumberOptions ( ) . find (
344- ( x ) => x . value === field . value
345- ) ?? null
349+ durationOptions . find ( ( x ) => x . value === field . value ) ?? null
346350 }
347351 placeholder = { t ( "common:select" ) }
348- options = { getDurationNumberOptions ( ) }
352+ options = { durationOptions }
349353 label = { t ( "application:Page1.minDuration" ) }
350354 required
351- onChange = { ( selection : OptionType ) : void => {
355+ onChange = { ( selection : ( typeof durationOptions ) [ 0 ] ) : void => {
352356 field . onChange ( selection . value ) ;
353357 } }
354358 invalid = { errors . applicationSections ?. [ index ] ?. minDuration != null }
355359 error = { getTranslatedError ( "minDuration" ) }
356360 />
357361 ) }
358362 />
363+ { /* TODO should use ControlledSelect */ }
359364 < Controller
360365 control = { control }
361366 name = { `applicationSections.${ index } .maxDuration` }
@@ -364,15 +369,13 @@ function ApplicationEventInner({
364369 < Select
365370 id = { field . name }
366371 value = {
367- getDurationNumberOptions ( ) . find (
368- ( x ) => x . value === field . value
369- ) ?? null
372+ durationOptions . find ( ( x ) => x . value === field . value ) ?? null
370373 }
371374 placeholder = { t ( "common:select" ) }
372- options = { getDurationNumberOptions ( ) }
375+ options = { durationOptions }
373376 label = { t ( "application:Page1.maxDuration" ) }
374377 required
375- onChange = { ( selection : OptionType ) : void => {
378+ onChange = { ( selection : ( typeof durationOptions ) [ 0 ] ) : void => {
376379 field . onChange ( selection . value ) ;
377380 } }
378381 invalid = { errors . applicationSections ?. [ index ] ?. maxDuration != null }
0 commit comments