add paymal and dinga with account no
This commit is contained in:
@@ -15,41 +15,41 @@
|
||||
<div class="rebate-form">
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="">You can redeem up to </label>
|
||||
<%@redeem_prices = @redeem_prices +@rounding_adj%>
|
||||
<input type="text" name="" id="redeemamt" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @redeem_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
<label class="">You can pay up to </label>
|
||||
<%@payment_prices = @payment_prices +@rounding_adj%>
|
||||
<input type="text" name="" id="paymentamt" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @payment_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @dingacount > 0 %>
|
||||
<% if @payparcount > 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="">Recent Redeem Amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @dingacount %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
<label class="">Recent Payment Amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @payparcount %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class=""> Rebate Balance </label>
|
||||
<label class="">Available Balance </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%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="">Redeem Amount</label>
|
||||
<label class="">Payment Balance</label>
|
||||
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <% if @dingacount > 0 %>
|
||||
<p class="">Last time rebate amount is <%= @dingacount %></p>
|
||||
<!-- <% if @payparcount > 0 %>
|
||||
<p class="">Last time rebate amount is <%= @payparcount %></p>
|
||||
<% end %>
|
||||
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @redeem_prices %></span></p> -->
|
||||
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @payment_prices %></span></p> -->
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
@@ -92,7 +92,7 @@
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="pay purple left" id="dinga">Pay</div>
|
||||
<div class="pay purple left" id="dinga_payment">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -106,15 +106,43 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- customer light box -->
|
||||
<div class="modal fade" id="is_paymemberModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-md" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title" id="is_paymemberModalLabel">Are you Member?</h1>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
|
||||
<input type="hidden" name="qr_code" id="qr_code" />
|
||||
<div class="row text-center m-t-20">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Card Member</button>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR Code</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function() {
|
||||
setHeaderBreadCrumb(_REDEEM_PAYMENT_);
|
||||
setHeaderBreadCrumb(_DINGA_);
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||
else {
|
||||
$('#redeemamt').attr("value",parseFloat("<%= @redeem_prices %>") - parseFloat(localStorage.getItem("cash")));
|
||||
}
|
||||
});
|
||||
else {
|
||||
$('#paymentamt').attr("value",parseFloat("<%= @payment_prices %>") - parseFloat(localStorage.getItem("cash")));
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
@@ -148,7 +176,7 @@
|
||||
$('#used_amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
var remain_amount = $('#redeemamt').val();
|
||||
var remain_amount = $('#paymentamt').val();
|
||||
$('#used_amount').text(remain_amount);
|
||||
break;
|
||||
|
||||
@@ -159,22 +187,82 @@
|
||||
}
|
||||
});
|
||||
|
||||
$("#dinga").click(function(){
|
||||
$("#dinga_payment").click(function(){
|
||||
valid_amount = $("#valid_amount").val();
|
||||
sale_id = $("#valid_amount").attr('data-value');
|
||||
membership_id = $("#valid_amount").attr('data-member-value');
|
||||
redeem_amount = parseFloat($("#used_amount").text());
|
||||
if(redeem_amount<=0 ){
|
||||
swal ( "Oops" , "Please type valid amount!" , "warning" );
|
||||
}else if(valid_amount< redeem_amount){
|
||||
swal ( "Oops" , "Insufficient Amount!" , "warning" );
|
||||
payment_amount = parseFloat($("#used_amount").text());
|
||||
if((membership_id!=undefined) && (membership_id!="") && (membership_id > 0)){
|
||||
if(payment_amount<=0 ){
|
||||
swal ( "Oops" , "Please type valid amount!" , "warning" );
|
||||
}else if(valid_amount< payment_amount){
|
||||
swal ( "Oops" , "Insufficient Amount!" , "warning" );
|
||||
}else{
|
||||
if(payment_amount <= "<%= @payment_prices %>"){
|
||||
$(this).off("click");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=origami_payment_dinga_path%>",
|
||||
data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:""},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: result.message,
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"
|
||||
});
|
||||
|
||||
}else{
|
||||
swal ( "Information" , result.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else {
|
||||
swal ( "Oops" , "Payment Amount is over!" , "warning" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(redeem_amount <= "<%= @redeem_prices %>"){
|
||||
$(this).off("click");
|
||||
$.ajax({
|
||||
$("#is_paymemberModal").modal({show : true, backdrop: false, keyboard : false});
|
||||
}
|
||||
});
|
||||
|
||||
// Read Card Reader
|
||||
$(".btn_member").on('click', function(){
|
||||
var cardNo = "";
|
||||
var customer_id = '';
|
||||
var customer_name = '';
|
||||
var membership_id = '';
|
||||
var membership_type = '';
|
||||
var sale_id = $("#sale_id").text() || 0;
|
||||
var customer_mamber_card_no = 0;
|
||||
|
||||
$("#is_paymemberModal").hide();
|
||||
$("#sxModal").show();
|
||||
setTimeout(function(){
|
||||
getCardNo();
|
||||
$("#sxModal").hide();
|
||||
customer_mamber_card_no = $("#paypar_account_no").val();
|
||||
|
||||
if(sale_id != 0 && customer_mamber_card_no != 0){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/"+sale_id+"/send_account" ,
|
||||
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status == true) {
|
||||
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
|
||||
$("#valid_amount").val(parseFloat(valid_amount));
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=origami_payment_dinga_path%>",
|
||||
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
|
||||
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
swal({
|
||||
@@ -185,17 +273,151 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment"
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
|
||||
}else{
|
||||
swal ( "Information" , result.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else {
|
||||
swal ( "Oops" , "Redeem Amount is over!" , "warning" );
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message.toString(),
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/DINGA";
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
},100);
|
||||
});
|
||||
|
||||
// Read NFC card no from java
|
||||
function getCardNo(){
|
||||
code2lab.readNFC();
|
||||
}
|
||||
|
||||
// get CardNo from Java
|
||||
function setCardNo(cardNo){
|
||||
if(cardNo.length == 16){
|
||||
$("#paypar_account_no").val(cardNo);
|
||||
}
|
||||
}
|
||||
|
||||
// QR Code Reader
|
||||
$(".btn_qr_code").on('click', function(e){
|
||||
$("#is_memberModal").hide();
|
||||
var code = "";
|
||||
var customer_id = '';
|
||||
var customer_name = '';
|
||||
var membership_id = '';
|
||||
var membership_type = '';
|
||||
setTimeout(function(){
|
||||
code=getQRCode();
|
||||
if(sale_id != 0 && code != ""){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/"+sale_id+"/send_account" ,
|
||||
data: { account_no : code, amount : payment_amount, receipt_no : receipt_no},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.status == true) {
|
||||
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
|
||||
$("#valid_amount").val(parseFloat(valid_amount));
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=origami_payment_paymal_path%>",
|
||||
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: result.message,
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
|
||||
}else{
|
||||
swal ( "Information" , result.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message.toString(),
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/DINGA";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},100);
|
||||
});
|
||||
|
||||
// Read qrcode from java
|
||||
function getQRCode(){
|
||||
return code2lab.readQRCode();
|
||||
$("#qr_code").val(code);
|
||||
}
|
||||
|
||||
function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
||||
var customer="";
|
||||
if(customer_name != ""){
|
||||
customer = '(' + customer_name + ')';
|
||||
}
|
||||
|
||||
swal({
|
||||
title: "Confirmation !",
|
||||
text: 'Are You Sure to assign this customer' + customer + '!',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "green",
|
||||
confirmButtonText: "Yes!",
|
||||
cancelButtonClass: 'btn btn-danger',
|
||||
closeOnConfirm: false,
|
||||
}, function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
|
||||
data: {customer_id:customer_id,sale_id:sale_id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
//change customer detail
|
||||
$("#customer_name").html(customer_name);
|
||||
$("#membership_id").html(membership_id);
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
swal("Alert!", "Record not found!", "error");
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$("#sxModal .btn_cancel").on('click',function(){
|
||||
$("#sxModal").hide();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user