update crm layout

This commit is contained in:
Aung Myo
2017-06-09 11:55:50 +06:30
parent 35277ac000
commit e2e8045d0f
13 changed files with 98 additions and 85 deletions

View File

@@ -0,0 +1,17 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require bootstrap
//= require jquery_ujs
//= require turbolinks
//= require cable

View File

@@ -1,4 +1,4 @@
class Crm::BookingsController < ApplicationController class Crm::BookingsController < BaseCrmController
def update_booking def update_booking
booking = Booking.find(params[:booking_id]) booking = Booking.find(params[:booking_id])

View File

@@ -1,4 +1,4 @@
class Crm::CustomersController < ApplicationController class Crm::CustomersController < BaseCrmController
before_action :set_crm_customer, only: [:show, :edit, :update, :destroy] before_action :set_crm_customer, only: [:show, :edit, :update, :destroy]
# GET /crm/customers # GET /crm/customers
@@ -8,18 +8,17 @@ class Crm::CustomersController < ApplicationController
filter = params[:filter] filter = params[:filter]
if filter.nil? if filter.nil?
@crm_custome = Customer.order("name").page(params[:page]) @crm_customers = Customer.order("name").page(params[:page])
#@products = Product.order("name").page(params[:page]).per(5) #@products = Product.order("name").page(params[:page]).per(5)
else else
@crm_custome = Customer.where("name LIKE ?", "%#{filter}%").order("name").page(params[:page]) @crm_customers = Customer.where("name LIKE ?", "%#{filter}%").order("name").page(params[:page])
end end
@crm_customers = Kaminari.paginate_array(@crm_custome).page(params[:page]).per(5)
#@crm_customers = Customer.all #@crm_customers = Customer.all
@crm_customer = Customer.new @crm_customer = Customer.new
# @membership = Customer.get_member_group @membership = Customer.get_member_group
# if @membership["status"] == true if @membership["status"] == true
# @member_group = @membership["data"] @member_group = @membership["data"]
# end end
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.json { render json: @crm_customers } format.json { render json: @crm_customers }
@@ -74,6 +73,7 @@ class Crm::CustomersController < ApplicationController
if response["status"] == true if response["status"] == true
puts "hhhhhhhhhhhhhhhhhh" puts "hhhhhhhhhhhhhhhhhh"
puts params[:sale_id] puts params[:sale_id]
puts response.to_json
customer = Customer.find(@crm_customers.customer_id) customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_id: response["customer_datas"]["id"]) status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
if params[:sale_id] != 0 if params[:sale_id] != 0

View File

@@ -1,4 +1,4 @@
class Crm::DiningQueuesController < ApplicationController class Crm::DiningQueuesController < BaseCrmController
before_action :set_dining_queue, only: [:show, :edit, :update, :destroy] before_action :set_dining_queue, only: [:show, :edit, :update, :destroy]
# GET /crm/dining_queues # GET /crm/dining_queues

View File

@@ -5,7 +5,8 @@ class Crm::HomeController < BaseCrmController
@customer = Customer.all @customer = Customer.all
from = Time.now.beginning_of_day.utc from = Time.now.beginning_of_day.utc
to = Time.now.end_of_day.utc to = Time.now.end_of_day.utc
@queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to) @queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC')
# .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) # .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
end end

View File

@@ -16,13 +16,5 @@
<%= f.button :submit %> <%= f.button :submit %>
</div> </div>
<% end %> <% end %>
<!-- <div class="form-group"> <!---->
<select class="selectpicker form-control col-md-12" name="membership_id">
<option>Select Member Group</option>
<% @member_group.each do |member| %>
<option value="<%= member["id"] %>">
<%= member["name"] %></option>
<%end %>
</select>
</div> -->

View File

@@ -72,7 +72,9 @@
<span class="patch_method"></span> <span class="patch_method"></span>
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" /> <input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<%= f.hidden_field :id, :class => "form-control col-md-6 " %> <%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group">
<%= f.button :submit, "Update Customer",:class => 'btn btn-primary btn-sm', :disabled =>'', :id => 'update_customer' %>
</div>
<div class="form-group"> <div class="form-group">
<%= f.input :name, :class => "form-control col-md-6 name" %> <%= f.input :name, :class => "form-control col-md-6 name" %>
@@ -92,10 +94,18 @@
<div class="form-group"> <div class="form-group">
<label>Date Of Birth</label> <label>Date Of Birth</label>
<%= f.text_field :date_of_birth,:class=>"form-control datepicker date_of_birth",:readonly =>true, :value => @date_of_birth%> <%= f.text_field :date_of_birth,:class=>"form-control date_of_birth datepicker"%>
</div> </div>
<div class="form-group">
<select class="selectpicker form-control col-md-12" name="membership_id">
<option>Select Member Group</option>
<% @member_group.each do |member| %>
<option value="<%= member["id"] %>">
<%= member["name"] %></option>
<%end %>
</select>
</div>
<div class="form-group"> <div class="form-group">
@@ -103,17 +113,19 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.input :membership_authentication_code, :class => "form-control col-md-6 membership_authentication_code" %> <%= f.input :membership_authentication_code, :class => "form-control col-md-6 membership_authentication_code" %>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %> <%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
</div> </div>
<%end%> <%end%>
</div>
</div> </div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
if (jQuery().datepicker) { if (jQuery().datepicker) {
@@ -213,23 +225,6 @@
}); });
} }
/*function changeMethod() {
$("#update_customer").attr('method', 'put');
}*/
/* $("#update_customer").click(function() {
$("#new_customer").attr('class', 'edit_customer');
var id = "edit_customer_"+$('#customer_id').val();alert(id);
$("#new_customer").attr('id', id);
alert(";;")
//$('#new_customer').removeClass('new_customer');
//$('#new_customer').addClass('edit_customer')
}); */
</script> </script>

View File

@@ -38,7 +38,6 @@
$(function(){ $(function(){
$(".booking_click").on("click", function(){ $(".booking_click").on("click", function(){
$(this).css('background-color', '#CCC');
$(".summary-items tbody tr").remove(); $(".summary-items tbody tr").remove();
$("#cancel").removeAttr("disabled"); $("#cancel").removeAttr("disabled");
$("#assign").removeAttr("disabled"); $("#assign").removeAttr("disabled");
@@ -94,7 +93,6 @@ $(function(){
$(".customer_detail").on("click", function(){ $(".customer_detail").on("click", function(){
$(this).css('background-color', '#CCC');
$(".summary-items tbody tr").remove(); $(".summary-items tbody tr").remove();
$("#crm_print").removeAttr("disabled"); $("#crm_print").removeAttr("disabled");
var id = $(this).attr('data-ref'); var id = $(this).attr('data-ref');
@@ -124,6 +122,7 @@ function show_details(url_item){
$("#order_by").text(data.checkin_by) $("#order_by").text(data.checkin_by)
$("#assign").val(data.id) $("#assign").val(data.id)
$("#cancel").val(data.id) $("#cancel").val(data.id)
$('.no_record').addClass('hide');
for(var field in item_data) { for(var field in item_data) {
if (item_data[field].item_name){ if (item_data[field].item_name){
@@ -157,13 +156,14 @@ function customer_details(id){
$("#for-booking").remove(); $("#for-booking").remove();
var div_data = "<strong>CUSTOMER DETAILS</strong>"; var div_data = "<strong>CUSTOMER DETAILS</strong>";
$("#order-title").replaceWith(div_data); $("#order-title").replaceWith(div_data);
$('.no_record').addClass('hide');
$('.customer-detail').removeClass('hide') ; $('.customer-detail').removeClass('hide') ;
$("#cus_name").text(data.name) $("#cus_name").text(data.name)
$("#cus_email").text(data.email) $("#cus_email").text(data.email)
$("#cus_contact_no").text(data.contact_no) $("#cus_contact_no").text(data.contact_no)
if(item_data.length>0){ if(item_data.length>0){
for(var field in item_data) { for(var field in item_data) {
if (item_data[field].item_name){ if (item_data[field].item_name){
@@ -178,7 +178,8 @@ function customer_details(id){
$(".summary-items tbody").append(row); $(".summary-items tbody").append(row);
} }
}else{ }else{
$('.no_record').removeClass('hide');
$("#crm_print").attr("disabled","disabled");
} }
} }
}); });

View File

@@ -18,7 +18,7 @@
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll"> <div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
<!--- Panel 0 - Completed --> <!--- Panel 0 - Completed -->
<div class="tab-pane" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll"> <div class="tab-pane" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<%= render :partial => 'queue' %> <%= render :partial => 'queue' %>
</div> </div>
@@ -30,7 +30,7 @@
</div> </div>
<!-- Panel 1 - Tables - End --> <!-- Panel 1 - Tables - End -->
<!-- Panel 2 - Rooms --> <!-- Panel 2 - Rooms -->
<div class="tab-pane" id="customer" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll"> <div class="tab-pane" id="customer" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<%= render :partial => 'customer' %> <%= render :partial => 'customer' %>
</div> </div>
<!-- Panel 2 - Rooms - End --> <!-- Panel 2 - Rooms - End -->
@@ -90,6 +90,9 @@
<th style="width:33%; text-align:center">Qty</th> <th style="width:33%; text-align:center">Qty</th>
<th style="width:33%; text-align:right">Price</th> <th style="width:33%; text-align:right">Price</th>
</tr> </tr>
<tr class="hide no_record">
<td style="width:44%; text-align:center;" id="no_record">No Order Items</td>
</tr>
</thead> </thead>
</table> </table>

View File

@@ -9,8 +9,8 @@
<title>SmartSales : Restaurant</title> <title>SmartSales : Restaurant</title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'CRM', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'CRM', 'data-turbolinks-track': 'reload' %>
</head> </head>
<body> <body>

View File

@@ -4,7 +4,7 @@
<strong>CRM</strong> <strong>CRM</strong>
</div> </div>
<div style="float:left;margin-top:3px;text-align:left; width:600px"> <div style="float:left;margin-top:3px;text-align:left; width:600px">
Queue | Bookings | Online Orders | <%= link_to 'Customer', crm_customers_path, :html=>":color:white" %> <%= link_to 'Queue', crm_dining_queues_path, :html=>":color:white" %> | Bookings | Online Orders | <%= link_to 'Customer', crm_customers_path, :html=>":color:white" %>
</div> </div>
<div style="float:right; margin-top:3px; text-align:right;width:200px;color:#ffffff"> <div style="float:right; margin-top:3px; text-align:right;width:200px;color:#ffffff">

View File

@@ -18,3 +18,7 @@ Rails.application.config.assets.precompile += %w( OQS.css )
Rails.application.config.assets.precompile += %w( OQS.js ) Rails.application.config.assets.precompile += %w( OQS.js )
Rails.application.config.assets.precompile += %w( settings.css ) Rails.application.config.assets.precompile += %w( settings.css )
# --- Customer/ Customer - Crm ----
Rails.application.config.assets.precompile += %w( CRM.css )
Rails.application.config.assets.precompile += %w( CRM.js )

View File

@@ -94,10 +94,10 @@ Rails.application.routes.draw do
#--------- Customer Relationship Management ------------# #--------- Customer Relationship Management ------------#
namespace :crm do namespace :crm do
root "home#index" #queue number root "home#index"
get 'customers/:sale_id/assign_sale_id', to: "customers#get_sale_id", :as => "assign_sale"#get sale id with customer for crm
resources :customers resources :customers
resources :dining_queues resources :dining_queues
get 'customers/:sale_id/assign_sale_id', to: "customers#get_sale_id", :as => "assign_sale"#get sale id with customer for crm
post "update_booking" , to: "bookings#update_booking", as: "update_booking"#assign and cancel post "update_booking" , to: "bookings#update_booking", as: "update_booking"#assign and cancel
post "update_sale" , to: "home#update_sale_by_customer"#update customer id in sale table post "update_sale" , to: "home#update_sale_by_customer"#update customer id in sale table
get '/print/:id', to: "home#print_order"#print order for crm get '/print/:id', to: "home#print_order"#print order for crm