Make new page to view all Resq app job orders. #770
This commit is contained in:
parent
fba077d4d3
commit
14d62d044f
6 changed files with 224 additions and 9 deletions
|
|
@ -277,6 +277,8 @@ catalyst_auth:
|
||||||
label: Fulfill Cancelled JO
|
label: Fulfill Cancelled JO
|
||||||
- id: jo_resq_proc.list
|
- id: jo_resq_proc.list
|
||||||
label: RESQ Dispatch
|
label: RESQ Dispatch
|
||||||
|
- id: jo_resq_all.list
|
||||||
|
label: RESQ All
|
||||||
|
|
||||||
- id: support
|
- id: support
|
||||||
label: Customer Support Access
|
label: Customer Support Access
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,10 @@ catalyst_menu:
|
||||||
acl: jo_hub.list
|
acl: jo_hub.list
|
||||||
label: '[menu.joborder.hubview]'
|
label: '[menu.joborder.hubview]'
|
||||||
parent: joborder
|
parent: joborder
|
||||||
|
- id: jo_resq_all
|
||||||
|
acl: jo_resq_all.list
|
||||||
|
label: '[menu.joborder.resqall]'
|
||||||
|
parent: joborder
|
||||||
|
|
||||||
- id: support
|
- id: support
|
||||||
acl: support.menu
|
acl: support.menu
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,17 @@ jo_resq_proc_rows:
|
||||||
path: /resq-job-order/processing-rows
|
path: /resq-job-order/processing-rows
|
||||||
controller: App\Controller\ResqJobOrderController::datatableRows
|
controller: App\Controller\ResqJobOrderController::datatableRows
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
defaults:
|
||||||
|
tier: "proc"
|
||||||
|
|
||||||
|
jo_resq_all:
|
||||||
|
path: /resq-job-order/all
|
||||||
|
controller: App\Controller\ResqJobOrderController::listAll
|
||||||
|
methods: [GET]
|
||||||
|
|
||||||
|
jo_resq_all_rows:
|
||||||
|
path: /resq-job-orer/all
|
||||||
|
controller: App\Controller\ResqJobOrderController::datatableRows
|
||||||
|
methods: [POST]
|
||||||
|
defaults:
|
||||||
|
tier: "all"
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class ResqJobOrderController extends Controller
|
||||||
/**
|
/**
|
||||||
* @IsGranted("jo_resq_proc.list")
|
* @IsGranted("jo_resq_proc.list")
|
||||||
*/
|
*/
|
||||||
public function datatableRows(Request $req, JobOrderHandlerInterface $jo_handler)
|
public function datatableRows(Request $req, $tier, JobOrderHandlerInterface $jo_handler)
|
||||||
{
|
{
|
||||||
// get query builder
|
// get query builder
|
||||||
$qb = $this->getDoctrine()
|
$qb = $this->getDoctrine()
|
||||||
|
|
@ -52,7 +52,14 @@ class ResqJobOrderController extends Controller
|
||||||
// count total records
|
// count total records
|
||||||
$tquery = $qb->select('COUNT(q)');
|
$tquery = $qb->select('COUNT(q)');
|
||||||
|
|
||||||
|
// right now, tier is either proc or all
|
||||||
|
if ($tier == 'proc')
|
||||||
$this->setQueryFilters($datatable, $tquery, $qb, JOStatus::PENDING, TransactionOrigin::MOBILE_APP);
|
$this->setQueryFilters($datatable, $tquery, $qb, JOStatus::PENDING, TransactionOrigin::MOBILE_APP);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// default to all
|
||||||
|
$this->setQueryFilters($datatable, $tquery, $qb, null, TransactionOrigin::MOBILE_APP);
|
||||||
|
}
|
||||||
|
|
||||||
$total = $tquery->getQuery()
|
$total = $tquery->getQuery()
|
||||||
->getSingleScalarResult();
|
->getSingleScalarResult();
|
||||||
|
|
@ -76,7 +83,13 @@ class ResqJobOrderController extends Controller
|
||||||
// build query
|
// build query
|
||||||
$query = $qb->select('q');
|
$query = $qb->select('q');
|
||||||
|
|
||||||
$this->setQueryFilters($datatable, $query, $qb, JOStatus::PENDING, TransactionOrigin::MOBILE_APP);
|
if ($tier == 'proc')
|
||||||
|
$this->setQueryFilters($datatable, $tquery, $qb, JOStatus::PENDING, TransactionOrigin::MOBILE_APP);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// default to all
|
||||||
|
$this->setQueryFilters($datatable, $tquery, $qb, null, TransactionOrigin::MOBILE_APP);
|
||||||
|
}
|
||||||
|
|
||||||
// check if sorting is present, otherwise use default
|
// check if sorting is present, otherwise use default
|
||||||
if (isset($datatable['sort']['field']) && !empty($datatable['sort']['field'])) {
|
if (isset($datatable['sort']['field']) && !empty($datatable['sort']['field'])) {
|
||||||
|
|
@ -135,8 +148,18 @@ class ResqJobOrderController extends Controller
|
||||||
// add the items for Actions
|
// add the items for Actions
|
||||||
$jo_id = $orow->getID();
|
$jo_id = $orow->getID();
|
||||||
|
|
||||||
|
if ($tier == 'proc')
|
||||||
|
{
|
||||||
$row['meta']['update_url'] = $this->generateUrl('jo_proc_form', ['id' => $jo_id, 'origin' => 'resq']);
|
$row['meta']['update_url'] = $this->generateUrl('jo_proc_form', ['id' => $jo_id, 'origin' => 'resq']);
|
||||||
$row['meta']['unlock_url'] = $this->generateUrl('jo_proc_unlock', ['id' => $jo_id, 'origin' => 'resq']);
|
$row['meta']['unlock_url'] = $this->generateUrl('jo_proc_unlock', ['id' => $jo_id, 'origin' => 'resq']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// default to all
|
||||||
|
$row['meta']['update_url'] = $this->generateUrl('jo_all_form', ['id' => $jo_id, 'origin' => 'resq']);
|
||||||
|
$row['meta']['pdf_url'] = $this->generateUrl('jo_pdf_form', ['id' => $jo_id, 'origin' => 'resq']);
|
||||||
|
$row['meta']['view_url'] = $this->generateUrl('jo_all_view_form',['id' => $jo_id, 'origin' => 'resq']);
|
||||||
|
}
|
||||||
|
|
||||||
$rows[] = $row;
|
$rows[] = $row;
|
||||||
}
|
}
|
||||||
|
|
@ -148,11 +171,31 @@ class ResqJobOrderController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Menu(selected="jo_resq_all")
|
||||||
|
* @IsGranted("jo_resq_all.list")
|
||||||
|
*/
|
||||||
|
public function listAll()
|
||||||
|
{
|
||||||
|
$params['table_refresh_rate'] = $this->container->getParameter('job_order_refresh_interval');
|
||||||
|
|
||||||
|
return $this->render('resq-job-order/list.all.html.twig', $params);
|
||||||
|
}
|
||||||
|
|
||||||
protected function setQueryFilters($datatable, &$query, $qb, $status, $source)
|
protected function setQueryFilters($datatable, &$query, $qb, $status, $source)
|
||||||
|
{
|
||||||
|
if ($status != null)
|
||||||
{
|
{
|
||||||
$query->where('q.status = :status')
|
$query->where('q.status = :status')
|
||||||
->andWhere('q.source = :source')
|
->andWhere('q.source = :source')
|
||||||
->setParameter('status', $status)
|
->setParameter('status', $status)
|
||||||
->setParameter('source', $source);
|
->setParameter('source', $source);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get all resq app job orders
|
||||||
|
$query->where('q.source = :source')
|
||||||
|
->setParameter('source', $source);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
151
templates/resq-job-order/list.all.html.twig
Normal file
151
templates/resq-job-order/list.all.html.twig
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<!-- BEGIN: Subheader -->
|
||||||
|
<div class="m-subheader">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="mr-auto">
|
||||||
|
<h3 class="m-subheader__title">
|
||||||
|
RESQ Job Orders (All)
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- END: Subheader -->
|
||||||
|
<div class="m-content">
|
||||||
|
<!--Begin::Section-->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<div class="m-portlet m-portlet--mobile">
|
||||||
|
<div class="m-portlet__body">
|
||||||
|
<div class="m-form m-form--label-align-right m--margin-top-20 m--margin-bottom-30">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<div class="form-group m-form__group row align-items-center">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="m-input-icon m-input-icon--left">
|
||||||
|
<input type="text" class="form-control m-input m-input--solid" placeholder="Search..." id="data-rows-search">
|
||||||
|
<span class="m-input-icon__icon m-input-icon__icon--left">
|
||||||
|
<span><i class="la la-search"></i></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--begin: Datatable -->
|
||||||
|
<div id="data-rows"></div>
|
||||||
|
<!--end: Datatable -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
var options = {
|
||||||
|
data: {
|
||||||
|
type: 'remote',
|
||||||
|
source: {
|
||||||
|
read: {
|
||||||
|
url: '{{ url('jo_resq_all_rows') }}',
|
||||||
|
method: 'POST'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
saveState: {
|
||||||
|
cookie: false,
|
||||||
|
webstorage: false
|
||||||
|
},
|
||||||
|
pageSize: 10,
|
||||||
|
serverPaging: true,
|
||||||
|
serverFiltering: true,
|
||||||
|
serverSorting: true
|
||||||
|
},
|
||||||
|
rows: {
|
||||||
|
beforeTemplate: function (row, data, index) {
|
||||||
|
var attribute = getRowAttribute(data);
|
||||||
|
// check if we have to apply a background color for the row
|
||||||
|
if (attribute) {
|
||||||
|
var row_class = "m-table__row--" + attribute;
|
||||||
|
$(row).addClass(row_class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
field: 'id',
|
||||||
|
title: 'JO Number'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'delivery_address',
|
||||||
|
title: 'Customer Area'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'type',
|
||||||
|
title: 'Schedule'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'date_schedule',
|
||||||
|
title: 'Scheduled Date'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'status',
|
||||||
|
title: 'Status'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'processor',
|
||||||
|
title: 'Dispatcher'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'Actions',
|
||||||
|
width: 110,
|
||||||
|
title: 'Actions',
|
||||||
|
sortable: false,
|
||||||
|
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="Edit"><i class="la la-edit"></i></a>';
|
||||||
|
actions += '<a href="' + row.meta.view_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"><i class="la la-eye"></i></a>';
|
||||||
|
actions += '<a href="' + row.meta.pdf_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="PDF" target="_blank"><i class="la la-file-o"></i></a>';
|
||||||
|
|
||||||
|
return actions;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
search: {
|
||||||
|
onEnter: false,
|
||||||
|
input: $('#data-rows-search'),
|
||||||
|
delay: 400
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var table = $("#data-rows").mDatatable(options);
|
||||||
|
|
||||||
|
// auto refresh table
|
||||||
|
setInterval(function() {
|
||||||
|
table.reload();
|
||||||
|
}, {{ table_refresh_rate }});
|
||||||
|
});
|
||||||
|
|
||||||
|
function getRowAttribute(data) {
|
||||||
|
if (data.is_vip) {
|
||||||
|
return 'is_vip';
|
||||||
|
}
|
||||||
|
if (data.is_emergency) {
|
||||||
|
return 'is_emergency';
|
||||||
|
}
|
||||||
|
if (data.flag_advance) {
|
||||||
|
return 'danger';
|
||||||
|
}
|
||||||
|
if (data.is_mobile) {
|
||||||
|
return 'is_mobile';
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
@ -126,6 +126,7 @@ menu.joborder.fulfillment: 'Fulfillment'
|
||||||
menu.joborder.open: 'Open'
|
menu.joborder.open: 'Open'
|
||||||
menu.joborder.viewall: 'View All'
|
menu.joborder.viewall: 'View All'
|
||||||
menu.joborder.hubview: 'Hub View'
|
menu.joborder.hubview: 'Hub View'
|
||||||
|
menu.joborder.resqall: 'RESQ All'
|
||||||
|
|
||||||
menu.support: 'Support'
|
menu.support: 'Support'
|
||||||
menu.support.customers: 'Customers'
|
menu.support.customers: 'Customers'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue