diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 212c5288..903846df 100755 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -10,6 +10,7 @@ @import "BSBMaterial/style"; @import "BSBMaterial/themes/all-themes"; @import "reset"; +@import "fileinput.min"; /* Reset */ diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 1d0ad8e4..97f75135 100755 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -96,7 +96,7 @@ 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) diff --git a/app/views/crm/customers/edit.json.jbuilder b/app/views/crm/customers/edit.json.jbuilder index 60148085..555989a4 100755 --- a/app/views/crm/customers/edit.json.jbuilder +++ b/app/views/crm/customers/edit.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, :customer_type, :tax_profiles + :salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path, :tax_profiles json.url crm_customer_url(@crm_customer, format: :json) \ No newline at end of file diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 87f3cabd..96f1f985 100755 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -185,7 +185,7 @@ $(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(taxes); @@ -193,7 +193,7 @@ $(document).on('click',".customer_tr",function(){ $("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'}); }); - $('#customer_id').val(data.id); + $('#customer_id').val(data.id); $('#customer_name').val(data.name); $('#customer_company').val(data.company); $('#customer_contact_no').val(data.contact_no); @@ -205,6 +205,9 @@ $(document).on('click',".customer_tr",function(){ $('#paypar_account_no').val(data.paypar_account_no); $('#customer_address').val(data.address); $('#customer_date_of_birth').val(data.date_of_birth); + if(data.image_path.url!=undefined && data.image_path.url!=null){ + $('.menu-item-img .img-thumbnail').attr('src',data.image_path.url); + } $('#customer_membership_type').val(data.membership_type); $('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected'); if (data.gender == 'Male') { diff --git a/app/views/crm/customers/show.json.jbuilder b/app/views/crm/customers/show.json.jbuilder index ffc312a2..3a6a8cb9 100755 --- 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, :customer_type, :tax_profiles + :salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path, :tax_profiles json.url crm_customer_url(@crm_customer, format: :json) diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index afe36d39..4108fe82 100755 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -207,6 +207,21 @@ <%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%> +