update search and crm

This commit is contained in:
Aung Myo
2017-06-14 00:09:54 +06:30
parent 713e0a367c
commit 3db6252304
20 changed files with 352 additions and 677 deletions

View File

@@ -25,8 +25,8 @@
<tr>
<td colspan="6">
<%= form_tag crm_customers_path, :method => :get do %>
<div class="input-append form-group pull-left">
<input type="text" name="filter" placeholder="Search" class="form-control input-sm col-md-8">
<div class="input-append col-md-12 form-group pull-left">
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" class="form-control input-sm col-md-4">
<button type="submit" class="btn btn-primary btn-sm">Search</button>
</div>
<% end %>
@@ -44,9 +44,9 @@
<tbody>
<% if @crm_customers.count > 0 %>
<% @crm_customers.each do |crm_customer| %>
<tr>
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
<td>
<input type="radio" style="width:20px;" value="<%= crm_customer.customer_id %>" name="checkbox" class="checkbox_check" ></td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
<td><%= crm_customer.name %></td>
<td><%= crm_customer.company rescue '-' %></td>
<td><%= crm_customer.contact_no %></td>
@@ -117,8 +117,9 @@
<%end%>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<a href="<%= crm_customers_path%>" class="btn btn-primary btn-lg ">
Back
<br>
<a href="<%= crm_customers_path%>" class="btn btn-primary">
<i class="fa fa-arrow-left fa-lg"></i> Back
</a>
</div>
</div>
@@ -135,11 +136,10 @@ $(function() {
$('.datepicker').css('cursor','pointer');
});
$(document).on('click',".checkbox_check",function(){
if(this.checked){
$(document).on('click',".customer_tr",function(){
// if(this.checked){
var sale_id = $("#sale_id").val() || 0;
var customer_id = $(this).val();
var customer_id = $(this).attr('data-ref');
if(sale_id != 0){
// var url = "/"+customer_id;
@@ -178,9 +178,9 @@ $(function() {
//$(".edit_customer").attr('method', 'PATCH');
}
});
}else{
// }else{
}
// }
})
function update_sale(customer_id,sale_id) {
@@ -205,7 +205,6 @@ $(function() {
success: function(data) {
if(data.status == true)
{
alert('Customer has assigned');
window.location.href = '/origami'
}else{
alert('Record not found!');

View File

@@ -1,120 +1,130 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= crm_customers_path %>">Customer</a>
</li>
<li class="active">Details
</li>
</ol>
</div>
</div>
<div class="col-lg-10 col-md-10 col-sm-10">
<!-- Column One -->
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#queue" role="tab">Customer Details </a>
</li>
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#booking" role="tab">Orders </a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#customer" role="tab">Sales</a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<hr>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Contact no</th>
<th>Company</th>
<th>Date Of Birth</th>
<th>Membership Account</th>
<th>Balance</th>
<th>Type</th>
</tr>
</thead>
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
<tbody>
<tr>
<td><%= @crm_customer.name %></td>
<td><%= @crm_customer.email %></td>
<td><%= @crm_customer.contact_no %></td>
<td><%= @crm_customer.company %></td>
<td><%= @crm_customer.date_of_birth %> </td>
<td><%= @balance %> </td>
<td><%= @type %> </td>
<%
puts "hhhhhhhhhhhhhhhhhhhhh"
puts @member_data.to_json %>
</tr>
</tbody>
</table>
<br>
<h3>Order Items</h3>
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<div class="table-responsive">
<table class="table table-striped">
<tbody>
<tr>
<th>Name</th>
<td><%= @crm_customer.name %></td>
</tr>
<tr>
<th>Email</th>
<td><%= @crm_customer.email %></td>
</tr>
<tr>
<th>Contact no</th>
<td><%= @crm_customer.contact_no %></td>
</tr>
<tr>
<th>Company</th>
<td><%= @crm_customer.company %></td>
</tr>
<tr>
<th>Date Of Birth</th>
<td><%= @crm_customer.date_of_birth %> </td>
</tr>
</tbody>
</table>
</div>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Created at </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Option</th>
<th>Status</th>
<th>Waiter</th>
</tr>
</thead>
<div class="tab-pane" id="booking" role="tabpanel">
<h3>Order Details</h3>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Order ID</th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Option</th>
<th>Status</th>
<th>Waiter</th>
<th>Created at </th>
</tr>
</thead>
<tbody>
<% @order_items.each do |order_item| %>
<tr>
<td><%= order_item.created_at %></td>
<td><%= order_item.item_name %></td>
<td><%= order_item.qty %></td>
<td><%= order_item.price %></td>
<td><%= order_item.options %></td>
<td><%= order_item.order_item_status %></td>
<td><%= order_item.item_order_by %> </td>
</tr>
<% end %>
</tbody>
</table>
<tbody>
<% @order_items.each do |order_item| %>
<tr>
<td><%= order_item.order_id %></td>
<td><%= order_item.item_name %></td>
<td><%= order_item.qty %></td>
<td><%= order_item.price %></td>
<td><%= order_item.options %></td>
<td><%= order_item.order_item_status %></td>
<td><%= order_item.item_order_by %> </td>
<td><%= order_item.created_at.strftime("%d-%m-%y") %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<h3>Sale Items</h3>
<div class="tab-pane" id="customer" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<h3>Sale Details</h3>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Sale ID </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Tax Price</th>
<th>Created At</th>
</tr>
</thead>
<table class="table table-striped">
<thead>
<tr>
<th>Sale ID </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Tax Price</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<% @sale_items.each do |sale_item| %>
<tr>
<td><%= sale_item.sale_id %></td>
<td><%= sale_item.product_name %></td>
<td><%= sale_item.qty %></td>
<td><%= sale_item.unit_price %></td>
<td><%= sale_item.taxable_price %></td>
<td><%= sale_item.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<tbody>
<% @sale_items.each do |sale_item| %>
<tr>
<td><%= sale_item.sale_id %></td>
<td><%= sale_item.product_name %></td>
<td><%= sale_item.qty %></td>
<td><%= sale_item.unit_price %></td>
<td><%= sale_item.taxable_price %></td>
<td><%= sale_item.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<br><br>
<a href="<%= crm_customers_path%>" class="btn btn-primary pull">
<i class="fa fa-arrow-left fa-xs"></i> Back
</a>
</div>
</div>
</div>