From c3dcecbaa04845016d50cf99ecfed71c63a5a5ab Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Tue, 14 Nov 2023 15:11:17 +0000 Subject: [PATCH] Layout --- app/helpers/dossier_helper.rb | 10 +- .../users/dossiers/_dossiers_list.html.haml | 4 + app/views/users/dossiers/identite.html.haml | 115 ++++++++++++++---- config/locales/en.yml | 4 +- config/locales/fr.yml | 6 +- config/locales/models/dossier/fr.yml | 5 + config/locales/models/individual/fr.yml | 5 + config/locales/shared.en.yml | 2 + config/locales/shared.fr.yml | 2 + 9 files changed, 123 insertions(+), 30 deletions(-) diff --git a/app/helpers/dossier_helper.rb b/app/helpers/dossier_helper.rb index 6dfeb1f40c7..709ebb0fd65 100644 --- a/app/helpers/dossier_helper.rb +++ b/app/helpers/dossier_helper.rb @@ -108,7 +108,9 @@ def correction_resolved_badge end def demandeur_dossier(dossier) - if dossier.procedure.for_individual? + if dossier.procedure.for_individual? && dossier.for_tiers + "#{t('shared.dossiers.beneficiaire')} : #{dossier&.individual&.nom} #{dossier&.individual&.prenom}" + elsif dossier.procedure.for_individual? "#{dossier&.individual&.nom} #{dossier&.individual&.prenom}" else if dossier.etablissement.present? @@ -119,6 +121,12 @@ def demandeur_dossier(dossier) end end + def mandataire_dossier(dossier) + if dossier.for_tiers + "#{t('shared.dossiers.mandataire')} : #{dossier.mandataire_first_name} #{dossier.mandataire_last_name}" + end + end + def safe_expiration_date(dossier) l(dossier.expiration_date, format: '%d/%m/%Y') end diff --git a/app/views/users/dossiers/_dossiers_list.html.haml b/app/views/users/dossiers/_dossiers_list.html.haml index e2f759b32ac..5955692d43b 100644 --- a/app/views/users/dossiers/_dossiers_list.html.haml +++ b/app/views/users/dossiers/_dossiers_list.html.haml @@ -17,6 +17,10 @@ %p.fr-icon--sm.fr-icon-user-line = demandeur_dossier(dossier) + - if mandataire_dossier(dossier).present? + %p.fr-icon--sm.fr-icon-group-line + = mandataire_dossier(dossier) + - if dossier.hidden_by_user? %p.fr-icon--sm.fr-icon-delete-line = t('views.users.dossiers.dossiers_list.deleted', date: l(dossier.hidden_by_user_at.to_date)) diff --git a/app/views/users/dossiers/identite.html.haml b/app/views/users/dossiers/identite.html.haml index 288e4487c15..cae2a9222ab 100644 --- a/app/views/users/dossiers/identite.html.haml +++ b/app/views/users/dossiers/identite.html.haml @@ -3,37 +3,98 @@ = render partial: "shared/dossiers/submit_is_over", locals: { dossier: @dossier } - if !dossier_submission_is_closed?(@dossier) - = form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f| + = form_for @dossier, url: update_identite_dossier_path(@dossier), html: { class: "form", "data-controller" => "for-tiers" } do |f| + + %fieldset#radio-rich-hint.fr-fieldset{ "aria-labelledby" => "radio-rich-hint-legend radio-rich-hint-messages" } + %legend#radio-rich-hint-legend.fr-fieldset__legend--regular.fr-fieldset__legend + Ce dossier est - %fieldset.fr-fieldset - %legend.fr-fieldset__legend--regular.fr-fieldset__legend - %h2.fr-h4= t('views.users.dossiers.identite.identity_data') .fr-fieldset__element - %fieldset.fr-fieldset - %legend.fr-fieldset__legend--regular.fr-fieldset__legend - = t('activerecord.attributes.individual.gender') - = render EditableChamp::AsteriskMandatoryComponent.new - .fr-fieldset__element - .fr-radio-group - = f.radio_button :gender, Individual::GENDER_FEMALE, required: true, id: "identite_champ_radio_#{Individual::GENDER_FEMALE}" - %label.fr-label{ for: "identite_champ_radio_#{Individual::GENDER_FEMALE}" } - = Individual.human_attribute_name('gender.female') - .fr-fieldset__element - .fr-radio-group - = f.radio_button :gender, Individual::GENDER_MALE, required: true, id: "identite_champ_radio_#{Individual::GENDER_MALE}" - %label.fr-label{ for: "identite_champ_radio_#{Individual::GENDER_MALE}" } - = Individual.human_attribute_name('gender.male') + .fr-radio-group.fr-radio-rich + = f.radio_button :for_tiers, false, required: true, id: "radio-self-manage", "data-for-tiers-target" => "forTiers" + %label.fr-label{ for: "radio-self-manage" } + = t('activerecord.attributes.dossier.for_tiers.false') + .fr-radio-rich__img + %span.fr-icon-user-fill + .fr-fieldset__element + .fr-radio-group.fr-radio-rich + = f.radio_button :for_tiers, true, required: true, id: "radio-tiers-manage", "data-for-tiers-target" => "forTiers" + %label.fr-label{ for: "radio-tiers-manage" } + = t('activerecord.attributes.dossier.for_tiers.true') + .fr-radio-rich__img + %span.fr-icon-parent-fill + + %div{ "data-for-tiers-target" => "mandataireBlock" } + .fr-alert.fr-alert--info.fr-mb-2w + %p.fr-notice__text= t('views.users.dossiers.identite.callout_text') + + %legend.fr-fieldset__legend--regular.fr-fieldset__legend + %h2.fr-h4= t('views.users.dossiers.identite.mandataire_title') + .fr-fieldset__element.fr-fieldset__element--short-text + = render Dsfr::InputComponent.new(form: f, attribute: :mandataire_first_name, opts: { "data-for-tiers-target" => "mandataireFirstName" }) do |c| + - c.with_label do + = t('activerecord.attributes.dossier.mandataire_first_name') - .fr-fieldset__element.fr-fieldset__element--short-text - = render Dsfr::InputComponent.new(form: f, attribute: :prenom, opts: { autocomplete: 'given-name' }) + .fr-fieldset__element.fr-fieldset__element--short-text + = render Dsfr::InputComponent.new(form: f, attribute: :mandataire_last_name, opts: { "data-for-tiers-target" => "mandataireLastName" }) do |c| + - c.with_label do + = t('activerecord.attributes.dossier.mandataire_last_name') - .fr-fieldset__element.fr-fieldset__element--short-text - = render Dsfr::InputComponent.new(form: f, attribute: :nom, opts: { autocomplete: 'family-name' }) - - if @dossier.procedure.ask_birthday? + + -# #radio-rich-hint-messages.fr-messages-group{"aria-live" => "assertive"} + + + = f.fields_for :individual do |individual| + %fieldset.fr-fieldset + %legend.fr-fieldset__legend--regular.fr-fieldset__legend + %h2.fr-h4= t('views.users.dossiers.identite.beneficiaire_title') .fr-fieldset__element - = render Dsfr::InputComponent.new(form: f, attribute: :birthdate, input_type: :date_field, - opts: { placeholder: 'Format : AAAA-MM-JJ', max: Date.today.iso8601, min: "1900-01-01", autocomplete: 'bday' }) + %fieldset.fr-fieldset + %legend.fr-fieldset__legend--regular.fr-fieldset__legend + = t('activerecord.attributes.individual.gender') + = render EditableChamp::AsteriskMandatoryComponent.new + .fr-fieldset__element + .fr-radio-group + = individual.radio_button :gender, Individual::GENDER_FEMALE, required: true, id: "identite_champ_radio_#{Individual::GENDER_FEMALE}" + %label.fr-label{ for: "identite_champ_radio_#{Individual::GENDER_FEMALE}" } + = Individual.human_attribute_name('gender.female') + .fr-fieldset__element + .fr-radio-group + = individual.radio_button :gender, Individual::GENDER_MALE, required: true, id: "identite_champ_radio_#{Individual::GENDER_MALE}" + %label.fr-label{ for: "identite_champ_radio_#{Individual::GENDER_MALE}" } + = Individual.human_attribute_name('gender.male') - .fr-fieldset__element - = f.submit t('views.users.dossiers.identite.continue'), class: "fr-btn fr-btn--lg fr-my-2w" + .fr-fieldset__element.fr-fieldset__element--short-text + = render Dsfr::InputComponent.new(form: individual, attribute: :prenom, opts: { autocomplete: 'given-name' }) + + .fr-fieldset__element.fr-fieldset__element--short-text + = render Dsfr::InputComponent.new(form: individual, attribute: :nom, opts: { autocomplete: 'family-name' }) + + .width-100{ "data-for-tiers-target" => "beneficiaireNotificationBlock" } + + .fr-fieldset__element + %fieldset.fr-fieldset + %legend.fr-fieldset__legend--regular.fr-fieldset__legend + = t('activerecord.attributes.individual.notification_method') + = render EditableChamp::AsteriskMandatoryComponent.new + + - Individual.notification_methods.each do |method, _| + .fr-fieldset__element + .fr-radio-group + = individual.radio_button :notification_method, method, required: true, id: "notification_method_#{method}", "data-for-tiers-target" => "notificationMethod" + %label.fr-label{ for: "notification_method_#{method}" } + = t("activerecord.attributes.individual.notification_methods.#{method}") + + + .fr-fieldset__element.fr-fieldset__element--short-text + = render Dsfr::InputComponent.new(form: individual, attribute: :email, opts: { "data-for-tiers-target" => "email" }) + + + - if @dossier.procedure.ask_birthday? + .fr-fieldset__element + = render Dsfr::InputComponent.new(form: individual, attribute: :birthdate, input_type: :date_field, + opts: { placeholder: 'Format : AAAA-MM-JJ', max: Date.today.iso8601, min: "1900-01-01", autocomplete: 'bday' }) + + .fr-fieldset__element + = f.submit t('views.users.dossiers.identite.continue'), class: "fr-btn fr-btn--lg fr-my-2w" diff --git a/config/locales/en.yml b/config/locales/en.yml index 8b97107cb79..0fff22fc8cb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -394,7 +394,9 @@ en: dossiers: archived_dossier: "Your file will be kept %{duree_conservation_dossiers_dans_ds} more months" identite: - identity_data: Identity data + mandataire_title: "Identity of the mandatary" + callout_text: "You are acting as a proxy for a principal, either professionally (such as accountant, lawyer) or personally (family). Make sure to respect the conditions of Articles 1984 to 1990 of the Civil Code." + beneficiaire_title: "Identity of the beneficiary" identity_siret: Identify your establishment civility: Civility first_name: First Name diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ace408772a5..c81ec9f2642 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -399,7 +399,11 @@ fr: dossiers: archived_dossier: "Votre dossier sera conservé %{duree_conservation_dossiers_dans_ds} mois supplémentaire" identite: - identity_data: Identité du demandeur + mandataire_title: Identité du mandataire + notify_method: Notifier le bénéficiaire pour le suivi de son dossier + callout_text: Vous agissez en tant que mandataire pour un mandant, soit professionnellement (comme expert-comptable, avocat) soit personnellement (famille). Assurez-vous de respecter les conditions des Articles 1984 à 1990 du Code civil. + mandataire_data: Identité du bénéficiaire + beneficiaire_title: Identité du bénéficiaire identity_siret: Identifier votre établissement civility: Civilité first_name: Prénom diff --git a/config/locales/models/dossier/fr.yml b/config/locales/models/dossier/fr.yml index 4c5765e0f85..9aa947e36b8 100644 --- a/config/locales/models/dossier/fr.yml +++ b/config/locales/models/dossier/fr.yml @@ -12,6 +12,11 @@ fr: date_previsionnelle: "La date de début prévisionnelle" state: "État" autorisation_donnees: Acceptation des CGU + mandataire_first_name: Prénom + mandataire_last_name: Nom + for_tiers: + false: Pour vous + true: "Pour un bénéficiaire : membre de la famille, proche, mandant..." dossier/state: &state brouillon: "Brouillon" en_construction: "En construction" diff --git a/config/locales/models/individual/fr.yml b/config/locales/models/individual/fr.yml index 7d73e33bf89..cf0d2f376c9 100644 --- a/config/locales/models/individual/fr.yml +++ b/config/locales/models/individual/fr.yml @@ -6,6 +6,11 @@ fr: nom: Nom prenom: Prénom birthdate: Date de naissance + email: Email + notification_method: "Notifier le bénéficiaire :" + notification_methods: + email: Par e-mail + no_notification: Pas de notification individual/gender: female: Madame male: Monsieur diff --git a/config/locales/shared.en.yml b/config/locales/shared.en.yml index d455ece29cf..6b48f104d59 100644 --- a/config/locales/shared.en.yml +++ b/config/locales/shared.en.yml @@ -1,6 +1,8 @@ en: shared: dossiers: + mandataire: Mandatary + beneficiaire: Beneficiary france_connect_informations: details_no_name: "The file was submitted by a FranceConnect account." details: "The file was submitted by the account of %{name}." diff --git a/config/locales/shared.fr.yml b/config/locales/shared.fr.yml index 3a67ffb5cac..302c71fe8ac 100644 --- a/config/locales/shared.fr.yml +++ b/config/locales/shared.fr.yml @@ -1,6 +1,8 @@ fr: shared: dossiers: + mandataire: Mandataire + beneficiaire: Beneficiaire france_connect_informations: details_no_name: "Le dossier a été déposé par un compte FranceConnect." details: "Le dossier a été déposé par le compte de %{name}."