Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into staging

This commit is contained in:
Aung Myo
2017-08-09 11:55:31 +06:30
9 changed files with 124 additions and 82 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,16 @@ class Crm::CustomersController < BaseCrmController
# POST /crm/customers
# POST /crm/customers.json
def create
def create
# Remove "" default first
params[:customer][:tax_profiles].delete_at(0)
@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 +353,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