Modify the function names for walkin. #340

This commit is contained in:
Korina Cordero 2020-02-14 03:07:42 +00:00
parent 034ae108e0
commit bea5d72d13
2 changed files with 30 additions and 7 deletions

View file

@ -208,21 +208,21 @@ jo_tracker:
jo_walkin_form:
path: /job-order/walk-in
controller: App\Controller\JobOrderController::walkinForm
controller: App\Controller\JobOrderController::walkInForm
methods: [GET]
jo_walkin_submit:
path: /job-order/walk-in
controller: App\Controller\JobOrderController::walkinSubmit
controller: App\Controller\JobOrderController::walkInSubmit
methods: [POST]
jo_walkin_edit_form:
path: /job-order/walk-in/{id}
controller: App\Controller\JobOrderController::walkinEditForm
controller: App\Controller\JobOrderController::walkInEditForm
methods: [GET]
jo_walkin_edit_submit:
path: /job-order/walk-in/{id}
controller: App\Controller\JobOrderController::walkinEditSubmit
controller: App\Controller\JobOrderController::walkInEditSubmit
methods: [POST]

View file

@ -966,7 +966,7 @@ class JobOrderController extends Controller
/**
* @Menu(selected="jo_walkin_form")
*/
public function walkinForm(EntityManagerInterface $em, JobOrderHandlerInterface $jo_handler)
public function walkInForm(EntityManagerInterface $em, JobOrderHandlerInterface $jo_handler)
{
$this->denyAccessUnlessGranted('jo_walkin.form', null, 'No access.');
@ -983,7 +983,7 @@ class JobOrderController extends Controller
return $this->render($template, $params);
}
public function walkinSubmit(Request $req, JobOrderHandlerInterface $jo_handler)
public function walkInSubmit(Request $req, JobOrderHandlerInterface $jo_handler)
{
$this->denyAccessUnlessGranted('jo_walkin.form', null, 'No access.');
@ -1010,7 +1010,7 @@ class JobOrderController extends Controller
/**
* @Menu(selected="jo_walkin_edit_form")
*/
public function walkinEditForm($id, EntityManagerInterface $em, JobOrderHandlerInterface $jo_handler)
public function walkInEditForm($id, EntityManagerInterface $em, JobOrderHandlerInterface $jo_handler)
{
$this->denyAccessUnlessGranted('jo_walkin.edit', null, 'No access.');
@ -1027,5 +1027,28 @@ class JobOrderController extends Controller
return $this->render($template, $params);
}
public function walkInEditSubmit(Request $req, JobOrderHandlerInterface $jo_handler)
{
$this->denyAccessUnlessGranted('jo_walkin.edit', null, 'No access.');
$error_array = [];
$error_array = $jo_handler->processOneStepJobOrder($req, $id);
// check if any errors were found
if (!empty($error_array)) {
// return validation failure response
return $this->json([
'success' => false,
'errors' => $error_array
], 422);
}
// return successful response
return $this->json([
'success' => 'Changes have been saved!'
]);
}
}