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

@@ -1,2 +1,2 @@
json.extract! crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, :created_at, :updated_at,:salutation, :gender,:nrc_no,:address,:card_no
json.extract! crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, :created_at, :updated_at,:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no
json.url crm_customer_url(crm_customer, format: :json)

View File

@@ -1,7 +1,5 @@
<div class="col-lg-4 col-md-4 col-sm-4" style="min-height:600px; max-height:600px; overflow-x:scroll">
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
<span class="patch_method"></span>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
@@ -15,6 +13,14 @@
<% end -%>
</div>
<div class="form-group">
<label>Paypar Account No:</label>
<div class="input-group">
<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>
@@ -107,11 +113,40 @@
</div>
<div class="form-group">
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
</div>
<%end%>
</div>
</div>
<div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div>
</div>
<script type="text/javascript">
$(function() {
// 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);
}
}
</script>

View File

@@ -119,7 +119,7 @@ $(document).on('click',".customer_tr",function(){
url: url,
data: {},
dataType: "json",
success: function(data) {
success: function(data) {
$('#customer_id').val(data.id);
$('#customer_name').val(data.name);
$('#customer_company').val(data.company);
@@ -128,6 +128,7 @@ $(document).on('click',".customer_tr",function(){
$('#customer_salutation').val(data.salutation);
$('#customer_nrc_no').val(data.nrc_no);
$('#customer_card_no').val(data.card_no);
$('#paypar_account_no').val(data.paypar_account_no);
$('#customer_address').val(data.address);
$('#customer_date_of_birth').val(data.date_of_birth);
$('#customer_membership_type').val(data.membership_type);

View File

@@ -1,4 +1,4 @@
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
:membership_id, :membership_type, :membership_authentication_code,
:salutation, :gender,:nrc_no,:address,:card_no
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no
json.url crm_customer_url(@crm_customer, format: :json)