update action cable for order resservation
This commit is contained in:
38
app/assets/javascripts/channels/order_reservation.js
Normal file
38
app/assets/javascripts/channels/order_reservation.js
Normal file
@@ -0,0 +1,38 @@
|
||||
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);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -62,7 +62,6 @@ $(function() {
|
||||
// console.log(data);
|
||||
var delivery = data["delivery"];
|
||||
var items = data["order_items"];
|
||||
console.log(data)
|
||||
var item_list = $('.summary-items');
|
||||
item_list.empty();
|
||||
|
||||
@@ -158,7 +157,6 @@ console.log(data)
|
||||
data: {'order_id': order_id, 'status': status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
if (data.status) {
|
||||
swal({
|
||||
title: 'Information',
|
||||
|
||||
Reference in New Issue
Block a user