diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index d7c93cd2..d2faf9da 100755
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -199,12 +199,3 @@ function export_to(path)
var form_params = $("#frm_report").serialize();
window.location = path+"?"+ form_params;
}
-
-function audioPlayBackground(shop_code){
- //audio play
- var audio = new Audio('/'+shop_code+'-beep.mp3'); // define your audio
- // setTimeout(function(){
- // audio.loop = true;
- audio.play();
- // },10000);
-}
diff --git a/app/assets/javascripts/channels/check_new_order.js b/app/assets/javascripts/channels/check_new_order.js
index 4aa0f1b0..ced5b3c2 100644
--- a/app/assets/javascripts/channels/check_new_order.js
+++ b/app/assets/javascripts/channels/check_new_order.js
@@ -19,21 +19,7 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
});
// alert(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();
- // }
- // });
+ checkNewOrderAlert(shop_code, order_lists);
// $("#notify_new_order_lists").text(order_lists);
// if($("#"+shop_code+"_notify_new_order").hasClass("hidden")){
// $("#"+shop_code+"_notify_new_order").removeClass("hidden");
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 dc406d5e..4ec3ea08 100644
--- a/app/assets/javascripts/channels/check_order_ready_to_delivery.js
+++ b/app/assets/javascripts/channels/check_order_ready_to_delivery.js
@@ -19,21 +19,7 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
});
// alert(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();
- // }
- // });
+ checkOrderReadyToKitchenAlert(shop_code, order_lists);
// $("#notify_order_ready_to_delivery_lists").text(order_lists);
// if($("#notify_order_ready_to_delivery").hasClass("hidden")){
// $("#"+shop_code+"_notify_order_ready_to_delivery").removeClass("hidden");
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 0d11207e..5e8751b1 100644
--- a/app/assets/javascripts/channels/check_order_send_to_kitchen.js
+++ b/app/assets/javascripts/channels/check_order_send_to_kitchen.js
@@ -19,21 +19,7 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
});
// alert(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();
- // }
- // });
+ checkOrderSendToKitchen(shop_code, order_lists);
// $("#notify_order_send_to_kitchen_lists").text(order_lists);
// if($("#notify_order_send_to_kitchen").hasClass("hidden")){
// $("#"+shop_code+"_notify_order_send_to_kitchen").removeClass("hidden");
diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js
index f81daaa3..6d91f504 100644
--- a/app/assets/javascripts/custom.js
+++ b/app/assets/javascripts/custom.js
@@ -157,3 +157,12 @@ $(document).ready(function() {
}
//end Notificaiotn message
});
+
+function audioPlayBackground(shop_code){
+ //audio play
+ var audio = new Audio('/'+shop_code+'-beep.mp3'); // define your audio
+ // setTimeout(function(){
+ // audio.loop = true;
+ audio.play();
+ // },10000);
+}
diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js
index e7f63188..fb210f6b 100644
--- a/app/assets/javascripts/order_reservation.js
+++ b/app/assets/javascripts/order_reservation.js
@@ -483,41 +483,81 @@ function showNewOrder(order_reservation,shop_code){
var date = new Date(order_reservation.requested_time);
var time = timeFormat(date);
var requested_date = date.getFullYear() + '-' + (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >= 10? date.getDate() : '0' + date.getDate()) +' '+time;
+ $('.first-1').click();
audioPlayBackground(shop_code);
- // $("#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('shown.bs.modal', function(e){
- // // $(document).off('focusin.modal');
- // $("#"+shop_code+"_doemal_new_order").focus();
- // $("#"+shop_code+"_notify_new_order").addClass("hidden");
- // $("#"+shop_code+"_notify_order_send_to_kitchen").addClass("hidden");
- // $("#"+shop_code+"_notify_order_ready_to_delivery").addClass("hidden");
- // }).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();
- // }
- // });
+ 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){
+ swal.close();
+ }
+ });
}
}
+function checkNewOrderAlert(shop_code, 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();
+ }
+ });
+}
+
+function checkOrderSendToKitchen(shop_code, 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();
+ }
+ });
+}
+
+function checkOrderReadyToKitchenAlert(shop_code, 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();
+ }
+ });
+}
+
function getOrderMonth(month){
var MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"];
return MONTHS[month];
diff --git a/app/models/sale.rb b/app/models/sale.rb
index d365771e..6803e8f2 100644
--- a/app/models/sale.rb
+++ b/app/models/sale.rb
@@ -752,7 +752,7 @@ def self.daily_sales_list(from,to)
SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount,
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
- .joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id")
+ .joins(" left join sale_payments on sale_payments.sale_id = sales.sale_id")
.where("sale_status = ? AND sales.receipt_date between ? and ? ", 'completed', from, to)
.group("DATE_FORMAT((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')),'%Y-%m-%d')")
diff --git a/app/views/origami/order_reservation/index.html.erb b/app/views/origami/order_reservation/index.html.erb
index 45bbfb6f..4894e9b5 100644
--- a/app/views/origami/order_reservation/index.html.erb
+++ b/app/views/origami/order_reservation/index.html.erb
@@ -463,10 +463,10 @@
-
+