39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
|
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
|
|
|
|
connected: function() {},
|
|
|
|
disconnected: function() {},
|
|
|
|
received: function(data) {
|
|
var order = data.data;
|
|
var rowCount = $('.order_reserve_cable tbody tr').length+1;
|
|
|
|
var date = new Date(order.requested_time);
|
|
var requested_time = date.getHours()+ ':' + date.getMinutes()+ '-' + date.getMinutes();
|
|
|
|
var isPM = date.getHours() >= 12;
|
|
var isMidday = date.getHours() == 12;
|
|
var result = document.querySelector('#result');
|
|
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
|
|
date.getMinutes() || '00'].join(':') +
|
|
(isPM ? ' PM' : 'AM');
|
|
|
|
row = '<tr class="custom-tr first-'+rowCount+'" style="" data-id="'+order.order_reservation_id+'" data-sr-no="'+rowCount+'">'
|
|
+'<td width ="5%" class="align-left">'+rowCount
|
|
+'</td>'
|
|
+'<td width ="30%" class="align-center">'+time
|
|
+'</td>'
|
|
+'<td width ="30%" class="align-center">'+order.grand_total
|
|
+'</td>'
|
|
+'<td width ="30%" class="align-center">'
|
|
+'<span class="font-10 col-blue">'+ order.status +'</span>'
|
|
+'</td>'
|
|
+' </tr>'
|
|
|
|
$('.order_reserve_cable tbody').append(row);
|
|
|
|
}
|
|
});
|
|
|