Améliorations après retours PR
This commit is contained in:
parent
878f58e00c
commit
57dfe2b0f6
17 changed files with 72 additions and 50 deletions
|
@ -590,7 +590,7 @@ module Users
|
|||
end
|
||||
|
||||
def dossier_params
|
||||
params.require(:dossier).permit(:for_tiers, :mandataire_first_name, :mandataire_last_name, individual_attributes: [:gender, :nom, :prenom, :birthdate, :email, :notification_method])
|
||||
params.require(:dossier).permit(:for_tiers, :mandataire_first_name, :mandataire_last_name, individual_attributes: [:gender, :nom, :prenom, :birthdate, :email, :notification_method, :id])
|
||||
end
|
||||
|
||||
def siret_params
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DossierProjectionService
|
||||
class DossierProjection < Struct.new(:dossier_id, :state, :archived, :hidden_by_user_at, :hidden_by_administration_at, :batch_operation_id, :sva_svr_decision_on, :corrections, :columns) do
|
||||
class DossierProjection < Struct.new(:dossier_id, :state, :archived, :hidden_by_user_at, :hidden_by_administration_at, :for_tiers, :prenom, :nom, :batch_operation_id, :sva_svr_decision_on, :corrections, :columns) do
|
||||
def pending_correction?
|
||||
return false if corrections.blank?
|
||||
|
||||
|
@ -29,9 +29,12 @@ class DossierProjectionService
|
|||
batch_operation_field = { TABLE => 'self', COLUMN => 'batch_operation_id' }
|
||||
hidden_by_user_at_field = { TABLE => 'self', COLUMN => 'hidden_by_user_at' }
|
||||
hidden_by_administration_at_field = { TABLE => 'self', COLUMN => 'hidden_by_administration_at' }
|
||||
for_tiers_field = { TABLE => 'self', COLUMN => 'for_tiers' }
|
||||
individual_first_name = { TABLE => 'individual', COLUMN => 'prenom' }
|
||||
individual_last_name = { TABLE => 'individual', COLUMN => 'nom' }
|
||||
sva_svr_decision_on_field = { TABLE => 'self', COLUMN => 'sva_svr_decision_on' }
|
||||
dossier_corrections = { TABLE => 'dossier_corrections', COLUMN => 'resolved_at' }
|
||||
([state_field, archived_field, sva_svr_decision_on_field, hidden_by_user_at_field, hidden_by_administration_at_field, batch_operation_field, dossier_corrections] + fields) # the view needs state and archived dossier attributes
|
||||
([state_field, archived_field, sva_svr_decision_on_field, hidden_by_user_at_field, hidden_by_administration_at_field, for_tiers_field, individual_first_name, individual_last_name, batch_operation_field, dossier_corrections] + fields) # the view needs state and archived dossier attributes
|
||||
.each { |f| f[:id_value_h] = {} }
|
||||
.group_by { |f| f[TABLE] } # one query per table
|
||||
.each do |table, fields|
|
||||
|
@ -55,7 +58,7 @@ class DossierProjectionService
|
|||
.pluck(:id, *fields.map { |f| f[COLUMN].to_sym })
|
||||
.each do |id, *columns|
|
||||
fields.zip(columns).each do |field, value|
|
||||
if [state_field, archived_field, hidden_by_user_at_field, hidden_by_administration_at_field, batch_operation_field, sva_svr_decision_on_field].include?(field)
|
||||
if [state_field, archived_field, hidden_by_user_at_field, hidden_by_administration_at_field, for_tiers_field, batch_operation_field, sva_svr_decision_on_field].include?(field)
|
||||
field[:id_value_h][id] = value
|
||||
else
|
||||
field[:id_value_h][id] = value&.strftime('%d/%m/%Y') # other fields are datetime
|
||||
|
@ -130,6 +133,9 @@ class DossierProjectionService
|
|||
archived_field[:id_value_h][dossier_id],
|
||||
hidden_by_user_at_field[:id_value_h][dossier_id],
|
||||
hidden_by_administration_at_field[:id_value_h][dossier_id],
|
||||
for_tiers_field[:id_value_h][dossier_id],
|
||||
individual_first_name[:id_value_h][dossier_id],
|
||||
individual_last_name[:id_value_h][dossier_id],
|
||||
batch_operation_field[:id_value_h][dossier_id],
|
||||
sva_svr_decision_on_field[:id_value_h][dossier_id],
|
||||
dossier_corrections[:id_value_h][dossier_id],
|
||||
|
|
|
@ -164,6 +164,10 @@
|
|||
%span.cell-link
|
||||
= column
|
||||
= "- #{t('views.instructeurs.dossiers.deleted_by_user')}" if p.hidden_by_user_at.present?
|
||||
- elsif p.for_tiers
|
||||
%a.cell-link{ href: path }
|
||||
= "#{column} (#{t('views.instructeurs.dossiers.acts_on_behalf')} #{p.prenom} #{p.nom})"
|
||||
= "- #{t('views.instructeurs.dossiers.deleted_by_user')}" if p.hidden_by_user_at.present?
|
||||
- else
|
||||
%a.cell-link{ href: path }
|
||||
= column
|
||||
|
|
|
@ -4,11 +4,15 @@
|
|||
%p
|
||||
Bonjour,
|
||||
|
||||
%p= "#{ t("instructeurs.dossiers.decisions_rendues_block.without_email.#{@dossier.state}", processed_at: l(@dossier.updated_at.to_date))}."
|
||||
|
||||
%p= "Le dossier nº #{@dossier.id} est rempli en votre nom par #{@dossier.mandataire_first_name} #{@dossier.mandataire_last_name} sur la procédure #{@dossier.procedure.libelle}."
|
||||
|
||||
%p= "Pour en savoir plus, veuillez vous rapprocher #{mail_to(@dossier.user.email)}."
|
||||
%p
|
||||
Nous vous informons que le dossier nº
|
||||
= number_with_delimiter(@dossier.id)
|
||||
rempli en votre nom par #{@dossier.mandataire_first_name}
|
||||
#{@dossier.mandataire_last_name} sur la démarche
|
||||
%span{ :style => "font-weight: bold;" }
|
||||
= @dossier.procedure.libelle
|
||||
est passé en phase #{t("instructeurs.dossiers.decisions_rendues_block.without_email.#{@dossier.state}")} le #{l(@dossier.updated_at.to_date)}.
|
||||
%p= "Pour en savoir plus, veuillez vous rapprocher de #{mail_to(@dossier.user.email)}."
|
||||
|
||||
%p
|
||||
= t(:best_regards, scope: [:views, :shared, :greetings])
|
||||
|
|
|
@ -11,6 +11,17 @@
|
|||
- if dossier.depose_at.present?
|
||||
= render partial: "shared/dossiers/infos_generales", locals: { dossier: dossier }
|
||||
|
||||
|
||||
- if dossier.for_tiers?
|
||||
%h2.fr-h6.fr-background-alt--grey.fr-mb-0.flex
|
||||
.flex-grow.fr-py-3v.fr-px-2w= t('views.shared.dossiers.demande.mandataire_identity')
|
||||
|
||||
- if dossier.individual.present? && profile == 'usager' && !dossier.read_only?
|
||||
= link_to t('views.shared.dossiers.demande.edit_identity'), identite_dossier_path(dossier), class: 'fr-py-3v fr-btn fr-btn--tertiary-no-outline'
|
||||
|
||||
|
||||
= render partial: "shared/dossiers/mandataire_infos", locals: { user_deleted: dossier.user_deleted?, email: dossier.user_email_for(:display), dossier: dossier }
|
||||
|
||||
.tab-title
|
||||
%h2.fr-h6.fr-background-alt--grey.fr-mb-0.flex
|
||||
.flex-grow.fr-py-3v.fr-px-2w
|
||||
|
@ -27,7 +38,7 @@
|
|||
= link_to t('views.shared.dossiers.demande.edit_identity'), identite_dossier_path(dossier), class: 'fr-py-3v fr-btn fr-btn--tertiary-no-outline'
|
||||
|
||||
|
||||
= render partial: "shared/dossiers/user_infos", locals: { user_deleted: dossier.user_deleted?, email: dossier.user_email_for(:display), for_tiers: dossier.for_tiers? }
|
||||
= render partial: "shared/dossiers/user_infos", locals: { user_deleted: dossier.user_deleted?, email: dossier.user_email_for(:display), for_tiers: dossier.for_tiers?, beneficiaire_mail: dossier.for_tiers? ? dossier.individual.email : ""}
|
||||
|
||||
|
||||
- if dossier.individual.present?
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
- if dossier.for_tiers?
|
||||
|
||||
= render Dossiers::RowShowComponent.new(label: t('views.users.dossiers.identite.mandataire')) do |c|
|
||||
- c.with_value do
|
||||
%p= t('views.users.dossiers.identite.act_as_mandataire', mandataire: dossier.mandataire_full_name)
|
||||
|
||||
= render Dossiers::RowShowComponent.new(label: t('views.users.dossiers.identite.civility')) do |c|
|
||||
- c.with_value do
|
||||
|
@ -20,8 +15,3 @@
|
|||
= render Dossiers::RowShowComponent.new(label: t('views.users.dossiers.identite.birthdate')) do |c|
|
||||
- c.with_value do
|
||||
%p= try_format_date(dossier.individual.birthdate)
|
||||
|
||||
- if dossier.for_tiers? && dossier.individual.email?
|
||||
= render Dossiers::RowShowComponent.new(label: t('activerecord.attributes.individual.email')) do |c|
|
||||
- c.with_value do
|
||||
%p= dossier.individual.email
|
||||
|
|
11
app/views/shared/dossiers/_mandataire_infos.html.haml
Normal file
11
app/views/shared/dossiers/_mandataire_infos.html.haml
Normal file
|
@ -0,0 +1,11 @@
|
|||
= render Dossiers::RowShowComponent.new(label: 'Email', profile: @profile) do |c|
|
||||
- c.with_value do
|
||||
= user_deleted ? "#{email} (l’usager a supprimé son compte)" : email
|
||||
|
||||
= render Dossiers::RowShowComponent.new(label: t('views.users.dossiers.identite.first_name')) do |c|
|
||||
- c.with_value do
|
||||
= dossier.mandataire_first_name
|
||||
|
||||
= render Dossiers::RowShowComponent.new(label: t('views.users.dossiers.identite.last_name')) do |c|
|
||||
- c.with_value do
|
||||
= dossier.mandataire_last_name
|
|
@ -1,3 +1,6 @@
|
|||
= render Dossiers::RowShowComponent.new(label: for_tiers ? t('views.users.dossiers.identite.mandataire_email') : 'Email', profile: @profile) do |c|
|
||||
= render Dossiers::RowShowComponent.new(label: 'Email', profile: @profile) do |c|
|
||||
- c.with_value do
|
||||
= user_deleted ? "#{email} (l’usager a supprimé son compte)" : email
|
||||
- if for_tiers
|
||||
= beneficiaire_mail
|
||||
- else
|
||||
= user_deleted ? "#{email} (l’usager a supprimé son compte)" : email
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
= render Dropdown::MenuComponent.new(wrapper: :div, wrapper_options: { class: ['dossier-show', 'edit-identity-action'] }, menu_options: { class:['edit-identity-content'] }) do |menu|
|
||||
- menu.with_button_inner_html do
|
||||
= t("views.shared.dossiers.demande.individual_identity")
|
||||
- if dossier.for_tiers?
|
||||
= t("views.shared.dossiers.demande.requester_identity")
|
||||
- else
|
||||
= t("views.shared.dossiers.demande.individual_identity")
|
||||
|
||||
- menu.with_form do
|
||||
- if dossier.procedure.for_individual
|
||||
|
|
|
@ -340,6 +340,7 @@ en:
|
|||
write_message_to_administration_placeholder: "Write your message to the administration here"
|
||||
demande:
|
||||
requester_identity: "Identity of the requester"
|
||||
mandataire_identity: "Identity of toe mandatary"
|
||||
requester_identity_updated_at: "updated on %{date}"
|
||||
individual_identity: "Your identity"
|
||||
form: "Form"
|
||||
|
@ -368,6 +369,7 @@ en:
|
|||
archived_dossier: "This file will be kept for an additional month"
|
||||
delete_dossier: "Delete file"
|
||||
deleted_by_user: "File deleted by user"
|
||||
acts_on_behalf: "acts for"
|
||||
deleted_by_administration: "File deleted by administration"
|
||||
restore: "Restore"
|
||||
filters:
|
||||
|
@ -393,8 +395,6 @@ en:
|
|||
archived_dossier: "Your file will be kept %{duree_conservation_dossiers_dans_ds} more months"
|
||||
identite:
|
||||
self_title: Your identity
|
||||
mandataire: Mandatary
|
||||
mandataire_email: Mandatary email
|
||||
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
|
||||
|
@ -408,7 +408,6 @@ en:
|
|||
annuaire_link_title: Search for a SIRET number in the Companies Directory
|
||||
siret_loading: Information retrieval…
|
||||
continue: Continue
|
||||
act_as_mandataire: '%{mandataire} act on behalf of the beneficiary :'
|
||||
merci:
|
||||
thanks: Thank you!
|
||||
dossier_send_l1: Your file on the procedure
|
||||
|
|
|
@ -341,6 +341,7 @@ fr:
|
|||
demande:
|
||||
en_construction: "Date de dépôt du dossier"
|
||||
requester_identity: "Identité du demandeur"
|
||||
mandataire_identity: "Identité du mandataire"
|
||||
requester_identity_updated_at: "modifiée le %{date}"
|
||||
individual_identity: "Votre identité"
|
||||
form: "Sections du formulaire"
|
||||
|
@ -372,6 +373,7 @@ fr:
|
|||
archived_dossier: "Le dossier sera conservé 1 mois supplémentaire"
|
||||
delete_dossier: "Supprimer le dossier"
|
||||
deleted_by_user: "Dossier supprimé par l’usager"
|
||||
acts_on_behalf: "agit pour"
|
||||
deleted_by_administration: "Dossier supprimé par l’administration"
|
||||
restore: "Restaurer"
|
||||
filters:
|
||||
|
@ -398,8 +400,6 @@ fr:
|
|||
archived_dossier: "Votre dossier sera conservé %{duree_conservation_dossiers_dans_ds} mois supplémentaire"
|
||||
identite:
|
||||
self_title: Votre identité
|
||||
mandataire: Mandataire
|
||||
mandataire_email: Email du mandataire
|
||||
callout_text: Vous agissez en tant que mandataire, soit professionnellement (comme expert-comptable, avocat) soit personnellement (famille). Assurez-vous de respecter les conditions des Articles 1984 à 1990 du Code civil.
|
||||
beneficiaire_title: Identité du bénéficiaire
|
||||
identity_siret: Identifier votre établissement
|
||||
|
@ -413,7 +413,6 @@ fr:
|
|||
annuaire_link_title: Rechercher un numéro de SIRET sur l’Annuaire des Entreprises
|
||||
siret_loading: Récupération des informations…
|
||||
continue: Continuer
|
||||
act_as_mandataire: '%{mandataire}'
|
||||
merci:
|
||||
thanks: Merci !
|
||||
dossier_send_l1: Votre dossier sur la démarche
|
||||
|
|
|
@ -6,8 +6,8 @@ en:
|
|||
dossiers:
|
||||
decisions_rendues_block:
|
||||
without_email:
|
||||
en_construction: The file had been sent at %{processed_at}
|
||||
en_instruction: The file had been on instruction at %{processed_at}
|
||||
en_construction: of contruction
|
||||
en_instruction: of instruction
|
||||
accepte: The file had been accepted at %{processed_at}
|
||||
refuse: The file file hadd been refused at %{processed_at}
|
||||
classe_sans_suite: The file had been filed away at %{processed_at}
|
||||
|
|
|
@ -6,8 +6,8 @@ fr:
|
|||
dossiers:
|
||||
decisions_rendues_block:
|
||||
without_email:
|
||||
en_construction: Le %{processed_at} ce dossier a été passé en construction
|
||||
en_instruction: Le %{processed_at} ce dossier a été passé en instruction
|
||||
en_construction: de construction
|
||||
en_instruction: d'instruction
|
||||
accepte: Le %{processed_at} ce dossier a été accepté
|
||||
refuse: Le %{processed_at} ce dossier a été refusé
|
||||
classe_sans_suite: Le %{processed_at} ce dossier a été classé sans suite
|
||||
|
|
|
@ -10,7 +10,7 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
|
||||
it { expect(subject.subject).to include("Votre dossier rempli par le mandataire #{dossier_for_tiers.mandataire_first_name} #{dossier_for_tiers.mandataire_last_name} a été mis à jour") }
|
||||
it { expect(subject.to).to eq([dossier_for_tiers.individual.email]) }
|
||||
it { expect(subject.body).to include("Pour en savoir plus, veuillez-vous rapprocher du mandataire #{dossier_for_tiers.user.email}.") }
|
||||
it { expect(subject.body).to include("Pour en savoir plus, veuillez vous rapprocher de <a href=\"mailto:#{dossier_for_tiers.user.email}\">#{dossier_for_tiers.user.email}</a>.") }
|
||||
end
|
||||
|
||||
describe 'send_en_construction_notification' do
|
||||
|
|
|
@ -64,7 +64,7 @@ describe 'user access to the list of their dossiers', js: true do
|
|||
let(:individual) { dossier_for_tiers.individual }
|
||||
|
||||
it 'displays the name of the mandataire' do
|
||||
expect(page).to have_content("#{individual.prenom} #{individual.nom}, dossier rempli par le mandataire #{dossier_for_tiers.mandataire_full_name}")
|
||||
expect(page).to have_content("#{individual.prenom} #{individual.nom}, dossier rempli par #{dossier_for_tiers.mandataire_full_name}")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -36,21 +36,12 @@ describe 'users/dossiers/brouillon', type: :view do
|
|||
it { is_expected.not_to have_link("Télécharger le guide de la démarche") }
|
||||
end
|
||||
|
||||
context 'when a dossier is for_tiers and the dossier is in brouillon with email notification' do
|
||||
context 'when a dossier is for_tiers and the dossier en construction with email notification' do
|
||||
let(:dossier) { create(:dossier, :for_tiers_with_notification) }
|
||||
|
||||
it 'displays the informations of the mandataire and the beneficiaire email' do
|
||||
expect(rendered).to have_text("#{dossier.mandataire_full_name} agit pour le compte du bénéficiaire :")
|
||||
expect(rendered).to have_text("Email :\n\n\n#{dossier.individual.email}")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a dossier is for_tiers and the dossier is in brouillon with no notification' do
|
||||
let!(:dossier) { create(:dossier, :for_tiers_without_notification) }
|
||||
|
||||
it 'displays the informations of the mandataire and do not display the beneficiary email' do
|
||||
expect(rendered).to have_text("#{dossier.mandataire_full_name} agit pour le compte du bénéficiaire :")
|
||||
expect(rendered).not_to have_text("Email :\n\n\n#{dossier.individual.email}")
|
||||
it 'displays the informations of the beneficiaire' do
|
||||
expect(rendered).to have_text("Identité du demandeur")
|
||||
expect(rendered).not_to have_text("Votre identité")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -53,8 +53,9 @@ describe 'users/dossiers/demande', type: :view do
|
|||
let(:dossier) { create(:dossier, :en_construction, :for_tiers_with_notification) }
|
||||
|
||||
it 'displays the informations of the mandataire' do
|
||||
expect(rendered).to have_text('Email du mandataire')
|
||||
expect(rendered).to have_text("#{dossier.mandataire_full_name} agit pour le compte du bénéficiaire :")
|
||||
expect(rendered).to have_text('Identité du mandataire')
|
||||
expect(rendered).to have_text(dossier.mandataire_first_name.to_s)
|
||||
expect(rendered).to have_text(dossier.mandataire_last_name.to_s)
|
||||
expect(rendered).to have_text(dossier.individual.email.to_s)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue