Resolve "Color code JOs in dispatch page" #1599
3 changed files with 142 additions and 86 deletions
|
|
@ -155,6 +155,30 @@ span.has-danger,
|
|||
color: #fff !important;
|
||||
}
|
||||
|
||||
.m-table__row--is_vip td {
|
||||
background-color: #ffff00 !important;
|
||||
color: #414a4c !important;
|
||||
}
|
||||
|
||||
.m-table__row--is_vip td > span,
|
||||
.m-table__row--is_vip td > span a,
|
||||
.m-table__row--is_vip td > span a i {
|
||||
color: #414a4c !important;
|
||||
}
|
||||
|
||||
.m-table__row--is_emergency td {
|
||||
background-color: #ffa500 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.m-table__row--is_emergency td > span,
|
||||
.m-table__row--is_emergency td > span a,
|
||||
.m-table__row--is_emergency td > span a i {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.m-datatable.m-datatable--default > .m-datatable__table {
|
||||
min-height: 0 !important;
|
||||
}
|
||||
|
|
@ -358,4 +382,4 @@ span.has-danger,
|
|||
|
||||
.map-info .m-badge {
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ use App\Ramcar\HubCriteria;
|
|||
use App\Ramcar\DeliveryStatus;
|
||||
use App\Ramcar\SourceOfAwareness;
|
||||
use App\Ramcar\InitialConcern;
|
||||
use App\Ramcar\CustomerClassification;
|
||||
use App\Ramcar\Gender;
|
||||
use App\Ramcar\CallerClassification;
|
||||
|
||||
|
|
@ -187,8 +188,20 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$service_types = ServiceType::getCollection();
|
||||
|
||||
// process rows
|
||||
$is_vip = false;
|
||||
$is_emergency = false;
|
||||
$rows = [];
|
||||
foreach ($obj_rows as $orow) {
|
||||
// check if customer is vip
|
||||
$cust_class = $orow->getCustomer()->getCustomerClassification();
|
||||
if ($cust_class == CustomerClassification::VIP)
|
||||
$is_vip = true;
|
||||
|
||||
// check if customer is not willing to wait
|
||||
$will_not_wait = $orow->getWillWait();
|
||||
if ($will_not_wait == WillingToWaitContent::NOT_WILLING_TO_WAIT)
|
||||
$is_emergency = true;
|
||||
|
||||
// add row data
|
||||
$row['id'] = $orow->getID();
|
||||
$row['customer_name'] = $orow->getCustomer()->getFirstName() . ' ' . $orow->getCustomer()->getLastName();
|
||||
|
|
@ -200,6 +213,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$row['flag_advance'] = $orow->isAdvanceOrder();
|
||||
$row['plate_number'] = $orow->getCustomerVehicle()->getPlateNumber();
|
||||
$row['is_mobile'] = $orow->getSource() == TransactionOrigin::MOBILE_APP;
|
||||
$row['is_vip'] = $is_vip;
|
||||
$row['is_emergency'] = $is_emergency;
|
||||
|
||||
$processor = $orow->getProcessedBy();
|
||||
if ($processor == null)
|
||||
|
|
|
|||
|
|
@ -45,94 +45,111 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
$(function() {
|
||||
var options = {
|
||||
data: {
|
||||
type: 'remote',
|
||||
source: {
|
||||
read: {
|
||||
url: '{{ url('jo_proc_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');
|
||||
}
|
||||
<script>
|
||||
$(function() {
|
||||
var options = {
|
||||
data: {
|
||||
type: 'remote',
|
||||
source: {
|
||||
read: {
|
||||
url: '{{ url('jo_proc_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="View / Edit"><i class="la la-edit"></i></a>';
|
||||
|
||||
if (data.is_mobile) {
|
||||
$(row).addClass('m-table__row--is_mobile');
|
||||
}
|
||||
}
|
||||
},
|
||||
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="View / Edit"><i class="la la-edit"></i></a>';
|
||||
{% if is_granted('jo_proc.unlock') %}
|
||||
if (row.meta.unlock_url != '') {
|
||||
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 %}
|
||||
|
||||
{% if is_granted('jo_proc.unlock') %}
|
||||
if (row.meta.unlock_url != '') {
|
||||
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;
|
||||
},
|
||||
}
|
||||
],
|
||||
search: {
|
||||
onEnter: false,
|
||||
input: $('#data-rows-search'),
|
||||
delay: 400
|
||||
}
|
||||
};
|
||||
|
||||
return actions;
|
||||
},
|
||||
}
|
||||
],
|
||||
search: {
|
||||
onEnter: false,
|
||||
input: $('#data-rows-search'),
|
||||
delay: 400
|
||||
}
|
||||
};
|
||||
var table = $("#data-rows").mDatatable(options);
|
||||
|
||||
var table = $("#data-rows").mDatatable(options);
|
||||
// auto refresh table
|
||||
setInterval(function() {
|
||||
table.reload();
|
||||
}, {{ table_refresh_rate }});
|
||||
});
|
||||
|
||||
// auto refresh table
|
||||
setInterval(function() {
|
||||
table.reload();
|
||||
}, {{ table_refresh_rate }});
|
||||
});
|
||||
</script>
|
||||
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 %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue