diff --git a/app/assets/javascripts/channels/check_new_order.js b/app/assets/javascripts/channels/check_new_order.js
index 28562ac8..a6317af6 100644
--- a/app/assets/javascripts/channels/check_new_order.js
+++ b/app/assets/javascripts/channels/check_new_order.js
@@ -5,6 +5,7 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
received: function(data) {
var order = data.data;
+ var shop_code = data.shop_code;
if(order.length > 0){
var order_lists = "";
$.each(order, function(key, value){
@@ -18,33 +19,33 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
});
// alert(order_lists);
- // swal({
- // title: 'Information',
- // target: document.getElementById("notify_new_order"),
- // text: "You have new orders
"+
- // "Are you accept or reject for these orders "+order_lists+"?",
- // type: 'success',
- // html: true,
- // closeOnConfirm: false,
- // closeOnCancel: false,
- // allowOutsideClick: false
- // }, function (isConfirm) {
- // if(isConfirm){
- // swal.close();
- // }
- // });
- $("#notify_new_order_lists").text(order_lists);
+ swal({
+ title: 'Information',
+ target: document.getElementById(shop_code+"_notify_new_order"),
+ text: "You have new orders
"+
+ "Are you accept or reject for these orders "+order_lists+"?",
+ type: 'success',
+ html: true,
+ closeOnConfirm: false,
+ closeOnCancel: false,
+ allowOutsideClick: false
+ }, function (isConfirm) {
+ if(isConfirm){
+ swal.close();
+ }
+ });
+ // $("#notify_new_order_lists").text(order_lists);
// 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_order_send_to_kitchen").addClass("hidden");
- $("#notify_order_ready_to_delivery").addClass("hidden");
- }).on('shown.bs.modal', function(e){
- $("#notify_new_order").focus();
- }).on('hide.bs.modal', function (e) {
- $("#notify_new_order").addClass("hidden");
- }).modal({show: true, keyboard: false, backdrop: false});
+ // $("#notify_new_order").on('show.bs.modal', function(e){
+ // $("#notify_order_send_to_kitchen").addClass("hidden");
+ // $("#notify_order_ready_to_delivery").addClass("hidden");
+ // }).on('shown.bs.modal', function(e){
+ // $("#notify_new_order").focus();
+ // }).on('hide.bs.modal', function (e) {
+ // $("#notify_new_order").addClass("hidden");
+ // }).modal({show: true, keyboard: false, backdrop: false});
}
}
});
diff --git a/app/assets/javascripts/channels/check_order_ready_to_delivery.js b/app/assets/javascripts/channels/check_order_ready_to_delivery.js
index 181008f6..319f7781 100644
--- a/app/assets/javascripts/channels/check_order_ready_to_delivery.js
+++ b/app/assets/javascripts/channels/check_order_ready_to_delivery.js
@@ -5,6 +5,7 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
received: function(data) {
var order = data.data;
+ var shop_code = data.shop_code;
if(order.length > 0){
var order_lists = "";
$.each(order, function(key, value){
@@ -18,33 +19,33 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
});
// alert(order_lists);
- // swal({
- // title: 'Information',
- // target: document.getElementById("notify_order_ready_to_delivery"),
- // text: "You have orders that are ready to deliver
"+
- // "Could you ready these orders "+order_lists+" to deliver?",
- // type: 'success',
- // html: true,
- // closeOnConfirm: false,
- // closeOnCancel: false,
- // allowOutsideClick: false
- // }, function (isConfirm) {
- // if(isConfirm){
- // swal.close();
- // }
- // });
- $("#notify_order_ready_to_delivery_lists").text(order_lists);
+ swal({
+ title: 'Information',
+ target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"),
+ text: "You have orders that are ready to deliver
"+
+ "Could you ready these orders "+order_lists+" to deliver?",
+ type: 'success',
+ html: true,
+ closeOnConfirm: false,
+ closeOnCancel: false,
+ allowOutsideClick: false
+ }, function (isConfirm) {
+ if(isConfirm){
+ swal.close();
+ }
+ });
+ // $("#notify_order_ready_to_delivery_lists").text(order_lists);
// 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_new_order").addClass("hidden");
- $("#notify_order_send_to_kitchen").addClass("hidden");
- }).on('shown.bs.modal', function(e){
- $("#notify_order_ready_to_delivery").focus();
- }).on('hide.bs.modal', function (e) {
- $("#notify_order_ready_to_delivery").addClass("hidden");
- }).modal({show: true, keyboard: false, backdrop: false});
+ // $("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
+ // $("#notify_new_order").addClass("hidden");
+ // $("#notify_order_send_to_kitchen").addClass("hidden");
+ // }).on('shown.bs.modal', function(e){
+ // $("#notify_order_ready_to_delivery").focus();
+ // }).on('hide.bs.modal', function (e) {
+ // $("#notify_order_ready_to_delivery").addClass("hidden");
+ // }).modal({show: true, keyboard: false, backdrop: false});
}
}
});
diff --git a/app/assets/javascripts/channels/check_order_send_to_kitchen.js b/app/assets/javascripts/channels/check_order_send_to_kitchen.js
index c2692f23..df9eb324 100644
--- a/app/assets/javascripts/channels/check_order_send_to_kitchen.js
+++ b/app/assets/javascripts/channels/check_order_send_to_kitchen.js
@@ -5,6 +5,7 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
received: function(data) {
var order = data.data;
+ var shop_code = data.shop_code;
if(order.length > 0){
var order_lists = "";
$.each(order, function(key, value){
@@ -18,33 +19,33 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
});
// alert(order_lists);
- // swal({
- // title: 'Information',
- // target: document.getElementById("notify_order_send_to_kitchen"),
- // text: "You have to send order to kitchen
"+
- // "Could you send these orders "+order_lists+" to kitchen?",
- // type: 'success',
- // html: true,
- // closeOnConfirm: false,
- // closeOnCancel: false,
- // allowOutsideClick: false
- // }, function (isConfirm) {
- // if(isConfirm){
- // swal.close();
- // }
- // });
- $("#notify_order_send_to_kitchen_lists").text(order_lists);
+ swal({
+ title: 'Information',
+ target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"),
+ text: "You have to send order to kitchen
"+
+ "Could you send these orders "+order_lists+" to kitchen?",
+ type: 'success',
+ html: true,
+ closeOnConfirm: false,
+ closeOnCancel: false,
+ allowOutsideClick: false
+ }, function (isConfirm) {
+ if(isConfirm){
+ swal.close();
+ }
+ });
+ // $("#notify_order_send_to_kitchen_lists").text(order_lists);
// 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_new_order").addClass("hidden");
- $("#notify_order_ready_to_delivery").addClass("hidden");
- }).on('shown.bs.modal', function(e){
- $("#notify_order_send_to_kitchen").focus();
- }).on('hide.bs.modal', function (e) {
- $("#notify_order_send_to_kitchen").addClass("hidden");
- }).modal({show: true, keyboard: false, backdrop: false});
+ // $("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
+ // $("#notify_new_order").addClass("hidden");
+ // $("#notify_order_ready_to_delivery").addClass("hidden");
+ // }).on('shown.bs.modal', function(e){
+ // $("#notify_order_send_to_kitchen").focus();
+ // }).on('hide.bs.modal', function (e) {
+ // $("#notify_order_send_to_kitchen").addClass("hidden");
+ // }).modal({show: true, keyboard: false, backdrop: false});
}
}
});
diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js
index a24c90ff..081aef7e 100644
--- a/app/assets/javascripts/order_reservation.js
+++ b/app/assets/javascripts/order_reservation.js
@@ -164,18 +164,18 @@ $(function() {
// $("#"+code+"_doemal_new_order").modal("hide");
// });
- $("[data-dismiss='modal']").on('click', function() {
- $('body').addClass('modal-open-fix');
- if($('body').css("padding-right") == '15px') {
- $('body').addClass('modal-open-fix-pad');
- }
- setTimeout(function() {
- if($('body').hasClass('modal-open-fix-pad')) {
- $('body').css('padding-right', '15px');
- }
- $('body').addClass('modal-open').removeClass('modal-open-fix, modal-open-fix-pad');
- }, 1000);
- });
+ // $("[data-dismiss='modal']").on('click', function() {
+ // $('body').addClass('modal-open-fix');
+ // if($('body').css("padding-right") == '15px') {
+ // $('body').addClass('modal-open-fix-pad');
+ // }
+ // setTimeout(function() {
+ // if($('body').hasClass('modal-open-fix-pad')) {
+ // $('body').css('padding-right', '15px');
+ // }
+ // $('body').addClass('modal-open').removeClass('modal-open-fix, modal-open-fix-pad');
+ // }, 1000);
+ // });
});
function warnBeforeRedirect(linkURL) {
@@ -473,20 +473,36 @@ function showNewOrder(order_reservation,shop_code){
audio.play();
// },10000);
- $("#new_order").text(order_reservation.order_reservation_id);
- $("#new_order_date").text(requested_date);
- if($("#"+shop_code+"_doemal_new_order").hasClass("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});
+ // $("#new_order").text(order_reservation.order_reservation_id);
+ // $("#new_order_date").text(requested_date);
+ // if($("#"+shop_code+"_doemal_new_order").hasClass("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 "+
+ ""+order_reservation.order_reservation_id+" requested for "+requested_date+"?",
+ type: 'success',
+ html: true,
+ closeOnConfirm: false,
+ closeOnCancel: false,
+ allowOutsideClick: false
+ }, function (isConfirm) {
+ if(isConfirm){
+ audio.pause();
+ swal.close();
+ }
+ });
}
}
diff --git a/app/controllers/concerns/token_verification.rb b/app/controllers/concerns/token_verification.rb
index 50f485f3..4e972bd9 100755
--- a/app/controllers/concerns/token_verification.rb
+++ b/app/controllers/concerns/token_verification.rb
@@ -18,7 +18,7 @@ module TokenVerification
# Rails.logger.debug "token - " + token.to_s
if(options.length !=0 && options["from"] == "DOEMAL")
if(ENV["SERVER_MODE"] === "cloud")
- from = request.subdomain.downcase + "." + request.domain.downcase #"local"
+ from = request.subdomain.downcase + "." + request.domain.downcase #"local"
aes = MyAesCrypt.new
return aes.checkKeyForAuth(from, token)
end
diff --git a/app/models/my_aes_crypt.rb b/app/models/my_aes_crypt.rb
index 2b414214..4116f2a2 100644
--- a/app/models/my_aes_crypt.rb
+++ b/app/models/my_aes_crypt.rb
@@ -65,7 +65,6 @@ class MyAesCrypt
if j["lookup"] == from
# add [0...44] for production cloud for remove \n
if(j["value"]["key"].gsub(/\s+/, "") == token)
- puts token
return true
end
end
diff --git a/app/models/order_reservation.rb b/app/models/order_reservation.rb
index 404d56e4..84209845 100644
--- a/app/models/order_reservation.rb
+++ b/app/models/order_reservation.rb
@@ -178,10 +178,9 @@ class OrderReservation < ApplicationRecord
end
Rails.logger.debug "Doemal URL" + base_url
post_url = base_url + url
-
- if !waiting_time.nil? && !min_type.nil? && reason.nil?
+ if waiting_time != ""
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}
else
send_params = {id: ref_no, status: status}
@@ -290,28 +289,46 @@ class OrderReservation < ApplicationRecord
end
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'")
if order_reservation.length > 0
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
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}'")
if order_reservation.length > 0
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
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}'")
if order_reservation.length > 0
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
diff --git a/app/views/origami/order_reservation/index.html.erb b/app/views/origami/order_reservation/index.html.erb
index d410d838..d2903041 100644
--- a/app/views/origami/order_reservation/index.html.erb
+++ b/app/views/origami/order_reservation/index.html.erb
@@ -464,9 +464,10 @@
-
+