. Are you sure you want to close cashier? ";
+ }else{
+ text = "Are you sure you want to close cashier?";
+ }
swal({
title: "Alert!",
- text: "Are you sure you want to close cashier?",
+ text: text,
type: "warning",
- showCancelButton: true
+ showCancelButton: true,
+ html: true
}, function() {
// Redirect the user
window.location.href = linkURL;
diff --git a/app/views/origami/pending_order/completed_sale.html.erb b/app/views/origami/pending_order/completed_sale.html.erb
index 7540a1e0..bc4719f9 100644
--- a/app/views/origami/pending_order/completed_sale.html.erb
+++ b/app/views/origami/pending_order/completed_sale.html.erb
@@ -224,7 +224,7 @@
<% end %>
<% end %>
-
+
<% end %>
@@ -337,8 +337,30 @@ $(document).ready(function(){
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
- warnBeforeRedirect(linkURL);
+ occupied_count = $(this).data("count");
+ warnBeforeRedirect(linkURL,occupied_count);
});
+
+
+ function warnBeforeRedirect(linkURL,occupied_count) {
+
+ if (occupied_count>0) {
+ text = "
We have "+occupied_count+" pending orders and sales
. Are you sure you want to close cashier? ";
+ }else{
+ text = "Are you sure you want to close cashier?";
+ }
+ swal({
+ title: "Alert!",
+ text: text,
+ type: "warning",
+ showCancelButton: true,
+ html: true
+ }, function() {
+ // Redirect the user
+ window.location.href = linkURL;
+ });
+ }
+
$('#cash_in').on('click',function(){
window.location.href = '/origami/quick_service/cash_ins';
})
diff --git a/app/views/origami/pending_order/credit_sale.html.erb b/app/views/origami/pending_order/credit_sale.html.erb
index aefc3c98..f8fd7ceb 100644
--- a/app/views/origami/pending_order/credit_sale.html.erb
+++ b/app/views/origami/pending_order/credit_sale.html.erb
@@ -215,7 +215,7 @@
<% if current_user.role != "waiter" %>
-
+
<% end %>
@@ -255,7 +255,9 @@ $(document).ready(function(){
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
- warnBeforeRedirect(linkURL);
+ occupied_count = $(this).data("count");
+
+ warnBeforeRedirect(linkURL,occupied_count);
});
$('#cash_in').on('click',function(){
@@ -270,5 +272,25 @@ $(document).ready(function(){
var sale_id = '<%= @sale.sale_id %>';
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/credit_payment";
});
+
+
+ function warnBeforeRedirect(linkURL,occupied_count) {
+
+ if (occupied_count>0) {
+ text = "
We have "+occupied_count+" pending orders and sales
. Are you sure you want to close cashier? ";
+ }else{
+ text = "Are you sure you want to close cashier?";
+ }
+ swal({
+ title: "Alert!",
+ text: text,
+ type: "warning",
+ showCancelButton: true,
+ html: true
+ }, function() {
+ // Redirect the user
+ window.location.href = linkURL;
+ });
+ }
});
diff --git a/app/views/origami/pending_order/index.html.erb b/app/views/origami/pending_order/index.html.erb
index f785449f..a6e91d63 100644
--- a/app/views/origami/pending_order/index.html.erb
+++ b/app/views/origami/pending_order/index.html.erb
@@ -91,7 +91,7 @@
<%= t("views.btn.back") %>
<% if current_user.role != "waiter" %>
-
+
<% end %>
@@ -135,7 +135,8 @@
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
- warnBeforeRedirect(linkURL);
+ occupied_count = $(this).data("count");
+ warnBeforeRedirect(linkURL,occupied_count);
});
$('#cash_in').on('click',function(){
@@ -147,11 +148,18 @@
});
});
- function warnBeforeRedirect(linkURL) {
+ function warnBeforeRedirect(linkURL,occupied_count) {
+
+ if (occupied_count>0) {
+ text = "
We have "+occupied_count+" pending orders and sales
. Are you sure you want to close cashier? ";
+ }else{
+ text = "Are you sure you want to close cashier?";
+ }
swal({
title: "Alert!",
- text: "Are you sure you want to close cashier?",
+ text: text,
type: "warning",
+ html: true,
showCancelButton: true
}, function() {
// Redirect the user
diff --git a/app/views/origami/pending_order/show.html.erb b/app/views/origami/pending_order/show.html.erb
index 9658f1c5..bf0e7d3a 100644
--- a/app/views/origami/pending_order/show.html.erb
+++ b/app/views/origami/pending_order/show.html.erb
@@ -224,7 +224,7 @@
<%end%>
<% if current_user.role != "waiter" %>
-
+
<% end %>
@@ -353,15 +353,23 @@ $(document).ready(function(){
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
- warnBeforeRedirect(linkURL);
+ occupied_count = $(this).data("count");
+ warnBeforeRedirect(linkURL,occupied_count);
});
- function warnBeforeRedirect(linkURL) {
+ function warnBeforeRedirect(linkURL,occupied_count) {
+
+ if (occupied_count>0) {
+ text = "
We have "+occupied_count+" pending orders and sales
. Are you sure you want to close cashier? ";
+ }else{
+ text = "Are you sure you want to close cashier?";
+ }
swal({
title: "Alert!",
- text: "Are you sure you want to close cashier?",
+ text: text,
type: "warning",
- showCancelButton: true
+ showCancelButton: true,
+ html: true
}, function() {
// Redirect the user
window.location.href = linkURL;