.form-group .row .col-sm-3 div#container_checkbox style="padding-top: 28px;" = f.check_box :perecivel, class: "form-control-sm", id: "checkbox_alimenticio" ==< f.label :perecivel, "Os materiais são perecíveis?", class: "control-label mt-4" = error_for @recebimento_de_material, :perecivel .col-sm-2#data_de_validade = f.label :validade, "Data de Validade*", class: "control-label" = f.calendar_field :validade, id: "validade" = error_for @recebimento_de_material, :validade .form-group#pereciveis .row .col-sm-3 = f.label "Odor*", class: "control-label", for: "normal-field" = f.select :odor, options_for_select( \ @odores.collect {|t|[ "#{GestaoDeEstoque::RecebimentoDeMaterial.localizar(:odor, t[0])}", t[0] ] }, @recebimento_de_material.try(:odor) \ ), { include_blank: 'Selecione' }, class: 'form-control s2' = error_for @recebimento_de_material, :odor .col-sm-3 = f.label "Textuta*", class: "control-label", for: "normal-field" = f.select :textura, options_for_select( \ @texturas.collect {|t|[ "#{GestaoDeEstoque::RecebimentoDeMaterial.localizar(:textura, t[0])}", t[0] ] }, @recebimento_de_material.try(:textura) \ ), { include_blank: 'Selecione' }, class: 'form-control s2' = error_for @recebimento_de_material, :textura .col-sm-3 = f.label "Cor*", class: "control-label", for: "normal-field" = f.select :cor, options_for_select( \ @cores.collect {|t|[ "#{GestaoDeEstoque::RecebimentoDeMaterial.localizar(:cor, t[0])}", t[0] ] }, @recebimento_de_material.try(:cor) \ ), { include_blank: 'Selecione' }, class: 'form-control s2' = error_for @recebimento_de_material, :cor .col-sm-3 = f.label "Aspecto Geral*", class: "control-label", for: "normal-field" = f.select :aspecto_geral, options_for_select( \ @aspectos_gerais.collect {|t|[ "#{GestaoDeEstoque::RecebimentoDeMaterial.localizar(:aspecto_geral, t[0])}", t[0] ] }, @recebimento_de_material.try(:aspecto_geral) \ ), { include_blank: 'Selecione' }, class: 'form-control s2' = error_for @recebimento_de_material, :aspecto_geral .form-group#nao_pereciveis .row .col-sm-3 = f.label :lote, "Lote de Fabricação*", class: "control-label" = f.text_field :lote, class: "form-control" = error_for @recebimento_de_material, :lote .col-sm-3 = f.label "Condição da Embalagem", class: "control-label", for: "normal-field" = f.select :condicao_da_embalagem, options_for_select( \ @condicoes_da_embalagem.collect {|t|[ "#{GestaoDeEstoque::RecebimentoDeMaterial.localizar(:condicao_da_embalagem, t[0])}", t[0] ] }, @recebimento_de_material.try(:condicao_da_embalagem) \ ), { include_blank: 'Selecione' }, class: 'form-control s2' = error_for @recebimento_de_material, :condicao_da_embalagem - content_for :js do javascript: $(function() { let checkboxAlimenticio = $('#checkbox_alimenticio') let dataDeValidade = $('#data_de_validade') let naoPereciveis = $('#nao_pereciveis') let pereciveis = $('#pereciveis') $(checkboxAlimenticio).on('change', function(e) { if (checkboxAlimenticio.is(':checked')) { $(pereciveis).show() $(dataDeValidade).show() $(naoPereciveis).show() } else { $(dataDeValidade).hide() $(pereciveis).hide() $(naoPereciveis).show() } }) $(checkboxAlimenticio).trigger('change') })