check api issue
This commit is contained in:
@@ -5,6 +5,7 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
|||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
var order = data.data;
|
var order = data.data;
|
||||||
|
var shop_code = data.shop_code;
|
||||||
if(order.length > 0){
|
if(order.length > 0){
|
||||||
var order_lists = "";
|
var order_lists = "";
|
||||||
$.each(order, function(key, value){
|
$.each(order, function(key, value){
|
||||||
@@ -18,33 +19,33 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// alert(order_lists);
|
// alert(order_lists);
|
||||||
// swal({
|
swal({
|
||||||
// title: 'Information',
|
title: 'Information',
|
||||||
// target: document.getElementById("notify_new_order"),
|
target: document.getElementById(shop_code+"_notify_new_order"),
|
||||||
// text: "You have new orders <br/>"+
|
text: "You have new orders <br/>"+
|
||||||
// "Are you accept or reject for these orders <b>"+order_lists+"</b>?",
|
"Are you accept or reject for these orders <b>"+order_lists+"</b>?",
|
||||||
// type: 'success',
|
type: 'success',
|
||||||
// html: true,
|
html: true,
|
||||||
// closeOnConfirm: false,
|
closeOnConfirm: false,
|
||||||
// closeOnCancel: false,
|
closeOnCancel: false,
|
||||||
// allowOutsideClick: false
|
allowOutsideClick: false
|
||||||
// }, function (isConfirm) {
|
}, function (isConfirm) {
|
||||||
// if(isConfirm){
|
if(isConfirm){
|
||||||
// swal.close();
|
swal.close();
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
$("#notify_new_order_lists").text(order_lists);
|
// $("#notify_new_order_lists").text(order_lists);
|
||||||
// if($("#notify_new_order").hasClass("hidden")){
|
// if($("#notify_new_order").hasClass("hidden")){
|
||||||
$("#notify_new_order").removeClass("hidden");
|
// $("#notify_new_order").removeClass("hidden");
|
||||||
// }
|
// }
|
||||||
$("#notify_new_order").on('show.bs.modal', function(e){
|
// $("#notify_new_order").on('show.bs.modal', function(e){
|
||||||
$("#notify_order_send_to_kitchen").addClass("hidden");
|
// $("#notify_order_send_to_kitchen").addClass("hidden");
|
||||||
$("#notify_order_ready_to_delivery").addClass("hidden");
|
// $("#notify_order_ready_to_delivery").addClass("hidden");
|
||||||
}).on('shown.bs.modal', function(e){
|
// }).on('shown.bs.modal', function(e){
|
||||||
$("#notify_new_order").focus();
|
// $("#notify_new_order").focus();
|
||||||
}).on('hide.bs.modal', function (e) {
|
// }).on('hide.bs.modal', function (e) {
|
||||||
$("#notify_new_order").addClass("hidden");
|
// $("#notify_new_order").addClass("hidden");
|
||||||
}).modal({show: true, keyboard: false, backdrop: false});
|
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
|
|||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
var order = data.data;
|
var order = data.data;
|
||||||
|
var shop_code = data.shop_code;
|
||||||
if(order.length > 0){
|
if(order.length > 0){
|
||||||
var order_lists = "";
|
var order_lists = "";
|
||||||
$.each(order, function(key, value){
|
$.each(order, function(key, value){
|
||||||
@@ -18,33 +19,33 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
|
|||||||
});
|
});
|
||||||
|
|
||||||
// alert(order_lists);
|
// alert(order_lists);
|
||||||
// swal({
|
swal({
|
||||||
// title: 'Information',
|
title: 'Information',
|
||||||
// target: document.getElementById("notify_order_ready_to_delivery"),
|
target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"),
|
||||||
// text: "You have orders that are ready to deliver <br/>"+
|
text: "You have orders that are ready to deliver <br/>"+
|
||||||
// "Could you ready these orders <b>"+order_lists+"</b> to deliver?",
|
"Could you ready these orders <b>"+order_lists+"</b> to deliver?",
|
||||||
// type: 'success',
|
type: 'success',
|
||||||
// html: true,
|
html: true,
|
||||||
// closeOnConfirm: false,
|
closeOnConfirm: false,
|
||||||
// closeOnCancel: false,
|
closeOnCancel: false,
|
||||||
// allowOutsideClick: false
|
allowOutsideClick: false
|
||||||
// }, function (isConfirm) {
|
}, function (isConfirm) {
|
||||||
// if(isConfirm){
|
if(isConfirm){
|
||||||
// swal.close();
|
swal.close();
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
$("#notify_order_ready_to_delivery_lists").text(order_lists);
|
// $("#notify_order_ready_to_delivery_lists").text(order_lists);
|
||||||
// if($("#notify_order_ready_to_delivery").hasClass("hidden")){
|
// if($("#notify_order_ready_to_delivery").hasClass("hidden")){
|
||||||
$("#notify_order_ready_to_delivery").removeClass("hidden");
|
// $("#notify_order_ready_to_delivery").removeClass("hidden");
|
||||||
// }
|
// }
|
||||||
$("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
|
// $("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
|
||||||
$("#notify_new_order").addClass("hidden");
|
// $("#notify_new_order").addClass("hidden");
|
||||||
$("#notify_order_send_to_kitchen").addClass("hidden");
|
// $("#notify_order_send_to_kitchen").addClass("hidden");
|
||||||
}).on('shown.bs.modal', function(e){
|
// }).on('shown.bs.modal', function(e){
|
||||||
$("#notify_order_ready_to_delivery").focus();
|
// $("#notify_order_ready_to_delivery").focus();
|
||||||
}).on('hide.bs.modal', function (e) {
|
// }).on('hide.bs.modal', function (e) {
|
||||||
$("#notify_order_ready_to_delivery").addClass("hidden");
|
// $("#notify_order_ready_to_delivery").addClass("hidden");
|
||||||
}).modal({show: true, keyboard: false, backdrop: false});
|
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
|
|||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
var order = data.data;
|
var order = data.data;
|
||||||
|
var shop_code = data.shop_code;
|
||||||
if(order.length > 0){
|
if(order.length > 0){
|
||||||
var order_lists = "";
|
var order_lists = "";
|
||||||
$.each(order, function(key, value){
|
$.each(order, function(key, value){
|
||||||
@@ -18,33 +19,33 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
|
|||||||
});
|
});
|
||||||
|
|
||||||
// alert(order_lists);
|
// alert(order_lists);
|
||||||
// swal({
|
swal({
|
||||||
// title: 'Information',
|
title: 'Information',
|
||||||
// target: document.getElementById("notify_order_send_to_kitchen"),
|
target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"),
|
||||||
// text: "You have to send order to kitchen <br/>"+
|
text: "You have to send order to kitchen <br/>"+
|
||||||
// "Could you send these orders <b>"+order_lists+"</b> to kitchen?",
|
"Could you send these orders <b>"+order_lists+"</b> to kitchen?",
|
||||||
// type: 'success',
|
type: 'success',
|
||||||
// html: true,
|
html: true,
|
||||||
// closeOnConfirm: false,
|
closeOnConfirm: false,
|
||||||
// closeOnCancel: false,
|
closeOnCancel: false,
|
||||||
// allowOutsideClick: false
|
allowOutsideClick: false
|
||||||
// }, function (isConfirm) {
|
}, function (isConfirm) {
|
||||||
// if(isConfirm){
|
if(isConfirm){
|
||||||
// swal.close();
|
swal.close();
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
$("#notify_order_send_to_kitchen_lists").text(order_lists);
|
// $("#notify_order_send_to_kitchen_lists").text(order_lists);
|
||||||
// if($("#notify_order_send_to_kitchen").hasClass("hidden")){
|
// if($("#notify_order_send_to_kitchen").hasClass("hidden")){
|
||||||
$("#notify_order_send_to_kitchen").removeClass("hidden");
|
// $("#notify_order_send_to_kitchen").removeClass("hidden");
|
||||||
// }
|
// }
|
||||||
$("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
|
// $("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
|
||||||
$("#notify_new_order").addClass("hidden");
|
// $("#notify_new_order").addClass("hidden");
|
||||||
$("#notify_order_ready_to_delivery").addClass("hidden");
|
// $("#notify_order_ready_to_delivery").addClass("hidden");
|
||||||
}).on('shown.bs.modal', function(e){
|
// }).on('shown.bs.modal', function(e){
|
||||||
$("#notify_order_send_to_kitchen").focus();
|
// $("#notify_order_send_to_kitchen").focus();
|
||||||
}).on('hide.bs.modal', function (e) {
|
// }).on('hide.bs.modal', function (e) {
|
||||||
$("#notify_order_send_to_kitchen").addClass("hidden");
|
// $("#notify_order_send_to_kitchen").addClass("hidden");
|
||||||
}).modal({show: true, keyboard: false, backdrop: false});
|
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -164,18 +164,18 @@ $(function() {
|
|||||||
// $("#"+code+"_doemal_new_order").modal("hide");
|
// $("#"+code+"_doemal_new_order").modal("hide");
|
||||||
// });
|
// });
|
||||||
|
|
||||||
$("[data-dismiss='modal']").on('click', function() {
|
// $("[data-dismiss='modal']").on('click', function() {
|
||||||
$('body').addClass('modal-open-fix');
|
// $('body').addClass('modal-open-fix');
|
||||||
if($('body').css("padding-right") == '15px') {
|
// if($('body').css("padding-right") == '15px') {
|
||||||
$('body').addClass('modal-open-fix-pad');
|
// $('body').addClass('modal-open-fix-pad');
|
||||||
}
|
// }
|
||||||
setTimeout(function() {
|
// setTimeout(function() {
|
||||||
if($('body').hasClass('modal-open-fix-pad')) {
|
// if($('body').hasClass('modal-open-fix-pad')) {
|
||||||
$('body').css('padding-right', '15px');
|
// $('body').css('padding-right', '15px');
|
||||||
}
|
// }
|
||||||
$('body').addClass('modal-open').removeClass('modal-open-fix, modal-open-fix-pad');
|
// $('body').addClass('modal-open').removeClass('modal-open-fix, modal-open-fix-pad');
|
||||||
}, 1000);
|
// }, 1000);
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
function warnBeforeRedirect(linkURL) {
|
function warnBeforeRedirect(linkURL) {
|
||||||
@@ -473,20 +473,36 @@ function showNewOrder(order_reservation,shop_code){
|
|||||||
audio.play();
|
audio.play();
|
||||||
// },10000);
|
// },10000);
|
||||||
|
|
||||||
$("#new_order").text(order_reservation.order_reservation_id);
|
// $("#new_order").text(order_reservation.order_reservation_id);
|
||||||
$("#new_order_date").text(requested_date);
|
// $("#new_order_date").text(requested_date);
|
||||||
if($("#"+shop_code+"_doemal_new_order").hasClass("hidden")){
|
// if($("#"+shop_code+"_doemal_new_order").hasClass("hidden")){
|
||||||
$("#"+shop_code+"_doemal_new_order").removeClass("hidden");
|
// $("#"+shop_code+"_doemal_new_order").removeClass("hidden");
|
||||||
|
// }
|
||||||
|
// $("#"+shop_code+"_doemal_new_order").on('show.bs.modal', function(e){
|
||||||
|
// $("#notify_new_order").addClass("hidden");
|
||||||
|
// $("#notify_order_send_to_kitchen").addClass("hidden");
|
||||||
|
// $("#notify_order_ready_to_delivery").addClass("hidden");
|
||||||
|
// }).on('shown.bs.modal', function(e){
|
||||||
|
// $("#"+shop_code+"_doemal_new_order").focus();
|
||||||
|
// }).on('hide.bs.modal', function (e) {
|
||||||
|
// $("#"+shop_code+"_doemal_new_order").addClass("hidden");
|
||||||
|
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||||
|
swal({
|
||||||
|
title: 'Information',
|
||||||
|
target: document.getElementById(shop_code+"_notify_new_order"),
|
||||||
|
text: "You have new order "+
|
||||||
|
"<b>"+order_reservation.order_reservation_id+"</b> requested for "+requested_date+"?",
|
||||||
|
type: 'success',
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if(isConfirm){
|
||||||
|
audio.pause();
|
||||||
|
swal.close();
|
||||||
}
|
}
|
||||||
$("#"+shop_code+"_doemal_new_order").on('show.bs.modal', function(e){
|
});
|
||||||
$("#notify_new_order").addClass("hidden");
|
|
||||||
$("#notify_order_send_to_kitchen").addClass("hidden");
|
|
||||||
$("#notify_order_ready_to_delivery").addClass("hidden");
|
|
||||||
}).on('shown.bs.modal', function(e){
|
|
||||||
$("#"+shop_code+"_doemal_new_order").focus();
|
|
||||||
}).on('hide.bs.modal', function (e) {
|
|
||||||
$("#"+shop_code+"_doemal_new_order").addClass("hidden");
|
|
||||||
}).modal({show: true, keyboard: false, backdrop: false});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ class MyAesCrypt
|
|||||||
if j["lookup"] == from
|
if j["lookup"] == from
|
||||||
# add [0...44] for production cloud for remove \n
|
# add [0...44] for production cloud for remove \n
|
||||||
if(j["value"]["key"].gsub(/\s+/, "") == token)
|
if(j["value"]["key"].gsub(/\s+/, "") == token)
|
||||||
puts token
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -178,10 +178,9 @@ class OrderReservation < ApplicationRecord
|
|||||||
end
|
end
|
||||||
Rails.logger.debug "Doemal URL" + base_url
|
Rails.logger.debug "Doemal URL" + base_url
|
||||||
post_url = base_url + url
|
post_url = base_url + url
|
||||||
|
if waiting_time != ""
|
||||||
if !waiting_time.nil? && !min_type.nil? && reason.nil?
|
|
||||||
send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
|
send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
|
||||||
elsif !reason.nil?
|
elsif reason != ""
|
||||||
send_params = {id: ref_no, status: status, reason: reason}
|
send_params = {id: ref_no, status: status, reason: reason}
|
||||||
else
|
else
|
||||||
send_params = {id: ref_no, status: status}
|
send_params = {id: ref_no, status: status}
|
||||||
@@ -290,28 +289,46 @@ class OrderReservation < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.check_new_order
|
def self.check_new_order
|
||||||
|
shop = Shop.find_by_id(1)
|
||||||
|
if !shop.shop_code.nil?
|
||||||
|
shop_code = shop.shop_code
|
||||||
|
else
|
||||||
|
shop_code = ''
|
||||||
|
end
|
||||||
order_reservation = OrderReservation.where("status='new'")
|
order_reservation = OrderReservation.where("status='new'")
|
||||||
if order_reservation.length > 0
|
if order_reservation.length > 0
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation
|
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.check_order_send_to_kitchen
|
def self.check_order_send_to_kitchen
|
||||||
|
shop = Shop.find_by_id(1)
|
||||||
|
if !shop.shop_code.nil?
|
||||||
|
shop_code = shop.shop_code
|
||||||
|
else
|
||||||
|
shop_code = ''
|
||||||
|
end
|
||||||
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.now.utc}'")
|
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.now.utc}'")
|
||||||
if order_reservation.length > 0
|
if order_reservation.length > 0
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation
|
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.check_order_ready_to_delivery
|
def self.check_order_ready_to_delivery
|
||||||
|
shop = Shop.find_by_id(1)
|
||||||
|
if !shop.shop_code.nil?
|
||||||
|
shop_code = shop.shop_code
|
||||||
|
else
|
||||||
|
shop_code = ''
|
||||||
|
end
|
||||||
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.now.utc}'")
|
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.now.utc}'")
|
||||||
if order_reservation.length > 0
|
if order_reservation.length > 0
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation
|
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -464,9 +464,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div id="notify_new_order"></div>
|
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order"></div>
|
||||||
<div id="notify_order_send_to_kitchen"></div>
|
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_new_order"></div>
|
||||||
<div id="notify_order_ready_to_delivery"></div> -->
|
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_send_to_kitchen"></div>
|
||||||
|
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p id="ref_no" class="hidden"></p>
|
<p id="ref_no" class="hidden"></p>
|
||||||
@@ -583,7 +584,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal fade text-center" id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order" tabindex="-1" role="dialog">
|
<!-- <div class="modal fade text-center" id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order" tabindex="-1" role="dialog">
|
||||||
<div class="modal-dialog modal-md" role="document">
|
<div class="modal-dialog modal-md" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@@ -670,4 +671,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
|
|||||||
Reference in New Issue
Block a user