diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index dfc421c6..1d1d84c1 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -277,13 +277,13 @@ class JobOrderController extends Controller $rows[$key]['meta']['reassign_hub_url'] = $this->generateUrl('jo_open_hub_form', ['id' => $jo_id]); $rows[$key]['meta']['reassign_rider_url'] = $this->generateUrl('jo_open_rider_form', ['id' => $jo_id]); // $rows[$key]['meta']['edit_url'] = $this->generateUrl('jo_open_edit_form', ['id' => $jo_id]); - $rows[$key]['meta']['edit_url'] = $this->generateUrl($jo_handler->getEditRoute($jo_id), ['id' => $jo_id]); + $rows[$key]['meta']['edit_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]); } else { // $rows[$key]['meta']['update_url'] = $this->generateUrl($tier_params['edit_route'], ['id' => $jo_id]); - $rows[$key]['meta']['update_url'] = $this->generateUrl($jo_handler->getEditRoute($jo_id), ['id' => $jo_id]); + $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]); } diff --git a/src/Service/JobOrderHandler/CMBJobOrderHandler.php b/src/Service/JobOrderHandler/CMBJobOrderHandler.php index 2e16f2e9..422f5fb7 100644 --- a/src/Service/JobOrderHandler/CMBJobOrderHandler.php +++ b/src/Service/JobOrderHandler/CMBJobOrderHandler.php @@ -2997,7 +2997,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface } } - public function getEditRoute($jo_id) + public function getEditRoute($jo_id, $tier = null) { $jo = $this->em->getRepository(JobOrder::class)->find($jo_id); if (empty($jo)) diff --git a/src/Service/JobOrderHandler/ResqJobOrderHandler.php b/src/Service/JobOrderHandler/ResqJobOrderHandler.php index 12995e56..a12e09d5 100644 --- a/src/Service/JobOrderHandler/ResqJobOrderHandler.php +++ b/src/Service/JobOrderHandler/ResqJobOrderHandler.php @@ -314,6 +314,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface } } + // TODO: check status before saving since JO might already + // have a status that needs to be retained + if (empty($error_array)) { // get current user $user = $this->security->getUser(); @@ -2588,7 +2591,11 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface } } - public function getEditRoute() + public function getEditRoute($jo_id, $tier) { + if (empty($tier)) + return 'jo_open_edit_form'; + + return $tier; } } diff --git a/src/Service/JobOrderHandlerInterface.php b/src/Service/JobOrderHandlerInterface.php index 5593d10c..590a0926 100644 --- a/src/Service/JobOrderHandlerInterface.php +++ b/src/Service/JobOrderHandlerInterface.php @@ -98,4 +98,7 @@ interface JobOrderHandlerInterface // check if service type is new battery public function checkIfNewBattery(JobOrder $jo); + + // return the edit route, based on tier and form + public function getEditRoute(int $jo_id, $tier); } diff --git a/templates/job-order/list.fulfillment.html.twig b/templates/job-order/list.fulfillment.html.twig index 8115866d..66d3c837 100644 --- a/templates/job-order/list.fulfillment.html.twig +++ b/templates/job-order/list.fulfillment.html.twig @@ -135,7 +135,7 @@ sortable: false, overflow: 'visible', template: function (row, index, datatable) { - var actions = '' + ''; + var actions = ''; return actions; }, diff --git a/templates/job-order/list.open.html.twig b/templates/job-order/list.open.html.twig index 451d8492..3a407009 100644 --- a/templates/job-order/list.open.html.twig +++ b/templates/job-order/list.open.html.twig @@ -148,9 +148,6 @@ {% if is_granted('jo_open.edit') %} actions += ''; {% endif %} - {% if is_granted('jo_onestep.edit') %} - actions += ''; - {% endif %} return actions; },