diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb
index cb2c6dd2..180901ad 100644
--- a/app/controllers/crm/customers_controller.rb
+++ b/app/controllers/crm/customers_controller.rb
@@ -69,7 +69,9 @@ 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|
diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb
index 13896e85..5f1d1b46 100644
--- a/app/views/crm/customers/_new_form.html.erb
+++ b/app/views/crm/customers/_new_form.html.erb
@@ -95,15 +95,14 @@
-
-
-
+
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb
index f2d28b19..b1b1272b 100644
--- a/app/views/crm/customers/index.html.erb
+++ b/app/views/crm/customers/index.html.erb
@@ -129,7 +129,14 @@ $(document).on('click',".customer_tr",function(){
url: url,
data: {},
dataType: "json",
- success: function(data) {
+ success: function(data) {
+ // Selected for Taxes
+ //var taxes = JSON.stringify(data.tax_profiles);
+ var parse_taxes = JSON.parse(data.tax_profiles);
+ $.each(parse_taxes, function(i, value){
+ $("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected");
+ });
+
$('#customer_id').val(data.id);
$('#customer_name').val(data.name);
$('#customer_company').val(data.company);
@@ -138,6 +145,7 @@ $(document).on('click',".customer_tr",function(){
$('#customer_salutation').val(data.salutation);
$('#customer_nrc_no').val(data.nrc_no);
$('#customer_card_no').val(data.card_no);
+ $('#customer_type').val(data.customer_type);
$('#paypar_account_no').val(data.paypar_account_no);
$('#customer_address').val(data.address);
$('#customer_date_of_birth').val(data.date_of_birth);
diff --git a/app/views/crm/customers/show.json.jbuilder b/app/views/crm/customers/show.json.jbuilder
index 5fd0410a..ffc312a2 100644
--- a/app/views/crm/customers/show.json.jbuilder
+++ b/app/views/crm/customers/show.json.jbuilder
@@ -1,4 +1,4 @@
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
:membership_id, :membership_type, :membership_authentication_code,
- :salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no
+ :salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
json.url crm_customer_url(@crm_customer, format: :json)