add paypar acc for nfc

This commit is contained in:
Yan
2017-07-16 18:16:52 +06:30
parent 7a036b8c0a
commit b2ccc12e17
12 changed files with 148 additions and 11 deletions

View File

@@ -34,6 +34,7 @@
<th>Company</th>
<th>Contact no</th>
<th>Email</th>
<!-- <th>Paypar No</th> -->
</tr>
</thead>
@@ -54,7 +55,7 @@
<td><%= crm_customer.company rescue '-' %></td>
<td><%= crm_customer.contact_no %></td>
<td><%= crm_customer.email %></td>
<!-- <td><%= crm_customer.paypar_account_no %></td> -->
</tr>
<% end %>
@@ -89,6 +90,14 @@
<span class="help-block" style="margin-top:-10px"><%= str %></span>
<% end -%>
</div>
<div class="form-group">
<label>Paypar Account No:</label>
<div class="input-group">
<%= #f.input :paypar_account_no, :id => "paypar_account_no", :class => "form-control" %>
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly/>
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
</div>
</div>
<div class="form-group">
<label>Salutation :</label><br>
<label>Mr</label>
@@ -192,6 +201,10 @@
</div>
</div>
<div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div>
</div>
<script type="text/javascript">
$(function() {
$('.datepicker').datepicker({
@@ -201,8 +214,30 @@
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
// Read Card Reader
$("#paypar_account_no").on('focus', function(e){
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
},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);
}
}
$(document).on('click',".customer_tr",function(){
// if(this.checked){
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
@@ -235,6 +270,7 @@
$('#customer_salutation').val(data.salutation);
$('#customer_nrc_no').val(data.nrc_no);
$('#paypar_account_no').val(data.paypar_account_no);
if (data.gender == 'Male') {
$('.male').prop( "checked", true )