From d04a6976f20dbecbfb3e0fedcb73a574122b92ae Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 5 Dec 2019 07:40:52 +0000 Subject: [PATCH] Use OpenStreetMap for map in incoming form. #270 --- src/Controller/JobOrderController.php | 5 ++++- src/Service/GISManager/Bing.php | 4 ++++ src/Service/GISManager/Google.php | 4 ++++ src/Service/GISManager/OpenStreet.php | 6 ++++++ src/Service/GISManagerInterface.php | 3 +++ templates/job-order/cmb.form.html.twig | 14 ++++++++++++++ templates/map/joOpenStreetMap.js | 23 +++++++++++++++++++++++ 7 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 templates/map/joOpenStreetMap.js diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index 77fffe0f..72b16e40 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -11,6 +11,7 @@ use App\Entity\Battery; use App\Service\InvoiceGeneratorInterface; use App\Service\JobOrderHandlerInterface; +use App\Service\GISManagerInterface; use App\Service\MapTools; use App\Service\MQTTClient; use App\Service\APNSClient; @@ -45,7 +46,8 @@ class JobOrderController extends Controller /** * @Menu(selected="jo_in") */ - public function incomingForm(JobOrderHandlerInterface $jo_handler) + public function incomingForm(JobOrderHandlerInterface $jo_handler, + GISManagerInterface $gis) { $this->denyAccessUnlessGranted('jo_in.list', null, 'No access.'); @@ -53,6 +55,7 @@ class JobOrderController extends Controller $params['submit_url'] = $this->generateUrl('jo_in_submit'); $params['return_url'] = $this->generateUrl('jo_in'); + $params['map_js_file'] = $gis->getJSJOFile(); $template = $params['template']; diff --git a/src/Service/GISManager/Bing.php b/src/Service/GISManager/Bing.php index 7c5f02ce..7c3f0d41 100644 --- a/src/Service/GISManager/Bing.php +++ b/src/Service/GISManager/Bing.php @@ -13,5 +13,9 @@ class Bing implements GISManagerInterface // return the bing map js file: initBingMap.js return self::JS_INIT_FILE; } + + public function getJSJOFile() + { + } } diff --git a/src/Service/GISManager/Google.php b/src/Service/GISManager/Google.php index 5d76b6a5..7927891d 100644 --- a/src/Service/GISManager/Google.php +++ b/src/Service/GISManager/Google.php @@ -13,5 +13,9 @@ class Google implements GISManagerInterface // return the google map js file: initGoogleMap.js return self::JS_INIT_FILE; } + + public function getJSJOFile() + { + } } diff --git a/src/Service/GISManager/OpenStreet.php b/src/Service/GISManager/OpenStreet.php index e5dc7fd4..74129384 100644 --- a/src/Service/GISManager/OpenStreet.php +++ b/src/Service/GISManager/OpenStreet.php @@ -7,11 +7,17 @@ use App\Service\GISManagerInterface; class OpenStreet implements GISManagerInterface { const JS_INIT_FILE = 'initOpenStreetMap.js'; + const JS_JO_FILE = 'joOpenStreetMap.js'; public function getJSInitFile() { // return the openstreet map js file: initOpenStreetMap.js return self::JS_INIT_FILE; } + + public function getJSJOFile() + { + return self::JS_JO_FILE; + } } diff --git a/src/Service/GISManagerInterface.php b/src/Service/GISManagerInterface.php index ceb4710f..e7eb5c21 100644 --- a/src/Service/GISManagerInterface.php +++ b/src/Service/GISManagerInterface.php @@ -6,5 +6,8 @@ interface GISManagerInterface { // returns the actual JS file public function getJSInitFile(); + + // return the JS file for JO map + public function getJSJOFile(); } diff --git a/templates/job-order/cmb.form.html.twig b/templates/job-order/cmb.form.html.twig index b32594a0..c0dc49eb 100644 --- a/templates/job-order/cmb.form.html.twig +++ b/templates/job-order/cmb.form.html.twig @@ -899,12 +899,24 @@ {% endblock %} {% block scripts %} +{{ include('map/' ~ map_js_file) }} + +