From 7e116d8d3eb11d19a226e6ed6ec2a1e32f7e181f Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 13 Feb 2020 07:32:18 +0000 Subject: [PATCH] Add function to load walk-in form. #340 --- src/Controller/JobOrderController.php | 22 + .../JobOrderHandler/CMBJobOrderHandler.php | 16 + templates/job-order/cmb.form.walkin.html.twig | 1087 +++++++++++++++++ 3 files changed, 1125 insertions(+) create mode 100644 templates/job-order/cmb.form.walkin.html.twig diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index f70d5484..02b5fcce 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -12,6 +12,7 @@ use App\Entity\Battery; use App\Entity\JobOrder; use App\Entity\VehicleManufacturer; use App\Entity\Vehicle; +use App\Entity\Hub; use App\Service\InvoiceGeneratorInterface; use App\Service\JobOrderHandlerInterface; @@ -962,4 +963,25 @@ class JobOrderController extends Controller return $this->render('job-order/tracker.html.twig', $params); } + + /** + * @Menu(selected="jo_walkin_form") + */ + public function walkinForm(EntityManagerInterface $em, JobOrderHandlerInterface $jo_handler) + { + $this->denyAccessUnlessGranted('jo_walkin.form', null, 'No access.'); + + $params = $jo_handler->initializeWalkinForm(); + $params['submit_url'] = $this->generateUrl('jo_walkin_submit'); + $params['return_url'] = $this->generateUrl('jo_walkin_form'); + $params['vmfgs'] = $em->getRepository(VehicleManufacturer::class)->findAll(); + $params['vmakes'] = $em->getRepository(Vehicle::class)->findAll(); + $params['hubs'] = $em->getRepository(Hub::class)->findAll(); + + $template = $params['template']; + + // response + return $this->render($template, $params); + } + } diff --git a/src/Service/JobOrderHandler/CMBJobOrderHandler.php b/src/Service/JobOrderHandler/CMBJobOrderHandler.php index 40f428ee..60856414 100644 --- a/src/Service/JobOrderHandler/CMBJobOrderHandler.php +++ b/src/Service/JobOrderHandler/CMBJobOrderHandler.php @@ -2345,6 +2345,21 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface return false; } + public function initializeWalkinForm() + { + $params['obj'] = new JobOrder(); + $params['mode'] = 'onestep'; + + $this->fillDropdownParameters($params); + $this->fillFormTags($params); + + // get template to display + $params['template'] = $this->getTwigTemplate('jo_walkin'); + + // return params + return $params; + } + protected function fillDropdownParameters(&$params) { $em = $this->em; @@ -2450,6 +2465,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface $this->template_hash['jo_list_all'] = 'job-order/list.all.html.twig'; $this->template_hash['jo_onestep'] = 'job-order/cmb.form.onestep.html.twig'; $this->template_hash['jo_onestep_edit_form'] = 'job-order/cmb.form.onestep.html.twig'; + $this->template_hash['jo_walkin'] = 'job-order/cmb.form.walkin.html.twig'; } protected function checkTier($tier) diff --git a/templates/job-order/cmb.form.walkin.html.twig b/templates/job-order/cmb.form.walkin.html.twig new file mode 100644 index 00000000..f3c8d224 --- /dev/null +++ b/templates/job-order/cmb.form.walkin.html.twig @@ -0,0 +1,1087 @@ +{% extends 'base.html.twig' %} + +{% block body %} + + + +
+ +
+
+
+
+
+
+ + + +

+ Walk-in Job Order +

+
+
+
+
+ + +
+ {%if ftags.vehicle_dropdown %} +
+
+
+ + + +
+ +
+
+
+
+
+ + + +
+
+
+ {% else %} + + {% endif %} + {% if obj.getReferenceJO %} +
+
+
+ + + +
+
+
+ {% endif %} + +
+
+

+ Customer Details +

+ + + +
+
+
+ + + +
+
+ + + +
+
+
+
+ +
+ {% trans %}country_code_prefix{% endtrans %} + + +
+
+
+ +
+ {% trans %}country_code_prefix{% endtrans %} + + +
+
+
+
+
+ +
+ {% trans %}country_code_prefix{% endtrans %} + + +
+
+
+ +
+ {% trans %}country_code_prefix{% endtrans %} + + +
+
+
+
+
+ + + +
+
+
+
+
+

+ Vehicle Details +

+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+

+ Battery Details +

+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+
+
+

+ Transaction Details +

+ + + +
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+
+
+
+ + + +
+
+ + + +
+
+
+
+
+ + + +
+
+
+ + +
+
+
+
+ + + +
+
+
+
+
+
+
+
+

+ Hubs +

+
+
+
+ + + +
+ + + + + + + + + + + + {% for hub in hubs %} + + + + + + + {% endfor %} + +
HubBranchContact NumbersDistance in KMAction
{{ hub.getName }}{{ hub.getBranch }}{{ hub.getContactNumbers }}
+
+
+
+
+
+
+
+

+ Invoice +

+
+
+
+ + + +
+
+ + + +
+
+
+
+ + {% if ftags.invoice_edit %} + + + {% else %} + + {% endif %} +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + + + + + + + + + + {% if not obj.getInvoice or (obj.getInvoice and obj.getInvoice.getItems|length == 0) %} + + + + {% else %} + {% for item in obj.getInvoice.getItems %} + + + + + + + {% endfor %} + {% endif %} + +
ItemQuantityUnit PriceAmount
+ No items to display. +
{{ item.getTitle }}{{ item.getQuantity|number_format }}{{ item.getPrice|number_format(2) }}{{ (item.getPrice * item.getQuantity)|number_format(2) }}
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + + +
+
+
+
+
+
+
+
+ + {% if ftags.set_map_coordinate and is_granted('joborder.cancel') and not obj.isCancelled %} + Cancel Job Order + {% endif %} + Back +
+
+
+
+ +
+
+
+
+{% endblock %} + +{% block scripts %} + +{% endblock %} +