42 lines
895 B
Ruby
42 lines
895 B
Ruby
class Origami::CustomersController < BaseOrigamiController
|
|
#Form to add customer -
|
|
def index
|
|
|
|
|
|
end
|
|
|
|
# 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_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(2)
|
|
@crm_customer = Customer.new
|
|
|
|
if flash["errors"]
|
|
@crm_customer.valid?
|
|
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
|