From 494ae85467b8d47c7fde155ff92c11838ee81d93 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 16 Dec 2019 08:56:00 +0000 Subject: [PATCH] Add OpenStreet implementation to resq form. #270 --- templates/job-order/cmb.form.html.twig | 8 ++ templates/job-order/form.html.twig | 111 +++++++++++++++++++++++-- 2 files changed, 114 insertions(+), 5 deletions(-) diff --git a/templates/job-order/cmb.form.html.twig b/templates/job-order/cmb.form.html.twig index 2ee5aa5b..3bbcf718 100644 --- a/templates/job-order/cmb.form.html.twig +++ b/templates/job-order/cmb.form.html.twig @@ -996,13 +996,17 @@ $(function() { callback: function(results, status) { markerLayerGroup.clearLayers(); if (status == 'OK') { + // google code // selectPoint(map, results[0].geometry.location); + // OSM code console.log(results); var lat = results[0].geometry.location.lat(); var lng = results[0].geometry.location.lng(); selectPoint(lat, lng); } }, + // TODO: change this to get what's in the translation file + // but for some strange reason, this worked. region: 'ph' }); } @@ -1022,8 +1026,10 @@ $(function() { {% if ftags.set_map_coordinate %} // check if we need to set map + // google code //var latlng = new google.maps.LatLng({{ obj.getCoordinates.getLatitude }}, {{ obj.getCoordinates.getLongitude }}); //selectPoint(map, latlng); + // OSM code var lat = {{ obj.getCoordinates.getLatitude }}; var lng = {{ obj.getCoordinates.getLongitude }}; selectPoint(lat, lng); @@ -1034,6 +1040,7 @@ $(function() { {% if mode in ['update-processing', 'update-reassign-hub'] %} // display hub map + // OSM code var hub_lat = {{ obj.getCoordinates.getLatitude }}; var hub_lng = {{ obj.getCoordinates.getLongitude }}; @@ -1064,6 +1071,7 @@ $(function() { hubLayerGroup.addLayer(hub_marker); {% endfor %} + // google code /* var hmap = new GMaps({ div: '#hub_map', diff --git a/templates/job-order/form.html.twig b/templates/job-order/form.html.twig index 9f986a4b..b637953c 100644 --- a/templates/job-order/form.html.twig +++ b/templates/job-order/form.html.twig @@ -893,15 +893,67 @@ {% endblock %} {% block scripts %} +{{ include('map/' ~ map_js_file) }} - +