@@ -10,6 +10,7 @@ import InputContainer from '~/components/controls/InputContainer';
1010import TextContainer from '~/components/controls/TextContainer' ;
1111import ButtonType from '~/enums/buttonType' ;
1212import { INode , IStop } from '~/models' ;
13+ import IArmamentInfo from '~/models/IArmamentInfo' ;
1314import IHastusArea from '~/models/IHastusArea' ;
1415import IStopArea from '~/models/IStopArea' ;
1516import navigator from '~/routing/navigator' ;
@@ -48,34 +49,37 @@ interface IStopFormProps {
4849}
4950
5051interface IStopFormState {
51- isRiseCountLoading : boolean ;
52- riseCount : number ;
52+ isArmamentInfoLoading : boolean ;
53+ passengerCount : number ;
54+ roof : string ;
5355}
5456
5557@inject ( 'codeListStore' , 'nodeStore' , 'modalStore' )
5658@observer
5759class StopForm extends Component < IStopFormProps , IStopFormState > {
5860 state = {
59- isRiseCountLoading : true ,
60- riseCount : 0 ,
61+ isArmamentInfoLoading : true ,
62+ passengerCount : 0 ,
63+ roof : '' ,
6164 } ;
6265 componentDidMount ( ) {
63- this . fetchRiseCount ( ) ;
66+ this . fetchArmamentInfo ( ) ;
6467 }
6568
66- private fetchRiseCount = async ( ) => {
69+ private fetchArmamentInfo = async ( ) => {
6770 if ( this . props . isNewStop ) {
6871 return ;
6972 }
7073 this . setState ( {
71- isRiseCountLoading : true ,
74+ isArmamentInfoLoading : true ,
7275 } ) ;
73- const riseCount = await StopService . fetchRiseCount ( {
76+ const armamentInfo : IArmamentInfo = await StopService . fetchArmamentInfo ( {
7477 nodeId : this . props . node . id ,
7578 } ) ;
7679 this . setState ( {
77- riseCount,
78- isRiseCountLoading : false ,
80+ passengerCount : armamentInfo . passengerCount ,
81+ roof : armamentInfo . roof ,
82+ isArmamentInfoLoading : false ,
7983 } ) ;
8084 } ;
8185
@@ -360,13 +364,11 @@ class StopForm extends Component<IStopFormProps, IStopFormState> {
360364 data-cy = 'section'
361365 />
362366 < Dropdown
363- onChange = { updateStopProperty ! ( 'roof' ) }
364367 items = { this . props . codeListStore ! . getDropdownItemList ( 'Pysäkkityyppi' ) }
365- selected = { stop . roof }
366- disabled = { isEditingDisabled }
368+ selected = { this . state . roof }
369+ isLoading = { this . state . isArmamentInfoLoading }
370+ disabled = { true }
367371 label = 'PYSÄKKIKATOS'
368- validationResult = { stopInvalidPropertiesMap [ 'roof' ] }
369- data-cy = 'roof'
370372 />
371373 </ div >
372374 < div className = { s . flexRow } >
@@ -445,9 +447,9 @@ class StopForm extends Component<IStopFormProps, IStopFormState> {
445447 { ! this . props . isNewStop && (
446448 < div className = { s . flexRow } >
447449 < TextContainer
448- isLoading = { this . state . isRiseCountLoading }
450+ isLoading = { this . state . isArmamentInfoLoading }
449451 label = 'NOUSIJAMÄÄRÄ'
450- value = { this . state . riseCount }
452+ value = { this . state . passengerCount }
451453 />
452454 </ div >
453455 ) }
0 commit comments