change customer UI and header css
This commit is contained in:
@@ -11,28 +11,31 @@
|
||||
</div>
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="<%= @create_flag ? 'col-lg-8 col-md-8 col-sm-8' : 'col-lg-12 col-md-12 col-sm-12' %>">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<div class="row p-l-20 p-t-20">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %>
|
||||
<div class="row clearfix">
|
||||
<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 class="col-sm-5 col-md-5 col-lg-5">
|
||||
<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 btn-sm bg-blue waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.search") %></button>
|
||||
<div class="col-sm-4 col-md-4 col-lg-4">
|
||||
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> -->
|
||||
<button type="submit" class="btn btn-sm bg-blue waves-effect"><%= t("views.btn.search") %></button>
|
||||
<!-- </div> -->
|
||||
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.memeber_card") %></button>
|
||||
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.qr_code") %></button>
|
||||
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect"><%= t("views.btn.memeber_card") %></button>
|
||||
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect"><%= t("views.btn.qr_code") %></button>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
|
||||
<%= paginate @crm_customers %>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-striped" style="width:100%">
|
||||
<!-- <div class="table-responsive">
|
||||
@@ -50,11 +53,12 @@
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><%= t("views.right_panel.detail.sr_no") %></th>
|
||||
<th><%= t :customer %> <%= t("views.right_panel.detail.type") %></th>
|
||||
<th><%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.card_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.membership_type") %></th>
|
||||
<th style="width:20%"><%= t("views.right_panel.detail.contact_no") %></th>
|
||||
<th style="width:20%"><%= t("views.right_panel.detail.email") %></th>
|
||||
<th style="width:20%"><%= t("views.right_panel.detail.contact_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.membership_type") %></th>
|
||||
<th><%= t("views.right_panel.detail.card_no") %></th>
|
||||
<th><%= t("views.right_panel.detail.action") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -74,8 +78,10 @@
|
||||
-
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= crm_customer.customer_type rescue '-' %></td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.card_no rescue '-' %></td>
|
||||
<td style="width:20px%;word-break: break-all;"><%= crm_customer.email %></td>
|
||||
<td style="width:20px%;word-break: break-all;"><%= crm_customer.contact_no %></td>
|
||||
<td>
|
||||
<% if !@membership_types.nil? %>
|
||||
<% @membership_types.each do |member_type| %>
|
||||
@@ -85,9 +91,10 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="width:20px%;word-break: break-all;"><%= crm_customer.contact_no %></td>
|
||||
<td style="width:20px%;word-break: break-all;"><%= crm_customer.email %></td>
|
||||
<td><%= link_to t("views.btn.show"), crm_customer_path(crm_customer) %></td>
|
||||
<td><%= crm_customer.card_no rescue '-' %></td>
|
||||
<td>
|
||||
<%= link_to t("views.btn.show"), crm_customer_path(crm_customer), :class => "btn btn-md bg-blue waves-effect" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
@@ -95,36 +102,24 @@
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<%= paginate @crm_customers %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if @create_flag %>
|
||||
<div class="col-sm-4 col-md-4 col-lg-4">
|
||||
<!-- .row-form-input -->
|
||||
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
||||
<!-- .row-form-input -->
|
||||
</div>
|
||||
<% end %>
|
||||
</div> <!-- .end-of-row -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if @create_flag %>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<div class="card">
|
||||
<div class="body" id="custom-slimscroll">
|
||||
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-lg-1 col-md-1 col-sm-1 ">
|
||||
<br>
|
||||
<a href="<%= dashboard_path%>" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</div> -->
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
|
||||
$(document).ready(function () {
|
||||
/*$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
@@ -163,91 +158,127 @@ $(function() {
|
||||
$("#search").val(code);
|
||||
}
|
||||
|
||||
});
|
||||
/*new customer UI func:*/
|
||||
//Initialize tooltips
|
||||
$('.nav-tabs > li a[title]').tooltip();
|
||||
|
||||
//Wizard
|
||||
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
|
||||
|
||||
$(document).on('click',".customer_tr",function(){
|
||||
// if(this.checked){
|
||||
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
||||
//$( "#checkbox_check" ).prop( "checked", true );
|
||||
var sale_id = $("#sale_id").val() || 0;
|
||||
var customer_id = $(this).attr('data-ref');
|
||||
var $target = $(e.target);
|
||||
|
||||
if ($target.parent().hasClass('disabled')) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if(sale_id != 0){
|
||||
// var url = "/"+customer_id;
|
||||
update_sale(customer_id,sale_id);
|
||||
}else{
|
||||
$(".next-step").click(function (e) {
|
||||
var $active = $('.wizard .nav-tabs li a.active');
|
||||
$active.parent().next().removeClass('disabled');
|
||||
nextTab($active);
|
||||
$('.wizard .nav-tabs li.active .connecting-line').css({"border-bottom-left-radius": 0, "border-top-left-radius": 0});
|
||||
});
|
||||
$(".prev-step").click(function (e) {
|
||||
|
||||
var url = "customers/" + customer_id + "/edit";
|
||||
}
|
||||
var $active = $('.wizard .nav-tabs li a.active');
|
||||
prevTab($active);
|
||||
|
||||
$("#customer_tax_profiles").children().removeAttr("selected").css({'color':'#000','background':'none'});
|
||||
});
|
||||
/*new customer UI func:*/
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// Selected for Taxes
|
||||
var taxes = JSON.stringify(data.tax_profiles);
|
||||
var parse_taxes = JSON.parse(taxes);
|
||||
$.each(parse_taxes, function(i, value){
|
||||
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
|
||||
});
|
||||
/*customer UI tab btn*/
|
||||
function nextTab(elem) {
|
||||
$(elem).parent().next().find('a[data-toggle="tab"]').click();
|
||||
}
|
||||
function prevTab(elem) {
|
||||
$(elem).parent().prev().find('a[data-toggle="tab"]').click();
|
||||
}
|
||||
/*customer UI tab btn*/
|
||||
|
||||
$('#customer_id').val(data.id);
|
||||
$('#customer_name').val(data.name);
|
||||
$('#customer_company').val(data.company);
|
||||
$('#customer_contact_no').val(data.contact_no);
|
||||
$('#customer_email').val(data.email);
|
||||
$('#customer_salutation').val(data.salutation);
|
||||
$('#customer_nrc_no').val(data.nrc_no);
|
||||
$('#customer_card_no').val(data.card_no);
|
||||
$('#customer_type').val(data.customer_type);
|
||||
$('#paypar_account_no').val(data.paypar_account_no);
|
||||
$('#customer_address').val(data.address);
|
||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||
if(data.image_path.url!=undefined && data.image_path.url!=null){
|
||||
$('.menu-item-img .img-thumbnail').attr('src',data.image_path.url);
|
||||
}
|
||||
$('#customer_membership_type').val(data.membership_type);
|
||||
$('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected');
|
||||
if (data.gender == 'Male') {
|
||||
$('.male').prop( "checked", true )
|
||||
}else{
|
||||
$('.female').prop( "checked", true )
|
||||
}
|
||||
$(document).on('click',".customer_tr",function(){
|
||||
// if(this.checked){
|
||||
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
||||
//$( "#checkbox_check" ).prop( "checked", true );
|
||||
var sale_id = $("#sale_id").val() || 0;
|
||||
var customer_id = $(this).attr('data-ref');
|
||||
|
||||
if(data.salutation == 'Mr') {
|
||||
$('.mr').prop( "checked", true )
|
||||
}else if(data.salutation == 'Miss') {
|
||||
$('.miss').prop( "checked", true )
|
||||
}else if(data.salutation == 'Mrs'){
|
||||
$('.mrs').prop( "checked", true )
|
||||
}else{
|
||||
$('.mdm').prop( "checked", true )
|
||||
}
|
||||
if(sale_id != 0){
|
||||
// var url = "/"+customer_id;
|
||||
update_sale(customer_id,sale_id);
|
||||
}else{
|
||||
|
||||
$('.membership_authentication_code').val(data.membership_authentication_code);
|
||||
var url = "customers/" + customer_id + "/edit";
|
||||
}
|
||||
|
||||
$('#update_customer').removeAttr('disabled').val('');
|
||||
$('#update_customer').attr('value', 'Update');
|
||||
$('#submit_customer').attr('disabled','disabled');
|
||||
$("#customer_tax_profiles").children().removeAttr("selected").css({'color':'#000','background':'none'});
|
||||
|
||||
$("#new_customer").attr('class', 'simple_form edit_customer');
|
||||
var id = "edit_customer_"+customer_id;
|
||||
$("#new_customer").attr('id', id);
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// Selected for Taxes
|
||||
var taxes = JSON.stringify(data.tax_profiles);
|
||||
var parse_taxes = JSON.parse(taxes);
|
||||
$.each(parse_taxes, function(i, value){
|
||||
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
|
||||
});
|
||||
|
||||
$(".edit_customer").attr('id', id);
|
||||
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
|
||||
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
|
||||
$(".patch_method").html('<input type="hidden" name="_method" value="patch">');
|
||||
//$(".edit_customer").attr('method', 'PATCH');
|
||||
}
|
||||
});
|
||||
// }else{
|
||||
$('#customer_id').val(data.id);
|
||||
$('#customer_name').val(data.name);
|
||||
$('#customer_company').val(data.company);
|
||||
$('#customer_contact_no').val(data.contact_no);
|
||||
$('#customer_email').val(data.email);
|
||||
$('#customer_salutation').val(data.salutation);
|
||||
$('#customer_nrc_no').val(data.nrc_no);
|
||||
$('#customer_card_no').val(data.card_no);
|
||||
$('#customer_type').val(data.customer_type);
|
||||
$('#paypar_account_no').val(data.paypar_account_no);
|
||||
$('#customer_address').val(data.address);
|
||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||
if(data.image_path.url!=undefined && data.image_path.url!=null){
|
||||
$('.menu-item-img .img-thumbnail').attr('src',data.image_path.url);
|
||||
}
|
||||
$('#customer_membership_type').val(data.membership_type);
|
||||
$('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected');
|
||||
if (data.gender == 'Male') {
|
||||
$('.male').prop( "checked", true )
|
||||
}else{
|
||||
$('.female').prop( "checked", true )
|
||||
}
|
||||
|
||||
// }
|
||||
if(data.salutation == 'Mr') {
|
||||
$('.mr').prop( "checked", true )
|
||||
}else if(data.salutation == 'Miss') {
|
||||
$('.miss').prop( "checked", true )
|
||||
}else if(data.salutation == 'Mrs'){
|
||||
$('.mrs').prop( "checked", true )
|
||||
}else{
|
||||
$('.mdm').prop( "checked", true )
|
||||
}
|
||||
|
||||
$('.membership_authentication_code').val(data.membership_authentication_code);
|
||||
|
||||
$('#update_customer').removeAttr('disabled').val('');
|
||||
$('#update_customer').attr('value', 'Update');
|
||||
$('#submit_customer').attr('disabled','disabled');
|
||||
|
||||
$("#new_customer").attr('class', 'simple_form edit_customer');
|
||||
var id = "edit_customer_"+customer_id;
|
||||
$("#new_customer").attr('id', id);
|
||||
|
||||
$(".edit_customer").attr('id', id);
|
||||
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
|
||||
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
|
||||
$(".patch_method").html('<input type="hidden" name="_method" value="patch">');
|
||||
//$(".edit_customer").attr('method', 'PATCH');
|
||||
}
|
||||
});
|
||||
// }else{
|
||||
|
||||
// }
|
||||
})
|
||||
|
||||
function update_sale(customer_id,sale_id) {
|
||||
@@ -289,5 +320,4 @@ $(document).on('click',".customer_tr",function(){
|
||||
$("#sxModal .btn_cancel").on('click',function(){
|
||||
$("#sxModal").hide();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user