Redeem amount validation
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -119,22 +120,26 @@ $("#redeem").click(function(){
|
||||
redeem_amount = parseInt($("#used_amount").text());
|
||||
if(redeem_amount<=0 ){
|
||||
alert("Please type valid amount");
|
||||
|
||||
|
||||
}else if(valid_amount< redeem_amount){
|
||||
alert(" Insufficient Amount!")
|
||||
}else{
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=origami_payment_paypar_path%>",
|
||||
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
}else{
|
||||
alert(result.message);
|
||||
if(redeem_amount <= "<%= @food_prices %>"){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=origami_payment_paypar_path%>",
|
||||
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
}else{
|
||||
alert(result.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}else {
|
||||
alert("Redeem Amount is over!");
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user