Merge branch 'quick_service' of bitbucket.org:code2lab/sxrestaurant into split_bill

This commit is contained in:
phyusin
2018-02-23 15:29:36 +06:30
19 changed files with 284 additions and 125 deletions

View File

@@ -473,7 +473,8 @@
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
<% if current_login_employee.role != "waiter" %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<% end %>
@@ -536,6 +537,30 @@
</div>
</div>
</div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
</div>
<div class="modal-body">
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
cashier_type = "cashier"
$(document).ready(function () {
@@ -868,9 +893,12 @@
if (isConfirm) {
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
var ajax_url = "/origami/sale/" + sale_id + '/void';
var remark = $("#remark").val();
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function () {
window.location.href = '/origami/';
}

View File

@@ -324,8 +324,12 @@
<i class="material-icons">reply</i>
Back
</button>
<button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </button>
<button type="button" class="btn bg-red btn-block" id="void" active="<%= can? :overall_void, :void %>"> Void </button>
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i>
Back
</button>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
<% if @cashier_type=="quick_service" %>
<hr>
@@ -339,8 +343,52 @@
</div>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
</div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
</div>
<div class="modal-body">
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="void" active="true">VOID</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="focModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="focModalLabel">Please Enter Reason for FOC</h4>
</div>
<div class="modal-body">
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="foc_remark">
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link bg-red waves-effect " id="foc" active="true">FOC</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
@@ -649,30 +697,59 @@ console.log("fffffffffffff")
}
});
$('#void').on('click',function () {
if ($(this).attr('active') === "true") {
// $('#void').on('click',function () {
// if ($(this).attr('active') === "true") {
// var sale_id = $('#sale_id').text();
// var remark = $("#remark").val();
// var ajax_url = "/origami/sale/" + sale_id + '/void';
// $.ajax({
// type: 'POST',
// url: ajax_url,
// data: "remark="+ remark + "&sale_id=" + sale_id,
// success: function () {
// window.location.href = '/origami/';
// }
// })
// }else{
// swal("Opps","You are not authorized for void","warning")
// }
// });
$('#void').on('click', function () {
if ($(this).attr('active')=== "true") {
swal({
title: "Information!",
text: 'Are you sure want to Void !',
}, function () {
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').text();
var remark = $("#remark").val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function () {
<<<<<<< HEAD
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
=======
window.location.href = '/origami/';
>>>>>>> 77a66d726bc48a7c5d8be7c12728c1d0a9a5621e
}
})
});
}
});
}else{
swal("Oops","You are not authorized for void","warning")
}
});
});
@@ -698,12 +775,14 @@ console.log("fffffffffffff")
$('#foc').click(function() {
//$( "#loading_wrapper" ).show();
// payment
var remark = $("#foc_remark").val();
var cash = $('#grand_total').text();
var sub_total = $('#sub-total').text();
var sale_id = $('#sale_id').text();
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark };
if ($(this).attr('active')=== "true") {
<<<<<<< HEAD
$.ajax({
type: "POST",
url: "<%= origami_payment_foc_path %>",
@@ -725,8 +804,36 @@ console.log("fffffffffffff")
});
}
=======
swal({
title: "Alert",
text: "Are you sure want to FOC This Receipt?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, FOC it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
$.ajax({
type: "POST",
url: "<%= origami_payment_foc_path %>",
data: params,
success:function(result){
if (cash >= 0) {
swal({
title: "Information!",
text: 'Thank You !',
}, function () {
window.location.href = '/origami';
});
}
}
});
>>>>>>> 77a66d726bc48a7c5d8be7c12728c1d0a9a5621e
}
});
});
}else{
swal("Oops","You are not authorized for foc","warning")
}