remove comment data
This commit is contained in:
40
app/assets/javascripts/channels/check_new_order.js
Normal file
40
app/assets/javascripts/channels/check_new_order.js
Normal file
@@ -0,0 +1,40 @@
|
||||
App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
if(order.length > 0){
|
||||
var order_lists = "";
|
||||
$.each(order, function(key, value){
|
||||
if(key==0){
|
||||
order_lists = value.order_reservation_id;
|
||||
}else if(key == (order.length - 1)){
|
||||
order_lists += ' and ' + value.order_reservation_id;
|
||||
}else{
|
||||
order_lists += ', ' + value.order_reservation_id;
|
||||
}
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
target: document.getElementById('notify_new_order'),
|
||||
text: "You have new orders. <br/>"+
|
||||
"Are you accept or reject for these orders <b>"+order_lists+"</b>?",
|
||||
type: 'success',
|
||||
timer: 1000,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderReadyToDeliveryChannel', {
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
if(order.length > 0){
|
||||
var order_lists = "";
|
||||
$.each(order, function(key, value){
|
||||
if(key==0){
|
||||
order_lists = value.order_reservation_id;
|
||||
}else if(key == (order.length - 1)){
|
||||
order_lists += ' and ' + value.order_reservation_id;
|
||||
}else{
|
||||
order_lists += ', ' + value.order_reservation_id;
|
||||
}
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
target: document.getElementById('notify_order_ready_to_delivery'),
|
||||
text: "You have orders that are ready to deliver. <br/>"+
|
||||
"Could you ready these orders <b>"+order_lists+"</b> to deliver?",
|
||||
type: 'success',
|
||||
timer: 1000,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSendToKitchenChannel', {
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
if(order.length > 0){
|
||||
var order_lists = "";
|
||||
$.each(order, function(key, value){
|
||||
if(key==0){
|
||||
order_lists = value.order_reservation_id;
|
||||
}else if(key == (order.length - 1)){
|
||||
order_lists += ' and ' + value.order_reservation_id;
|
||||
}else{
|
||||
order_lists += ', ' + value.order_reservation_id;
|
||||
}
|
||||
});
|
||||
|
||||
// alert(order_lists);
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
target: document.getElementById('notify_order_send_to_kitchen'),
|
||||
text: "You have to send order to kitchen. <br/>"+
|
||||
"Could you send these orders <b>"+order_lists+"</b> to kitchen?",
|
||||
type: 'success',
|
||||
timer: 1000,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
||||
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
|
||||
|
||||
App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel', {
|
||||
connected: function() {},
|
||||
|
||||
disconnected: function() {},
|
||||
@@ -9,27 +7,28 @@ App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
||||
var order = data.data;
|
||||
if(order.length > 0){
|
||||
$('.order_reserve_cable tbody').html("");
|
||||
$(".nav-item.red > a > p.num").text(order.length);
|
||||
$.each(order, function(key,value){
|
||||
var active_class = "";
|
||||
if(key==0){
|
||||
active_class = "tr-active";
|
||||
showNewOrder(order[key]);
|
||||
}
|
||||
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 time = timeFormat(date);
|
||||
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate()>10?date.getDate() : '0'+date.getDate());
|
||||
|
||||
var delivery_type = "";
|
||||
if(deliveries.delivery_type == "service"){
|
||||
if(value.delivery_type == "service"){
|
||||
delivery_type = "DELIVERY";
|
||||
}else if(deliveries.delivery_type == "pick_up"){
|
||||
}else if(value.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+'">'
|
||||
row = '<tr class="custom-tr first-'+rowCount+' '+active_class+'" 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
|
||||
@@ -41,13 +40,13 @@ App.checkin = App.cable.subscriptions.create('OrderReservationChannel', {
|
||||
+'<td width ="30%" class="align-center">'
|
||||
+'<span class="font-10 col-blue">'+ delivery_type +'</span>'
|
||||
+'</td>'
|
||||
+' </tr>'
|
||||
+' </tr>';
|
||||
|
||||
$('.order_reserve_cable tbody').append(row);
|
||||
$('.custom-table.order_reserve_cable tbody').append(row);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
customTableClick();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user