update shift close alert
This commit is contained in:
@@ -91,7 +91,7 @@
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
<% if current_user.role != "waiter" %>
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
<button id="close_cashier" type="button" data-count="<%=@occupied_table%>" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
|
||||
<% 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 = "<h5><span style=\"color: #CC0000\"> We have "+occupied_count+" pending orders and sales</span> </h5>.<br>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
|
||||
|
||||
Reference in New Issue
Block a user