diff --git a/app/assets/javascripts/CRM.js b/app/assets/javascripts/CRM.js new file mode 100644 index 00000000..66f161af --- /dev/null +++ b/app/assets/javascripts/CRM.js @@ -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 \ No newline at end of file diff --git a/app/controllers/crm/bookings_controller.rb b/app/controllers/crm/bookings_controller.rb index eeb19f75..65511512 100644 --- a/app/controllers/crm/bookings_controller.rb +++ b/app/controllers/crm/bookings_controller.rb @@ -1,4 +1,4 @@ -class Crm::BookingsController < ApplicationController +class Crm::BookingsController < BaseCrmController def update_booking booking = Booking.find(params[:booking_id]) diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index fff260e2..886f66d6 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -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 diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index 235703d2..9e8cd06c 100644 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -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 diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index c8d919e5..d1ee475b 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -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 diff --git a/app/views/crm/customers/_form.html.erb b/app/views/crm/customers/_form.html.erb index 9e1046c3..c913651a 100644 --- a/app/views/crm/customers/_form.html.erb +++ b/app/views/crm/customers/_form.html.erb @@ -16,13 +16,5 @@ <%= f.button :submit %> <% end %> - + \ No newline at end of file diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 786a9f42..d76c94ac 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -68,52 +68,64 @@