queue and crm view updated

This commit is contained in:
Aung Myo
2017-06-09 09:29:25 +06:30
parent ea4f50e779
commit 35277ac000
41 changed files with 685 additions and 318 deletions

View File

@@ -5,12 +5,21 @@ class Crm::CustomersController < ApplicationController
# GET /crm/customers.json
def index
@sale_id = 0
@crm_customers = Customer.all
@crm_customer = Customer.new
@membership = Customer.get_member_group
if @membership["status"] == true
@member_group = @membership["data"]
filter = params[:filter]
if filter.nil?
@crm_custome = 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])
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
respond_to do |format|
format.html # index.html.erb
format.json { render json: @crm_customers }

View File

@@ -0,0 +1,74 @@
class Crm::DiningQueuesController < ApplicationController
before_action :set_dining_queue, only: [:show, :edit, :update, :destroy]
# GET /crm/dining_queues
# GET /crm/dining_queues.json
def index
@dining_queues = DiningQueue.all
end
# GET /crm/dining_queues/1
# GET /crm/dining_queues/1.json
def show
end
# GET /crm/dining_queues/new
def new
@dining_queue = DiningQueue.new
end
# GET /crm/dining_queues/1/edit
def edit
end
# POST /crm/dining_queues
# POST /crm/dining_queues.json
def create
@dining_queue = DiningQueue.new(dining_queue_params)
respond_to do |format|
if @dining_queue.save
format.html { redirect_to crm_dining_queues_path, notice: 'Dining queue was successfully created.' }
format.json { render :show, status: :created, location: @dining_queue }
else
format.html { render :new }
format.json { render json: @dining_queue.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /crm/dining_queues/1
# PATCH/PUT /crm/dining_queues/1.json
def update
respond_to do |format|
if @dining_queue.update(dining_queue_params)
format.html { redirect_to crm_dining_queues_path, notice: 'Dining queue was successfully updated.' }
format.json { render :show, status: :ok, location: @dining_queue }
else
format.html { render :edit }
format.json { render json: @dining_queue.errors, status: :unprocessable_entity }
end
end
end
# DELETE /crm/dining_queues/1
# DELETE /crm/dining_queues/1.json
def destroy
@dining_queue.destroy
respond_to do |format|
format.html { redirect_to crm_dining_queues_path, notice: 'Dining queue was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_dining_queue
@dining_queue = DiningQueue.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def dining_queue_params
params.require(:dining_queue).permit(:name, :contact_no, :queue_no)
end
end

View File

@@ -1,8 +1,12 @@
class Crm::HomeController < BaseCrmController
def index
@booking = Booking.all
@booking = Booking.all
@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)
# .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
end