Change implementation of all maps for job order to OpenStreet. #270

This commit is contained in:
Korina Cordero 2019-12-09 08:02:29 +00:00
parent 5bdc1a7f86
commit bf2231037d
2 changed files with 48 additions and 12 deletions

View file

@ -66,13 +66,15 @@ class JobOrderController extends Controller
/** /**
* @Menu(selected="jo_in") * @Menu(selected="jo_in")
*/ */
public function openEditForm($id, JobOrderHandlerInterface $jo_handler) public function openEditForm($id, JobOrderHandlerInterface $jo_handler,
GISManagerInterface $gis)
{ {
$this->denyAccessUnlessGranted('jo_open.edit', null, 'No access.'); $this->denyAccessUnlessGranted('jo_open.edit', null, 'No access.');
$params = $jo_handler->initializeOpenEditForm($id); $params = $jo_handler->initializeOpenEditForm($id);
$params['submit_url'] = $this->generateUrl('jo_open_edit_submit', ['id' => $id]); $params['submit_url'] = $this->generateUrl('jo_open_edit_submit', ['id' => $id]);
$params['return_url'] = $this->generateUrl('jo_open'); $params['return_url'] = $this->generateUrl('jo_open');
$params['map_js_file'] = $gis->getJSJOFile();
$template = $params['template']; $template = $params['template'];
@ -285,7 +287,8 @@ class JobOrderController extends Controller
/** /**
* @Menu(selected="jo_proc") * @Menu(selected="jo_proc")
*/ */
public function processingForm(MapTools $map_tools, $id, JobOrderHandlerInterface $jo_handler) public function processingForm(MapTools $map_tools, $id, JobOrderHandlerInterface $jo_handler,
GISManagerInterface $gis)
{ {
$this->denyAccessUnlessGranted('jo_proc.list', null, 'No access.'); $this->denyAccessUnlessGranted('jo_proc.list', null, 'No access.');
@ -304,6 +307,7 @@ class JobOrderController extends Controller
$params['submit_url'] = $this->generateUrl('jo_proc_submit', ['id' => $id]); $params['submit_url'] = $this->generateUrl('jo_proc_submit', ['id' => $id]);
$params['return_url'] = $this->generateUrl('jo_proc'); $params['return_url'] = $this->generateUrl('jo_proc');
$params['map_js_file'] = $gis->getJSJOFile();
$template = $params['template']; $template = $params['template'];
@ -349,7 +353,8 @@ class JobOrderController extends Controller
/** /**
* @Menu(selected="jo_assign") * @Menu(selected="jo_assign")
*/ */
public function assigningForm($id, JobOrderHandlerInterface $jo_handler) public function assigningForm($id, JobOrderHandlerInterface $jo_handler,
GISManagerInterface $gis)
{ {
$this->denyAccessUnlessGranted('jo_assign.list', null, 'No access.'); $this->denyAccessUnlessGranted('jo_assign.list', null, 'No access.');
@ -368,6 +373,7 @@ class JobOrderController extends Controller
$params['submit_url'] = $this->generateUrl('jo_assign_submit', ['id' => $id]); $params['submit_url'] = $this->generateUrl('jo_assign_submit', ['id' => $id]);
$params['return_url'] = $this->generateUrl('jo_assign'); $params['return_url'] = $this->generateUrl('jo_assign');
$params['map_js_file'] = $gis->getJSJOFile();
$template = $params['template']; $template = $params['template'];
@ -410,7 +416,8 @@ class JobOrderController extends Controller
/** /**
* @Menu(selected="jo_fulfill") * @Menu(selected="jo_fulfill")
*/ */
public function fulfillmentForm(JobOrderHandlerInterface $jo_handler, $id) public function fulfillmentForm(JobOrderHandlerInterface $jo_handler, $id,
GISManagerInterface $gis)
{ {
$this->denyAccessUnlessGranted('jo_fulfill.list', null, 'No access.'); $this->denyAccessUnlessGranted('jo_fulfill.list', null, 'No access.');
@ -425,6 +432,7 @@ class JobOrderController extends Controller
$params['submit_url'] = $this->generateUrl('jo_fulfill_submit', ['id' => $id]); $params['submit_url'] = $this->generateUrl('jo_fulfill_submit', ['id' => $id]);
$params['return_url'] = $this->generateUrl('jo_fulfill'); $params['return_url'] = $this->generateUrl('jo_fulfill');
$params['map_js_file'] = $gis->getJSJOFile();
$template = $params['template']; $template = $params['template'];
@ -467,7 +475,8 @@ class JobOrderController extends Controller
/** /**
* @Menu(selected="jo_open") * @Menu(selected="jo_open")
*/ */
public function openHubForm(MapTools $map_tools, $id, JobOrderHandlerInterface $jo_handler) public function openHubForm(MapTools $map_tools, $id, JobOrderHandlerInterface $jo_handler,
GISManagerInterface $gis)
{ {
$this->denyAccessUnlessGranted('jo_open.list', null, 'No access.'); $this->denyAccessUnlessGranted('jo_open.list', null, 'No access.');
@ -482,6 +491,7 @@ class JobOrderController extends Controller
$params['submit_url'] = $this->generateUrl('jo_open_hub_submit', ['id' => $id]); $params['submit_url'] = $this->generateUrl('jo_open_hub_submit', ['id' => $id]);
$params['return_url'] = $this->generateUrl('jo_open'); $params['return_url'] = $this->generateUrl('jo_open');
$params['map_js_file'] = $gis->getJSJOFile();
$template = $params['template']; $template = $params['template'];
@ -523,7 +533,8 @@ class JobOrderController extends Controller
/** /**
* @Menu(selected="jo_open") * @Menu(selected="jo_open")
*/ */
public function openRiderForm($id, JobOrderHandlerInterface $jo_handler) public function openRiderForm($id, JobOrderHandlerInterface $jo_handler,
GISManagerInterface $gis)
{ {
$this->denyAccessUnlessGranted('jo_open.list', null, 'No access.'); $this->denyAccessUnlessGranted('jo_open.list', null, 'No access.');
@ -538,6 +549,7 @@ class JobOrderController extends Controller
$params['submit_url'] = $this->generateUrl('jo_open_rider_submit', ['id' => $id]); $params['submit_url'] = $this->generateUrl('jo_open_rider_submit', ['id' => $id]);
$params['return_url'] = $this->generateUrl('jo_open'); $params['return_url'] = $this->generateUrl('jo_open');
$params['map_js_file'] = $gis->getJSJOFile();
$template = $params['template']; $template = $params['template'];
@ -579,7 +591,8 @@ class JobOrderController extends Controller
/** /**
* @Menu(selected="jo_all") * @Menu(selected="jo_all")
*/ */
public function allForm($id, JobOrderHandlerInterface $jo_handler) public function allForm($id, JobOrderHandlerInterface $jo_handler,
GISManagerInterface $gis)
{ {
$this->denyAccessUnlessGranted('jo_all.list', null, 'No access.'); $this->denyAccessUnlessGranted('jo_all.list', null, 'No access.');
@ -594,6 +607,7 @@ class JobOrderController extends Controller
$params['return_url'] = $this->generateUrl('jo_all'); $params['return_url'] = $this->generateUrl('jo_all');
$params['submit_url'] = ''; $params['submit_url'] = '';
$params['map_js_file'] = $gis->getJSJOFile();
$template = $params['template']; $template = $params['template'];

View file

@ -944,9 +944,6 @@ $(function() {
// clear markers // clear markers
markerLayerGroup.clearLayers(); markerLayerGroup.clearLayers();
//var lat = latlng.lat;
//var lng = latlng.lng;
var marker = L.marker([lat, lng]); var marker = L.marker([lat, lng]);
// add marker to layer group // add marker to layer group
@ -1024,8 +1021,11 @@ $(function() {
{% if ftags.set_map_coordinate %} {% if ftags.set_map_coordinate %}
// check if we need to set map // check if we need to set map
var latlng = new google.maps.LatLng({{ obj.getCoordinates.getLatitude }}, {{ obj.getCoordinates.getLongitude }}); //var latlng = new google.maps.LatLng({{ obj.getCoordinates.getLatitude }}, {{ obj.getCoordinates.getLongitude }});
selectPoint(map, latlng); //selectPoint(map, latlng);
var lat = {{ obj.getCoordinates.getLatitude }};
var lng = {{ obj.getCoordinates.getLongitude }};
selectPoint(lat, lng);
// remove placeholder text // remove placeholder text
$("[data-vehicle-field='1']").prop('placeholder', ''); $("[data-vehicle-field='1']").prop('placeholder', '');
@ -1033,6 +1033,27 @@ $(function() {
{% if mode in ['update-processing', 'update-reassign-hub'] %} {% if mode in ['update-processing', 'update-reassign-hub'] %}
// display hub map // display hub map
var hub_lat = {{ obj.getCoordinates.getLatitude }};
var hub_lng = {{ obj.getCoordinates.getLongitude }};
var hmap = mapCreate('hub_map', hub_lat, hub_lng, 'road', 13);
var destLayerGroup = L.layerGroup().addTo(hmap);
var hubLayerGroup = L.layerGroup().addTo(hmap);
var dest_marker = new L.Marker([hub_lat, hub_lng]).bindPopup("Destination");
destLayerGroup.addLayer(dest_marker);
{% for hub in hubs %}
var hub_marker = new L.Marker([{{ hub.hub.getCoordinates.getLatitude }},
{{ hub.hub.getCoordinates.getLongitude }}]).bindPopup("{{ hub.hub.getName }}");
hubLayerGroup.addLayer(hub_marker);
{% endfor %}
/*
var hmap = new GMaps({ var hmap = new GMaps({
div: '#hub_map', div: '#hub_map',
lat: {{ obj.getCoordinates.getLatitude }}, lat: {{ obj.getCoordinates.getLatitude }},
@ -1056,6 +1077,7 @@ $(function() {
icon: '/assets/images/icon-outlet.png' icon: '/assets/images/icon-outlet.png'
}); });
{% endfor %} {% endfor %}
*/
{% endif %} {% endif %}