Fix edit for walkin JOs. #270
This commit is contained in:
parent
4700d2b840
commit
22be1eaf5a
3 changed files with 16 additions and 13 deletions
|
|
@ -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_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']['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_open_edit_form', ['id' => $jo_id]);
|
||||||
$rows[$key]['meta']['edit_url'] = $this->generateUrl($jo_handler->getEditRoute(), ['id' => $jo_id]);
|
$rows[$key]['meta']['edit_url'] = $this->generateUrl($jo_handler->getEditRoute($jo_id), ['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('jo_onestep_edit_form', ['id' => $jo_id]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// $rows[$key]['meta']['update_url'] = $this->generateUrl($tier_params['edit_route'], ['id' => $jo_id]);
|
// $rows[$key]['meta']['update_url'] = $this->generateUrl($tier_params['edit_route'], ['id' => $jo_id]);
|
||||||
$rows[$key]['meta']['update_url'] = $this->generateUrl($jo_handler->getEditRoute(), ['id' => $jo_id]);
|
$rows[$key]['meta']['update_url'] = $this->generateUrl($jo_handler->getEditRoute($jo_id), ['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('jo_onestep_edit_form', ['id' => $jo_id]);
|
||||||
$rows[$key]['meta']['pdf_url'] = $this->generateUrl('jo_pdf_form', ['id' => $jo_id]);
|
$rows[$key]['meta']['pdf_url'] = $this->generateUrl('jo_pdf_form', ['id' => $jo_id]);
|
||||||
}
|
}
|
||||||
|
|
@ -1037,12 +1037,12 @@ class JobOrderController extends Controller
|
||||||
return $this->render($template, $params);
|
return $this->render($template, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function walkInEditSubmit(Request $req, JobOrderHandlerInterface $jo_handler)
|
public function walkInEditSubmit(Request $req, JobOrderHandlerInterface $jo_handler, $id)
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('jo_walkin.edit', null, 'No access.');
|
$this->denyAccessUnlessGranted('jo_walkin.edit', null, 'No access.');
|
||||||
|
|
||||||
$error_array = [];
|
$error_array = [];
|
||||||
$error_array = $jo_handler->processOneStepJobOrder($req, $id);
|
$error_array = $jo_handler->processWalkinJobOrder($req, $id);
|
||||||
|
|
||||||
// check if any errors were found
|
// check if any errors were found
|
||||||
if (!empty($error_array)) {
|
if (!empty($error_array)) {
|
||||||
|
|
|
||||||
|
|
@ -2997,8 +2997,16 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEditRoute()
|
public function getEditRoute($jo_id)
|
||||||
{
|
{
|
||||||
return 'jo_onestep_edit_form';
|
$jo = $this->em->getRepository(JobOrder::class)->find($jo_id);
|
||||||
|
if (empty($jo))
|
||||||
|
throw new NotFoundHttpException('The item does not exist');
|
||||||
|
|
||||||
|
// check transaction origin
|
||||||
|
if ($jo->getSource() == TransactionOrigin::WALK_IN)
|
||||||
|
return 'jo_walkin_edit_form';
|
||||||
|
else
|
||||||
|
return 'jo_onestep_edit_form';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -347,7 +347,7 @@
|
||||||
</label>
|
</label>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="form-control-feedback hide" data-field="hub"></div>
|
<div class="form-control-feedback hide" data-field="hub"></div>
|
||||||
<input type="hidden" id="hub-field" name="hub_id" value="">
|
<input type="hidden" id="hub-field" name="hub_id" value="{{ obj.getHub ? obj.getHub.getID : "" }}">
|
||||||
<div class="table-frame" data-name="hub">
|
<div class="table-frame" data-name="hub">
|
||||||
<table id="hubs-table" class="table table-compact table-hover table-clickable m-table">
|
<table id="hubs-table" class="table table-compact table-hover table-clickable m-table">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
@ -557,7 +557,7 @@ function get_vehicle_makes(mfg_id, vid = 0) {
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var form_in_process = false;
|
var form_in_process = false;
|
||||||
var selected_hub = '';
|
var selected_hub = '{{ obj.getHub ? obj.getHub.getID : "" }}';
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$('#hubs-table').on('click', 'tr', function() {
|
$('#hubs-table').on('click', 'tr', function() {
|
||||||
|
|
@ -592,11 +592,6 @@ $(function() {
|
||||||
// add invoice items to data
|
// add invoice items to data
|
||||||
fields['invoice_items'] = invoiceItems;
|
fields['invoice_items'] = invoiceItems;
|
||||||
|
|
||||||
{% if mode in ['update-processing', 'update-reassign-hub'] %}
|
|
||||||
// add selected hub to data
|
|
||||||
fields['hub'] = selectedHub;
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue