Merge pull request #10488 from demarches-simplifiees/improve-mails-for-deleted-dossiers-ldu
[usager] Laisser un délai avant suppression des dossiers expirés
This commit is contained in:
commit
e93ea356ab
44 changed files with 436 additions and 239 deletions
|
@ -23,6 +23,12 @@ module Instructeurs
|
|||
redirect_back(fallback_location: instructeur_dossier_path(@dossier.procedure, @dossier))
|
||||
end
|
||||
|
||||
def extend_conservation_and_restore
|
||||
dossier.extend_conservation_and_restore(1.month, current_instructeur)
|
||||
flash[:notice] = t('views.instructeurs.dossiers.archived_dossier')
|
||||
redirect_back(fallback_location: instructeur_dossier_path(@dossier.procedure, @dossier))
|
||||
end
|
||||
|
||||
def geo_data
|
||||
send_data dossier.to_feature_collection.to_json,
|
||||
type: 'application/json',
|
||||
|
@ -376,6 +382,10 @@ module Instructeurs
|
|||
Dossier
|
||||
.where(id: current_instructeur.dossiers.visible_by_administration)
|
||||
.or(Dossier.where(id: current_user.dossiers.for_procedure_preview))
|
||||
elsif action_name == 'extend_conservation_and_restore'
|
||||
Dossier
|
||||
.where(id: current_instructeur.dossiers.visible_by_administration)
|
||||
.or(Dossier.where(id: current_instructeur.dossiers.hidden_by_expired))
|
||||
else
|
||||
current_instructeur.dossiers.visible_by_administration
|
||||
end
|
||||
|
|
|
@ -57,7 +57,7 @@ module Users
|
|||
@user_dossiers = current_user.dossiers.state_not_termine.merge(@dossiers_visibles)
|
||||
@dossiers_traites = current_user.dossiers.state_termine.merge(@dossiers_visibles)
|
||||
@dossiers_invites = current_user.dossiers_invites.merge(@dossiers_visibles)
|
||||
@dossiers_supprimes_recemment = current_user.dossiers.hidden_by_user.merge(ordered_dossiers)
|
||||
@dossiers_supprimes_recemment = (current_user.dossiers.hidden_by_user.or(current_user.dossiers.hidden_by_expired)).merge(ordered_dossiers)
|
||||
@dossier_transferes = @dossiers_visibles.where(dossier_transfer_id: DossierTransfer.for_email(current_user.email))
|
||||
@dossiers_close_to_expiration = current_user.dossiers.close_to_expiration.merge(@dossiers_visibles)
|
||||
@dossiers_supprimes_definitivement = deleted_dossiers
|
||||
|
@ -259,6 +259,12 @@ module Users
|
|||
redirect_back(fallback_location: dossier_path(@dossier))
|
||||
end
|
||||
|
||||
def extend_conservation_and_restore
|
||||
dossier.extend_conservation_and_restore(dossier.procedure.duree_conservation_dossiers_dans_ds.months, current_user)
|
||||
flash[:notice] = t('views.users.dossiers.archived_dossier', duree_conservation_dossiers_dans_ds: dossier.procedure.duree_conservation_dossiers_dans_ds)
|
||||
redirect_back(fallback_location: dossier_path(@dossier))
|
||||
end
|
||||
|
||||
def modifier
|
||||
@dossier = dossier_with_champs
|
||||
end
|
||||
|
@ -530,6 +536,8 @@ module Users
|
|||
Dossier.visible_by_user.or(Dossier.for_procedure_preview).or(Dossier.for_editing_fork)
|
||||
elsif action_name == 'restore'
|
||||
Dossier.hidden_by_user
|
||||
elsif action_name == 'extend_conservation_and_restore'
|
||||
Dossier.visible_by_user.or(Dossier.hidden_by_expired)
|
||||
else
|
||||
Dossier.visible_by_user
|
||||
end
|
||||
|
|
|
@ -129,32 +129,32 @@ class DossierMailer < ApplicationMailer
|
|||
mail(to: to_email, subject: @subject)
|
||||
end
|
||||
|
||||
def notify_deletion_to_administration(deleted_dossier, to_email)
|
||||
def notify_deletion_to_administration(hidden_dossier, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
@subject = default_i18n_subject(dossier_id: deleted_dossier.dossier_id)
|
||||
@deleted_dossier = deleted_dossier
|
||||
@subject = default_i18n_subject(dossier_id: hidden_dossier.id)
|
||||
@hidden_dossier = hidden_dossier
|
||||
|
||||
mail(to: to_email, subject: @subject)
|
||||
end
|
||||
|
||||
def notify_automatic_deletion_to_user(deleted_dossiers, to_email)
|
||||
def notify_automatic_deletion_to_user(hidden_dossiers, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
I18n.with_locale(deleted_dossiers.first.user_locale) do
|
||||
@state = deleted_dossiers.first.state
|
||||
@subject = default_i18n_subject(count: deleted_dossiers.size)
|
||||
@deleted_dossiers = deleted_dossiers
|
||||
I18n.with_locale(hidden_dossiers.first.user_locale) do
|
||||
@state = hidden_dossiers.first.state
|
||||
@subject = default_i18n_subject(count: hidden_dossiers.size)
|
||||
@hidden_dossiers = hidden_dossiers
|
||||
|
||||
mail(to: to_email, subject: @subject)
|
||||
end
|
||||
end
|
||||
|
||||
def notify_automatic_deletion_to_administration(deleted_dossiers, to_email)
|
||||
def notify_automatic_deletion_to_administration(hidden_dossiers, to_email)
|
||||
configure_defaults_for_email(to_email)
|
||||
|
||||
@subject = default_i18n_subject(count: deleted_dossiers.size)
|
||||
@deleted_dossiers = deleted_dossiers
|
||||
@subject = default_i18n_subject(count: hidden_dossiers.size)
|
||||
@hidden_dossiers = hidden_dossiers
|
||||
|
||||
mail(to: to_email, subject: @subject)
|
||||
end
|
||||
|
|
|
@ -221,10 +221,12 @@ class Dossier < ApplicationRecord
|
|||
scope :prefilled, -> { where(prefilled: true) }
|
||||
scope :hidden_by_user, -> { where.not(hidden_by_user_at: nil) }
|
||||
scope :hidden_by_administration, -> { where.not(hidden_by_administration_at: nil) }
|
||||
scope :visible_by_user, -> { where(for_procedure_preview: false).where(hidden_by_user_at: nil, editing_fork_origin_id: nil) }
|
||||
scope :hidden_by_expired, -> { where.not(hidden_by_expired_at: nil) }
|
||||
scope :visible_by_user, -> { where(for_procedure_preview: false, hidden_by_user_at: nil, editing_fork_origin_id: nil, hidden_by_expired_at: nil) }
|
||||
scope :visible_by_administration, -> {
|
||||
state_not_brouillon
|
||||
.where(hidden_by_administration_at: nil)
|
||||
.where(hidden_by_expired_at: nil)
|
||||
.merge(visible_by_user.or(state_not_en_construction))
|
||||
}
|
||||
scope :visible_by_user_or_administration, -> { visible_by_user.or(visible_by_administration) }
|
||||
|
@ -363,12 +365,12 @@ class Dossier < ApplicationRecord
|
|||
scope :without_brouillon_expiration_notice_sent, -> { where(brouillon_close_to_expiration_notice_sent_at: nil) }
|
||||
scope :without_en_construction_expiration_notice_sent, -> { where(en_construction_close_to_expiration_notice_sent_at: nil) }
|
||||
scope :without_termine_expiration_notice_sent, -> { where(termine_close_to_expiration_notice_sent_at: nil) }
|
||||
|
||||
scope :deleted_by_user_expired, -> { where('dossiers.hidden_by_user_at < ?', 1.week.ago) }
|
||||
scope :deleted_by_administration_expired, -> { where('dossiers.hidden_by_administration_at < ?', 1.week.ago) }
|
||||
scope :en_brouillon_expired_to_delete, -> { state_brouillon.deleted_by_user_expired }
|
||||
scope :en_construction_expired_to_delete, -> { state_en_construction.deleted_by_user_expired }
|
||||
scope :termine_expired_to_delete, -> { state_termine.deleted_by_user_expired.deleted_by_administration_expired }
|
||||
scope :deleted_by_automatic_expired, -> { where('dossiers.hidden_by_expired_at < ?', 1.week.ago) }
|
||||
scope :en_brouillon_expired_to_delete, -> { state_brouillon.deleted_by_user_expired.or(state_brouillon.deleted_by_automatic_expired) }
|
||||
scope :en_construction_expired_to_delete, -> { state_en_construction.deleted_by_user_expired.or(state_en_construction.deleted_by_automatic_expired) }
|
||||
scope :termine_expired_to_delete, -> { state_termine.deleted_by_user_expired.deleted_by_administration_expired.or(state_termine.deleted_by_automatic_expired) }
|
||||
|
||||
scope :brouillon_near_procedure_closing_date, -> do
|
||||
# select users who have submitted dossier for the given 'procedures.id'
|
||||
|
@ -415,7 +417,7 @@ class Dossier < ApplicationRecord
|
|||
when 'tous'
|
||||
visible_by_administration.all_state
|
||||
when 'supprimes_recemment'
|
||||
hidden_by_administration.state_termine
|
||||
hidden_by_administration.state_termine.or(hidden_by_expired)
|
||||
when 'archives'
|
||||
visible_by_administration.archived
|
||||
when 'expirant'
|
||||
|
@ -600,6 +602,10 @@ class Dossier < ApplicationRecord
|
|||
termine? || reason == :procedure_removed
|
||||
end
|
||||
|
||||
def can_be_deleted_by_automatic?(reason)
|
||||
reason == :expired && !en_instruction?
|
||||
end
|
||||
|
||||
def can_terminer_automatiquement_by_sva_svr?
|
||||
sva_svr_decision_triggered_at.nil? && !pending_correction? && (sva_svr_decision_on.today? || sva_svr_decision_on.past?)
|
||||
end
|
||||
|
@ -645,7 +651,12 @@ class Dossier < ApplicationRecord
|
|||
|
||||
def close_to_expiration?
|
||||
return false if en_instruction?
|
||||
expiration_notification_date < Time.zone.now
|
||||
expiration_notification_date < Time.zone.now && Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks.ago < expiration_notification_date
|
||||
end
|
||||
|
||||
def has_expired?
|
||||
return false if en_instruction?
|
||||
expiration_notification_date < Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks.ago
|
||||
end
|
||||
|
||||
def after_notification_expiration_date
|
||||
|
@ -677,6 +688,12 @@ class Dossier < ApplicationRecord
|
|||
termine_close_to_expiration_notice_sent_at: nil)
|
||||
end
|
||||
|
||||
def extend_conservation_and_restore(conservation_extension, author)
|
||||
extend_conservation(conservation_extension)
|
||||
update(hidden_by_expired_at: nil, hidden_by_reason: nil)
|
||||
restore(author)
|
||||
end
|
||||
|
||||
def show_procedure_state_warning?
|
||||
procedure.discarded? || (brouillon? && !procedure.dossier_can_transition_to_en_construction?)
|
||||
end
|
||||
|
@ -766,6 +783,10 @@ class Dossier < ApplicationRecord
|
|||
!procedure.brouillon? && !brouillon?
|
||||
end
|
||||
|
||||
def hidden_by_expired?
|
||||
hidden_by_expired_at.present?
|
||||
end
|
||||
|
||||
def hidden_by_user?
|
||||
hidden_by_user_at.present?
|
||||
end
|
||||
|
@ -820,37 +841,32 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def expired_keep_track_and_destroy!
|
||||
transaction do
|
||||
DeletedDossier.create_from_dossier(self, :expired)
|
||||
log_automatic_dossier_operation(:supprimer, self)
|
||||
dossier_operation_logs.purge_discarded
|
||||
destroy!
|
||||
end
|
||||
true
|
||||
rescue
|
||||
false
|
||||
end
|
||||
|
||||
def author_is_user(author)
|
||||
def is_user?(author)
|
||||
author.is_a?(User)
|
||||
end
|
||||
|
||||
def author_is_administration(author)
|
||||
def is_administration?(author)
|
||||
author.is_a?(Instructeur) || author.is_a?(Administrateur) || author.is_a?(SuperAdmin)
|
||||
end
|
||||
|
||||
def is_automatic?(author)
|
||||
author == :automatic
|
||||
end
|
||||
|
||||
def hide_and_keep_track!(author, reason)
|
||||
transaction do
|
||||
if author_is_administration(author) && can_be_deleted_by_administration?(reason)
|
||||
if is_administration?(author) && can_be_deleted_by_administration?(reason)
|
||||
update(hidden_by_administration_at: Time.zone.now, hidden_by_reason: reason)
|
||||
elsif author_is_user(author) && can_be_deleted_by_user?
|
||||
log_dossier_operation(author, :supprimer, self)
|
||||
elsif is_user?(author) && can_be_deleted_by_user?
|
||||
update(hidden_by_user_at: Time.zone.now, dossier_transfer_id: nil, hidden_by_reason: reason)
|
||||
log_dossier_operation(author, :supprimer, self)
|
||||
elsif is_automatic?(author) && can_be_deleted_by_automatic?(reason)
|
||||
update(hidden_by_expired_at: Time.zone.now, hidden_by_reason: reason)
|
||||
log_automatic_dossier_operation(:supprimer, self)
|
||||
else
|
||||
raise "Unauthorized dossier hide attempt Dossier##{id} by #{author} for reason #{reason}"
|
||||
end
|
||||
|
||||
log_dossier_operation(author, :supprimer, self)
|
||||
end
|
||||
|
||||
if en_construction? && !hidden_by_administration?
|
||||
|
@ -863,14 +879,18 @@ class Dossier < ApplicationRecord
|
|||
|
||||
def restore(author)
|
||||
transaction do
|
||||
if author_is_administration(author)
|
||||
if is_administration?(author)
|
||||
update(hidden_by_administration_at: nil)
|
||||
elsif author_is_user(author)
|
||||
elsif is_user?(author)
|
||||
update(hidden_by_user_at: nil)
|
||||
end
|
||||
|
||||
if !hidden_by_user? && !hidden_by_administration?
|
||||
update(hidden_by_reason: nil)
|
||||
elsif hidden_by_user?
|
||||
update(hidden_by_reason: :user_request)
|
||||
elsif hidden_by_administration?
|
||||
update(hidden_by_reason: :instructeur_request)
|
||||
end
|
||||
|
||||
log_dossier_operation(author, :restaurer, self)
|
||||
|
|
|
@ -227,18 +227,18 @@ class Instructeur < ApplicationRecord
|
|||
def dossiers_count_summary(groupe_instructeur_ids)
|
||||
query = <<~EOF
|
||||
SELECT
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND not archived AND dossiers.state in ('en_construction', 'en_instruction') AND follows.id IS NULL) AS a_suivre,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND not archived AND dossiers.state in ('en_construction', 'en_instruction') AND follows.instructeur_id = :instructeur_id) AS suivis,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND not archived AND dossiers.state in ('accepte', 'refuse', 'sans_suite')) AS traites,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND not archived) AS tous,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND archived) AS archives,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NOT NULL AND not archived AND dossiers.state in ('accepte', 'refuse', 'sans_suite')) AS supprimes_recemment,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND procedures.procedure_expires_when_termine_enabled
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND dossiers.hidden_by_expired_at IS NULL AND not archived AND dossiers.state in ('en_construction', 'en_instruction') AND follows.id IS NULL) AS a_suivre,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND dossiers.hidden_by_expired_at IS NULL AND not archived AND dossiers.state in ('en_construction', 'en_instruction') AND follows.instructeur_id = :instructeur_id) AS suivis,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND dossiers.hidden_by_expired_at IS NULL AND not archived AND dossiers.state in ('accepte', 'refuse', 'sans_suite')) AS traites,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND dossiers.hidden_by_expired_at IS NULL AND not archived) AS tous,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND dossiers.hidden_by_expired_at IS NULL AND archived) AS archives,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NOT NULL AND not archived OR dossiers.hidden_by_expired_at IS NOT NULL) AS supprimes_recemment,
|
||||
COUNT(DISTINCT dossiers.id) FILTER (where dossiers.hidden_by_administration_at IS NULL AND dossiers.hidden_by_expired_at IS NULL AND procedures.procedure_expires_when_termine_enabled
|
||||
AND (
|
||||
dossiers.state in ('accepte', 'refuse', 'sans_suite')
|
||||
AND dossiers.processed_at + dossiers.conservation_extension + (procedures.duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now
|
||||
) OR (
|
||||
dossiers.state in ('en_construction')
|
||||
dossiers.state in ('en_construction') AND dossiers.hidden_by_expired_at IS NULL
|
||||
AND dossiers.en_construction_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now
|
||||
)
|
||||
) AS expirant
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DossierProjectionService
|
||||
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
|
||||
class DossierProjection < Struct.new(:dossier_id, :state, :archived, :hidden_by_user_at, :hidden_by_administration_at, :hidden_by_reason, :for_tiers, :prenom, :nom, :batch_operation_id, :sva_svr_decision_on, :corrections, :columns) do
|
||||
def pending_correction?
|
||||
return false if corrections.blank?
|
||||
|
||||
|
@ -44,13 +44,14 @@ 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' }
|
||||
hidden_by_reason_field = { TABLE => 'self', COLUMN => 'hidden_by_reason' }
|
||||
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' }
|
||||
champ_value = champ_value_formatter(dossiers_ids, fields)
|
||||
([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
|
||||
([state_field, archived_field, sva_svr_decision_on_field, hidden_by_user_at_field, hidden_by_administration_at_field, hidden_by_reason_field, for_tiers_field, individual_first_name, individual_last_name, batch_operation_field, dossier_corrections] + fields)
|
||||
.each { |f| f[:id_value_h] = {} }
|
||||
.group_by { |f| f[TABLE] } # one query per table
|
||||
.each do |table, fields|
|
||||
|
@ -73,7 +74,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, for_tiers_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, hidden_by_reason_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
|
||||
|
@ -150,6 +151,7 @@ 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],
|
||||
hidden_by_reason_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],
|
||||
|
|
|
@ -93,27 +93,26 @@ class Expired::DossiersDeletionService < Expired::MailRateLimiter
|
|||
administration_notifications = group_by_fonctionnaire_email(dossiers_to_remove)
|
||||
.map { |(email, dossiers)| [email, dossiers.map(&:id)] }
|
||||
|
||||
deleted_dossier_ids = []
|
||||
hidden_dossier_ids = []
|
||||
dossiers_to_remove.find_each do |dossier|
|
||||
if dossier.expired_keep_track_and_destroy!
|
||||
deleted_dossier_ids << dossier.id
|
||||
end
|
||||
dossier.hide_and_keep_track!(:automatic, :expired)
|
||||
hidden_dossier_ids << dossier.id
|
||||
end
|
||||
user_notifications.each do |(email, dossier_ids)|
|
||||
dossier_ids = dossier_ids.intersection(deleted_dossier_ids)
|
||||
dossier_ids = dossier_ids.intersection(hidden_dossier_ids)
|
||||
if dossier_ids.present?
|
||||
mail = DossierMailer.notify_automatic_deletion_to_user(
|
||||
DeletedDossier.where(dossier_id: dossier_ids).to_a,
|
||||
Dossier.where(id: dossier_ids).to_a,
|
||||
email
|
||||
)
|
||||
send_with_delay(mail)
|
||||
end
|
||||
end
|
||||
administration_notifications.each do |(email, dossier_ids)|
|
||||
dossier_ids = dossier_ids.intersection(deleted_dossier_ids)
|
||||
dossier_ids = dossier_ids.intersection(hidden_dossier_ids)
|
||||
if dossier_ids.present?
|
||||
mail = DossierMailer.notify_automatic_deletion_to_administration(
|
||||
DeletedDossier.where(dossier_id: dossier_ids).to_a,
|
||||
Dossier.where(id: dossier_ids).to_a,
|
||||
email
|
||||
)
|
||||
send_with_delay(mail)
|
||||
|
|
|
@ -3,9 +3,14 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
= t('.header', count: @deleted_dossiers.size)
|
||||
= t('.header', count: @hidden_dossiers.size)
|
||||
%ul
|
||||
- @deleted_dossiers.each do |d|
|
||||
%li n° #{d.dossier_id} (#{d.procedure.libelle})
|
||||
- @hidden_dossiers.each do |d|
|
||||
%li n° #{d.id} (#{d.procedure.libelle})
|
||||
|
||||
%p
|
||||
= t('.footer', count: @hidden_dossiers.size)
|
||||
= link_to("mes dossiers", dossiers_url)
|
||||
\.
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
= t('.header', count: @deleted_dossiers.size)
|
||||
= t('.header', count: @hidden_dossiers.size)
|
||||
%ul
|
||||
- @deleted_dossiers.each do |d|
|
||||
%li N° #{d.dossier_id} (#{d.procedure.libelle})
|
||||
- @hidden_dossiers.each do |d|
|
||||
%li N° #{d.id} (#{d.procedure.libelle})
|
||||
|
||||
%p
|
||||
%strong= t('.account_active', count: @deleted_dossiers.size)
|
||||
|
||||
- if @state == Dossier.states.fetch(:en_construction)
|
||||
%p= t('.footer_en_construction', count: @deleted_dossiers.size, remaining_weeks_before_expiration: distance_of_time_in_words(Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks))
|
||||
= t('.footer', count: @hidden_dossiers.size)
|
||||
= link_to("mes dossiers", dossiers_url)
|
||||
\.
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
- @dossiers.each do |d|
|
||||
%li= link_to("n° #{d.id} (#{d.procedure.libelle})", dossier_url(d))
|
||||
|
||||
%p= sanitize(t('.footer', count: @dossiers.size))
|
||||
%p
|
||||
= t('.account_active', count: @dossiers.size)
|
||||
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
%p= t(:hello, scope: [:views, :shared, :greetings])
|
||||
|
||||
%p
|
||||
= t('.body', dossier_id: @deleted_dossier.dossier_id, procedure: @deleted_dossier.procedure.libelle)
|
||||
= t('.body', dossier_id: @hidden_dossier.id, procedure: @hidden_dossier.procedure.libelle)
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -4,18 +4,17 @@
|
|||
|
||||
%p
|
||||
- if @state == Dossier.states.fetch(:en_construction)
|
||||
= t('.header_en_construction', count: @dossiers.size)
|
||||
= t('.header_en_construction', count: @dossiers.size, remaining_weeks_before_expiration: distance_of_time_in_words(Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks))
|
||||
- else
|
||||
= t('.header_termine', count: @dossiers.size)
|
||||
= t('.header_termine', count: @dossiers.size, remaining_weeks_before_expiration: distance_of_time_in_words(Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks))
|
||||
|
||||
%ul
|
||||
- @dossiers.each do |d|
|
||||
%li
|
||||
#{link_to("N° #{d.id} (#{d.procedure.libelle})", dossier_url(d))}. Retrouvez le dossier au format #{link_to("PDF", instructeur_dossier_url(d.procedure, d, format: :pdf))}
|
||||
|
||||
%p
|
||||
- if @state == Dossier.states.fetch(:en_construction)
|
||||
= sanitize(t('.footer_en_construction', count: @dossiers.size, remaining_weeks_before_expiration: distance_of_time_in_words(Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks)))
|
||||
- else
|
||||
= sanitize(t('.footer_termine', count: @dossiers.size, remaining_weeks_before_expiration: distance_of_time_in_words(Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks)))
|
||||
- if @state == Dossier.states.fetch(:en_construction)
|
||||
%p
|
||||
= sanitize(t('.footer_en_construction'))
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -12,13 +12,15 @@
|
|||
%li
|
||||
#{link_to("N° #{d.id} (#{d.procedure.libelle})", dossier_url(d))}
|
||||
|
||||
%p
|
||||
%strong= t('.account_active', count: @dossiers.size)
|
||||
|
||||
%p
|
||||
- if @state == Dossier.states.fetch(:en_construction)
|
||||
= sanitize(t('.footer_en_construction', count: @dossiers.size, remaining_weeks_before_expiration: distance_of_time_in_words(Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks)))
|
||||
- else
|
||||
= sanitize(t('.footer_termine', count: @dossiers.size, dossiers_url: dossiers_url, remaining_weeks_before_expiration: distance_of_time_in_words(Expired::REMAINING_WEEKS_BEFORE_EXPIRATION.weeks)))
|
||||
|
||||
= link_to("mes dossiers", dossiers_url)
|
||||
\.
|
||||
%p
|
||||
= t('.account_active', count: @dossiers.size)
|
||||
|
||||
= render partial: "layouts/mailers/signature"
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
- if dossier.conservation_extension.positive?
|
||||
= t('instructeurs.dossiers.header.banner.expiration_date_extended')
|
||||
|
||||
- if dossier.close_to_expiration?
|
||||
= render Dsfr::CalloutComponent.new(title: t('instructeurs.dossiers.header.banner.title'), theme: :warning) do |c|
|
||||
- if dossier.close_to_expiration? || dossier.has_expired?
|
||||
- title = dossier.has_expired? ? 'title_expired' : 'title'
|
||||
= render Dsfr::CalloutComponent.new(title: t("instructeurs.dossiers.header.banner.#{title}"), theme: :warning) do |c|
|
||||
- c.with_body do
|
||||
- if dossier.brouillon?
|
||||
= t('instructeurs.dossiers.header.banner.states.brouillon')
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
dossier_is_followed: current_instructeur&.follow?(dossier),
|
||||
close_to_expiration: dossier.close_to_expiration?,
|
||||
hidden_by_administration: dossier.hidden_by_administration?,
|
||||
hidden_by_expired: dossier.hidden_by_expired?,
|
||||
has_pending_correction: dossier.pending_correction?,
|
||||
has_blocking_pending_correction: dossier.procedure.feature_enabled?(:blocking_pending_correction) && dossier.pending_correction?,
|
||||
turbo: true,
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
- if hidden_by_administration
|
||||
- if hidden_by_administration && hidden_by_expired
|
||||
%li
|
||||
= button_to repousser_expiration_and_restore_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: "fr-btn fr-icon-refresh-line" do
|
||||
= t('views.instructeurs.dossiers.restore_and_extend')
|
||||
|
||||
- elsif hidden_by_administration
|
||||
%li
|
||||
= button_to restore_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: "fr-btn fr-icon-refresh-line" do
|
||||
= t('views.instructeurs.dossiers.restore')
|
||||
|
||||
- elsif close_to_expiration || Dossier::TERMINE.include?(state)
|
||||
%li
|
||||
- if close_to_expiration
|
||||
|
|
|
@ -144,11 +144,12 @@
|
|||
- if p.hidden_by_administration_at.present?
|
||||
%span.cell-link
|
||||
= column
|
||||
= "- #{t('views.instructeurs.dossiers.deleted_by_user')}" if p.hidden_by_user_at.present?
|
||||
- if p.hidden_by_user_at.present?
|
||||
= "- #{t("views.instructeurs.dossiers.deleted_reason.#{p.hidden_by_reason}")}"
|
||||
- else
|
||||
%a.cell-link{ href: path }
|
||||
= column
|
||||
= "- #{t('views.instructeurs.dossiers.deleted_by_user')}" if p.hidden_by_user_at.present?
|
||||
= "- #{t('views.instructeurs.dossiers.deleted_reason', reason: p.hidden_by_reason)}" if p.hidden_by_user_at.present?
|
||||
|
||||
%td.status-col
|
||||
- status = [status_badge(p.state)]
|
||||
|
@ -172,6 +173,7 @@
|
|||
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
||||
close_to_expiration: @statut == 'expirant',
|
||||
hidden_by_administration: @statut == 'supprimes_recemment',
|
||||
hidden_by_expired: p.hidden_by_reason == 'expired',
|
||||
sva_svr: @procedure.sva_svr_enabled?,
|
||||
has_blocking_pending_correction: @procedure.feature_enabled?(:blocking_pending_correction) && p.pending_correction?,
|
||||
turbo: false,
|
||||
|
|
|
@ -102,6 +102,7 @@
|
|||
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
||||
close_to_expiration: nil,
|
||||
hidden_by_administration: nil,
|
||||
hidden_by_expired: nil,
|
||||
sva_svr: p.sva_svr_decision_on.present?,
|
||||
has_blocking_pending_correction: p.pending_correction? && Flipper.enabled?(:blocking_pending_correction, ProcedureFlipperActor.new(procedure_id)),
|
||||
turbo: false,
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
= t('views.users.dossiers.dossiers_list.n_dossier')
|
||||
= dossier.dossier_id
|
||||
|
||||
%span.fr-badge.fr-badge--sm.fr-badge--warning
|
||||
= t('views.users.dossiers.dossiers_list.deleted_badge')
|
||||
= status_badge(dossier.state, 'fr-mb-1w')
|
||||
|
||||
= paginate deleted_dossiers, views_prefix: 'shared'
|
||||
|
||||
|
|
|
@ -16,9 +16,12 @@
|
|||
%p.fr-icon--sm.fr-icon-user-line
|
||||
= demandeur_dossier(dossier)
|
||||
|
||||
- if dossier.hidden_by_user?
|
||||
- if dossier.hidden_by_expired?
|
||||
%p.fr-icon--sm.fr-icon-delete-line
|
||||
= t('views.users.dossiers.dossiers_list.deleted', date: l(dossier.hidden_by_user_at.to_date))
|
||||
= t('views.users.dossiers.dossiers_list.deleted_by_automatic', date: l(dossier.hidden_by_expired_at.to_date))
|
||||
- elsif dossier.hidden_by_user?
|
||||
%p.fr-icon--sm.fr-icon-delete-line
|
||||
= t('views.users.dossiers.dossiers_list.deleted_by_user', date: l(dossier.hidden_by_user_at.to_date))
|
||||
- else
|
||||
%p.fr-icon--sm.fr-icon-edit-box-line
|
||||
- if dossier.depose_at.present?
|
||||
|
@ -40,11 +43,7 @@
|
|||
= t('views.users.dossiers.dossiers_list.n_dossier')
|
||||
= number_with_html_delimiter(dossier.id)
|
||||
|
||||
- if @statut == "dossiers-supprimes-recemment"
|
||||
%span.fr-badge.fr-badge--sm.fr-badge--warning
|
||||
= t('views.users.dossiers.dossiers_list.deleted_badge')
|
||||
- else
|
||||
= status_badge_user(dossier, 'fr-mb-1w')
|
||||
= status_badge_user(dossier, 'fr-mb-1w')
|
||||
|
||||
- if dossier.pending_correction?
|
||||
%br
|
||||
|
@ -103,8 +102,18 @@
|
|||
|
||||
- if @statut == "dossiers-supprimes-recemment"
|
||||
.flex.justify-end
|
||||
= link_to restore_dossier_path(dossier.id), method: :patch, class: "fr-btn fr-btn--sm" do
|
||||
Restaurer
|
||||
- if dossier.hidden_by_reason != 'expired'
|
||||
= link_to restore_dossier_path(dossier.id), method: :patch, class: "fr-btn fr-btn--sm" do
|
||||
Restaurer
|
||||
|
||||
- else
|
||||
- if dossier.expiration_can_be_extended?
|
||||
= button_to users_dossier_repousser_expiration_and_restore_path(dossier), class: 'fr-btn fr-btn--sm' do
|
||||
Restaurer et étendre la conservation
|
||||
|
||||
|
||||
- else
|
||||
= render(partial: 'users/dossiers/show/download_dossier', locals: { dossier: dossier })
|
||||
|
||||
= paginate dossiers, views_prefix: 'shared'
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
%p.expires_at
|
||||
%small= t("shared.dossiers.header.expires_at.#{dossier.state}", date: safe_expiration_date(dossier), duree_conservation_totale: dossier.duree_totale_conservation_in_months)
|
||||
|
||||
- if dossier.close_to_expiration?
|
||||
= render Dsfr::CalloutComponent.new(title: t('users.dossiers.header.banner.title'), theme: :warning) do |c|
|
||||
- if dossier.close_to_expiration? || dossier.has_expired?
|
||||
- title = dossier.has_expired? ? 'title_expired' : 'title'
|
||||
= render Dsfr::CalloutComponent.new(title: t("users.dossiers.header.banner.#{title}"), theme: :warning) do |c|
|
||||
- c.with_body do
|
||||
- if dossier.brouillon?
|
||||
= t('users.dossiers.header.banner.states.brouillon')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue