Adding Redeem at payment
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
if (@booking)
|
||||
json.id @booking.booking_id
|
||||
json.status @booking.booking_status
|
||||
json.checkin_at @booking.checkin_at
|
||||
json.checkin_at @booking.checkin_at.strftime("%d-%m-%Y")
|
||||
json.checkin_by @booking.checkin_by
|
||||
json.table_name @booking.dining_facility.name
|
||||
|
||||
@@ -17,9 +17,9 @@ if (@booking)
|
||||
order_items = []
|
||||
@booking.booking_orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
if (order.status == "new")
|
||||
#if (order.status == "new")
|
||||
order_items = order_items + order.order_items
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
json.order_items order_items do |item|
|
||||
|
||||
@@ -40,7 +40,7 @@ $(function(){
|
||||
$(".summary-items tbody tr").remove();
|
||||
$("#cancel").removeAttr("disabled");
|
||||
$("#assign").removeAttr("disabled");
|
||||
var url = $(this).attr('data-ref');alert(url);
|
||||
var url = $(this).attr('data-ref');
|
||||
show_details(url);
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
2
app/views/origami/paypar_payments/create.json.jbuilder
Normal file
2
app/views/origami/paypar_payments/create.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message, @out[1]
|
||||
Reference in New Issue
Block a user