feat(sva): pending correction email mention sva/svr
This commit is contained in:
parent
4c46a2f8da
commit
e1b21f980f
9 changed files with 103 additions and 8 deletions
|
@ -53,6 +53,8 @@ class DossierMailer < ApplicationMailer
|
||||||
@dossier = dossier
|
@dossier = dossier
|
||||||
@service = dossier.procedure.service
|
@service = dossier.procedure.service
|
||||||
@logo_url = attach_logo(dossier.procedure)
|
@logo_url = attach_logo(dossier.procedure)
|
||||||
|
@correction = commentaire.dossier_correction
|
||||||
|
|
||||||
@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)
|
@subject = default_i18n_subject(dossier_id: dossier.id, libelle_demarche: dossier.procedure.libelle)
|
||||||
|
|
||||||
mail(to: dossier.user_email_for(:notification), subject: @subject) do |format|
|
mail(to: dossier.user_email_for(:notification), subject: @subject) do |format|
|
||||||
|
|
|
@ -3,10 +3,13 @@
|
||||||
|
|
||||||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||||
|
|
||||||
%p= t('.explanation_html', dossier_id: @dossier.id, libelle_demarche: @dossier.procedure.libelle)
|
%p= t(".#{@correction.kind}.explanation_html", dossier_id: @dossier.id, libelle_demarche: @dossier.procedure.libelle)
|
||||||
%p= t('.link')
|
%p= t('.link')
|
||||||
= round_button(t('.access_message'), messagerie_dossier_url(@dossier), :primary)
|
= round_button(t('.access_message'), messagerie_dossier_url(@dossier), :primary)
|
||||||
|
|
||||||
|
- if @dossier.sva_svr_decision_on.present?
|
||||||
|
%p= t(".#{@correction.kind}.sva_svr", rule_name: t(@dossier.procedure.sva? ? :sva : :svr, scope: 'shared.procedures.sva_svr_rule_name'))
|
||||||
|
|
||||||
= render 'layouts/mailers/signature', service: @service
|
= render 'layouts/mailers/signature', service: @service
|
||||||
|
|
||||||
- content_for :footer do
|
- content_for :footer do
|
||||||
|
|
|
@ -837,6 +837,9 @@ en:
|
||||||
dossiers_count: "Nb files"
|
dossiers_count: "Nb files"
|
||||||
weekly_distribution: "Weekly distribution"
|
weekly_distribution: "Weekly distribution"
|
||||||
weekly_distribution_details: "in the last 6 months"
|
weekly_distribution_details: "in the last 6 months"
|
||||||
|
sva_svr_rule_name:
|
||||||
|
sva: "Silence Vaut Accord"
|
||||||
|
svr: "Silence Vaut Rejet"
|
||||||
procedure_description:
|
procedure_description:
|
||||||
estimated_fill_duration: "Estimated fill time: %{estimated_minutes} mn"
|
estimated_fill_duration: "Estimated fill time: %{estimated_minutes} mn"
|
||||||
estimated_fill_duration_title: What is the procedure estimated fill time ?
|
estimated_fill_duration_title: What is the procedure estimated fill time ?
|
||||||
|
|
|
@ -891,6 +891,9 @@ fr:
|
||||||
dossiers_count: "Nb dossiers"
|
dossiers_count: "Nb dossiers"
|
||||||
weekly_distribution: "Répartition par semaine"
|
weekly_distribution: "Répartition par semaine"
|
||||||
weekly_distribution_details: "au cours des 6 derniers mois"
|
weekly_distribution_details: "au cours des 6 derniers mois"
|
||||||
|
sva_svr_rule_name:
|
||||||
|
sva: "Silence Vaut Accord"
|
||||||
|
svr: "Silence Vaut Rejet"
|
||||||
procedure_description:
|
procedure_description:
|
||||||
estimated_fill_duration: "Temps de remplissage estimé : %{estimated_minutes} mn"
|
estimated_fill_duration: "Temps de remplissage estimé : %{estimated_minutes} mn"
|
||||||
estimated_fill_duration_title: Quelle est la durée de remplissage de la démarche ?
|
estimated_fill_duration_title: Quelle est la durée de remplissage de la démarche ?
|
||||||
|
|
|
@ -3,8 +3,16 @@ en:
|
||||||
dossier_mailer:
|
dossier_mailer:
|
||||||
notify_pending_correction:
|
notify_pending_correction:
|
||||||
subject: You need to modify your file no. %{dossier_id} « %{libelle_demarche} »
|
subject: You need to modify your file no. %{dossier_id} « %{libelle_demarche} »
|
||||||
explanation_html:
|
correction:
|
||||||
In order to continue its instruction, <strong>an instructor requested you to edit information</strong> to your file no. %{dossier_id} of the « %{libelle_demarche} » procedure.
|
explanation_html:
|
||||||
|
In order to continue its instruction, <strong>an instructor requested you to edit information</strong> to your file no. %{dossier_id} of the « %{libelle_demarche} » procedure.
|
||||||
|
sva_svr:
|
||||||
|
As part of the « %{rule_name} » principle, the instruction period is suspended until you submit the requested corrections.
|
||||||
|
incomplete:
|
||||||
|
explanation_html:
|
||||||
|
In order to continue its instruction, <strong>an instructor requested you to complete</strong> your file no. %{dossier_id} of the « %{libelle_demarche} » procedure.
|
||||||
|
sva_svr:
|
||||||
|
As part of the « %{rule_name} » principle, the instruction period will be reset upon receipt of your complete file.
|
||||||
link:
|
link:
|
||||||
Check your file's mailbox to see what changes need to be made, then edit the file directly on the website.
|
Check your file's mailbox to see what changes need to be made, then edit the file directly on the website.
|
||||||
access_message: Open the mailbox
|
access_message: Open the mailbox
|
||||||
|
|
|
@ -3,8 +3,16 @@ fr:
|
||||||
dossier_mailer:
|
dossier_mailer:
|
||||||
notify_pending_correction:
|
notify_pending_correction:
|
||||||
subject: Vous devez corriger votre dossier nº %{dossier_id} « %{libelle_demarche} »
|
subject: Vous devez corriger votre dossier nº %{dossier_id} « %{libelle_demarche} »
|
||||||
explanation_html:
|
correction:
|
||||||
Afin de poursuivre son instruction, <strong>un instructeur vous demande d’apporter des corrections</strong> à votre dossier nº %{dossier_id} de la démarche « %{libelle_demarche} ».
|
explanation_html:
|
||||||
|
Afin de poursuivre son instruction, <strong>un instructeur vous demande d’apporter des corrections</strong> à votre dossier nº %{dossier_id} de la démarche « %{libelle_demarche} ».
|
||||||
|
sva_svr:
|
||||||
|
Dans le cadre du principe du « %{rule_name} », le délai d’instruction est suspendu jusqu’à ce que vous déposiez les corrections demandées.
|
||||||
|
incomplete:
|
||||||
|
explanation_html:
|
||||||
|
Afin de commencer son instruction, <strong>un instructeur vous demande de compléter</strong> votre dossier nº %{dossier_id} de la démarche « %{libelle_demarche} ».
|
||||||
|
sva_svr:
|
||||||
|
Dans le cadre du principe du « %{rule_name} », le délai d’instruction sera réinitialisé à réception de votre dossier complet.
|
||||||
link:
|
link:
|
||||||
Consultez la messagerie de votre dossier pour prendre connaissance des modifications à effectuer,
|
Consultez la messagerie de votre dossier pour prendre connaissance des modifications à effectuer,
|
||||||
puis modifiez le dossier directement sur le site.
|
puis modifiez le dossier directement sur le site.
|
||||||
|
|
|
@ -416,6 +416,10 @@ FactoryBot.define do
|
||||||
trait :sva do
|
trait :sva do
|
||||||
sva_svr { SVASVRConfiguration.new(decision: :sva).attributes }
|
sva_svr { SVASVRConfiguration.new(decision: :sva).attributes }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trait :svr do
|
||||||
|
sva_svr { SVASVRConfiguration.new(decision: :svr).attributes }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -228,4 +228,53 @@ RSpec.describe DossierMailer, type: :mailer do
|
||||||
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
it { expect(subject.body).to include(dossier.procedure.libelle) }
|
||||||
it { expect(subject.body).to include("Suite à cette modification, vous ne suivez plus ce dossier.") }
|
it { expect(subject.body).to include("Suite à cette modification, vous ne suivez plus ce dossier.") }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '.notify_pending_correction' do
|
||||||
|
let(:procedure) { create(:procedure) }
|
||||||
|
let(:dossier) { create(:dossier, :en_construction, procedure:, sva_svr_decision_on:) }
|
||||||
|
let(:sva_svr_decision_on) { nil }
|
||||||
|
let(:kind) { :correction }
|
||||||
|
let(:commentaire) { create(:commentaire, dossier:) }
|
||||||
|
|
||||||
|
subject {
|
||||||
|
dossier.flag_as_pending_correction!(commentaire, kind)
|
||||||
|
described_class.with(commentaire:).notify_pending_correction
|
||||||
|
}
|
||||||
|
|
||||||
|
context 'kind is correction' do
|
||||||
|
it { expect(subject.subject).to eq("Vous devez corriger votre dossier nº #{dossier.id} « #{dossier.procedure.libelle} »") }
|
||||||
|
it { expect(subject.body).to include("apporter des corrections") }
|
||||||
|
it { expect(subject.body).not_to include("Silence") }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'sva with kind is correction' do
|
||||||
|
let(:sva_svr_decision_on) { Date.tomorrow }
|
||||||
|
let(:procedure) { create(:procedure, :sva) }
|
||||||
|
|
||||||
|
it { expect(subject.subject).to eq("Vous devez corriger votre dossier nº #{dossier.id} « #{dossier.procedure.libelle} »") }
|
||||||
|
it { expect(subject.body).to include("apporter des corrections") }
|
||||||
|
it { expect(subject.body).to include("Silence Vaut Accord") }
|
||||||
|
it { expect(subject.body).to include("suspendu") }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'sva with kind is incomplete' do
|
||||||
|
let(:sva_svr_decision_on) { Date.tomorrow }
|
||||||
|
let(:kind) { :incomplete }
|
||||||
|
let(:procedure) { create(:procedure, :sva) }
|
||||||
|
|
||||||
|
it { expect(subject.body).to include("compléter") }
|
||||||
|
it { expect(subject.body).to include("Silence Vaut Accord") }
|
||||||
|
it { expect(subject.body).to include("réinitialisé") }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'svr with kind is incomplete' do
|
||||||
|
let(:sva_svr_decision_on) { Date.tomorrow }
|
||||||
|
let(:kind) { :incomplete }
|
||||||
|
let(:procedure) { create(:procedure, :svr) }
|
||||||
|
|
||||||
|
it { expect(subject.body).to include("compléter") }
|
||||||
|
it { expect(subject.body).to include("Silence Vaut Rejet") }
|
||||||
|
it { expect(subject.body).to include("réinitialisé") }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,13 @@ class DossierMailerPreview < ActionMailer::Preview
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_pending_correction
|
def notify_pending_correction
|
||||||
DossierMailer.with(dossier: dossier_en_construction).notify_pending_correction
|
commentaire = commentaire(on: dossier_en_construction(sva_svr_decision: :sva)).tap { _1.build_dossier_correction(kind: :correction) }
|
||||||
|
DossierMailer.with(commentaire:).notify_pending_correction
|
||||||
|
end
|
||||||
|
|
||||||
|
def notify_pending_correction_sva_correction
|
||||||
|
commentaire = commentaire(on: dossier_en_construction(sva_svr_decision: :sva)).tap { _1.build_dossier_correction(kind: :correction) }
|
||||||
|
DossierMailer.with(commentaire:).notify_pending_correction
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_revert_to_instruction
|
def notify_revert_to_instruction
|
||||||
|
@ -99,8 +105,17 @@ class DossierMailerPreview < ActionMailer::Preview
|
||||||
Dossier.new(id: 47882, state: :en_instruction, procedure: procedure, user: user)
|
Dossier.new(id: 47882, state: :en_instruction, procedure: procedure, user: user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossier_en_construction
|
def dossier_en_construction(sva_svr_decision: nil)
|
||||||
Dossier.new(id: 47882, state: :en_construction, procedure: procedure, user: user)
|
local_procedure = procedure
|
||||||
|
|
||||||
|
dossier = Dossier.new(id: 47882, state: :en_construction, procedure: local_procedure, user: user)
|
||||||
|
|
||||||
|
if sva_svr_decision
|
||||||
|
local_procedure.sva_svr = { decision: sva_svr_decision, period: 2, unit: :months }
|
||||||
|
dossier.sva_svr_decision_on = 10.days.from_now.to_date
|
||||||
|
end
|
||||||
|
|
||||||
|
dossier
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossier_accepte
|
def dossier_accepte
|
||||||
|
|
Loading…
Reference in a new issue