54 lines
1.9 KiB
JavaScript
54 lines
1.9 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;
|
|
if(order.length > 0){
|
|
$('.order_reserve_cable tbody').html("");
|
|
$.each(order, function(key,value){
|
|
var rowCount = key+1;
|
|
var date = new Date(value.created_at);
|
|
var deliveries = value["delivery"];
|
|
var isPM = date.getHours() >= 12;
|
|
var isMidday = date.getHours() == 12;
|
|
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
|
|
date.getMinutes() || '00'].join(':') +
|
|
(isPM ? ' PM' : 'AM');
|
|
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ date.getDate();
|
|
|
|
var delivery_type = "";
|
|
if(deliveries.delivery_type == "service"){
|
|
delivery_type = "DELIVERY";
|
|
}else if(deliveries.delivery_type == "pick_up"){
|
|
delivery_type = "PICK-UP";
|
|
}else{
|
|
delivery_type = "DIRECT DELIVERY";
|
|
}
|
|
|
|
row = '<tr class="custom-tr first-'+rowCount+'" style="" data-id="'+value.order_reservation_id+'" data-sr-no="'+rowCount+'">'
|
|
+'<td width ="5%" class="align-left">'+rowCount
|
|
+'</td>'
|
|
+'<td width ="20%" class="align-center">'+created_at
|
|
+'</td>'
|
|
+'<td width ="20%" class="align-center">'+time
|
|
+'</td>'
|
|
+'<td width ="20%" class="align-center">'+value.grand_total
|
|
+'</td>'
|
|
+'<td width ="30%" class="align-center">'
|
|
+'<span class="font-10 col-blue">'+ delivery_type +'</span>'
|
|
+'</td>'
|
|
+' </tr>'
|
|
|
|
$('.order_reserve_cable tbody').append(row);
|
|
});
|
|
}
|
|
|
|
|
|
}
|
|
});
|
|
|