diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/index.html | 13 | ||||
| -rw-r--r-- | templates/index.js | 7 |
2 files changed, 17 insertions, 3 deletions
diff --git a/templates/index.html b/templates/index.html index b29f84f..00e6208 100644 --- a/templates/index.html +++ b/templates/index.html @@ -9,6 +9,17 @@ <form id="path-form"> <div class="row" > <div class="col"> + Mode of transport: + <div> + <input type="radio" name="transport-mode" id="transport-mode-bike" checked="true" /> + <label for="transport-mode-bike">Bike</label> + </div> + <div> + <input type="radio" name="transport-mode" id="transport-mode-car" /> + <label for="transport-mode-car">Car</label> + </div> + </div> + <div class="col"> Place marker for: <div> <input type="radio" name="marker-point" id="marker-point-start" checked="true" /> @@ -47,4 +58,4 @@ {{ templates/index.js }} </body> -</html>
\ No newline at end of file +</html> diff --git a/templates/index.js b/templates/index.js index 01e3880..1422fe6 100644 --- a/templates/index.js +++ b/templates/index.js @@ -19,7 +19,10 @@ async function postShortestPath(event){ if(!lat1 || !lng1 || !lat2 || !lng2) return alert('Formatting Error: Coordinates are not float values.') - req = {lat1, lng1, lat2, lng2} // Dictionary auto-keys + const transport_mode_elem = document.getElementById("transport-mode-bike") + const transport_mode = transport_mode_elem.checked ? "bike" : "car" + + req = {lat1, lng1, lat2, lng2, transport_mode} // Dictionary auto-keys res = await fetch('/shortest-path', { method:'POST', @@ -66,4 +69,4 @@ async function showUnconnectedMarkers() { var marker = L.marker(res[key]).addTo(map) } } -showUnconnectedMarkers() +//showUnconnectedMarkers() |
