Skip to content

Commit

Permalink
Layout
Browse files Browse the repository at this point in the history
  • Loading branch information
kara22 committed Nov 21, 2023
1 parent c829774 commit c3dcecb
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 30 deletions.
10 changes: 9 additions & 1 deletion app/helpers/dossier_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/views/users/dossiers/_dossiers_list.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
115 changes: 88 additions & 27 deletions app/views/users/dossiers/identite.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 3 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions config/locales/models/dossier/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions config/locales/models/individual/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions config/locales/shared.en.yml
Original file line number Diff line number Diff line change
@@ -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}."
Expand Down
2 changes: 2 additions & 0 deletions config/locales/shared.fr.yml
Original file line number Diff line number Diff line change
@@ -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}."
Expand Down

0 comments on commit c3dcecb

Please sign in to comment.