diff --git a/config/routes/job_order.yaml b/config/routes/job_order.yaml index 6ea3a3c5..861aab78 100644 --- a/config/routes/job_order.yaml +++ b/config/routes/job_order.yaml @@ -267,3 +267,8 @@ jo_geofence: path: /ajax/job-order/geofence controller: App\Controller\JobOrderController::checkGeofence methods: [GET] + +jo_all_view_form: + path: /job-order/all/view/{id} + controller: App\Controller\JobOrderController::allViewForm + methods: [GET] diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index 121edd8f..91921a0f 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -300,6 +300,7 @@ class JobOrderController extends Controller $rows[$key]['meta']['update_url'] = $this->generateUrl($jo_handler->getEditRoute($jo_id, $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']['pdf_url'] = $this->generateUrl('jo_pdf_form', ['id' => $jo_id]); + $rows[$key]['meta']['view_url'] = $this->generateUrl('jo_all_view_form',['id' => $jo_id]); } if ($tier_params['unlock_route'] != '') @@ -658,6 +659,32 @@ class JobOrderController extends Controller // response return $this->render($template, $params); } + + /** + * @Menu(selected="jo_all") + */ + public function allViewForm($id, JobOrderHandlerInterface $jo_handler, + GISManagerInterface $gis, EntityManagerInterface $em) + { + $this->denyAccessUnlessGranted('jo_all.list', null, 'No access.'); + + try + { + $params = $jo_handler->initializeAllViewForm($id); + } + catch (NotFoundHttpException $e) + { + throw $this->createNotFoundException($e->getMessage()); + } + + $params['return_url'] = $this->generateUrl('jo_all'); + $params['map_js_file'] = $gis->getJSJOFile(); + + $template = $params['template']; + + // response + return $this->render($template, $params); + } public function pdfForm(Request $req, $id, JobOrderHandlerInterface $jo_handler) diff --git a/src/Service/JobOrderHandler/ResqJobOrderHandler.php b/src/Service/JobOrderHandler/ResqJobOrderHandler.php index 234619a7..97ddb2a3 100644 --- a/src/Service/JobOrderHandler/ResqJobOrderHandler.php +++ b/src/Service/JobOrderHandler/ResqJobOrderHandler.php @@ -2404,6 +2404,27 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface return $params; } + public function initializeAllViewform($id) + { + $em = $this->em; + + // get row data + $obj = $em->getRepository(JobOrder::class)->find($id); + + // make sure this row exists + if (empty($obj)) + throw new NotFoundHttpException('The job order does not exist'); + + $this->fillDropdownParameters($params); + + $params['obj'] = $obj; + + // get template to display + $params['template'] = $this->getTwigTemplate('jo_all_view_form'); + + return $params; + } + // initialize dispatch/processing job order form public function initializeProcessingForm($id, HubSelector $hub_selector, $motiv) { @@ -3655,6 +3676,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface $this->template_hash['jo_popup'] = 'job-order/popup.html.twig'; $this->template_hash['jo_hub_list'] = 'job-order/list.hubview.html.twig'; $this->template_hash['jo_hub_view_form'] = 'job-order/form.html.twig'; + $this->template_hash['jo_all_view_form'] = 'job-order/form.view.html.twig'; } protected function checkTier($tier) diff --git a/templates/job-order/form.view.html.twig b/templates/job-order/form.view.html.twig new file mode 100644 index 00000000..1cbd764d --- /dev/null +++ b/templates/job-order/form.view.html.twig @@ -0,0 +1,728 @@ +{% extends 'base.html.twig' %} + +{% block body %} +