11
11
<v-text-field
12
12
v-model =" startpointInput"
13
13
:label =" $t('common:plugins.routing.startLabel')"
14
+ :aria-label =" $t('common:plugins.routing.startLabel')"
14
15
@input =" handleAddressSearch('start')"
15
16
></v-text-field >
16
17
<v-list
36
37
<v-text-field
37
38
v-model =" endpointInput"
38
39
:label =" $t('common:plugins.routing.endLabel')"
40
+ :aria-label =" $t('common:plugins.routing.endLabel')"
39
41
@input =" handleAddressSearch('end')"
40
42
></v-text-field >
41
43
<v-list
57
59
</v-list >
58
60
</div >
59
61
60
- <v-btn @click =" reset"
62
+ <v-btn
63
+ :aria-label =" $t('common:plugins.routing.resetButton')"
64
+ @click =" reset"
61
65
>{{ $t('common:plugins.routing.resetButton') }}
62
66
</v-btn >
63
67
64
68
<v-select
65
69
v-model =" selectedTravelModeItem"
66
- clearable
67
70
:label =" $t('common:plugins.routing.modeLabel')"
71
+ :aria-label =" $t('common:plugins.routing.modeLabel')"
68
72
:items =" translatedTravelModeOptions"
69
73
item-value =" key"
70
74
item-text =" translatedKey"
71
75
></v-select >
72
76
<v-select
73
77
v-model =" selectedPreferenceItem"
74
- clearable
75
78
:label =" $t('common:plugins.routing.preferenceLabel')"
79
+ :aria-label =" $t('common:plugins.routing.preferenceLabel')"
76
80
:items =" translatedPreferenceOptions"
77
81
item-value =" key"
78
82
item-text =" translatedKey"
79
83
></v-select >
80
84
81
- <div >
85
+ <div class = " select " >
82
86
{{ $t('common:plugins.routing.avoidRoutesTitle') }}
83
- <v-layout row wrap >
84
- <v-flex >
85
- <v-checkbox
86
- v-for =" (routeType, i) in selectableRouteTypesToAvoid"
87
- :key =" i"
88
- v-model =" selectedRouteTypesToAvoidItem"
89
- :label =" $t(translatedRouteTypeToAvoid(routeType.key))"
90
- :value =" routeType.key"
91
- ></v-checkbox >
92
- </v-flex >
93
- </v-layout >
94
- </div >
87
+ <v-checkbox
88
+ v-for =" (routeType, i) in RouteTypesToAvoidForSelectedProfile"
89
+ :key =" i"
90
+ v-model =" selectedRouteTypesToAvoidItem"
91
+ :label =" $t(translatedRouteTypeToAvoid(routeType.key))"
92
+ :aria-label =" $t(translatedRouteTypeToAvoid(routeType.key))"
93
+ :value =" routeType.key"
94
+ ></v-checkbox >
95
95
96
- <v-btn :disabled =" disableSendButton" @click =" sendRequest" >{{
97
- $t('common:plugins.routing.sendRequestButton')
98
- }}</v-btn >
96
+ </div >
97
+ <v-tooltip left :disabled =" !areFieldsMissing" >
98
+ <template #activator =" { on } " >
99
+ <div v-on =" on" >
100
+ <v-btn
101
+ :aria-label =" $t('common:plugins.routing.sendRequestButton')"
102
+ :disabled =" areFieldsMissing"
103
+ @click =" sendRequest"
104
+ >
105
+ {{ $t('common:plugins.routing.sendRequestButton') }}
106
+ </v-btn >
107
+ </div >
108
+ </template >
109
+ <span >{{ $t('common:plugins.routing.toolTip') }}</span >
110
+ </v-tooltip >
99
111
100
- <v-btn @click =" showSteps = !showSteps" >
112
+ <v-btn
113
+ :aria-label =" $t('common:plugins.routing.routeDetails')"
114
+ @click =" showSteps = !showSteps"
115
+ >
101
116
{{ $t('common:plugins.routing.routeDetails') }}
102
117
</v-btn >
103
118
<div v-if =" showSteps && Object.keys(searchResponseData).length !== 0" >
@@ -121,7 +136,6 @@ export default Vue.extend({
121
136
showSteps: false ,
122
137
startDropdownOpen: false ,
123
138
endDropdownOpen: false ,
124
- disableSendButton: false ,
125
139
}),
126
140
computed: {
127
141
... mapGetters ([' hasSmallDisplay' ]),
@@ -132,16 +146,15 @@ export default Vue.extend({
132
146
' selectableTravelModes' ,
133
147
' selectablePreferences' ,
134
148
' selectableRouteTypesToAvoid' ,
135
- // TODO: warum ist selectedRTTA aufgezählt, aber selectedPreferences nicht? Kann beides raus?
136
149
' selectedRouteTypesToAvoid' ,
150
+ ' selectedTravelMode' ,
151
+ ' selectedPreference' ,
137
152
' searchResults' ,
138
153
' searchResponseData' ,
139
154
' start' ,
140
155
' end' ,
141
156
' startAddress' ,
142
157
' endAddress' ,
143
- // TODO: löschen, falls es sich in debouncedSendSearchRequest nicht einfügen lässt
144
- ' waitMs' ,
145
158
]),
146
159
startpointInput: {
147
160
get() {
@@ -222,19 +235,47 @@ export default Vue.extend({
222
235
return this .selectedRouteTypesToAvoid
223
236
},
224
237
set(value : string ): void {
225
- console .error (this .selectedRouteTypesToAvoid )
226
238
this .setSelectedRouteTypesToAvoid (value )
227
239
},
228
240
},
229
241
searchResponseSegments: {
230
242
get(): object {
231
- console .error (
232
- ' Search Response Segments or Steps: ' ,
233
- this .searchResponseData .features [0 ].properties .segments [0 ].steps
234
- )
235
243
return this .searchResponseData .features [0 ].properties .segments [0 ].steps
236
244
},
237
245
},
246
+ RouteTypesToAvoidForSelectedProfile() {
247
+ if (
248
+ this .selectedTravelMode === ' driving-car' ||
249
+ this .selectedTravelMode === ' driving-hgv' ||
250
+ this .selectedTravelMode === ' '
251
+ ) {
252
+ return this .selectableRouteTypesToAvoid
253
+ }
254
+ return [
255
+ {
256
+ key: ' ferries' ,
257
+ localKey: ' common:plugins.routing.avoidRoutes.ferries' ,
258
+ },
259
+ ]
260
+ },
261
+ areFieldsMissing() {
262
+ const areStartAndStartAddressMissing =
263
+ this .start .length === 0 && this .startAddress === ' '
264
+ const areEndAndEndAddressMissing =
265
+ this .end .length === 0 && this .endAddress === ' '
266
+ const isSelectedTravelModeMissing = this .selectedTravelMode === ' '
267
+ const isSelectedPreferenceMissing = this .selectedPreference === ' '
268
+ const isSelectedRouteTypesToAvoidMissing =
269
+ this .selectedRouteTypesToAvoid .length === 0
270
+
271
+ return Boolean (
272
+ areStartAndStartAddressMissing ||
273
+ areEndAndEndAddressMissing ||
274
+ isSelectedTravelModeMissing ||
275
+ isSelectedPreferenceMissing ||
276
+ isSelectedRouteTypesToAvoidMissing
277
+ )
278
+ },
238
279
},
239
280
mounted() {
240
281
this .initializeTool ()
@@ -259,7 +300,6 @@ export default Vue.extend({
259
300
this .sendSearchRequest (payload )
260
301
}, 300 ),
261
302
handleAddressSearch(inputType ) {
262
- console .error (inputType )
263
303
const input =
264
304
inputType === ' start' ? this .startpointInput : this .endpointInput
265
305
@@ -270,17 +310,9 @@ export default Vue.extend({
270
310
this .startDropdownOpen = false
271
311
this .endDropdownOpen = true
272
312
}
273
- this .debouncedSendSearchRequest ({ input , inputType })
274
- },
275
- disableSendRequest() {
276
- console .error (' Ist der Send-Button disabled?' , this .disableSendButton )
277
- (this .selectedTravelMode &&
278
- this .selectedPreference &&
279
- this .selectedRouteTypesToAvoid
280
- )
281
- ? this .disableSendButton = true
282
- : this .disableSendButton = false
283
- console .error (' Ist der Send-Button disabled?' , this .disableSendButton )
313
+ this .$nextTick (() => {
314
+ this .debouncedSendSearchRequest ({ input , inputType })
315
+ })
284
316
},
285
317
reset() {
286
318
this .showSteps = false
@@ -290,7 +322,6 @@ export default Vue.extend({
290
322
if (result .strassenname ) {
291
323
this .startpointInput = result .displayName
292
324
this .setStart (result .position )
293
- console .error (' Result Position:' , result .position )
294
325
this .setStartAddress (result .displayName )
295
326
this .startDropdownOpen = false
296
327
this .$nextTick (() => {
@@ -317,7 +348,6 @@ export default Vue.extend({
317
348
const localKey = this .selectableRouteTypesToAvoid .find (
318
349
(element ) => element .key === myKey
319
350
).localKey
320
- console .error (localKey )
321
351
return localKey
322
352
},
323
353
},
@@ -334,7 +364,11 @@ export default Vue.extend({
334
364
padding-left : 20px ;
335
365
padding-right : 20px ;
336
366
}
337
-
367
+ .select {
368
+ display : flex ;
369
+ flex-direction : row ;
370
+ justify-content : center ;
371
+ }
338
372
.dropdown {
339
373
max-height : 300px ; /* adjusts the hight */
340
374
overflow-y : auto ; /* enables scrolling */
0 commit comments