Merge branch '746-resq-2-0-final' of gitlab.com:jankstudio/resq into 773-add-a-dropdown-box-in-customer-information-to-indicate-if-customer-is-new-old
This commit is contained in:
commit
24332c0f9b
3 changed files with 67 additions and 3 deletions
|
|
@ -200,6 +200,8 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$row['car_model'] = $car_model;
|
$row['car_model'] = $car_model;
|
||||||
$row['rider_name'] = $rider_name;
|
$row['rider_name'] = $rider_name;
|
||||||
$row['rider_plate_number'] = $rider_plate_number;
|
$row['rider_plate_number'] = $rider_plate_number;
|
||||||
|
$row['date_assign'] = !empty($orow->getDateAssign()) ? $orow->getDateAssign()->format("c") : null;
|
||||||
|
$row['date_fulfill'] = !empty($orow->getDateFulfill()) ? $orow->getDateFulfill()->format("c") : null;
|
||||||
|
|
||||||
$processor = $orow->getProcessedBy();
|
$processor = $orow->getProcessedBy();
|
||||||
if ($processor == null)
|
if ($processor == null)
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$row['is_vip'] = $is_vip;
|
$row['is_vip'] = $is_vip;
|
||||||
$row['is_emergency'] = $is_emergency;
|
$row['is_emergency'] = $is_emergency;
|
||||||
$row['flag_cust_new'] = $orow->isCustNew();
|
$row['flag_cust_new'] = $orow->isCustNew();
|
||||||
|
$row['date_assign'] = !empty($orow->getDateAssign()) ? $orow->getDateAssign()->format("c") : null;
|
||||||
|
$row['date_fulfill'] = !empty($orow->getDateFulfill()) ? $orow->getDateFulfill()->format("c") : null;
|
||||||
|
|
||||||
$processor = $orow->getProcessedBy();
|
$processor = $orow->getProcessedBy();
|
||||||
if ($processor == null)
|
if ($processor == null)
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,20 @@
|
||||||
if (data.flag_advance) {
|
if (data.flag_advance) {
|
||||||
$(row).addClass('m-table__row--danger');
|
$(row).addClass('m-table__row--danger');
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
afterTemplate: function (row, data, index) {
|
||||||
|
// if this row has an incrementing timer, handle the behavior
|
||||||
|
const timer = row.find('[data-incrementing]')[0];
|
||||||
|
|
||||||
|
if (timer) {
|
||||||
|
setInterval(() => {
|
||||||
|
const dateStart = new moment(data.date_assign, moment.ISO_8601);
|
||||||
|
const dateEnd = moment();
|
||||||
|
|
||||||
|
timer.innerHTML = timeDiff(dateStart, dateEnd);
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
|
@ -151,6 +164,42 @@
|
||||||
field: 'processor',
|
field: 'processor',
|
||||||
title: 'Dispatcher'
|
title: 'Dispatcher'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: '',
|
||||||
|
title: 'Dispatch Time',
|
||||||
|
sortable: false,
|
||||||
|
searchable: false,
|
||||||
|
textAlign: 'right',
|
||||||
|
template: function (row, index, datatable) {
|
||||||
|
let dateAssign;
|
||||||
|
let dateEnd;
|
||||||
|
let incrementing = false;
|
||||||
|
|
||||||
|
// only display timer for these statuses
|
||||||
|
const statusesWithTimer = [
|
||||||
|
'Assigned',
|
||||||
|
'In Transit',
|
||||||
|
'In Progress',
|
||||||
|
'Completed', // NOTE: completed would be based off the fulfillment time
|
||||||
|
];
|
||||||
|
|
||||||
|
if (row.date_assign && statusesWithTimer.includes(row.status)) {
|
||||||
|
dateAssign = new moment(row.date_assign, moment.ISO_8601);
|
||||||
|
|
||||||
|
// on completed jos, use date_fulfill as end date and do not increment
|
||||||
|
if (row.status == 'Completed') {
|
||||||
|
if (row.date_fulfill) {
|
||||||
|
dateEnd = new moment(row.date_fulfill, moment.ISO_8601);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dateEnd = moment();
|
||||||
|
incrementing = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dateEnd ? '<span class="m-badge m-badge--wide m--font-boldest ' + (incrementing ? 'm-badge--warning" data-incrementing="1"' : 'm-badge--success"') + '>' + timeDiff(dateAssign, dateEnd) + '</span>' : '-';
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'Actions',
|
field: 'Actions',
|
||||||
width: 110,
|
width: 110,
|
||||||
|
|
@ -163,13 +212,13 @@
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
search: {
|
search: {
|
||||||
onEnter: false,
|
onEnter: false,
|
||||||
input: $('#data-rows-search'),
|
input: $('#data-rows-search'),
|
||||||
delay: 400
|
delay: 400
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var table = $("#data-rows").mDatatable(options);
|
var table = $("#data-rows").mDatatable(options);
|
||||||
|
|
@ -201,5 +250,16 @@
|
||||||
table.search(date_array, "schedule_date");
|
table.search(date_array, "schedule_date");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// get difference in hh:mm:ss format
|
||||||
|
const timeDiff = (startDate, endDate) => {
|
||||||
|
const seconds = Math.abs(startDate.diff(endDate, 'seconds'));
|
||||||
|
|
||||||
|
const hh = Math.floor(seconds / 3600).toString().padStart(2, "0");
|
||||||
|
const mm = Math.floor((seconds % 3600) / 60).toString().padStart(2, "0");
|
||||||
|
const ss = (seconds % 60).toString().padStart(2, "0");
|
||||||
|
|
||||||
|
return [hh, mm, ss].join(':');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue