fix discount with selected

This commit is contained in:
Yan
2017-07-20 17:42:02 +06:30
parent e45bc7964c
commit 30e1854969
3 changed files with 54 additions and 50 deletions

View File

@@ -497,60 +497,63 @@ $(document).ready(function(){
var ajax_url = "/origami/" + sale_id + "/member_discount";
// Selected Account
var account_types = JSON.stringify(get_selected_account_types());
//var account_types = JSON.stringify(get_selected_account_types());
if($('.accounts-type').hasClass('selected-account') == true){
// if($('.accounts-type').hasClass('selected-account') == true){
var params = {'sale_id':sale_id, 'sub_total':sub_total, 'account_types':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){
var params = {'sale_id':sale_id, 'sub_total':sub_total };
if (result.status == "Success") {
type = 'green'
btn_color = 'btn-green'
}else{
type = 'red'
btn_color = 'btn-red'
$.ajax({
type: "POST",
url: ajax_url,
data: params,
success:function(result){
}
$.confirm({
title: result.title,
content: result.status,
columnClass: 'small',
type: type,
buttons: {
confirm: {
text: 'Ok',
btnClass: btn_color,
action: function(){
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
}
}
}
});
}
});
}else{
$.alert({
title: 'Alert!',
content: 'Please Select Account',
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
if (result.status == "Success") {
type = 'green'
btn_color = 'btn-green'
}else{
type = 'red'
btn_color = 'btn-red'
}
$.confirm({
title: result.title,
content: result.status,
columnClass: 'small',
type: type,
buttons: {
confirm: {
text: 'Ok',
btnClass: btn_color,
action: function(){
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
}
}
}
});
}
});
// }
// else{
// $.alert({
// title: 'Alert!',
// content: 'Please Select Account',
// type: 'red',
// typeAnimated: true,
// btnClass: 'btn-danger',
// });
}
// }
});//end member discount
});