diff --git a/.env.dist b/.env.dist index 4c0b202a..eef6592b 100644 --- a/.env.dist +++ b/.env.dist @@ -16,6 +16,7 @@ APP_SECRET=b344cd6cd151ae1d61403ed55806c5ce DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name ###< doctrine/doctrine-bundle ### GMAPS_API_KEY=insertgmapsapikeyhere +BINGMAPS_API_KEY=insertbingmapsapikeyhere # rising tide sms gateway RT_USER=rt_user diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index a11fab53..3b638258 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -4,3 +4,4 @@ twig: strict_variables: '%kernel.debug%' globals: gmaps_api_key: "%env(GMAPS_API_KEY)%" + bingmaps_api_key: "%env(BINGMAPS_API_KEY)%" diff --git a/config/services.yaml b/config/services.yaml index 8c8024f5..bd81dd79 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -87,6 +87,10 @@ services: $password: "%env(REDIS_CLIENT_PASSWORD)%" $env_flag: "dev" + App\Service\BingMapManager: ~ + + App\Service\MapManagerInterface: "@App\\Service\\BingMapManager" + Catalyst\APIBundle\Security\APIKeyUserProvider: arguments: $em: "@doctrine.orm.entity_manager" diff --git a/src/Controller/GeofenceController.php b/src/Controller/GeofenceController.php index 48cc5e43..08808352 100644 --- a/src/Controller/GeofenceController.php +++ b/src/Controller/GeofenceController.php @@ -6,6 +6,7 @@ use App\Entity\SupportedArea; use App\Service\KMLFileImporter; use App\Service\FileUploader; +use App\Service\MapManagerInterface; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; @@ -25,13 +26,14 @@ class GeofenceController extends Controller /** * @Menu(selected="geofence_list") */ - public function index() + public function index(MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('geofence.list', null, 'No access.'); $params['areas'] = $this->getDoctrine() ->getRepository(SupportedArea::class) - ->findAll();; + ->findAll(); + $params['map_manager'] = $map_manager->getMapManager(); return $this->render('geofence/list.html.twig', $params); } diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index 8e1afedd..05d048fd 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -32,6 +32,7 @@ use App\Service\MapTools; use App\Service\HubCounter; use App\Service\MQTTClient; use App\Service\APNSClient; +use App\Service\MapManagerInterface; use Doctrine\ORM\Query; use Doctrine\DBAL\Connection; @@ -206,7 +207,7 @@ class JobOrderController extends Controller /** * @Menu(selected="jo_in") */ - public function incomingForm() + public function incomingForm(MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('jo_in.list', null, 'No access.'); @@ -214,6 +215,7 @@ class JobOrderController extends Controller $params['mode'] = 'create'; $params['submit_url'] = $this->generateUrl('jo_in_submit'); $params['return_url'] = $this->generateUrl('jo_in'); + $params['map_manager'] = $map_manager->getMapManager(); $em = $this->getDoctrine()->getManager(); @@ -227,7 +229,7 @@ class JobOrderController extends Controller /** * @Menu(selected="jo_in") */ - public function openEditForm($id) + public function openEditForm($id, MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('jo_open.edit', null, 'No access.'); @@ -240,6 +242,7 @@ class JobOrderController extends Controller $params['return_url'] = $this->generateUrl('jo_open'); $params['cvid'] = $jo->getCustomerVehicle()->getID(); $params['vid'] = $jo->getCustomerVehicle()->getVehicle()->getID(); + $params['map_manager'] = $map_manager->getMapManager(); $em = $this->getDoctrine()->getManager(); @@ -390,7 +393,7 @@ class JobOrderController extends Controller /** * @Menu(selected="jo_in") */ - public function incomingVehicleForm($cvid) + public function incomingVehicleForm($cvid, MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('jo_in.list', null, 'No access.'); @@ -398,6 +401,7 @@ class JobOrderController extends Controller $params['submit_url'] = $this->generateUrl('jo_in_submit'); $params['return_url'] = $this->generateUrl('jo_in'); $params['cvid'] = $cvid; + $params['map_manager'] = $map_manager->getMapManager(); $em = $this->getDoctrine()->getManager(); @@ -858,7 +862,7 @@ class JobOrderController extends Controller /** * @Menu(selected="jo_proc") */ - public function processingForm(MapTools $map_tools, $id) + public function processingForm(MapTools $map_tools, $id, MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('jo_proc.list', null, 'No access.'); @@ -974,6 +978,7 @@ class JobOrderController extends Controller $params['obj'] = $obj; $params['submit_url'] = $this->generateUrl('jo_proc_submit', ['id' => $obj->getID()]); $params['return_url'] = $this->generateUrl('jo_proc'); + $params['map_manager'] = $map_manager->getMapManager(); // response return $this->render('job-order/form.html.twig', $params); @@ -1121,7 +1126,7 @@ class JobOrderController extends Controller /** * @Menu(selected="jo_assign") */ - public function assigningForm(MapTools $map_tools, $id) + public function assigningForm(MapTools $map_tools, $id, MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('jo_assign.list', null, 'No access.'); @@ -1195,6 +1200,7 @@ class JobOrderController extends Controller $params['status_cancelled'] = JOStatus::CANCELLED; $params['submit_url'] = $this->generateUrl('jo_assign_submit', ['id' => $obj->getID()]); $params['return_url'] = $this->generateUrl('jo_assign'); + $params['map_manager'] = $map_manager->getMapManager(); // response return $this->render('job-order/form.html.twig', $params); @@ -1309,7 +1315,7 @@ class JobOrderController extends Controller /** * @Menu(selected="jo_fulfill") */ - public function fulfillmentForm(MapTools $map_tools, $id) + public function fulfillmentForm(MapTools $map_tools, $id, MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('jo_fulfill.list', null, 'No access.'); @@ -1346,6 +1352,7 @@ class JobOrderController extends Controller $params['status_cancelled'] = JOStatus::CANCELLED; $params['submit_url'] = $this->generateUrl('jo_fulfill_submit', ['id' => $obj->getID()]); $params['return_url'] = $this->generateUrl('jo_fulfill'); + $params['map_manager'] = $map_manager->getMapManager(); // response return $this->render('job-order/form.html.twig', $params); @@ -1528,7 +1535,7 @@ class JobOrderController extends Controller /** * @Menu(selected="jo_open") */ - public function openHubForm(MapTools $map_tools, $id) + public function openHubForm(MapTools $map_tools, $id, MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('jo_open.list', null, 'No access.'); @@ -1606,6 +1613,7 @@ class JobOrderController extends Controller $params['obj'] = $obj; $params['submit_url'] = $this->generateUrl('jo_open_hub_submit', ['id' => $obj->getID()]); $params['return_url'] = $this->generateUrl('jo_open'); + $params['map_manager'] = $map_manager->getMapManager(); // response return $this->render('job-order/form.html.twig', $params); @@ -1718,7 +1726,7 @@ class JobOrderController extends Controller /** * @Menu(selected="jo_open") */ - public function openRiderForm($id) + public function openRiderForm($id, MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('jo_open.list', null, 'No access.'); @@ -1750,6 +1758,7 @@ class JobOrderController extends Controller $params['status_cancelled'] = JOStatus::CANCELLED; $params['submit_url'] = $this->generateUrl('jo_open_rider_submit', ['id' => $obj->getID()]); $params['return_url'] = $this->generateUrl('jo_open'); + $params['map_manager'] = $map_manager->getMapManager(); // response return $this->render('job-order/form.html.twig', $params); @@ -1862,7 +1871,7 @@ class JobOrderController extends Controller /** * @Menu(selected="jo_all") */ - public function allForm($id) + public function allForm($id, MapManagerInterface $map_manager) { $this->denyAccessUnlessGranted('jo_all.list', null, 'No access.'); @@ -1884,6 +1893,7 @@ class JobOrderController extends Controller $params['status_cancelled'] = JOStatus::CANCELLED; $params['return_url'] = $this->generateUrl('jo_all'); $params['submit_url'] = ''; + $params['map_manager'] = $map_manager->getMapManager(); // timeline stuff (descending by time) $params['timeline'] = [ diff --git a/src/Service/BingMapManager.php b/src/Service/BingMapManager.php new file mode 100644 index 00000000..6320a406 --- /dev/null +++ b/src/Service/BingMapManager.php @@ -0,0 +1,13 @@ + + + + + - - - + + + + - - - + + +