add paypar acc for nfc
This commit is contained in:
@@ -53,3 +53,32 @@
|
|||||||
column-count: 5;
|
column-count: 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#sxModal {
|
||||||
|
display: none;
|
||||||
|
overflow: auto;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #000;
|
||||||
|
background-color: rgba(0,0,0,0.4);
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1100;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sxModal-Content {
|
||||||
|
position: relative;
|
||||||
|
left: 42%;
|
||||||
|
top: 30%;
|
||||||
|
background-color: #d9534f;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
padding-top: 5%;
|
||||||
|
border-radius: 100px;
|
||||||
|
z-index: 1101;
|
||||||
|
}
|
||||||
@@ -211,3 +211,32 @@ tr.discount-item-row:hover {
|
|||||||
margin-left:-40px !important;
|
margin-left:-40px !important;
|
||||||
margin-top:-40px !important;
|
margin-top:-40px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#sxModal {
|
||||||
|
display: none;
|
||||||
|
overflow: auto;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #000;
|
||||||
|
background-color: rgba(0,0,0,0.4);
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1100;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sxModal-Content {
|
||||||
|
position: relative;
|
||||||
|
left: 42%;
|
||||||
|
top: 30%;
|
||||||
|
background-color: #d9534f;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
padding-top: 5%;
|
||||||
|
border-radius: 100px;
|
||||||
|
z-index: 1101;
|
||||||
|
}
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
address = customer_params[:address]
|
address = customer_params[:address]
|
||||||
nrc = customer_params[:nrc_no]
|
nrc = customer_params[:nrc_no]
|
||||||
card_no = customer_params[:card_no]
|
card_no = customer_params[:card_no]
|
||||||
|
paypar_account_no = customer_params[:paypar_account_no]
|
||||||
member_group_id = params[:member_group_id]
|
member_group_id = params[:member_group_id]
|
||||||
|
|
||||||
if member_group_id.present?
|
if member_group_id.present?
|
||||||
@@ -95,6 +96,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
response = HTTParty.post(url,
|
response = HTTParty.post(url,
|
||||||
:body => {name: name,phone: phone,email: email,
|
:body => {name: name,phone: phone,email: email,
|
||||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||||
|
paypar_account_no: paypar_account_no,
|
||||||
member_group_id: member_group_id,
|
member_group_id: member_group_id,
|
||||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
@@ -172,6 +174,7 @@ end
|
|||||||
address = customer_params[:address]
|
address = customer_params[:address]
|
||||||
nrc = customer_params[:nrc_no]
|
nrc = customer_params[:nrc_no]
|
||||||
card_no = customer_params[:card_no]
|
card_no = customer_params[:card_no]
|
||||||
|
paypar_account_no = customer_params[:paypar_account_no]
|
||||||
id = @crm_customer.membership_id
|
id = @crm_customer.membership_id
|
||||||
member_group_id = params[:member_group_id]
|
member_group_id = params[:member_group_id]
|
||||||
|
|
||||||
@@ -187,6 +190,7 @@ end
|
|||||||
response = HTTParty.post(url,
|
response = HTTParty.post(url,
|
||||||
:body => { name: name,phone: phone,email: email,
|
:body => { name: name,phone: phone,email: email,
|
||||||
dob: dob,address: address,nrc:nrc,
|
dob: dob,address: address,nrc:nrc,
|
||||||
|
paypar_account_no: paypar_account_no,
|
||||||
card_no:card_no,member_group_id: member_group_id,
|
card_no:card_no,member_group_id: member_group_id,
|
||||||
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
@@ -231,6 +235,7 @@ end
|
|||||||
response = HTTParty.post(url,
|
response = HTTParty.post(url,
|
||||||
:body => {name: name,phone: phone,email: email,
|
:body => {name: name,phone: phone,email: email,
|
||||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||||
|
paypar_account_no: paypar_account_no,
|
||||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
:headers => {
|
:headers => {
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
@@ -287,6 +292,6 @@ end
|
|||||||
def customer_params
|
def customer_params
|
||||||
|
|
||||||
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
||||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no)
|
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class HomeController < ApplicationController
|
|||||||
if !shift.nil?
|
if !shift.nil?
|
||||||
redirect_to origami_root_path
|
redirect_to origami_root_path
|
||||||
else
|
else
|
||||||
redirect_to dashboard_path
|
redirect_to crm_customers_path
|
||||||
end
|
end
|
||||||
elsif employee.role == "cashier"
|
elsif employee.role == "cashier"
|
||||||
#check if cashier has existing open cashier
|
#check if cashier has existing open cashier
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class Customer < ApplicationRecord
|
|||||||
validates :contact_no, uniqueness: true
|
validates :contact_no, uniqueness: true
|
||||||
validates :email, uniqueness: true
|
validates :email, uniqueness: true
|
||||||
validates :card_no, uniqueness: true
|
validates :card_no, uniqueness: true
|
||||||
|
validates :paypar_account_no, uniqueness: true
|
||||||
|
|
||||||
paginates_per 50
|
paginates_per 50
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
json.url crm_customer_url(crm_customer, format: :json)
|
||||||
|
|||||||
@@ -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">
|
<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| %>
|
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||||
|
|
||||||
<span class="patch_method"></span>
|
<span class="patch_method"></span>
|
||||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||||
|
|
||||||
@@ -15,6 +13,14 @@
|
|||||||
<% end -%>
|
<% end -%>
|
||||||
</div>
|
</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">
|
<div class="form-group">
|
||||||
<label>Salutation :</label><br>
|
<label>Salutation :</label><br>
|
||||||
<label>Mr</label>
|
<label>Mr</label>
|
||||||
@@ -107,7 +113,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
|
<%= 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 :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
|
||||||
@@ -115,3 +120,33 @@
|
|||||||
</div>
|
</div>
|
||||||
<%end%>
|
<%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>
|
||||||
@@ -128,6 +128,7 @@ $(document).on('click',".customer_tr",function(){
|
|||||||
$('#customer_salutation').val(data.salutation);
|
$('#customer_salutation').val(data.salutation);
|
||||||
$('#customer_nrc_no').val(data.nrc_no);
|
$('#customer_nrc_no').val(data.nrc_no);
|
||||||
$('#customer_card_no').val(data.card_no);
|
$('#customer_card_no').val(data.card_no);
|
||||||
|
$('#paypar_account_no').val(data.paypar_account_no);
|
||||||
$('#customer_address').val(data.address);
|
$('#customer_address').val(data.address);
|
||||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||||
$('#customer_membership_type').val(data.membership_type);
|
$('#customer_membership_type').val(data.membership_type);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||||
:membership_id, :membership_type, :membership_authentication_code,
|
: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)
|
json.url crm_customer_url(@crm_customer, format: :json)
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
<th>Company</th>
|
<th>Company</th>
|
||||||
<th>Contact no</th>
|
<th>Contact no</th>
|
||||||
<th>Email</th>
|
<th>Email</th>
|
||||||
|
<!-- <th>Paypar No</th> -->
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@
|
|||||||
<td><%= crm_customer.company rescue '-' %></td>
|
<td><%= crm_customer.company rescue '-' %></td>
|
||||||
<td><%= crm_customer.contact_no %></td>
|
<td><%= crm_customer.contact_no %></td>
|
||||||
<td><%= crm_customer.email %></td>
|
<td><%= crm_customer.email %></td>
|
||||||
|
<!-- <td><%= crm_customer.paypar_account_no %></td> -->
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -89,6 +90,14 @@
|
|||||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</div>
|
</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">
|
<div class="form-group">
|
||||||
<label>Salutation :</label><br>
|
<label>Salutation :</label><br>
|
||||||
<label>Mr</label>
|
<label>Mr</label>
|
||||||
@@ -192,6 +201,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="sxModal">
|
||||||
|
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
$('.datepicker').datepicker({
|
$('.datepicker').datepicker({
|
||||||
@@ -201,7 +214,29 @@
|
|||||||
});
|
});
|
||||||
$('.datepicker').attr('ReadOnly','true');
|
$('.datepicker').attr('ReadOnly','true');
|
||||||
$('.datepicker').css('cursor','pointer');
|
$('.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(){
|
$(document).on('click',".customer_tr",function(){
|
||||||
// if(this.checked){
|
// if(this.checked){
|
||||||
@@ -235,6 +270,7 @@
|
|||||||
|
|
||||||
$('#customer_salutation').val(data.salutation);
|
$('#customer_salutation').val(data.salutation);
|
||||||
$('#customer_nrc_no').val(data.nrc_no);
|
$('#customer_nrc_no').val(data.nrc_no);
|
||||||
|
$('#paypar_account_no').val(data.paypar_account_no);
|
||||||
|
|
||||||
if (data.gender == 'Male') {
|
if (data.gender == 'Male') {
|
||||||
$('.male').prop( "checked", true )
|
$('.male').prop( "checked", true )
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class CreateCustomers < ActiveRecord::Migration[5.1]
|
|||||||
t.string :nrc_no
|
t.string :nrc_no
|
||||||
t.string :address
|
t.string :address
|
||||||
t.string :card_no, :unique => true
|
t.string :card_no, :unique => true
|
||||||
|
t.string :paypar_account_no, :unique => true
|
||||||
t.string :membership_id
|
t.string :membership_id
|
||||||
t.string :membership_type
|
t.string :membership_type
|
||||||
t.string :membership_authentication_code
|
t.string :membership_authentication_code
|
||||||
|
|||||||
Reference in New Issue
Block a user