|
| 1 | +<%= form_for @dossier, url: update_identite_dossier_path(@dossier), html: { id: 'identite-form', class: "form", "data-controller" => "for-tiers" } do |f| %> |
| 2 | + <%= f.hidden_field :for_tiers %> |
| 3 | + |
| 4 | + <% if for_tiers? %> |
| 5 | + <div class="fr-alert fr-alert--info fr-mb-4w"> |
| 6 | + <p class="fr-notice__text"> |
| 7 | + <%= t('.for_tiers.callout_text') %> |
| 8 | + |
| 9 | + <%= link_to(t('.for_tiers.callout_link'), |
| 10 | + 'https://www.legifrance.gouv.fr/codes/section_lc/LEGITEXT000006070721/LEGISCTA000006136404/#LEGISCTA000006136404', |
| 11 | + title: helpers.new_tab_suffix(t('.for_tiers.callout_link_title')), |
| 12 | + **helpers.external_link_attributes) %> |
| 13 | + </p> |
| 14 | + </div> |
| 15 | + <div class="border-grey fr-p-3w fr-mb-4w"> |
| 16 | + <fieldset class="fr-fieldset mandataire-infos fr-mb-0"> |
| 17 | + <legend class="fr-fieldset__legend fr-fieldset__legend--regular"> |
| 18 | + <h2 class="fr-h5"><%= t('.for_self.self_title') %></h2> |
| 19 | + </legend> |
| 20 | + |
| 21 | + <% if @dossier.france_connected_with_one_identity? %> |
| 22 | + <div class="fr-highlight fr-text--sm"> |
| 23 | + <%= t('.identity_locked_by_france_connect') %> |
| 24 | + </div> |
| 25 | + <% end %> |
| 26 | + |
| 27 | + <div class="fr-fieldset__element fr-fieldset__element--short-text"> |
| 28 | + <%= render Dsfr::InputComponent.new(form: f, attribute: :mandataire_first_name, opts: { autocomplete: 'given-name', disabled: mandataire_identity_locked? }) %> |
| 29 | + </div> |
| 30 | + |
| 31 | + <div class="fr-fieldset__element fr-fieldset__element--short-text"> |
| 32 | + <%= render Dsfr::InputComponent.new(form: f, attribute: :mandataire_last_name, opts: { autocomplete: 'family-name', disabled: mandataire_identity_locked? }) %> |
| 33 | + </div> |
| 34 | + </fieldset> |
| 35 | + </div> |
| 36 | + <% elsif can_personal_data_be_transmitted? %> |
| 37 | + <%= render Dsfr::AlertComponent.new(title: t('.for_self.callout_title'), state: :info, with_prefix: false, extra_class_names: 'fr-mb-2w') do |c| %> |
| 38 | + <% c.with_body do %> |
| 39 | + <%= t('.for_self.callout_text') %> |
| 40 | + <% end %> |
| 41 | + <% end %> |
| 42 | + <% end %> |
| 43 | + |
| 44 | + <%= f.fields_for :individual, include_id: false do |individual| %> |
| 45 | + <div class="border-grey fr-p-3w fr-mb-4w"> |
| 46 | + <fieldset class="fr-fieldset individual-infos fr-mb-0"> |
| 47 | + <legend class="fr-fieldset__legend fr-fieldset__legend--regular"> |
| 48 | + <h2 class="fr-h5"> |
| 49 | + <% if for_tiers? %> |
| 50 | + <%= t('.for_tiers.beneficiaire_title') %> |
| 51 | + <% else %> |
| 52 | + <%= t('.for_self.self_title') %> |
| 53 | + <% end %> |
| 54 | + </h2> |
| 55 | + </legend> |
| 56 | + |
| 57 | + <% if @dossier.france_connected_with_one_identity? && !for_tiers? %> |
| 58 | + <div class="fr-highlight fr-text--sm"> |
| 59 | + <%= t('.identity_locked_by_france_connect') %> |
| 60 | + </div> |
| 61 | + <% end %> |
| 62 | + |
| 63 | + <% unless @dossier.procedure.no_gender? %> |
| 64 | + <div class="fr-fieldset__element"> |
| 65 | + <%= render Dsfr::RadioButtonListComponent.new( |
| 66 | + form: individual, |
| 67 | + target: :gender, |
| 68 | + buttons: [ |
| 69 | + { label: Individual.human_attribute_name('gender.female'), value: Individual::GENDER_FEMALE, required: true, disabled: identity_locked?, translate: "no" }, |
| 70 | + { label: Individual.human_attribute_name('gender.male'), value: Individual::GENDER_MALE, required: true, disabled: identity_locked?, translate: "no" } |
| 71 | + ], |
| 72 | + error: individual.object.errors.full_messages_for(:gender).first, |
| 73 | + inline: true |
| 74 | + ) do %> |
| 75 | + <%= t('activerecord.attributes.individual.gender') %> |
| 76 | + <%= render EditableChamp::AsteriskMandatoryComponent.new %> |
| 77 | + <% end %> |
| 78 | + </div> |
| 79 | + <% end %> |
| 80 | + |
| 81 | + <div class="fr-fieldset__element fr-fieldset__element--short-text"> |
| 82 | + <% if for_tiers? %> |
| 83 | + <%= render Dsfr::InputComponent.new(form: individual, attribute: :prenom) %> |
| 84 | + <% else %> |
| 85 | + <%= render Dsfr::InputComponent.new(form: individual, attribute: :prenom, opts: { autocomplete: 'given-name', disabled: identity_locked? }) %> |
| 86 | + <% end %> |
| 87 | + </div> |
| 88 | + |
| 89 | + <div class="fr-fieldset__element fr-fieldset__element--short-text"> |
| 90 | + <% if for_tiers? %> |
| 91 | + <%= render Dsfr::InputComponent.new(form: individual, attribute: :nom) %> |
| 92 | + <% else %> |
| 93 | + <%= render Dsfr::InputComponent.new(form: individual, attribute: :nom, opts: { autocomplete: 'family-name', disabled: identity_locked? }) %> |
| 94 | + <% end %> |
| 95 | + </div> |
| 96 | + |
| 97 | + <% if @dossier.procedure.ask_birthday? %> |
| 98 | + <div class="fr-fieldset__element"> |
| 99 | + <%= render Dsfr::InputComponent.new(form: individual, attribute: :birthdate, input_type: :date_field, |
| 100 | + opts: { placeholder: 'Format : AAAA-MM-JJ', max: Date.today.iso8601, min: "1900-01-01", autocomplete: 'bday' }) %> |
| 101 | + </div> |
| 102 | + <% end %> |
| 103 | + |
| 104 | + <% if for_tiers? %> |
| 105 | + <div class="fr-fieldset__element"> |
| 106 | + <div class="fr-checkbox-group fr-mt-2w <%= 'fr-checkbox-group--error' if individual.object.errors.include?(:notification_method) %>"> |
| 107 | + <%= individual.check_box :notification_method, { |
| 108 | + id: "notification_method_checkbox", |
| 109 | + checked: email_notifications?(individual), |
| 110 | + "data-action" => "for-tiers#toggleEmailInput", |
| 111 | + "data-for-tiers-target" => "notificationMethodCheckbox", |
| 112 | + "aria-describedby" => individual.object.errors.include?(:notification_method) ? "individual_notification_method-error" : nil |
| 113 | + }, 'email', 'no_notification' %> |
| 114 | + |
| 115 | + <label class="fr-label" for="notification_method_checkbox"> |
| 116 | + <%= t('.for_tiers.notify_beneficiary') %> |
| 117 | + </label> |
| 118 | + |
| 119 | + <% if individual.object.errors.include?(:notification_method) %> |
| 120 | + <p |
| 121 | + class="fr-error-text" |
| 122 | + id="individual_notification_method-error" |
| 123 | + > |
| 124 | + <%= individual.object.errors.full_messages_for(:notification_method).first %> |
| 125 | + </p> |
| 126 | + <% end %> |
| 127 | + </div> |
| 128 | + </div> |
| 129 | + <div |
| 130 | + class="fr-fieldset__element fr-fieldset__element--short-text <%= 'hidden' unless email_notifications?(individual) %>" |
| 131 | + data-for-tiers-target="emailContainer" |
| 132 | + > |
| 133 | + <%= render Dsfr::InputComponent.new(form: individual, attribute: :email, input_type: :email_field, opts: { "data-for-tiers-target" => "emailInput" }) %> |
| 134 | + </div> |
| 135 | + <% end %> |
| 136 | + </fieldset> |
| 137 | + </div> |
| 138 | + <% end %> |
| 139 | + |
| 140 | + <div class="fr-btns-group fr-btns-group--inline"> |
| 141 | + <%= link_to t('views.users.dossiers.identite.back'), back_url, class: "fr-btn fr-btn--secondary" %> |
| 142 | + <%= f.submit t('views.users.dossiers.identite.continue'), class: "fr-btn", "data-email-input-target": "next" %> |
| 143 | + </div> |
| 144 | +<% end %> |
0 commit comments