@@ -2,15 +2,16 @@ import { zodResolver } from '@hookform/resolvers/zod';
22import { ForwardRefRenderFunction , forwardRef } from 'react' ;
33import { FormProvider , useForm } from 'react-hook-form' ;
44import { useTranslation } from 'react-i18next' ;
5+ import { StopRegistryTransportModeType } from '../../../../../../generated/graphql' ;
56import { mapStopPlaceStateToUiName } from '../../../../../../i18n/uiNameMappings' ;
6- import { Column } from '../../../../../../layoutComponents' ;
77import { StopWithDetails } from '../../../../../../types' ;
88import { StopPlaceState } from '../../../../../../types/stop-registry' ;
99import {
1010 EnumDropdown ,
1111 FormActionButtons ,
1212 FormColumn ,
1313 FormRow ,
14+ InputElement ,
1415 InputField ,
1516 ReasonForChangeForm ,
1617} from '../../../../../forms/common' ;
@@ -20,6 +21,8 @@ import { MirroredQuayFormState, mirroredQuayFormSchema } from './schema';
2021
2122const testIds = {
2223 stopPlaceState : 'MirroredQuayForm::stopPlaceState' ,
24+ trunkLineStop : 'StopBasicDetailsForm::trunkLineStop' ,
25+ speedTramStop : 'StopBasicDetailsForm::speedTramStop' ,
2326} ;
2427
2528type MirroredQuayBasicDetailsFormProps = {
@@ -29,13 +32,22 @@ type MirroredQuayBasicDetailsFormProps = {
2932 readonly onRemove : ( ) => void ;
3033 readonly stop : StopWithDetails ;
3134 readonly testIdPrefix : string ;
35+ readonly transportMode : StopRegistryTransportModeType | null | undefined ;
3236} ;
3337
3438const MirroredQuayBasicDetailsFormComponent : ForwardRefRenderFunction <
3539 HTMLFormElement ,
3640 MirroredQuayBasicDetailsFormProps
3741> = (
38- { defaultValues, onSubmit, onCancel, onRemove, stop, testIdPrefix } ,
42+ {
43+ defaultValues,
44+ onSubmit,
45+ onCancel,
46+ onRemove,
47+ stop,
48+ testIdPrefix,
49+ transportMode,
50+ } ,
3951 ref ,
4052) => {
4153 const { t } = useTranslation ( ) ;
@@ -47,14 +59,17 @@ const MirroredQuayBasicDetailsFormComponent: ForwardRefRenderFunction<
4759 useDirtyFormBlockNavigation ( methods . formState , 'MirroredQuayForm' ) ;
4860 const { handleSubmit } = methods ;
4961
62+ const isBusStop = transportMode === StopRegistryTransportModeType . Bus ;
63+ const isTramStop = transportMode === StopRegistryTransportModeType . Tram ;
64+
5065 return (
5166 // eslint-disable-next-line react/jsx-props-no-spreading
5267 < FormProvider { ...methods } >
5368 < form onSubmit = { handleSubmit ( onSubmit ) } ref = { ref } >
5469 < FormColumn >
5570 < StopAreaDetailsSection stop = { stop } />
5671 < FormRow mdColumns = { 4 } >
57- < Column >
72+ < FormColumn >
5873 < InputField < MirroredQuayFormState >
5974 translationPrefix = "stopDetails.basicDetails"
6075 fieldPath = "stopState"
@@ -72,7 +87,41 @@ const MirroredQuayBasicDetailsFormComponent: ForwardRefRenderFunction<
7287 />
7388 ) }
7489 />
75- </ Column >
90+ </ FormColumn >
91+
92+ < FormColumn className = "justify-end" >
93+ < label
94+ htmlFor = "trunkLineStop"
95+ className = "inline-flex font-normal"
96+ >
97+ < InputElement < MirroredQuayFormState >
98+ type = "checkbox"
99+ id = "trunkLineStop"
100+ fieldPath = "trunkLineStop"
101+ className = "mr-3.5 h-6 w-6"
102+ testId = { testIds . trunkLineStop }
103+ disabled = { ! isBusStop }
104+ />
105+ { t ( ( $ ) => $ . stopPlaceTypes . trunkLineStop ) }
106+ </ label >
107+ </ FormColumn >
108+
109+ < FormColumn className = "justify-end" >
110+ < label
111+ htmlFor = "speedTramStop"
112+ className = "inline-flex font-normal"
113+ >
114+ < InputElement < MirroredQuayFormState >
115+ type = "checkbox"
116+ id = "speedTramStop"
117+ fieldPath = "speedTramStop"
118+ className = "mr-3.5 h-6 w-6"
119+ testId = { testIds . speedTramStop }
120+ disabled = { ! isTramStop }
121+ />
122+ { t ( ( $ ) => $ . stopPlaceTypes . speedTramStop ) }
123+ </ label >
124+ </ FormColumn >
76125 </ FormRow >
77126 < ReasonForChangeForm />
78127 </ FormColumn >
0 commit comments