Adding Redeem at payment

This commit is contained in:
Moe Su
2017-06-08 15:17:26 +06:30
50 changed files with 144 additions and 65 deletions

View File

@@ -15,7 +15,7 @@
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">Valid Amount</label>
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @membership_rebate_balance %>">
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="1000">
</div>
<hr>
</div>
@@ -142,14 +142,23 @@ $("#redeem").click(function(){
valid_amount = $("#valid_amount").val();
sale_id = $(this).attr("data-value")
membership_id = $(this).attr("data-member-value");
used_amount = parseInt($("#used_amount").text());
if(used_amount<=0){
redeem_amount = parseInt($("#used_amount").text());
if(redeem_amount<=0){
alert(" Insufficient Amount!")
}else if(valid_amount< used_amount){
}else if(valid_amount< redeem_amount){
alert("Please type valid amount");
}else{
$.ajax({
type: "POST",
url: "<%=origami_paypar_payment_process_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);
}
}
})
}
});

View File

@@ -0,0 +1,2 @@
json.set! :status, @out[0]
json.set! :message, @out[1]