crm update

This commit is contained in:
Aung Myo
2017-06-11 18:00:34 +06:30
parent 9c228dce5c
commit d65882ac5b
10 changed files with 146 additions and 75 deletions

View File

@@ -1,7 +1,38 @@
class Origami::CustomersController < BaseOrigamiController
#Form to add customer -
def index
end
def create
# GET /crm/customers/1
# GET /crm/customers/1.json
def show
end
def add_customer
@sale_id = params[:sale_id]
filter = params[:filter]
if filter.nil?
@crm_customers = Customer.order("name").page(params[:page])
else
@crm_customers = Customer.where("name LIKE ?", "%#{filter}%").order("name").page(params[:page])
end
@crm_customer = Customer.new
@membership = Customer.get_member_group
if @membership["status"] == true
@member_group = @membership["data"]
end
respond_to do |format|
# format.html { render :template => "crm/customers/index" }
format.html { render action: "index"}
format.json { render json: @crm_customers }
end
end
end

View File

@@ -3,6 +3,7 @@ class Origami::HomeController < BaseOrigamiController
@booking_orders = Order.get_booking_order_table()
@booking_rooms = Order.get_booking_order_rooms()
@orders = Order.get_orders()
end
def show
@@ -25,4 +26,23 @@ class Origami::HomeController < BaseOrigamiController
render :json => str.to_json
end
end
def update_sale_by_customer
sale = Sale.find(params[:sale_id])
status = sale.update_attributes(customer_id: params[:customer_id])
if status == true
render json: JSON.generate({:status => true})
else
render json: JSON.generate({:status => false, :error_message => "Record not found"})
end
end
def get_customer
@customer = Customer.find(params[:customer_id])
render :json => @customer.to_json
end
end