update crm customer and bind customer and queue

This commit is contained in:
Aung Myo
2017-06-23 17:03:52 +06:30
parent 4b9291110d
commit f5f0f9e077
22 changed files with 480 additions and 302 deletions

View File

@@ -104,6 +104,7 @@
<div class="form-group">
<label>Select Member Group</label>
<select class="selectpicker form-control col-md-12" name="member_group_id" style="height: 40px" >
<option value="">Select Membership Group</option>
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
<option value="<%= member.value %>">
<%= member.name %></option>

View File

@@ -37,9 +37,10 @@
<th>Select</th>
<th>Sr.no</th>
<th>Name</th>
<th>Company</th>
<th>Card No</th>
<th>Contact no</th>
<th>Email</th>
<th>Action</th>
</tr>
</thead>
@@ -52,7 +53,7 @@
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
<td><%= @i += 1 %></td>
<td><%= crm_customer.name %></td>
<td><%= crm_customer.company rescue '-' %></td>
<td><%= crm_customer.card_no rescue '-' %></td>
<td><%= crm_customer.contact_no %></td>
<td><%= crm_customer.email %></td>
<td><%= link_to 'Show', crm_customer_path(crm_customer) %></td>
@@ -126,7 +127,7 @@ $(document).on('click',".customer_tr",function(){
$('#customer_address').val(data.address);
$('#customer_date_of_birth').val(data.date_of_birth);
$('#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{
@@ -142,7 +143,7 @@ $(document).on('click',".customer_tr",function(){
}else{
$('.mdm').prop( "checked", true )
}
// $('.selectpicker > option[value="'+data.membership_id+'"]').attr('selected','selected');
$('.membership_authentication_code').val(data.membership_authentication_code);
$('#update_customer').removeAttr('disabled').val('');
@@ -150,11 +151,14 @@ $(document).on('click',".customer_tr",function(){
$('#submit_customer').attr('disabled','disabled');
$("#new_customer").attr('class', 'simple_form edit_customer');
var id = "edit_customer_"+$('#customer_id').val();
var id = "edit_customer_"+customer_id;
alert(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").append('<input type="hidden" name="_method" value="patch">');
$(".patch_method").html('<input type="hidden" name="_method" value="patch">');
//$(".edit_customer").attr('method', 'PATCH');
}
});

View File

@@ -1,126 +1,166 @@
<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><%= @customer.customer_id%></li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-11 col-md-11 col-sm-11">
<!-- Column One -->
<div class="tab-pane active" id="queue" role="tabpanel"">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Card No</th>
<th>Name</th>
<th>Company</th>
<th>Contact no</th>
<th>Email</th>
<th>NRC/Passport No</th>
<th>Address</th>
<th>DOB</th>
</tr>
</thead>
<div class="col-lg-11 col-md-11 col-sm-11">
<!-- Column One -->
<tbody>
<tr>
<td><%= @customer.card_no rescue '-'%></td>
<td><%= @customer.name %></td>
<td><%= @customer.company rescue '-' %></td>
<td><%= @customer.contact_no %></td>
<td><%= @customer.email %></td>
<td><%= @customer.nrc_no %></td>
<td><%= @customer.address%></td>
<td><%= @customer.date_of_birth %></td>
</tr>
<tr>
<th colspan="8">Membership Transactions</th>
</tr>
<tr>
<th>Date</th>
<th>Redeem</th>
<th>Rebate</th>
<th>Balance</th>
<!-- <th>Account No</th> -->
<th>Status</th>
<th>Receipt No</th>
</tr>
<%
if @response["status"] == true %>
<% @response["data"].each do |transaction| %>
<tr>
<td><%= transaction["date"]%></td>
<td><%= transaction["redeem"]%></td>
<td><%= transaction["rebate"] %></td>
<td><%= transaction["balance"] %></td>
<!-- <td><%= transaction["account_no"] %></td> -->
<td><%= transaction["status"] %></td>
<td><%= transaction["receipt_no"] %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
<!-- 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="tab-content">
<div class="tab-pane" id="booking" role="tabpanel">
<h3>Order Details</h3>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#customer" role="tab">Customer Details</a>
</li>
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#order" role="tab">Order Details</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#sale" role="tab">Sale Details</a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content" style="min-height:670px; max-height:670px; ">
<div class="tab-pane active" id="customer" role="tabpanel" style="min-height:670px; max-height:670px; ">
<div class="table-responsive">
<br><br>
<table class="table table-striped">
<thead>
<tr>
<th>Card No</th>
<th>Name</th>
<th>Company</th>
<th>Contact no</th>
<th>Email</th>
<th>NRC/Passport No</th>
<th>Address</th>
<th>DOB</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @customer.card_no rescue '-'%></td>
<td><%= @customer.name %></td>
<td><%= @customer.company rescue '-' %></td>
<td><%= @customer.contact_no %></td>
<td><%= @customer.email %></td>
<td><%= @customer.nrc_no %></td>
<td><%= @customer.address%></td>
<td><%= @customer.date_of_birth %></td>
</tr>
<tr><th colspan="8"></th></tr>
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th colspan="5">Membership Transactions</th>
<% if @response["status"] == true %>
<th>Current Balance : <%= @response["data"][0]["balance"]%></th>
<% end %>
</tr>
<tr>
<th>Date</th>
<th>Redeem</th>
<th>Rebate</th>
<th>Balance</th>
<!-- <th>Account No</th> -->
<th>Status</th>
<th>Receipt No</th>
</tr>
</thead>
<tbody>
<% if @response["status"] == true %>
<% @response["data"].each do |transaction| %>
<tr>
<td><%= transaction["date"]%></td>
<td><%= transaction["redeem"]%></td>
<td><%= transaction["rebate"] %></td>
<td><%= transaction["balance"] %></td>
<!-- <td><%= transaction["account_no"] %></td> -->
<td><%= transaction["status"] %></td>
<td><%= transaction["receipt_no"] %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="order" role="tabpanel" style="min-height:670px; max-height:670px; ">
<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.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>
<div class="tab-pane" id="sale" role="tabpanel" style="min-height:670px; max-height:670px; ">
<h3>Sale Details</h3>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Order ID</th>
<th>Sale 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>
<th>Tax Price</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<% @order_items.each do |order_item| %>
<% @sale_items.each do |sale_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>
<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 class="tab-pane" id="customer" role="tabpanel">
</div>
</div>
<div class="tab-pane" id="customer" role="tabpanel">
<h3>Sale Details</h3>
<div class="table-responsive">
<table class="table table-striped">
@@ -150,18 +190,17 @@
</tbody>
</table>
</div>
</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="<%= crm_customers_path%>" class="btn btn-primary pull">
<i class="fa fa-arrow-left fa-xs"></i> Back
<a href="<%= crm_customers_path%>" class="btn btn-primary btn-lg">
<i class="fa fa-arrow-left fa-lg"></i> Back
</a>
</div>
</div>

View File

@@ -1,85 +0,0 @@
<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="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>
</tr>
</thead>
<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>
</tr>
</tbody>
</table>
<br>
<h3>Sale Items</h3>
<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>
</div>
</div>
</div>

View File

@@ -2,15 +2,20 @@
<%= simple_form_for([:crm,@dining_queue]) do |f| %>
<%= f.error_notification %>
<p class="hidden generate_no"><%= @queue_no %></p>
<div class="form-inputs">
<%= f.input :name %>
<%= f.input :contact_no %>
<%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%>
<div class="col-md-6">
<div class="form-inputs">
<%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%>
<%= f.input :name %>
<%= f.input :contact_no %>
<%= f.input :seater %>
<%= f.input :remark %>
</div>
<br>
<div class="form-actions">
<%= f.button :submit,"Create Queue" %>
</div>
<br>
<div class="form-actions">
<%= f.button :submit,"Create Queue" %>
</div>
</div>
<% end %>

View File

@@ -24,6 +24,7 @@
<p class="hidden queue-id"><%= @queue.id %></p>
<p class="hidden queue-status"><%= table.status %></p>
<p style="text-align: center"><%= table.name %></p>
<p style="text-align: center">Seat : <%= table.seater %></p>
</div>
</div>

View File

@@ -26,6 +26,7 @@
<p class="hidden queue-status"><%= queue.status %></p>
<span class="card-title">
<%= @i += 1 %> . Queue No </span>
<span class="card-title pull-right">Seater : <%= queue.seater %> </span>
<p style="font-size: 30px ;text-align: center;">
<strong><%= queue.queue_no %></strong>
</p>