Add acl, menu item, template, and route for Hub View. #410
This commit is contained in:
parent
5bfa881354
commit
25997ae11e
7 changed files with 208 additions and 0 deletions
|
|
@ -266,6 +266,8 @@ access_keys:
|
|||
label: Walk-in Edit
|
||||
- id: jo_autoassign.test
|
||||
label: Autoassign Test
|
||||
- id: jo_hub.view
|
||||
label: Hub View
|
||||
|
||||
- id: support
|
||||
label: Customer Support Access
|
||||
|
|
|
|||
|
|
@ -122,6 +122,10 @@ main_menu:
|
|||
acl: jo_all.list
|
||||
label: View All
|
||||
parent: joborder
|
||||
- id: jo_hub_view
|
||||
acl: jo_hub.view
|
||||
label: Hub View
|
||||
parent: joborder
|
||||
|
||||
- id: support
|
||||
acl: support.menu
|
||||
|
|
|
|||
|
|
@ -122,6 +122,9 @@ main_menu:
|
|||
acl: jo_all.list
|
||||
label: View All
|
||||
parent: joborder
|
||||
- id: jo_hub.view
|
||||
label: Hub View
|
||||
parent: joborder
|
||||
|
||||
- id: support
|
||||
acl: support.menu
|
||||
|
|
|
|||
|
|
@ -235,3 +235,8 @@ jo_autoassign_test_submit:
|
|||
path: /job-order/autoassign
|
||||
controller: App\Controller\JobOrderController::autoAssignSubmit
|
||||
methods: [POST]
|
||||
|
||||
jo_hub_view:
|
||||
path: /job-order/hub-view
|
||||
controller: App\Controller\JobOrderController::hubView
|
||||
methods: [GET]
|
||||
|
|
|
|||
|
|
@ -1065,6 +1065,21 @@ class JobOrderController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="jo_hub_view")
|
||||
*/
|
||||
public function hubView(JobOrderHandlerInterface $jo_handler)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('jo_hub.view', null, 'No access.');
|
||||
|
||||
$template = $jo_handler->getTwigTemplate('jo_hub_list');
|
||||
|
||||
$params = $jo_handler->getOtherParameters();
|
||||
$params['table_refresh_rate'] = $this->container->getParameter('job_order_refresh_interval');
|
||||
|
||||
return $this->render($template, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="jo_autoassign")
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2341,6 +2341,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
// get riders for dropdown
|
||||
$params['riders'] = $this->em->getRepository(Rider::class)->findAll();
|
||||
|
||||
// get hubs for dropdown
|
||||
$params['hubs'] = $this->em->getRepository(Hub::class)->findAll();
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
|
|
@ -2509,6 +2512,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$this->template_hash['jo_list_open'] = 'job-order/list.open.html.twig';
|
||||
$this->template_hash['jo_list_all'] = 'job-order/list.all.html.twig';
|
||||
$this->template_hash['jo_popup'] = 'job-order/popup.html.twig';
|
||||
$this->template_hash['jo_hub_list'] = 'job-order/list.hubview.html.twig';
|
||||
}
|
||||
|
||||
protected function checkTier($tier)
|
||||
|
|
|
|||
175
templates/job-order/list.hubview.html.twig
Normal file
175
templates/job-order/list.hubview.html.twig
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
{% 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">
|
||||
Job Orders (Hub View)
|
||||
</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 class="col-md-4">
|
||||
<div class="m-input-icon m-input-icon--left">
|
||||
<div class="input-group">
|
||||
<select class="form-control m-input" id="hub_list" name="hub_list">
|
||||
<option value="">All Hubs</option>
|
||||
{% for hub in hubs %}
|
||||
<option value="{{ hub.getID }}">{{ hub.getName }} </option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</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() {
|
||||
$("#date-range").datepicker({
|
||||
orientation: "bottom"
|
||||
});
|
||||
|
||||
var options = {
|
||||
data: {
|
||||
type: 'remote',
|
||||
source: {
|
||||
read: {
|
||||
url: '{{ url('jo_all_rows') }}',
|
||||
method: 'POST'
|
||||
}
|
||||
},
|
||||
saveState: {
|
||||
cookie: false,
|
||||
webstorage: false
|
||||
},
|
||||
pageSize: 10,
|
||||
serverPaging: true,
|
||||
serverFiltering: true,
|
||||
serverSorting: true
|
||||
},
|
||||
rows: {
|
||||
beforeTemplate: function (row, data, index) {
|
||||
if (data.flag_advance) {
|
||||
$(row).addClass('m-table__row--danger');
|
||||
}
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
field: 'id',
|
||||
title: 'JO Number'
|
||||
},
|
||||
{
|
||||
field: 'plate_number',
|
||||
title: 'Plate #'
|
||||
},
|
||||
{
|
||||
field: 'customer_name',
|
||||
title: 'Customer'
|
||||
},
|
||||
{
|
||||
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="View"><i class="la la-edit"></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 }});
|
||||
|
||||
$("#rider_list").on("change", function() {
|
||||
table.search($(this).val(), "rider");
|
||||
});
|
||||
|
||||
$("#date_start").on("change", function() {
|
||||
var date_start = $(this).val();
|
||||
var date_end = $("[name='date_end']").val();
|
||||
var date_array = [date_start, date_end];
|
||||
|
||||
table.search(date_array, "schedule_date");
|
||||
});
|
||||
|
||||
$("#date_end").on("change", function() {
|
||||
console.log($(this).val());
|
||||
|
||||
var date_end = $(this).val();
|
||||
var date_start = $("[name='date_start']").val();
|
||||
var date_array = [date_start, date_end];
|
||||
|
||||
table.search(date_array, "schedule_date");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Loading…
Reference in a new issue