From 51c14f379bfb555f3d204d2cc336675d7defa0de Mon Sep 17 00:00:00 2001 From: Yan Date: Mon, 17 Jul 2017 15:07:27 +0630 Subject: [PATCH] still nfc --- app/assets/stylesheets/CRM.scss | 2 +- app/models/customer.rb | 2 +- app/views/crm/customers/_new_form.html.erb | 20 ++++++++++++-------- app/views/crm/customers/index.html.erb | 17 +++++++++++++++-- app/views/origami/customers/index.html.erb | 1 + 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/app/assets/stylesheets/CRM.scss b/app/assets/stylesheets/CRM.scss index 4f14b531..82b84afd 100644 --- a/app/assets/stylesheets/CRM.scss +++ b/app/assets/stylesheets/CRM.scss @@ -73,7 +73,7 @@ position: relative; left: 42%; top: 30%; - background-color: #d9534f; + background-color: #32ad1a; color: #fff; text-align: center; width: 200px; diff --git a/app/models/customer.rb b/app/models/customer.rb index 83a652d3..002bde6c 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -194,7 +194,7 @@ class Customer < ApplicationRecord def self.search(search) if search # find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"]) - where("name LIKE ? OR contact_no LIKE ? OR card_no LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%",) + where("name LIKE ? OR contact_no LIKE ? OR card_no LIKE ? OR paypar_account_no ='#{search}'", "%#{search}%", "%#{search}%", "%#{search}%",) else find(:all) end diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb index b51aac36..41130f76 100644 --- a/app/views/crm/customers/_new_form.html.erb +++ b/app/views/crm/customers/_new_form.html.erb @@ -128,12 +128,15 @@ \ No newline at end of file diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 955395ef..53212f8a 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -22,10 +22,11 @@ - <%= form_tag crm_customers_path, :method => :get do %> + <%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %>
+ @@ -73,7 +74,6 @@ <%= paginate @crm_customers %>
- <%= render 'card_read_form' %> <%= render 'new_form', crm_customer: @crm_customer %> @@ -97,6 +97,19 @@ $(function() { $('.datepicker').attr('ReadOnly','true'); $('.datepicker').css('cursor','pointer'); + // Read Card Reader + $("#member_acc_no").on('click', function(e){ + var cardNo = ""; + $("#sxModal").show(); + setTimeout(function(){ + cardNo = getCardNo(); + $("#search").val(cardNo); + $("#sxModal").hide(); + },100); + + $("#filter_form").submit(); + }); + }); $(document).on('click',".customer_tr",function(){ diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index 4d03d48f..8e5e5157 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -23,6 +23,7 @@
+
<% end %>