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
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]
# GET /crm/customers
@@ -8,18 +8,17 @@ class Crm::CustomersController < ApplicationController
filter = params[:filter]
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)
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
@crm_customers = Kaminari.paginate_array(@crm_custome).page(params[:page]).per(5)
#@crm_customers = Customer.all
@crm_customer = Customer.new
# @membership = Customer.get_member_group
# if @membership["status"] == true
# @member_group = @membership["data"]
# end
@membership = Customer.get_member_group
if @membership["status"] == true
@member_group = @membership["data"]
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @crm_customers }
@@ -74,6 +73,7 @@ class Crm::CustomersController < ApplicationController
if response["status"] == true
puts "hhhhhhhhhhhhhhhhhh"
puts params[:sale_id]
puts response.to_json
customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
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]
# GET /crm/dining_queues

View File

@@ -5,7 +5,8 @@ class Crm::HomeController < BaseCrmController
@customer = Customer.all
from = Time.now.beginning_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)
end

View File

@@ -16,13 +16,5 @@
<%= f.button :submit %>
</div>
<% 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

@@ -68,52 +68,64 @@
</div>
<div class="col-lg-4">
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
<span class="patch_method"></span>
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group">
<%= f.input :name, :class => "form-control col-md-6 name" %>
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
<span class="patch_method"></span>
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<%= 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">
<%= f.input :name, :class => "form-control col-md-6 name" %>
</div>
<div class="form-group">
<%= f.input :company, :class => "form-control col-md-6 company" %>
</div>
<div class="form-group">
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
</div>
<div class="form-group">
<%= f.input :company, :class => "form-control col-md-6 company" %>
</div>
<div class="form-group">
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
</div>
</div>
<div class="form-group">
<%= f.input :email, :class => "form-control col-md-6 email" %>
<div class="form-group">
<%= f.input :email, :class => "form-control col-md-6 email" %>
</div>
<div class="form-group">
<label>Date Of Birth</label>
<%= f.text_field :date_of_birth,:class=>"form-control date_of_birth datepicker"%>
</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">
<label>Date Of Birth</label>
<%= f.text_field :date_of_birth,:class=>"form-control datepicker date_of_birth",:readonly =>true, :value => @date_of_birth%>
</div>
<div class="form-group">
<%= f.input :membership_type, :class => "form-control col-md-6 membership_type" %>
</div>
<div class="form-group">
<%= f.input :membership_authentication_code, :class => "form-control col-md-6 membership_authentication_code" %>
</div>
<div class="form-group">
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
</div>
<%end%>
<div class="form-group">
<%= f.input :membership_type, :class => "form-control col-md-6 membership_type" %>
</div>
<div class="form-group">
<%= f.input :membership_authentication_code, :class => "form-control col-md-6 membership_authentication_code" %>
</div>
<div class="form-group">
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
</div>
<%end%>
</div>
</div>
<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 type="text/javascript">
$(function () {
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>

View File

@@ -38,7 +38,6 @@
$(function(){
$(".booking_click").on("click", function(){
$(this).css('background-color', '#CCC');
$(".summary-items tbody tr").remove();
$("#cancel").removeAttr("disabled");
$("#assign").removeAttr("disabled");
@@ -94,7 +93,6 @@ $(function(){
$(".customer_detail").on("click", function(){
$(this).css('background-color', '#CCC');
$(".summary-items tbody tr").remove();
$("#crm_print").removeAttr("disabled");
var id = $(this).attr('data-ref');
@@ -118,13 +116,14 @@ function show_details(url_item){
success: function(data) {
item_data = data.order_items;
//console.log(item_data.length);
$("#table").text(data.table_name)
$("#order_at").text(data.checkin_at)
$("#order_by").text(data.checkin_by)
$("#assign").val(data.id)
$("#cancel").val(data.id)
$('.no_record').addClass('hide');
for(var field in item_data) {
if (item_data[field].item_name){
var price = parseFloat(item_data[field].price).toFixed(2);
@@ -157,13 +156,14 @@ function customer_details(id){
$("#for-booking").remove();
var div_data = "<strong>CUSTOMER DETAILS</strong>";
$("#order-title").replaceWith(div_data);
$('.no_record').addClass('hide');
$('.customer-detail').removeClass('hide') ;
$("#cus_name").text(data.name)
$("#cus_email").text(data.email)
$("#cus_contact_no").text(data.contact_no)
if(item_data.length>0){
for(var field in item_data) {
if (item_data[field].item_name){
@@ -178,7 +178,8 @@ function customer_details(id){
$(".summary-items tbody").append(row);
}
}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">
<!--- 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' %>
</div>
@@ -30,7 +30,7 @@
</div>
<!-- Panel 1 - Tables - End -->
<!-- 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' %>
</div>
<!-- Panel 2 - Rooms - End -->
@@ -90,6 +90,9 @@
<th style="width:33%; text-align:center">Qty</th>
<th style="width:33%; text-align:right">Price</th>
</tr>
<tr class="hide no_record">
<td style="width:44%; text-align:center;" id="no_record">No Order Items</td>
</tr>
</thead>
</table>

View File

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

View File

@@ -4,7 +4,7 @@
<strong>CRM</strong>
</div>
<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 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( 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 ------------#
namespace :crm do
root "home#index" #queue number
get 'customers/:sale_id/assign_sale_id', to: "customers#get_sale_id", :as => "assign_sale"#get sale id with customer for crm
root "home#index"
resources :customers
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_sale" , to: "home#update_sale_by_customer"#update customer id in sale table
get '/print/:id', to: "home#print_order"#print order for crm