bootstrap datepicker and customer save

This commit is contained in:
Aung Myo
2017-06-06 14:16:40 +06:30
parent 324f1e3b24
commit d2ce74f648
9 changed files with 146 additions and 46 deletions

View File

@@ -5,6 +5,13 @@ class Crm::CustomersController < ApplicationController
# GET /crm/customers.json
def index
@crm_customers = Customer.all
@customers = Customer.new
@membership = Customer.get_member_group
respond_to do |format|
format.html # index.html.erb
format.json { render json: @crm_customers }
end
end
# GET /crm/customers/1
@@ -15,7 +22,8 @@ class Crm::CustomersController < ApplicationController
# GET /crm/customers/new
def new
@crm_customer = Customer.new
@membership = Customer.get_member_group
@membership = Customer.get_member_group()
end
# GET /crm/customers/1/edit
@@ -25,7 +33,7 @@ class Crm::CustomersController < ApplicationController
# POST /crm/customers
# POST /crm/customers.json
def create
@crm_customer = Customer.new(crm_customer_params)
@crm_customer = Customer.new(customer_params)
respond_to do |format|
if @crm_customer.save
@@ -42,7 +50,7 @@ class Crm::CustomersController < ApplicationController
# PATCH/PUT /crm/customers/1.json
def update
respond_to do |format|
if @crm_customer.update(crm_customer_params)
if @crm_customer.update(customer_params)
format.html { redirect_to @crm_customer, notice: 'Customer was successfully updated.' }
format.json { render :show, status: :ok, location: @crm_customer }
else
@@ -69,7 +77,7 @@ class Crm::CustomersController < ApplicationController
end
# Never trust parameters from the scary internet, only allow the white list through.
def crm_customer_params
params.require(:crm_customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
def customer_params
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
end
end