add customer tax

This commit is contained in:
Yan
2017-08-08 18:02:05 +06:30
parent f46d786859
commit 1685713ff5
5 changed files with 52 additions and 30 deletions

View File

@@ -17,6 +17,8 @@ class Crm::CustomersController < BaseCrmController
@crm_customer = Customer.new
@count_customer = Customer.count_customer
@taxes = TaxProfile.all.order("order_by asc")
# if flash["errors"]
# @crm_customer.valid?
# end
@@ -67,11 +69,14 @@ class Crm::CustomersController < BaseCrmController
# POST /crm/customers
# POST /crm/customers.json
def create
def create
@crm_customers = Customer.new(customer_params)
respond_to do |format|
if @crm_customers.save
# update tax profile
customer = Customer.find(@crm_customers.customer_id)
customer.update_attributes(tax_profiles: params[:customer][:tax_profiles].to_json)
name = customer_params[:name]
phone = customer_params[:contact_no]
email = customer_params[:email]
@@ -346,7 +351,7 @@ end
# Never trust parameters from the scary internet, only allow the white list through.
def customer_params
params.require(:customer).permit(:name, :company, :contact_no, :email,
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no)
params.require(:customer).permit(:id, :name, :company, :contact_no, :email,
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type)
end
end