From 13fcb69deed7006de28d8646d8a053c3e93c2d4e Mon Sep 17 00:00:00 2001 From: Thein Lin Kyaw Date: Fri, 10 Jul 2020 13:04:12 +0630 Subject: [PATCH] member credit payment --- app/views/origami/payments/show.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 2ead90c7..e5c12572 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -680,8 +680,10 @@ $(document).ready(function(){ $('#pay').click(function() { sub_total = $('#sub-total').text(); member = $('#membership_id').text(); - if (payment_type && payment_type.length > 0 && !other_payments.some(x => payment_type.indexOf(x[0]) >= 0 && x[1] > 0) && sub_total != 0.0 && member) { + if (payment_type && payment_type.length > 0 && parseInt(jQuery.inArray("Credit", payment_type)) == -1 && !other_payments.some(x => payment_type.indexOf(x[0]) >= 0 && x[1] > 0) && sub_total != 0.0 && member) { swal("Oops","Please Pay with " + payment_methods.find(x => payment_type.indexOf(x) >= 0) + " Payment","warning"); + } else if (payment_type && payment_type.length > 0 && parseInt(jQuery.inArray("Credit", payment_type)) != -1 && $('#credit').text() == 0 && sub_total != 0.0 && member) { + swal("Oops","Please Pay with Credit Payment","warning"); } else { $( "#loading_wrapper").show(); if($('#balance').text() > 0){