change UI for Customer

This commit is contained in:
phyusin
2017-11-22 18:35:44 +06:30
parent 5ff93ad20d
commit 50de7dd377
2 changed files with 220 additions and 210 deletions

View File

@@ -1,153 +1,152 @@
<%= 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 " %> <%= f.hidden_field :id, :class => "form-control " %>
<div class="form-group"> <div class="form-group">
<label> <%= t("views.right_panel.detail.salutation") %> :</label><br> <label> <%= t("views.right_panel.detail.salutation") %> :</label><br>
<label class="font-13"><%= t("views.right_panel.detail.mr") %> <label class="font-13"><%= t("views.right_panel.detail.mr") %>
<%= f.radio_button :salutation,"Mr", :class => "salutation mr with-gap radio-col-indigo", :value=>"Mr", :style=>"width: 30px"%> <%= f.radio_button :salutation,"Mr", :class => "salutation mr with-gap radio-col-indigo", :value=>"Mr", :style=>"width: 30px"%>
</label>&nbsp; </label>&nbsp;
<label class="font-13 m-l--15"><%= t("views.right_panel.detail.miss") %> <label class="font-13 m-l--15"><%= t("views.right_panel.detail.miss") %>
<%= f.radio_button :salutation,"Mrs", :class => "salutation mrs with-gap radio-col-indigo", :value=>"Mrs", :style=>"width: 30px"%> <%= f.radio_button :salutation,"Mrs", :class => "salutation mrs with-gap radio-col-indigo", :value=>"Mrs", :style=>"width: 30px"%>
</label>&nbsp; </label>&nbsp;
<label class="font-13 m-l--15"><%= t("views.right_panel.detail.mrs") %> <label class="font-13 m-l--15"><%= t("views.right_panel.detail.mrs") %>
<%= f.radio_button :salutation,"Miss", :class => "salutation miss with-gap radio-col-indigo", :value=>"Miss", :style=>"width: 30px"%> <%= f.radio_button :salutation,"Miss", :class => "salutation miss with-gap radio-col-indigo", :value=>"Miss", :style=>"width: 30px"%>
</label>&nbsp; </label>&nbsp;
<label class="font-13 m-l--15"> <label class="font-13 m-l--15">
<%= t("views.right_panel.detail.mdm") %> <%= t("views.right_panel.detail.mdm") %>
<%= f.radio_button :salutation,"Mdm", :class => "salutation mdm with-gap radio-col-indigo", :value=>"Mdm", :style=>"width: 30px"%> <%= f.radio_button :salutation,"Mdm", :class => "salutation mdm with-gap radio-col-indigo", :value=>"Mdm", :style=>"width: 30px"%>
</label> </label>
</div> </div>
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
<%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
<% flash.each do |test, msg| %>
<%
str="[\"#{msg['name']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end -%>
</div>
<div class="form-group"> <div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
<label><%= t("views.right_panel.detail.gender") %> :</label><br> <%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
<label><%= t("views.right_panel.detail.male") %></label> <% flash.each do |test, msg| %>
<%= f.radio_button :gender,"Male", :class => "gender male", :value=>"Male", :style=>"width: 30px"%> <%
<label><%= t("views.right_panel.detail.female") %></label> str="[\"#{msg['name']}\"]"
<%= f.radio_button :gender,"Female", :class => "gender female", :value=>"Female", :style=>"width: 30px"%> str.gsub!('["', '')
</div> str.gsub!('"]', '') %>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<div class="form-group"> <% end -%>
<%= f.input :nrc_no,:label => "NRC No", :class => "form-control nrc_no" %> </div>
</div>
<div class="form-group"> <div class="form-group">
<%= f.input :company, :class => "form-control col-md-6 company"%> <label><%= t("views.right_panel.detail.gender") %> :</label><br>
<label><%= t("views.right_panel.detail.male") %>
<% flash.each do |name, msg| %> <%= f.radio_button :gender,"Male", :class => "gender male", :value=>"Male", :style=>"width: 30px"%></label>
<% str="[\"#{msg['company']}\"]" <label><%= t("views.right_panel.detail.female") %>
str.gsub!('["', '') <%= f.radio_button :gender,"Female", :class => "gender female", :value=>"Female", :style=>"width: 30px"%></label>
str.gsub!('"]', '') %> </div>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end -%>
</div>
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['contact_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end %>
</div>
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>"> <div class="form-group">
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%> <%= f.input :nrc_no,:label => "NRC No", :class => "form-control nrc_no" %>
</div>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['email']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end %>
</div>
<div class="form-group"> <div class="form-group">
<%= f.input :address, :class => "form-control col-md-6 address" %> <%= f.input :company, :class => "form-control col-md-6 company"%>
</div>
<div class="form-group"> <% flash.each do |name, msg| %>
<label><%= t("views.right_panel.detail.sr_no") %></label> <% str="[\"#{msg['company']}\"]"
<div class="form-line disabled"> str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end -%>
</div>
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['contact_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end %>
</div>
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['email']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end %>
</div>
<div class="form-group">
<%= f.input :address, :class => "form-control col-md-6 address" %>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.sr_no") %></label>
<div class="form-line disabled">
<input type="text" name="" value="<%=@count_customer%>" class="form-control" disabled="" > <input type="text" name="" value="<%=@count_customer%>" class="form-control" disabled="" >
</div>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.date_of_birth") %></label>
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.select_customer_type") %></label>
<select class="form-control col-md-12 selectpicker show-tick" id="customer_type" name="customer[customer_type]" style="height: " >
<% Lookup.where("lookup_type = ?", "customer_type" ).each do |ct| %>
<option value="<%= ct.value %>">
<%= ct.name %></option>
<%end %>
</select>
</div>
<div class="form-group">
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
</div>
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['card_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end %>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.paypar_account_no") %>:</label>
<div class="-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><%= t("views.right_panel.detail.select_membership_group") %></label>
<select class="form-control col-md-12 selectpicker show-tick" name="member_group_id" style="height: " >
<option value=""><%= t("views.right_panel.detail.select_membership_group") %></option>
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
<option value="<%= member.value %>">
<%= member.name %></option>
<%end %>
</select>
</div> </div>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.date_of_birth") %></label>
<%= f.text_field :date_of_birth, :value=>"01-01-1990",:class=>"datepicker form-control col-md-12"%>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.select_customer_type") %></label>
<select class="form-control col-md-12 selectpicker show-tick" id="customer_type" name="customer[customer_type]" style="height: " >
<% Lookup.where("lookup_type = ?", "customer_type" ).each do |ct| %>
<option value="<%= ct.value %>">
<%= ct.name %></option>
<%end %>
</select>
</div>
<div class="form-group">
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
</div>
<div class="form-group <%= (flash["errors"]) ? "error" : "" %>">
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['card_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<lable class="error col-red m-t--10" style="margin-top:-6px"><%= str %></lable>
<% end %>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.paypar_account_no") %>:</label>
<div class="-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><%= t("views.right_panel.detail.select_membership_group") %></label>
<select class="form-control col-md-12 selectpicker show-tick" name="member_group_id" style="height: " >
<option value=""><%= t("views.right_panel.detail.select_membership_group") %></option>
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
<option value="<%= member.value %>">
<%= member.name %></option>
<%end %>
</select>
</div>
<div class="form-group"> <div class="form-group">
<!-- <%= f.submit "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %> <!-- <%= f.submit "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
<%= f.submit "Update",:class => 'btn btn-info ', :disabled =>'', :id => 'update_customer' %> --> <%= f.submit "Update",:class => 'btn btn-info ', :disabled =>'', :id => 'update_customer' %> -->
<button type="submit" class="btn btn-primary" id="submit_customer"><%= t("views.btn.submit") %></button> <button type="submit" class="btn btn-primary" id="submit_customer"><%= t("views.btn.submit") %></button>
<button type="submit" class="btn btn-info" disabled id="update_customer"><%= t("views.btn.update") %></button> <button type="submit" class="btn btn-info" disabled id="update_customer"><%= t("views.btn.update") %></button>
<button type="button" class="btn btn-danger" id="reset"><%= t("views.btn.reset") %></button> <button type="button" class="btn btn-danger" id="reset"><%= t("views.btn.reset") %></button>
</div> </div>
<%end%> <%end%>
<div id="sxModal"> <div id="sxModal">
<div id="sxModal-Content"><h3><%= t :card_tap %></h3></div> <div id="sxModal-Content"><h3><%= t :card_tap %></h3></div>
</div> </div>
<!-- The modal --> <!-- The modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="modalLabelLarge" aria-hidden="true"> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="modalLabelLarge" aria-hidden="true">
@@ -155,9 +154,9 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-body"> <div class="modal-body">
<div id="container"> <div id="container">
<video autoplay="true" id="videoElement"> <video autoplay="true" id="videoElement">
</video> </video>
</div> </div>
</div> </div>
@@ -166,7 +165,7 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
// Read Card Reader // Read Card Reader
$("#paypar_account_no").on('focus', function(e){ $("#paypar_account_no").on('focus', function(e){
if($(this).val() == ''){ if($(this).val() == ''){
$("#sxModal").show(); $("#sxModal").show();

View File

@@ -12,81 +12,92 @@
<div class="row clearfix"> <div class="row clearfix">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<!-- <div class="main-box-body clearfix"> --> <div class="card">
<div class="body table-responsive"> <div class="body">
<table class="table table-hover table-striped"> <!-- <div class="main-box-body clearfix"> -->
<!-- <div class="table-responsive"> <div class="body table-responsive">
<table class="table table-striped"> --> <table class="table table-hover table-striped">
<thead> <!-- <div class="table-responsive">
<tr> <table class="table table-striped"> -->
<td colspan="7"> <thead>
<!-- <button id="member_acc_no" class="btn btn-success btn-md"><span class="fa fa-credit-card"></span> Member Card</button> <tr>
<button id="qr_code" class="btn btn-danger btn-md"> <td colspan="7">
<span class="fa fa-credit-card"></span> QR CODE <!-- <button id="member_acc_no" class="btn btn-success btn-md"><span class="fa fa-credit-card"></span> Member Card</button>
</button> --> <button id="qr_code" class="btn btn-danger btn-md">
<div class="body"> <span class="fa fa-credit-card"></span> QR CODE
<%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %> </button> -->
<div class="row clearfix"> <div class="body">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12"> <%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %>
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" id="search" class="form-control"> <div class="row clearfix">
<input type="hidden" name="type" id="type" value=""> <div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" id="search" class="form-control">
<input type="hidden" name="type" id="type" value="">
</div>
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> -->
<button type="submit" class="btn bg-blue waves-effect" style="margin-right: 10px;"><%= t("views.btn.search") %></button>
<!-- </div> -->
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="margin-right: 10px;"><%= t("views.btn.memeber_card") %></button>
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="margin-right: 10px;"><%= t("views.btn.qr_code") %></button>
</div>
<% end %>
</div> </div>
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> --> </td>
<button type="submit" class="btn bg-blue waves-effect" style="margin-right: 10px;"><%= t("views.btn.search") %></button> </tr>
<!-- </div> --> <tr>
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="margin-right: 10px;"><%= t("views.btn.memeber_card") %></button> <th></th>
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="margin-right: 10px;"><%= t("views.btn.qr_code") %></button> <th><%= t("views.right_panel.detail.sr_no") %></th>
</div> <th><%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.card_no") %></th>
<th><%= t("views.right_panel.detail.contact_no") %></th>
<th><%= t("views.right_panel.detail.email") %></th>
<th><%= t("views.right_panel.detail.action") %></th>
</tr>
</thead>
<tbody>
<% @i = 0 %>
<% @crm_customers.each do |crm_customer| %>
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
<td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
<td>
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
<%= @i += 1 %>
<%else%>
-
<% end %>
</td>
<td><%= crm_customer.name %></td>
<td><%= crm_customer.card_no rescue '-' %></td>
<td><%= crm_customer.contact_no %></td>
<td><%= crm_customer.email %></td>
<td><%= link_to t("views.btn.show"), crm_customer_path(crm_customer) %></td>
</tr>
<% end %> <% end %>
</div>
</td>
</tr>
<tr>
<th></th>
<th><%= t("views.right_panel.detail.sr_no") %></th>
<th><%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.card_no") %></th>
<th><%= t("views.right_panel.detail.contact_no") %></th>
<th><%= t("views.right_panel.detail.email") %></th>
<th><%= t("views.right_panel.detail.action") %></th>
</tr>
</thead>
<tbody> </tbody>
<% @i = 0 %> </table>
<% @crm_customers.each do |crm_customer| %> <br>
<%= paginate @crm_customers %>
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>"> </div>
<td> <!-- </div> -->
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td> </div>
<td>
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
<%= @i += 1 %>
<%else%>
-
<% end %>
</td>
<td><%= crm_customer.name %></td>
<td><%= crm_customer.card_no rescue '-' %></td>
<td><%= crm_customer.contact_no %></td>
<td><%= crm_customer.email %></td>
<td><%= link_to t("views.btn.show"), crm_customer_path(crm_customer) %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= paginate @crm_customers %>
</div> </div>
<!-- </div> -->
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3"> <div class="col-lg-3 col-md-3 col-sm-3">
<div id="custom-slimscroll"> <div class="row">
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %> <div class="col-md-12">
</div> <div class="card">
<div class="body" id="custom-slimscroll">
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
</div>
</div>
</div>
</div>
<!-- <div class="col-lg-1 col-md-1 col-sm-1 "> <!-- <div class="col-lg-1 col-md-1 col-sm-1 ">
<br> <br>
<a href="<%= dashboard_path%>" class="btn btn-primary"> <a href="<%= dashboard_path%>" class="btn btn-primary">