2021-03-18 22:39:34 +00:00
< div class = "fm-route-form" >
2021-03-19 16:25:03 +00:00
< b -form @submit.prevent ="handleSubmit" >
2021-03-18 22:39:34 +00:00
< draggable v-model ="destinations" handle=".fm-drag-handle" @end="reroute(true)" >
<!-- ng - class = "{'has-error': }" -- >
< b -form -group v-for ="(destination, idx) in destinations" :class="{ active: hoverDestinationIdx == idx }" >
< hr class = "fm-route-form-hover-insert" : class = "{ active: hoverInsertIdx === idx }" / >
< b -input -group @mouseenter ="destinationMouseOver(idx)" @mouseleave ="destinationMouseOut(idx)" :state ="getValidationState(destination)" >
< b -input -group -prepend >
2021-03-19 16:25:03 +00:00
< b -input -group -text class = "px-2" > < a href = "javascript:" class = "fm-drag-handle" > < Icon icon = "resize-vertical" alt = "Reorder" > < / Icon > < / a > < / b - i n p u t - g r o u p - t e x t >
2021-03-18 22:39:34 +00:00
< / b - i n p u t - g r o u p - p r e p e n d >
< b -form -input v-model ="destination.query" :placeholder="idx == 0 ? 'From' : idx == destinations.length-1 ? 'To' : 'Via'" :tabindex="idx+1" :state="getValidationState(destination)" > < / b -form -input >
< b -input -group -append >
< b -dropdown v-if ="destination.query.trim() != ''" @show="loadSuggestions(destination)" :menu-class="['fm-route-suggestions', { isPending: !destination.searchSuggestions }]" >
< template v-if ="destination.searchSuggestions" >
< template v-for ="suggestion in destination.mapSuggestions" >
< b -dropdown -item
: active = "suggestion === getSelectedSuggestion(destination)"
2021-03-21 22:38:48 +00:00
@ mouseenter . native = "suggestionMouseOver(suggestion)"
@ mouseleave . native = "suggestionMouseOut(suggestion)"
@ click . native . capture . stop . prevent = "suggestionZoom(suggestion)"
2021-03-18 22:39:34 +00:00
class = "fm-route-form-suggestions-zoom"
> < Icon icon = "zoom-in" alt = "Zoom" > < / Icon > < / b - d r o p d o w n - i t e m >
< b -dropdown -item
: active = "suggestion === getSelectedSuggestion(destination)"
2021-03-21 22:38:48 +00:00
@ mouseenter . native = "suggestionMouseOver(suggestion)"
@ mouseleave . native = "suggestionMouseOut(suggestion)"
2021-03-18 22:39:34 +00:00
@ click = "destination.selectedSuggestion = suggestion; reroute(true)"
> { { suggestion . name } } ( { { client . types [ suggestion . typeId ] . name } } ) < / b - d r o p d o w n - i t e m >
< / template >
< b -dropdown -divider
v - if = "(destination.searchSuggestions || []).length > 0 && (destination.mapSuggestions || []).length > 0"
class = "fm-route-form-suggestions-divider"
> < / b - d r o p d o w n - d i v i d e r >
< template v-for ="suggestion in destination.searchSuggestions" >
< b -dropdown -item
href = "javascript:"
: active = "suggestion === getSelectedSuggestion(destination)"
2021-03-21 22:38:48 +00:00
@ mouseenter . native = "suggestionMouseOver(suggestion)"
@ mouseleave . native = "suggestionMouseOut(suggestion)"
@ click . native . capture . stop . prevent = "suggestionZoom(suggestion)"
2021-03-18 22:39:34 +00:00
class = "fm-route-form-suggestions-zoom"
> < Icon icon = "zoom-in" alt = "Zoom" > < / Icon > < / b - d r o p d o w n - i t e m >
< b -dropdown -item
href = "javascript:"
: active = "suggestion === getSelectedSuggestion(destination)"
2021-03-21 22:38:48 +00:00
@ mouseenter . native = "suggestionMouseOver(suggestion)"
@ mouseleave . native = "suggestionMouseOut(suggestion)"
2021-03-18 22:39:34 +00:00
@ click = "destination.selectedSuggestion = suggestion; reroute(true)"
> { { suggestion . display _name } } < span v-if ="suggestion.type" > ( {{ suggestion.type }} ) < / span > < / b -dropdown -item >
< / template >
< / template >
< b -spinner v-else > < / b -spinner >
< / b - d r o p d o w n >
2021-03-21 22:38:48 +00:00
< b -button v-if ="destinations.length > 2" @click="removeDestination(idx); reroute(false)" v-b-tooltip.right="'Remove this destination'"><Icon icon="minus" alt="Remove" size="1.0em" > < / Icon > < / b -button >
2021-03-18 22:39:34 +00:00
< / b - i n p u t - g r o u p - a p p e n d >
< / b - i n p u t - g r o u p >
< / b - f o r m - g r o u p >
< hr class = "fm-route-form-hover-insert" : class = "{ active: hoverInsertIdx === destinations.length }" / >
< / draggable >
< b -button -toolbar >
2021-03-21 22:38:48 +00:00
< b -button @click ="addDestination()" v-b-tooltip="'Add another destination ' " :tabindex ="destinations.length+1" > < Icon icon = "plus" alt = "Add" > < / Icon > < / b - b u t t o n >
2021-03-18 22:39:34 +00:00
< RouteMode v-model ="routeMode" :tabindex="destinations.length+2" @input="reroute(false)" > < / RouteMode >
2021-03-19 21:16:57 +00:00
< b -button type = "submit" variant = "primary" :tabindex ="destinations.length+7" class = "flex-grow-1" ref = "submitButton" > Go ! < / b - b u t t o n >
2021-03-21 22:38:48 +00:00
< b -button v-if ="hasRoute" type="button" :tabindex="destinations.length+8" @click="reset()" v-b-tooltip.right="'Clear route'"><Icon icon="remove" alt="Clear" > < / Icon > < / b -button >
2021-03-18 22:39:34 +00:00
< / b - b u t t o n - t o o l b a r >
< template v-if ="routeError" >
< hr / >
< b -alert variant = "danger" show > { { routeError } } < / b - a l e r t >
< / template >
< template v-if ="client.route" >
< hr / >
< dl >
< dt > Distance < / dt >
< dd > { { client . route . distance | round ( 2 ) } } km < span v-if ="client.route.time != null" > ( {{ client.route.time | fmFormatTime }} h {{ client.route.mode | fmRouteMode }} ) < / span > < / dd >
2021-03-19 21:16:57 +00:00
< template v-if ="client.route.ascent != null" >
< dt > Climb / drop < / dt >
< dd > < ElevationStats :route ="client.route" > < / ElevationStats > < / dd >
< / template >
2021-03-18 22:39:34 +00:00
< / dl >
2021-03-19 21:16:57 +00:00
< ElevationPlot :route ="client.route" v-if ="client.route.ascent != null" > < / ElevationPlot >
< b -button -toolbar v-if ="!client.readonly" >
2021-03-21 22:38:48 +00:00
< b -button v-b-tooltip="'Zoom to route ' " @click ="zoomToRoute()" size = "sm" > < Icon icon = "zoom-in" alt = "Zoom to route" > < / Icon > < / b - b u t t o n >
2021-03-19 21:16:57 +00:00
< b -dropdown v-if ="lineTypes.length > 1" text="Add to map" size="sm" >
< b -dropdown -item v-for ="type in lineTypes" href="javascript:" @click="addToMap(type)" > {{ type.name }} < / b -dropdown -item >
< / b - d r o p d o w n >
< b -button v-if ="lineTypes.length == 1" @click="addToMap(lineTypes[0])" size="sm" > Add to map < / b -button >
< b -dropdown text = "Export" size = "sm" >
< b -dropdown -item
href = "javascript:"
@ click = "exportRoute('gpx-trk')"
2021-03-21 22:38:48 +00:00
v - b - tooltip . right = "'GPX files can be opened with most navigation software. In track mode, the calculated route is saved in the file.'"
2021-03-19 21:16:57 +00:00
> Export as GPX track < / b - d r o p d o w n - i t e m >
< b -dropdown -item
href = "javascript:"
@ click = "exportRoute('gpx-rte')"
2021-03-21 22:38:48 +00:00
v - b - tooltip . right = "'GPX files can be opened with most navigation software. In route mode, only the start/end/via points are saved in the file, and the navigation software needs to calculate the route.'"
2021-03-19 21:16:57 +00:00
> Export as GPX route < / b - d r o p d o w n - i t e m >
< / b - d r o p d o w n >
< / b - b u t t o n - t o o l b a r >
2021-03-18 22:39:34 +00:00
< / template >
< / b - f o r m >
< / div >