update discount message

This commit is contained in:
Aung Myo
2017-07-11 15:45:01 +06:30
parent 1e329d1c5f
commit 28c51300cf
2 changed files with 64 additions and 36 deletions

View File

@@ -185,10 +185,14 @@ class Origami::DiscountsController < BaseOrigamiController
table_type = DiningFacility.find(table_id).type table_type = DiningFacility.find(table_id).type
# Re-calc All Amount in Sale # Re-calc All Amount in Sale
if response["status"] == true if response["status"] == true
sale.compute_by_sale_items(sale_id, sale.sale_items, response["rebate_earned"].to_f,"member_discount") sale.compute_by_sale_items(sale_id, sale.sale_items, response["rebate_earned"].to_f,"member_discount")
result = {:status=> "Success", :table_id => table_id, :table_type => table_type,:table_type => table_type }
end end
result = {:status=> "Success", :table_id => table_id, :table_type => table_type,:table_type => table_type,:url_status => response[:status],:url_message => response[:message] }
if response[:status] == false
result = {:status=> "Success", :table_id => table_id, :table_type => table_type,:table_type => table_type,:url_status => response[:status],:url_message => response[:message] }
end
render :json => result.to_json render :json => result.to_json
end end

View File

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