Merge branch 'master' into '13-job-order-reassignment'
# Conflicts: # src/Controller/JobOrderController.php
This commit is contained in:
commit
ea4906d207
7 changed files with 68 additions and 3 deletions
|
|
@ -187,8 +187,12 @@ access_keys:
|
|||
label: Incoming
|
||||
- id: jo_proc.list
|
||||
label: Processing
|
||||
- id: jo_proc.unlock
|
||||
label: Processing Unlock
|
||||
- id: jo_assign.list
|
||||
label: Assigning
|
||||
- id: jo_assign.unlock
|
||||
label: Assigning Unlock
|
||||
- id: jo_fulfill.list
|
||||
label: Fulfillment
|
||||
- id: jo_open.list
|
||||
|
|
|
|||
|
|
@ -121,4 +121,14 @@ jo_cancel:
|
|||
jo_search:
|
||||
path: /job-order/search
|
||||
controller: App\Controller\JobOrderController::getJobOrders
|
||||
methods: [GET]
|
||||
methods: [GET]
|
||||
|
||||
jo_proc_unlock:
|
||||
path: /job-order/{id}/unlock/processor
|
||||
controller: App\Controller\JobOrderController::unlockProcessor
|
||||
methods: [GET]
|
||||
|
||||
jo_assign_unlock:
|
||||
path: /job-order/{id}/unlock/assignor
|
||||
controller: App\Controller\JobOrderController::unlockAssignor
|
||||
methods: [GET]
|
||||
|
|
|
|||
|
|
@ -278,6 +278,7 @@ class JobOrderController extends BaseController
|
|||
$tier_name = 'Processing';
|
||||
$rows_route = 'jo_proc_rows';
|
||||
$edit_route = 'jo_proc_form';
|
||||
$unlock_route = 'jo_proc_unlock';
|
||||
$jo_status = JOStatus::PENDING;
|
||||
break;
|
||||
case 'assign':
|
||||
|
|
@ -285,6 +286,7 @@ class JobOrderController extends BaseController
|
|||
$tier_name = 'Assigning';
|
||||
$rows_route = 'jo_assign_rows';
|
||||
$edit_route = 'jo_assign_form';
|
||||
$unlock_route = 'jo_assign_unlock';
|
||||
$jo_status = JOStatus::RIDER_ASSIGN;
|
||||
break;
|
||||
case 'fulfill':
|
||||
|
|
@ -292,6 +294,7 @@ class JobOrderController extends BaseController
|
|||
$tier_name = 'Fullfillment';
|
||||
$rows_route = 'jo_fulfill_rows';
|
||||
$edit_route = 'jo_fulfill_form';
|
||||
$unlock_route = '';
|
||||
$jo_status = [
|
||||
JOStatus::ASSIGNED,
|
||||
JOStatus::IN_PROGRESS
|
||||
|
|
@ -323,6 +326,7 @@ class JobOrderController extends BaseController
|
|||
'name' => $tier_name,
|
||||
'rows_route' => $rows_route,
|
||||
'edit_route' => $edit_route,
|
||||
'unlock_route' => $unlock_route,
|
||||
'jo_status' => $jo_status
|
||||
];
|
||||
}
|
||||
|
|
@ -466,6 +470,9 @@ class JobOrderController extends BaseController
|
|||
{
|
||||
$row['meta']['update_url'] = $this->generateUrl($tier_params['edit_route'], ['id' => $row['id']]);
|
||||
}
|
||||
|
||||
if ($tier_params['unlock_route'] != '')
|
||||
$row['meta']['unlock_url'] = $this->generateUrl($tier_params['unlock_route'], ['id' => $row['id']]);
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
|
@ -1402,4 +1409,39 @@ class JobOrderController extends BaseController
|
|||
'invoice' => $invoice
|
||||
]);
|
||||
}
|
||||
|
||||
public function unlockProcessor($id)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('jo_proc.unlock', null, 'No access.');
|
||||
|
||||
// clear lock
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$jo = $em->getRepository(JobOrder::class)->find($id);
|
||||
if ($jo == null)
|
||||
return $this->redirectToRoute('jo_proc');
|
||||
|
||||
$jo->setProcessedBy(null);
|
||||
|
||||
$em->flush();
|
||||
|
||||
// redirect to list
|
||||
return $this->redirectToRoute('jo_proc');
|
||||
}
|
||||
|
||||
public function unlockAssignor($id)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('jo_assign.unlock', null, 'No access.');
|
||||
|
||||
// clear lock
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$jo = $em->getRepository(JobOrder::class)->find($id);
|
||||
if ($jo == null)
|
||||
return $this->redirectToRoute('jo_assign');
|
||||
|
||||
$jo->setAssignedBy(null);
|
||||
$em->flush();
|
||||
|
||||
// redirect to list
|
||||
return $this->redirectToRoute('jo_assign');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ class JobOrder
|
|||
return $this->created_by;
|
||||
}
|
||||
|
||||
public function setAssignedBy(User $assigned_by)
|
||||
public function setAssignedBy(User $assigned_by = null)
|
||||
{
|
||||
$this->assigned_by = $assigned_by;
|
||||
return $this;
|
||||
|
|
@ -299,7 +299,7 @@ class JobOrder
|
|||
return $this->assigned_by;
|
||||
}
|
||||
|
||||
public function setProcessedBy(User $user)
|
||||
public function setProcessedBy(User $user = null)
|
||||
{
|
||||
$this->processed_by = $user;
|
||||
return $this;
|
||||
|
|
|
|||
|
|
@ -109,6 +109,10 @@
|
|||
overflow: 'visible',
|
||||
template: function (row, index, datatable) {
|
||||
var actions = '<a href="' + row.meta.update_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill btn-edit" title="View / Edit"><i class="la la-edit"></i></a>';
|
||||
|
||||
{% if is_granted('jo_assign.unlock') %}
|
||||
actions += '<a href="' + row.meta.unlock_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill btn-edit" title="Unlock"><i class="fa fa-unlock"></i></a>';
|
||||
{% endif %}
|
||||
|
||||
return actions;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -105,6 +105,10 @@
|
|||
overflow: 'visible',
|
||||
template: function (row, index, datatable) {
|
||||
var actions = '<a href="' + row.meta.update_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill btn-edit" title="View / Edit"><i class="la la-edit"></i></a>';
|
||||
|
||||
{% if row.meta.unlock_url != "" && is_granted('jo_proc.unlock') %}
|
||||
actions += '<a href="' + row.meta.unlock_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill btn-edit" title="Unlock"><i class="fa fa-unlock"></i></a>';
|
||||
{% endif %}
|
||||
|
||||
return actions;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@
|
|||
overflow: 'visible',
|
||||
template: function (row, index, datatable) {
|
||||
var actions = '<a href="' + row.meta.update_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill btn-edit" title="View / Edit"><i class="la la-edit"></i></a>';
|
||||
actions += '<a href="' + row.meta.unlock_url + '" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill btn-edit" title="View / Edit"><i class="la la-edit"></i></a>';
|
||||
|
||||
return actions;
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue