Merge pull request #6656 from betagouv/6649-etq-usager-instructeur-rendre-la-suppression-plus-visible
6649 ETQ usager instructeur rendre la suppression plus visible
This commit is contained in:
commit
73faa569e8
27 changed files with 397 additions and 62 deletions
|
@ -1,9 +1,7 @@
|
|||
@import "colors";
|
||||
@import "constants";
|
||||
|
||||
#dossier-show {
|
||||
margin-bottom: 30px;
|
||||
|
||||
.dossier-container {
|
||||
.sub-header {
|
||||
.label {
|
||||
float: right;
|
|
@ -50,6 +50,8 @@
|
|||
color: $black;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.mt-1 {
|
||||
margin-top: $default-spacer;
|
||||
}
|
||||
|
@ -58,6 +60,10 @@
|
|||
margin-top: 2 * $default-spacer;
|
||||
}
|
||||
|
||||
.mt-3 {
|
||||
margin-top: 3 * $default-spacer;
|
||||
}
|
||||
|
||||
.mt-4 {
|
||||
margin-top: 4 * $default-spacer;
|
||||
}
|
||||
|
@ -66,10 +72,62 @@
|
|||
margin-top: 8 * $default-spacer;
|
||||
}
|
||||
|
||||
.mb-1 {
|
||||
margin-bottom: $default-spacer;
|
||||
}
|
||||
|
||||
.mb-2 {
|
||||
margin-bottom: 2 * $default-spacer;
|
||||
}
|
||||
|
||||
.mb-1 {
|
||||
margin-bottom: $default-spacer;
|
||||
.mb-3 {
|
||||
margin-bottom: 3 * $default-spacer;
|
||||
}
|
||||
|
||||
.mb-4 {
|
||||
margin-bottom: 4 * $default-spacer;
|
||||
}
|
||||
|
||||
.mb-8 {
|
||||
margin-bottom: 8 * $default-spacer;
|
||||
}
|
||||
|
||||
.pt-1 {
|
||||
padding-top: $default-spacer;
|
||||
}
|
||||
|
||||
.pt-2 {
|
||||
padding-top: 2 * $default-spacer;
|
||||
}
|
||||
|
||||
.pt-3 {
|
||||
padding-top: 3 * $default-spacer;
|
||||
}
|
||||
|
||||
.pt-4 {
|
||||
padding-top: 4 * $default-spacer;
|
||||
}
|
||||
|
||||
.pt-8 {
|
||||
padding-top: 8 * $default-spacer;
|
||||
}
|
||||
|
||||
.pb-1 {
|
||||
padding-bottom: $default-spacer;
|
||||
}
|
||||
|
||||
.pb-2 {
|
||||
padding-bottom: 2 * $default-spacer;
|
||||
}
|
||||
|
||||
.pb-3 {
|
||||
padding-bottom: 3 * $default-spacer;
|
||||
}
|
||||
|
||||
.pb-4 {
|
||||
padding-bottom: 4 * $default-spacer;
|
||||
}
|
||||
|
||||
.pb-8 {
|
||||
padding-bottom: 8 * $default-spacer;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@ module Users
|
|||
.with_dossiers
|
||||
.where(email: current_user.email)
|
||||
.page(page)
|
||||
@statut = statut(@user_dossiers, @dossiers_invites, @dossiers_supprimes, @dossier_transfers, params[:statut])
|
||||
@dossiers_close_to_expiration = current_user.dossiers.close_to_expiration.page(page)
|
||||
@statut = statut(@user_dossiers, @dossiers_invites, @dossiers_supprimes, @dossier_transfers, @dossiers_close_to_expiration, params[:statut])
|
||||
end
|
||||
|
||||
def show
|
||||
|
@ -291,12 +292,13 @@ module Users
|
|||
# if the status tab is filled, then this tab
|
||||
# else first filled tab
|
||||
# else mes-dossiers
|
||||
def statut(mes_dossiers, dossiers_invites, dossiers_supprimes, dossier_transfers, params_statut)
|
||||
def statut(mes_dossiers, dossiers_invites, dossiers_supprimes, dossier_transfers, dossiers_close_to_expiration, params_statut)
|
||||
tabs = {
|
||||
'mes-dossiers' => mes_dossiers.present?,
|
||||
'dossiers-invites' => dossiers_invites.present?,
|
||||
'dossiers-supprimes' => dossiers_supprimes.present?,
|
||||
'dossiers-transferes' => dossier_transfers.present?
|
||||
'dossiers-transferes' => dossier_transfers.present?,
|
||||
'dossiers-expirant' => dossiers_close_to_expiration.present?
|
||||
}
|
||||
if tabs[params_statut]
|
||||
params_statut
|
||||
|
|
|
@ -98,6 +98,11 @@ module DossierHelper
|
|||
end
|
||||
end
|
||||
|
||||
def safe_expiration_date(dossier)
|
||||
date = dossier.expiration_date.presence || dossier.approximative_expiration_date
|
||||
l(date, format: '%d/%m/%Y')
|
||||
end
|
||||
|
||||
def annuaire_link(siren)
|
||||
base_url = "https://annuaire-entreprises.data.gouv.fr"
|
||||
return base_url if siren.blank?
|
||||
|
|
|
@ -60,8 +60,11 @@ class Dossier < ApplicationRecord
|
|||
|
||||
REMAINING_DAYS_BEFORE_CLOSING = 2
|
||||
INTERVAL_BEFORE_CLOSING = "#{REMAINING_DAYS_BEFORE_CLOSING} days"
|
||||
INTERVAL_BEFORE_EXPIRATION = '2 weeks'
|
||||
INTERVAL_EXPIRATION = '1 month 5 days'
|
||||
REMAINING_WEEKS_BEFORE_EXPIRATION = 2
|
||||
INTERVAL_BEFORE_EXPIRATION = "#{REMAINING_WEEKS_BEFORE_EXPIRATION} weeks"
|
||||
MONTHS_AFTER_EXPIRATION = 1
|
||||
DAYS_AFTER_EXPIRATION = 5
|
||||
INTERVAL_EXPIRATION = "#{MONTHS_AFTER_EXPIRATION} month #{DAYS_AFTER_EXPIRATION} days"
|
||||
|
||||
has_one :etablissement, dependent: :destroy
|
||||
has_one :individual, validate: false, dependent: :destroy
|
||||
|
@ -286,25 +289,39 @@ class Dossier < ApplicationRecord
|
|||
.where.not(user_id: nil)
|
||||
end
|
||||
|
||||
scope :interval_brouillon_close_to_expiration, -> do
|
||||
state_brouillon.where("dossiers.created_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
scope :interval_en_construction_close_to_expiration, -> do
|
||||
state_en_construction.where("dossiers.en_construction_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
scope :interval_en_instruction_close_to_expiration, -> do
|
||||
state_en_instruction.where("dossiers.en_instruction_at + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
scope :interval_termine_close_to_expiration, -> do
|
||||
state_termine.where(id: Traitement.termine_close_to_expiration.select(:dossier_id).distinct)
|
||||
end
|
||||
|
||||
scope :brouillon_close_to_expiration, -> do
|
||||
state_brouillon
|
||||
.joins(:procedure)
|
||||
.where("dossiers.created_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
joins(:procedure).interval_brouillon_close_to_expiration
|
||||
end
|
||||
scope :en_construction_close_to_expiration, -> do
|
||||
state_en_construction
|
||||
.joins(:procedure)
|
||||
.where("dossiers.en_construction_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
joins(:procedure).interval_en_construction_close_to_expiration
|
||||
end
|
||||
scope :en_instruction_close_to_expiration, -> do
|
||||
state_en_instruction
|
||||
.joins(:procedure)
|
||||
.where("dossiers.en_instruction_at + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
joins(:procedure).interval_en_instruction_close_to_expiration
|
||||
end
|
||||
scope :termine_close_to_expiration, -> do
|
||||
state_termine
|
||||
.joins(:procedure)
|
||||
.where(id: Traitement.termine_close_to_expiration.select(:dossier_id).distinct)
|
||||
joins(:procedure).interval_termine_close_to_expiration
|
||||
end
|
||||
|
||||
scope :close_to_expiration, -> do
|
||||
joins(:procedure).scoping do
|
||||
interval_brouillon_close_to_expiration
|
||||
.or(interval_en_construction_close_to_expiration)
|
||||
.or(interval_en_instruction_close_to_expiration)
|
||||
.or(interval_termine_close_to_expiration)
|
||||
end
|
||||
end
|
||||
|
||||
scope :brouillon_expired, -> do
|
||||
|
@ -522,16 +539,50 @@ class Dossier < ApplicationRecord
|
|||
!brouillon? && !user_deleted? && !archived
|
||||
end
|
||||
|
||||
def en_construction_close_to_expiration?
|
||||
self.class.en_construction_close_to_expiration.exists?(id: self)
|
||||
def expirable?
|
||||
[brouillon?, en_construction?, termine?].any?
|
||||
end
|
||||
|
||||
def brouillon_close_to_expiration?
|
||||
self.class.brouillon_close_to_expiration.exists?(id: self)
|
||||
def approximative_expiration_date_reference
|
||||
if brouillon?
|
||||
created_at
|
||||
elsif en_construction?
|
||||
en_construction_at
|
||||
elsif termine?
|
||||
processed_at
|
||||
else
|
||||
fail "approximative_expiration_date_reference should not be called in state #{self.state}"
|
||||
end
|
||||
end
|
||||
|
||||
def approximative_expiration_date
|
||||
[
|
||||
approximative_expiration_date_reference,
|
||||
conservation_extension,
|
||||
procedure.duree_conservation_dossiers_dans_ds.months
|
||||
].sum - REMAINING_WEEKS_BEFORE_EXPIRATION.weeks
|
||||
end
|
||||
|
||||
def close_to_expiration?
|
||||
en_construction_close_to_expiration? || brouillon_close_to_expiration?
|
||||
approximative_expiration_date < Time.zone.now
|
||||
end
|
||||
|
||||
def expiration_date
|
||||
if brouillon? && brouillon_close_to_expiration_notice_sent_at.present?
|
||||
brouillon_close_to_expiration_notice_sent_at + duration_after_notice
|
||||
elsif en_construction? && en_construction_close_to_expiration_notice_sent_at.present?
|
||||
en_construction_close_to_expiration_notice_sent_at + duration_after_notice
|
||||
elsif termine? && termine_close_to_expiration_notice_sent_at.present?
|
||||
termine_close_to_expiration_notice_sent_at + duration_after_notice
|
||||
end
|
||||
end
|
||||
|
||||
def duration_after_notice
|
||||
MONTHS_AFTER_EXPIRATION.month + DAYS_AFTER_EXPIRATION.days
|
||||
end
|
||||
|
||||
def expiration_can_be_extended?
|
||||
brouillon? || en_construction?
|
||||
end
|
||||
|
||||
def show_groupe_instructeur_details?
|
||||
|
|
|
@ -17,14 +17,6 @@ class Traitement < ApplicationRecord
|
|||
scope :en_instruction, -> { where(state: Dossier.states.fetch(:en_instruction)) }
|
||||
scope :termine, -> { where(state: Dossier::TERMINE) }
|
||||
|
||||
scope :termine_close_to_expiration, -> do
|
||||
joins(dossier: :procedure)
|
||||
.termine
|
||||
.where(process_expired: true)
|
||||
.where('dossiers.state' => Dossier::TERMINE)
|
||||
.where("traitements.processed_at + (procedures.duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: Dossier::INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
|
||||
scope :for_traitement_time_stats, -> (procedure) do
|
||||
includes(:dossier)
|
||||
.termine
|
||||
|
@ -33,6 +25,14 @@ class Traitement < ApplicationRecord
|
|||
.order(:processed_at)
|
||||
end
|
||||
|
||||
scope :termine_close_to_expiration, -> do
|
||||
joins(dossier: :procedure)
|
||||
.termine
|
||||
.where(process_expired: true)
|
||||
.where('dossiers.state' => Dossier::TERMINE)
|
||||
.where("traitements.processed_at + (procedures.duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: Dossier::INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
|
||||
def self.count_dossiers_termines_by_month(groupe_instructeurs)
|
||||
last_traitements_per_dossier = Traitement
|
||||
.select('max(traitements.processed_at) as processed_at')
|
||||
|
|
14
app/views/shared/dossiers/_expiration_banner.html.haml
Normal file
14
app/views/shared/dossiers/_expiration_banner.html.haml
Normal file
|
@ -0,0 +1,14 @@
|
|||
- if dossier.expirable? && dossier.close_to_expiration?
|
||||
.card.warning.mt-2.mb-3
|
||||
.card-title= t('shared.dossiers.header.banner.title')
|
||||
%p
|
||||
- if dossier.brouillon?
|
||||
= t('shared.dossiers.header.banner.states.brouillon')
|
||||
- elsif dossier.en_construction?
|
||||
= t('shared.dossiers.header.banner.states.en_construction')
|
||||
- elsif dossier.termine?
|
||||
= t('shared.dossiers.header.banner.states.termine')
|
||||
|
||||
- if dossier.expiration_can_be_extended?
|
||||
%br
|
||||
= button_to t('shared.dossiers.header.banner.button_delay_expiration'), users_dossier_repousser_expiration_path(dossier), class: 'button secondary mt-2'
|
|
@ -1,6 +1,14 @@
|
|||
%h1
|
||||
= procedure_libelle(dossier.procedure)
|
||||
= status_badge(dossier.state)
|
||||
.title-container
|
||||
%span.icon.folder
|
||||
%h1= procedure_libelle(dossier.procedure)
|
||||
%h2
|
||||
= t('views.users.dossiers.show.header.dossier_number', dossier_id: dossier.id)
|
||||
= t('views.users.dossiers.show.header.created_date', date_du_dossier: I18n.l(dossier.created_at))
|
||||
|
||||
= render(partial: 'shared/dossiers/short_expires_message', locals: {dossier: dossier})
|
||||
|
||||
.header-actions
|
||||
- if current_user.owns?(dossier)
|
||||
= render partial: 'invites/dropdown', locals: { dossier: dossier }
|
||||
|
||||
.dossier-form-actions
|
||||
- if current_user.owns?(dossier)
|
||||
= render partial: 'invites/dropdown', locals: { dossier: dossier }
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
- if dossier.expirable?
|
||||
%p.expires_at
|
||||
%small= t("shared.dossiers.header.expires_at.#{dossier.state}", date: safe_expiration_date(dossier))
|
||||
- else
|
||||
%p.expires_at_en_instruction
|
||||
%small= t("shared.dossiers.header.expires_at.en_instruction")
|
||||
|
||||
|
||||
= render(partial: 'shared/dossiers/expiration_banner', locals: {dossier: dossier})
|
|
@ -4,7 +4,7 @@
|
|||
- content_for :footer do
|
||||
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
|
||||
|
||||
#dossier-draft
|
||||
.dossier-container
|
||||
.dossier-header.sub-header
|
||||
.container
|
||||
= render partial: "shared/dossiers/header", locals: { dossier: @dossier, apercu: false }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
- content_for :footer do
|
||||
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
|
||||
|
||||
#dossier-show
|
||||
.dossier-container.mb-4
|
||||
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
|
||||
|
||||
= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil, profile: 'usager' }
|
||||
|
|
|
@ -39,6 +39,12 @@
|
|||
active: @statut == 'dossiers-transferes',
|
||||
badge: number_with_html_delimiter(@dossier_transfers.count))
|
||||
|
||||
- if @dossiers_close_to_expiration.count > 0
|
||||
= tab_item(t('pluralize.dossiers_close_to_expiration', count: @dossiers_close_to_expiration.count),
|
||||
dossiers_path(statut: 'dossiers-expirant'),
|
||||
active: @statut == 'dossiers-expirant',
|
||||
badge: number_with_html_delimiter(@dossiers_close_to_expiration.count))
|
||||
|
||||
.container
|
||||
- if @statut == "mes-dossiers"
|
||||
= render partial: "dossiers_list", locals: { dossiers: @user_dossiers }
|
||||
|
@ -48,6 +54,8 @@
|
|||
|
||||
- if @statut == "dossiers-supprimes"
|
||||
= render partial: "deleted_dossiers_list", locals: { deleted_dossiers: @dossiers_supprimes }
|
||||
|
||||
- if @statut == "dossiers-transferes"
|
||||
= render partial: "transfered_dossiers_list", locals: { dossier_transfers: @dossier_transfers }
|
||||
|
||||
- if @statut == "dossiers-expirant"
|
||||
= render partial: "dossiers_list", locals: { dossiers: @dossiers_close_to_expiration }
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
- content_for :footer do
|
||||
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
|
||||
|
||||
#dossier-show
|
||||
.dossier-container.mb-4
|
||||
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
|
||||
|
||||
.container
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
- content_for :footer do
|
||||
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
|
||||
|
||||
#dossier-show
|
||||
.dossier-container.mb-4
|
||||
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
|
||||
|
||||
.container
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
- content_for :footer do
|
||||
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
|
||||
|
||||
#dossier-show
|
||||
.dossier-container.mb-4
|
||||
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
|
||||
|
||||
.container
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
- if dossier.en_construction_at.present?
|
||||
= t('views.users.dossiers.show.header.submit_date', date_du_dossier: I18n.l(dossier.en_construction_at))
|
||||
|
||||
= render(partial: 'shared/dossiers/short_expires_message', locals: {dossier: dossier})
|
||||
|
||||
|
||||
- if current_user.owns?(dossier)
|
||||
.header-actions
|
||||
= render partial: 'invites/dropdown', locals: { dossier: dossier }
|
||||
|
@ -22,21 +25,6 @@
|
|||
%li
|
||||
= link_to t('views.users.dossiers.show.header.print_dossier'), dossier_path(dossier, format: :pdf), target: "_blank", rel: "noopener", class: "menu-item menu-link"
|
||||
|
||||
- if dossier.close_to_expiration?
|
||||
.card.warning
|
||||
.card-title Votre dossier va expirer
|
||||
- if dossier.brouillon?
|
||||
%p
|
||||
Votre dossier est en brouillon, mais va bientôt expirer. Cela signifie qu’il va bientôt être supprimé sans avoir été déposé.
|
||||
Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver
|
||||
un mois de plus en cliquant sur le bouton ci-dessous.
|
||||
- else
|
||||
%p
|
||||
Votre dossier a été déposé, mais va bientôt expirer. Cela signifie qu’il va bientôt être supprimé sans avoir été traité par l’administration.
|
||||
Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver
|
||||
un mois de plus en cliquant sur le bouton ci-dessous.
|
||||
%br
|
||||
= button_to 'Repousser sa suppression', users_dossier_repousser_expiration_path(dossier), class: 'button secondary'
|
||||
|
||||
%ul.tabs
|
||||
= dynamic_tab_item(t('views.users.dossiers.show.header.summary'), dossier_path(dossier))
|
||||
|
|
|
@ -160,6 +160,7 @@ en:
|
|||
request: "Request"
|
||||
mailbox: "Mailbox"
|
||||
dossier_number: "File n. %{dossier_id}"
|
||||
created_date: "- Draft on %{date_du_dossier}"
|
||||
submit_date: "- Submit on %{date_du_dossier}"
|
||||
print: "print"
|
||||
print_dossier: "All the file"
|
||||
|
@ -341,6 +342,10 @@ en:
|
|||
zero: transfer request
|
||||
one: transfer request
|
||||
other: transfer requests
|
||||
dossiers_close_to_expiration:
|
||||
zero: expiring file
|
||||
one: expiring file
|
||||
other: expiring files
|
||||
dossier_trouve:
|
||||
zero: 0 file found
|
||||
one: 1 file found
|
||||
|
|
|
@ -156,6 +156,7 @@ fr:
|
|||
request: "Demande"
|
||||
mailbox: "Messagerie"
|
||||
dossier_number: "Dossier nº %{dossier_id}"
|
||||
created_date: "- En brouillon depuis le %{date_du_dossier}"
|
||||
submit_date: "- Déposé le %{date_du_dossier}"
|
||||
print: "imprimer"
|
||||
print_dossier: "Tout le dossier"
|
||||
|
@ -349,6 +350,10 @@ fr:
|
|||
zero: demande de transfert
|
||||
one: demande de transfert
|
||||
other: demandes de transfert
|
||||
dossiers_close_to_expiration:
|
||||
zero: dossier expirant
|
||||
one: dossier expirant
|
||||
other: dossiers expirant
|
||||
dossier_trouve:
|
||||
zero: 0 dossier trouvé
|
||||
one: 1 dossier trouvé
|
||||
|
|
|
@ -7,6 +7,21 @@ en:
|
|||
numero_allocataire_notice: It is usually composed of 7 digits.
|
||||
code_postal_label: postal code
|
||||
code_postal_notice: It is usually composed of 5 digits.
|
||||
header:
|
||||
expires_at:
|
||||
brouillon: "Expires at %{date}"
|
||||
en_construction: "Expires at %{date}"
|
||||
en_instruction: "This file is being instructed, the administration will answer as soon as possible"
|
||||
accepte: "Expires at %{date}"
|
||||
refuse: "Expires at %{date}"
|
||||
sans_suite: "Expires at %{date}"
|
||||
banner:
|
||||
title: Your file will expire
|
||||
states:
|
||||
brouillon: Your file is still in draft and will soon expire. So it will be deleted soon without being instructed. If you want to pursue your procedure you can submit it now. Otherwise you are able to delay its expiration by clicking on the underneath button.
|
||||
en_construction: Your file is pending for instruction. The maximum delay is 6 months, but your can extend the duration by a month by clicking on the underneath button.
|
||||
termine: Your file had been processed and will soon expire.So it will be deleted soon. If you want to keep it, your can dowload a PDF file of it.
|
||||
button_delay_expiration: "Delay deletion"
|
||||
champs:
|
||||
cnaf:
|
||||
show:
|
||||
|
|
|
@ -7,6 +7,22 @@ fr:
|
|||
numero_allocataire_notice: Il est généralement composé de 7 chiffres.
|
||||
code_postal_label: Le code postal
|
||||
code_postal_notice: Il est généralement composé de 5 chiffres.
|
||||
header:
|
||||
expires_at:
|
||||
brouillon: "Expirera le %{date}"
|
||||
en_construction: "Expirera le %{date}"
|
||||
en_instruction: "Ce dossier est en instruction, il n'expirera pas"
|
||||
accepte: "Expirera le %{date}"
|
||||
refuse: "Expirera le %{date}"
|
||||
sans_suite: "Expirera le %{date}"
|
||||
banner:
|
||||
title: Votre dossier va expirer
|
||||
states:
|
||||
brouillon: Votre dossier est en brouillon, mais va bientôt expirer. Cela signifie qu’il va bientôt être supprimé sans avoir été déposé. Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver un mois de plus en cliquant sur le bouton ci-dessous.
|
||||
en_construction: Votre dossier est en attente de prise en charge par l'administration. Le delais de prise en charge maximale est de 6 mois. Vous pouvez toutefois entendre cette durée d'un mois en cliquant sur le bouton suivant.
|
||||
termine: Le traitement de votre dossier est terminé, mais il va bientôt expirer. Cela signifie qu’il va bientôt être supprimé. Si vous souhaitez conserver une trace, vous pouvez le télécharger au format PDF.
|
||||
button_delay_expiration: "Repousser sa suppression"
|
||||
|
||||
champs:
|
||||
cnaf:
|
||||
show:
|
||||
|
|
|
@ -1125,4 +1125,14 @@ describe Users::DossiersController, type: :controller do
|
|||
it { is_expected.to be_falsy }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#index' do
|
||||
before do
|
||||
sign_in(user)
|
||||
end
|
||||
it 'works' do
|
||||
get :index
|
||||
expect(response).to have_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
8
spec/factories/traitement.rb
Normal file
8
spec/factories/traitement.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
FactoryBot.define do
|
||||
factory :traitement do
|
||||
trait :accepte do
|
||||
process_expired { true }
|
||||
state { :accepte }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -61,6 +61,16 @@ describe Dossier do
|
|||
|
||||
it { is_expected.not_to include(expiring_dossier) }
|
||||
end
|
||||
|
||||
context 'when .close_to_expiration' do
|
||||
subject { Dossier.close_to_expiration }
|
||||
it do
|
||||
is_expected.not_to include(young_dossier)
|
||||
is_expected.to include(expiring_dossier)
|
||||
is_expected.to include(just_expired_dossier)
|
||||
is_expected.to include(long_expired_dossier)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'en_construction_close_to_expiration' do
|
||||
|
@ -87,6 +97,16 @@ describe Dossier do
|
|||
|
||||
it { is_expected.not_to include(expiring_dossier) }
|
||||
end
|
||||
|
||||
context 'when .close_to_expiration' do
|
||||
subject { Dossier.close_to_expiration }
|
||||
it do
|
||||
is_expected.not_to include(young_dossier)
|
||||
is_expected.to include(expiring_dossier)
|
||||
is_expected.to include(just_expired_dossier)
|
||||
is_expected.to include(long_expired_dossier)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'en_instruction_close_to_expiration' do
|
||||
|
@ -104,6 +124,43 @@ describe Dossier do
|
|||
is_expected.to include(just_expired_dossier)
|
||||
is_expected.to include(long_expired_dossier)
|
||||
end
|
||||
|
||||
context 'when .close_to_expiration' do
|
||||
subject { Dossier.close_to_expiration }
|
||||
it do
|
||||
is_expected.not_to include(young_dossier)
|
||||
is_expected.to include(expiring_dossier)
|
||||
is_expected.to include(just_expired_dossier)
|
||||
is_expected.to include(long_expired_dossier)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'termine_close_to_expiration' do
|
||||
let(:procedure) { create(:procedure, :published, duree_conservation_dossiers_dans_ds: 6) }
|
||||
let!(:young_dossier) { create(:dossier, :accepte, procedure: procedure, traitements: [build(:traitement, :accepte)]) }
|
||||
let!(:expiring_dossier) { create(:dossier, :accepte, procedure: procedure, traitements: [build(:traitement, :accepte, processed_at: 175.days.ago)]) }
|
||||
let!(:just_expired_dossier) { create(:dossier, :accepte, procedure: procedure, traitements: [build(:traitement, :accepte, processed_at: (6.months + 1.hour + 10.seconds).ago)]) }
|
||||
let!(:long_expired_dossier) { create(:dossier, :accepte, procedure: procedure, traitements: [build(:traitement, :accepte, processed_at: 1.year.ago)]) }
|
||||
|
||||
subject { Dossier.termine_close_to_expiration }
|
||||
|
||||
it do
|
||||
is_expected.not_to include(young_dossier)
|
||||
is_expected.to include(expiring_dossier)
|
||||
is_expected.to include(just_expired_dossier)
|
||||
is_expected.to include(long_expired_dossier)
|
||||
end
|
||||
|
||||
context 'when .close_to_expiration' do
|
||||
subject { Dossier.close_to_expiration }
|
||||
it do
|
||||
is_expected.not_to include(young_dossier)
|
||||
is_expected.to include(expiring_dossier)
|
||||
is_expected.to include(just_expired_dossier)
|
||||
is_expected.to include(long_expired_dossier)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with_notifications' do
|
||||
|
|
|
@ -9,7 +9,7 @@ end
|
|||
|
||||
Capybara.register_driver :headless_chrome do |app|
|
||||
options = Selenium::WebDriver::Chrome::Options.new
|
||||
options.add_argument('--headless')
|
||||
options.add_argument('--headless') unless ENV['NO_HEADLESS']
|
||||
options.add_argument('--window-size=1440,900')
|
||||
|
||||
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
||||
|
|
|
@ -165,6 +165,27 @@ describe 'The user' do
|
|||
expect(page).to have_current_path(merci_dossier_path(user_dossier))
|
||||
end
|
||||
|
||||
scenario 'extends dossier experation date more than one time, ', js: true do
|
||||
user_old_dossier = create(:dossier,
|
||||
procedure: simple_procedure,
|
||||
created_at: simple_procedure.duree_conservation_dossiers_dans_ds.month.ago,
|
||||
user: user)
|
||||
login_as(user, scope: :user)
|
||||
visit brouillon_dossier_path(user_old_dossier)
|
||||
|
||||
expect(page).to have_css('.card-title', text: 'Votre dossier va expirer', visible: true)
|
||||
click_on "Repousser sa suppression"
|
||||
expect(page).not_to have_button("Repousser sa suppression")
|
||||
|
||||
Timecop.freeze(1.month.from_now) do
|
||||
visit brouillon_dossier_path(user_old_dossier)
|
||||
|
||||
expect(page).to have_css('.card-title', text: 'Votre dossier va expirer', visible: true)
|
||||
click_on "Repousser sa suppression"
|
||||
expect(page).not_to have_button("Repousser sa suppression")
|
||||
end
|
||||
end
|
||||
|
||||
let(:procedure_with_pj) do
|
||||
tdcs = [build(:type_de_champ_piece_justificative, mandatory: true, libelle: 'Pièce justificative')]
|
||||
create(:procedure, :published, :for_individual, types_de_champ: tdcs)
|
||||
|
|
56
spec/views/shared/dossiers/_header.html.haml_spec.rb
Normal file
56
spec/views/shared/dossiers/_header.html.haml_spec.rb
Normal file
|
@ -0,0 +1,56 @@
|
|||
describe 'shared/dossiers/short_expires_message.html.haml', type: :view do
|
||||
include DossierHelper
|
||||
let(:dossier) do
|
||||
build(:dossier, state, attributes.merge(id: 1, state: state))
|
||||
end
|
||||
let(:i18n_key_state) { state }
|
||||
subject do
|
||||
render('shared/dossiers/short_expires_message.html.haml',
|
||||
dossier: dossier,
|
||||
current_user: build(:user))
|
||||
end
|
||||
|
||||
context 'with dossier.brouillon?' do
|
||||
let(:attributes) { { created_at: 6.months.ago } }
|
||||
let(:state) { :brouillon }
|
||||
|
||||
it 'render estimated expiration date' do
|
||||
expect(subject).to have_selector('.expires_at',
|
||||
text: I18n.t("shared.dossiers.header.expires_at.#{i18n_key_state}",
|
||||
date: safe_expiration_date(dossier)))
|
||||
end
|
||||
end
|
||||
|
||||
context 'with dossier.en_construction?' do
|
||||
let(:attributes) { { en_construction_at: 6.months.ago } }
|
||||
let(:state) { :en_construction }
|
||||
|
||||
it 'render estimated expiration date' do
|
||||
expect(subject).to have_selector('.expires_at',
|
||||
text: I18n.t("shared.dossiers.header.expires_at.#{i18n_key_state}",
|
||||
date: safe_expiration_date(dossier)))
|
||||
end
|
||||
end
|
||||
|
||||
context 'with dossier.en_instruction?' do
|
||||
let(:state) { :en_instruction }
|
||||
let(:attributes) { {} }
|
||||
|
||||
it 'render estimated expiration date' do
|
||||
expect(subject).to have_selector('p.expires_at_en_instruction',
|
||||
text: I18n.t("shared.dossiers.header.expires_at.#{i18n_key_state}"))
|
||||
end
|
||||
end
|
||||
|
||||
context 'with dossier.en_processed_at?' do
|
||||
let(:state) { :accepte }
|
||||
let(:attributes) { {} }
|
||||
|
||||
it 'render estimated expiration date' do
|
||||
allow(dossier).to receive(:processed_at).and_return(6.months.ago)
|
||||
expect(subject).to have_selector('.expires_at',
|
||||
text: I18n.t("shared.dossiers.header.expires_at.#{i18n_key_state}",
|
||||
date: safe_expiration_date(dossier)))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -13,6 +13,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
assign(:dossiers_invites, Kaminari.paginate_array(dossiers_invites).page(1))
|
||||
assign(:dossiers_supprimes, Kaminari.paginate_array(user_dossiers).page(1))
|
||||
assign(:dossier_transfers, Kaminari.paginate_array([]).page(1))
|
||||
assign(:dossiers_close_to_expiration, Kaminari.paginate_array([]).page(1))
|
||||
assign(:statut, statut)
|
||||
render
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue