Merge branch 'discount' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-07-11 11:07:01 +06:30
5 changed files with 123 additions and 27 deletions

View File

@@ -190,8 +190,9 @@
<button id="remove-item-discount" class="btn btn-warning btn-block action-btn">RemoveItem Discount</button>
<button id="remove-all" class="btn btn-warning btn-block action-btn">Remove All</button>
<button id="pay-discount" class="btn btn-danger btn-block action-btn">Enter</button>
<!-- <hr />
<button id="member-discount" class="btn btn-success btn-block action-btn">Member Discount</button> -->
<hr />
<button id="member-discount" class="btn btn-success btn-block action-btn
<%= @sale_data.customer.membership_id ? " " : "disabled"%>">Member Discount</button>
</div>
</div>
</div>
@@ -482,31 +483,50 @@ $(document).ready(function(){
});
// Pay Discount for membership
// $("#member-discount").on('click', function(e){
// e.preventDefault();
// var sale_id = $('#sale-id').text();
// var sub_total = $('#order-sub-total').text();
// var ajax_url = "/origami/" + sale_id + "/member_discount";
$("#member-discount").on('click', function(e){
e.preventDefault();
var sale_id = $('#sale-id').text();
var sub_total = $('#order-sub-total').text();
var ajax_url = "/origami/" + sale_id + "/member_discount";
// // Selected Account
// var account_types = JSON.stringify(get_selected_account_types());
// var params = {'sale_id':sale_id, 'sub_total':sub_total, 'account_types':account_types };
// Selected Account
var account_types = JSON.stringify(get_selected_account_types());
var params = {'sale_id':sale_id, 'sub_total':sub_total, 'account_types':account_types };
// $.ajax({
// type: "POST",
// url: ajax_url,
// data: params,
// success:function(result){
// alert("Successfully Discount!");
// if(result.table_type == "Table"){
// window.location.href = "/origami/table/" + result.table_id
// }
// else {
// window.location.href = "/origami/room/" + result.table_id
// }
// }
// });
// });
$.ajax({
type: "POST",
url: ajax_url,
data: params,
success:function(result){
if (result.url_status == false) {
status = result.url_message
}else{
status = result.status
}
$.confirm({
title: 'Infomation!',
content: status,
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
}
}
}
});
}
});
});
});
/* Remove Selection */