From 4a12fb6eb2762215774b5080d434c2dc4462866c Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 20 Feb 2020 04:12:12 +0000 Subject: [PATCH] Change edit to edit onestep edit and walkin. #353 --- src/Controller/JobOrderController.php | 6 +- .../JobOrderHandler/CMBJobOrderHandler.php | 16 +- .../job-order/cmb.form.onestep.html.twig | 20 +- .../job-order/cmb.list.fulfillment.html.twig | 183 +++++++++++++++++ templates/job-order/cmb.list.open.html.twig | 190 ++++++++++++++++++ 5 files changed, 391 insertions(+), 24 deletions(-) create mode 100644 templates/job-order/cmb.list.fulfillment.html.twig create mode 100644 templates/job-order/cmb.list.open.html.twig diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index c06383c7..44265309 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -282,7 +282,7 @@ class JobOrderController extends Controller else { $rows[$key]['meta']['update_url'] = $this->generateUrl($tier_params['edit_route'], ['id' => $jo_id]); - $rows[$key]['meta']['onestep_edit_url'] = $this->generateUrl('jo_onestep_edit_form', ['id' => $jo_id]); + $rows[$key]['meta']['onestep_edit_url'] = $this->generateUrl($tier_params['edit_route'], ['id' => $jo_id]); $rows[$key]['meta']['pdf_url'] = $this->generateUrl('jo_pdf_form', ['id' => $jo_id]); } @@ -430,7 +430,7 @@ class JobOrderController extends Controller * @Menu(selected="jo_fulfill") */ public function fulfillmentForm(JobOrderHandlerInterface $jo_handler, $id, - GISManagerInterface $gis) + GISManagerInterface $gis, EntityManagerInterface $em) { $this->denyAccessUnlessGranted('jo_fulfill.list', null, 'No access.'); @@ -443,6 +443,8 @@ class JobOrderController extends Controller throw $this->createNotFoundException($e->getMessage()); } + $params['vmfgs'] = $em->getRepository(VehicleManufacturer::class)->findAll(); + $params['vmakes'] = $em->getRepository(Vehicle::class)->findAll(); $params['submit_url'] = $this->generateUrl('jo_fulfill_submit', ['id' => $id]); $params['return_url'] = $this->generateUrl('jo_fulfill'); $params['map_js_file'] = $gis->getJSJOFile(); diff --git a/src/Service/JobOrderHandler/CMBJobOrderHandler.php b/src/Service/JobOrderHandler/CMBJobOrderHandler.php index 80e4158e..06f1fb72 100644 --- a/src/Service/JobOrderHandler/CMBJobOrderHandler.php +++ b/src/Service/JobOrderHandler/CMBJobOrderHandler.php @@ -2779,19 +2779,11 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface // $this->template_hash = [ // 'blah' => 'blah', // ]; - $this->template_hash['jo_incoming_form'] = 'job-order/cmb.form.html.twig'; - $this->template_hash['jo_open_edit_form'] = 'job-order/cmb.form.html.twig'; $this->template_hash['jo_incoming_vehicle_form'] = 'job-order/cmb.form.html.twig'; - $this->template_hash['jo_processing_form'] = 'job-order/cmb.form.html.twig'; - $this->template_hash['jo_assigning_form'] = 'job-order/cmb.form.html.twig'; - $this->template_hash['jo_fulfillment_form'] = 'job-order/cmb.form.html.twig'; - $this->template_hash['jo_open_hub_form'] = 'job-order/cmb.form.html.twig'; - $this->template_hash['jo_open_rider_form'] = 'job-order/cmb.form.html.twig'; - $this->template_hash['jo_all_form'] = 'job-order/cmb.form.html.twig'; - $this->template_hash['jo_list_processing'] = 'job-order/list.processing.html.twig'; - $this->template_hash['jo_list_assigning'] = 'job-order/list.assigning.html.twig'; - $this->template_hash['jo_list_fulfillment'] = 'job-order/list.fulfillment.html.twig'; - $this->template_hash['jo_list_open'] = 'job-order/list.open.html.twig'; + $this->template_hash['jo_fulfillment_form'] = 'job-order/cmb.form.onestep.html.twig'; + $this->template_hash['jo_all_form'] = 'job-order/cmb.form.onestep.html.twig'; + $this->template_hash['jo_list_fulfillment'] = 'job-order/cmb.list.fulfillment.html.twig'; + $this->template_hash['jo_list_open'] = 'job-order/cmb.list.open.html.twig'; $this->template_hash['jo_list_all'] = 'job-order/list.all.html.twig'; $this->template_hash['jo_onestep_form'] = 'job-order/cmb.form.onestep.html.twig'; $this->template_hash['jo_onestep_edit_form'] = 'job-order/cmb.form.onestep.html.twig'; diff --git a/templates/job-order/cmb.form.onestep.html.twig b/templates/job-order/cmb.form.onestep.html.twig index 0d9bac9f..4c913bca 100644 --- a/templates/job-order/cmb.form.onestep.html.twig +++ b/templates/job-order/cmb.form.onestep.html.twig @@ -389,7 +389,7 @@

- {% if mode == 'view-all' %} + {% if mode in ['view-all', 'update-fulfillment'] %} Assigned Hub {% else %} Nearest Hubs @@ -436,7 +436,7 @@

- {% if mode == 'view-all' %} + {% if mode in ['view-all', 'update-fulfillment'] %} Assigned Rider {% else %} Rider Assignment @@ -464,7 +464,7 @@ - {% if mode in ['onestep-edit', 'view-all'] %} + {% if mode in ['onestep-edit', 'view-all', 'update-fulfillment'] %} {% set avail_riders = obj.getHub.getAvailableRiders|default([]) %} @@ -474,7 +474,7 @@ {% if obj.getHub %} {% for rider in avail_riders %} - {% if mode == 'view-all' %} + {% if mode in ['view-all', 'update-fulfillment'] %} {% else %} @@ -512,9 +512,9 @@
- {% for key, sc in service_charges %} - + {% endfor %}
@@ -653,7 +653,7 @@
{% if mode != 'view-all' %} - + {% if ftags.set_map_coordinate and is_granted('joborder.cancel') and not obj.isCancelled %} Cancel Job Order {% endif %} @@ -801,7 +801,7 @@ $(function() { }); {% endif %} - {% if mode in ['view-all'] %} + {% if mode in ['view-all', 'update-fulfillment'] %} var hub_table = ''; $.getJSON("{{ url('hub_nearest') }}?lat=" + lat + "&long=" + lng, function(data) { var hubs = data['hubs']; @@ -963,7 +963,7 @@ $(function() { {% endif %} }); - {% if mode in ['onestep-edit', 'view-all'] %} + {% if mode in ['onestep-edit', 'view-all', 'update-fulfillment'] %} var lat = {{ obj.getCoordinates.getLatitude }}; var lng = {{ obj.getCoordinates.getLongitude }}; @@ -1357,7 +1357,7 @@ $(function() { var sc_array = []; // populate invoiceItems if editing so that we don't lose the battery - {% if mode in ['view-all', 'open-edit', 'onestep-edit', 'walk-in-edit'] %} + {% if mode in ['view-all', 'open-edit', 'onestep-edit', 'walk-in-edit', 'update-fulfillment'] %} {% if (obj.getInvoice and obj.getInvoice.getItems|length > 0) %} {% for item in obj.getInvoice.getItems %} {% if item.getBattery() %} diff --git a/templates/job-order/cmb.list.fulfillment.html.twig b/templates/job-order/cmb.list.fulfillment.html.twig new file mode 100644 index 00000000..7cd98ad3 --- /dev/null +++ b/templates/job-order/cmb.list.fulfillment.html.twig @@ -0,0 +1,183 @@ +{% extends 'base.html.twig' %} + +{% block body %} + +
+
+
+

+ Job Orders (Fulfillment) +

+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+ + + + +
+
+
+
+
+ +
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+{% endblock %} + +{% block scripts %} + +{% endblock %} diff --git a/templates/job-order/cmb.list.open.html.twig b/templates/job-order/cmb.list.open.html.twig new file mode 100644 index 00000000..bffdfd6c --- /dev/null +++ b/templates/job-order/cmb.list.open.html.twig @@ -0,0 +1,190 @@ +{% extends 'base.html.twig' %} + +{% block body %} + +
+
+
+

+ Job Orders (Open) +

+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+ + + + +
+
+
+
+
+ +
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+{% endblock %} + +{% block scripts %} + +{% endblock %}