Validate required for reference no: in other payment amount
This commit is contained in:
@@ -52,7 +52,8 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<input type="text" name="reference_no" id="reference_no" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<br><span id="reference_no_Err" style="color:red;"></span>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -196,56 +197,62 @@
|
||||
|
||||
$('#mpu_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var reference_no = $('#reference_no').val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
// var sub_total = $('#sub-total').text();
|
||||
// var member_id = $('#membership_id').text();
|
||||
// var member_discount = $('#member_discount').text();
|
||||
// if (member_id && member_discount) {
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "/origami/" + sale_id + "/member_discount",
|
||||
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//end member discount
|
||||
if(bank_integration == '1'){
|
||||
pay_withBank("SALE", "mpu", amount, sale_id, receipt_no);
|
||||
}else{
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_mpu_path %>",
|
||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Payment Successfully",
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
$("#reference_no_Err").html("");
|
||||
if(reference_no.length > 0){
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
//start member discount 5% by pay card
|
||||
// var sub_total = $('#sub-total').text();
|
||||
// var member_id = $('#membership_id').text();
|
||||
// var member_discount = $('#member_discount').text();
|
||||
// if (member_id && member_discount) {
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "/origami/" + sale_id + "/member_discount",
|
||||
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//end member discount
|
||||
if(bank_integration == '1'){
|
||||
$("#reference_no").val("");
|
||||
pay_withBank("SALE", "mpu", amount, sale_id, receipt_no);
|
||||
}else{
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_mpu_path %>",
|
||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Payment Successfully",
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user