Files
sx-fc/app/views/origami/pending_order/index.html.erb
2018-03-19 19:34:34 +06:30

75 lines
2.9 KiB
Plaintext

<div class="container-fluid">
<div class="row clearfix">
<!-- Column One -->
<div class="col-lg-10 col-md-10 col-sm-10">
<div class="card">
<div class="card-header">
<strong id="order-title"> PENDING ORDER </strong>
</div>
<div class="card-block">
<div id="custom-slimscroll">
<div class="card-columns">
<% @sale.each do |sale| %>
<div class="card sales bg-red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;">Billed</span>
</div>
</div>
<% end %>
<% @order.each do |order| %>
<div class="card sales blue text-white" data-id = "<%= order.booking_id %>">
<div class="card-block">
<%= order.booking_id %><span style="font-size:12px;float:right;line-height:inherit;">new</span>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i>
<%= 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>
<% end %>
</div>
</div>
</div>
<script>
cashier_type = "quick_service"
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
})
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service';
})
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
warnBeforeRedirect(linkURL);
});
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true
}, function() {
// Redirect the user
window.location.href = linkURL;
});
}
</script>