2023-03-28 18:00:27 +02:00
|
|
|
%label.notice{ for: code_postal_input_id }= t('.postal_code')
|
2023-03-21 14:44:03 +01:00
|
|
|
= @form.text_field :code_postal, required: @champ.required?, id: code_postal_input_id, class: "width-33-desktop width-100-mobile small-margin"
|
2023-04-11 10:49:01 +02:00
|
|
|
- if @champ.code_postal?
|
2023-03-21 14:44:03 +01:00
|
|
|
- if commune_options.empty?
|
2023-04-11 10:49:01 +02:00
|
|
|
.fr-error-text.mb-4= t('.not_found', postal_code: @champ.code_postal)
|
2023-03-21 14:44:03 +01:00
|
|
|
- elsif commune_options.size <= 3
|
|
|
|
%fieldset.radios
|
|
|
|
- commune_options.each.with_index do |(option, value), index|
|
|
|
|
%label
|
|
|
|
= @form.radio_button :value, value, checked: @champ.selected == value, id: index == 0 ? @champ.input_id : nil
|
|
|
|
= option
|
|
|
|
- else
|
|
|
|
= @form.select :value, commune_options, commune_select_options, required: @champ.required?, id: @champ.input_id, aria: { describedby: @champ.describedby_id }, class: "width-33-desktop width-100-mobile"
|