.row .col-sm-12 .box .box-header.dark-background .box-content = form_for [:user, @registration], html: { multipart: true, class: 'form form-horizontal'} do |f| = form_group(@registration, :product_id) do %label.col-md-2.control-label{for: :product_id} Printer* .col-md-5 = f.collection_select :product_id, Product.all, :id, :name, { prompt: true }, class: 'form-control' .product-variations = form_group(@registration, :variation_id) do %label.col-md-2.control-label{for: :variation_id} Print & Color Management Software* .col-md-5 = f.collection_select :variation_id, [], :id, :name, { prompt: true }, class: 'form-control' .product-options = f.hidden_field :options_array, multiple: true, value: nil = form_group(@registration, :serial_number) do #help_sn.icon-question-sign.left{ "data-featherlight" => "image", :href => "../../assets/snhelp.jpg"} %label.col-md-2.control-label{for: :serial_number} Serial Number* .col-md-5 = f.text_field :serial_number, class: 'form-control' = form_group(@registration, :powerdriver_challenge) do #help_sn.icon-question-sign.left{ "data-featherlight" => "../../assets/reg_instructions.png"} %label.col-md-2.control-label{for: :powerdriver_challenge} Product ID* .col-md-5 = f.text_field :powerdriver_challenge, class: 'form-control' = form_group(@registration, :reseller_id) do %label.col-md-2.control-label{for: :reseller_id} Reseller* .col-md-5 = f.collection_select :reseller_id, Reseller.all, :id, :name, { prompt: true }, class: 'form-control' #sawgrassable = form_group(@registration, :date_of_purchase) do %label.col-md-2.control-label{for: :date_of_purchase} Date of Printer Purchase .col-md-5.datepicker.input-group = f.text_field :date_of_purchase, class: 'form-control', data: { format: 'yyyy-MM-dd' }, :data => {'provide' => 'datepicker'} %span.input-group-addon %span.icon-calendar{ data: { 'date-icon' => 'icon-calendar', 'time-icon' => 'icon-time'}, id: 'cal_icon' } = form_group(@registration, :proof_of_purchase) do %label.col-md-2.control-label{for: :proof_of_purchase} Proof of Printer Purchase .col-md-5 - unless @registration.has_proof_of_purchase? %small jpg, png, pdf or tiff up to 10MB = f.file_field :proof_of_purchase, class: 'form-control' - else = f.file_field :proof_of_purchase, class: 'form-control' = link_to("Proof of Purchase", @registration.proof_of_purchase.url) =form_group(@registration, :has_warranty) do %label.col-md-2.control-label Extended Warranty? .col-md-5 = f.collection_radio_buttons :has_warranty, [[true, "Yes"], [false, "No"]], :first, :last .warranty{:id => "warranty"} = form_group(@registration, :reseller_warranty_code) do %label.col-md-2.control-label{for: :reseller_warranty_code} Warranty Code .col-md-5 = f.text_field :reseller_warranty_code, class: 'form-control' = form_group(@registration, :registration_reason) do %label.col-md-2.control-label{for: :registration_reason} Registration Reason* .col-md-5 = f.collection_select :registration_reason, ProductRegistration::REASONS, :first, :last, { prompt: true }, class: 'form-control' .form-actions.form-actions-padding-sm .row .col-md-10.col-md-offset-2 = f.submit "Save", class: 'btn btn-primary' :javascript window.registration = #{@registration.to_json}; :javascript code = "#{false if @registration.reseller_warranty_code.nil? || true}" printer = "#{ @registration.product_id }" country = "#{ current_user.profile.country }" $(document).ready(function(){ $('#product_registration_serial_number').attr('disabled', 'disabled'); if (code == true){ $('#product_registration_reseller_warranty_code').attr('disabled', 'disabled'); } $('#product_registration_registration_reason').attr('disabled', 'disabled'); $('#product_registration_product_id').attr('disabled', 'disabled'); $('#product_registration_variation_id').attr('disabled', 'disabled'); $('#product_registration_powerdriver_challenge').attr('disabled', 'disabled'); $('#product_registration_powerdriver_response').attr('disabled', 'disabled'); if( printer != 1 && product != 2){ $('#sawgrassable1').show(); $('#sawgrassable2').show(); $('#sawgrassable3').show(); }else{ $('#sawgrassable1').show(); $('#sawgrassable2').show(); $('#sawgrassable3').show(); } $('#warranty').hide(); $('#help_sn').hide(); $('#cal_icon').click(function(){ $('#product_registration_date_of_purchase').focus(); }) $('#product_registration_has_warranty_false').click(function(){ if($(this).is(":checked")){ $('#warranty').hide() } }) $('#product_registration_has_warranty_true').click(function(){ if($(this).is(":checked")){ $('#warranty').show() } }) }) function showSnHelp(){ console.log("Help") }