add page link and page to access deleted dossier historique
This commit is contained in:
parent
ab483a8959
commit
30df5aa89a
5 changed files with 54 additions and 39 deletions
|
@ -6,7 +6,7 @@ module Users
|
|||
|
||||
layout 'procedure_context', only: [:identite, :update_identite, :siret, :update_siret]
|
||||
|
||||
ACTIONS_ALLOWED_TO_ANY_USER = [:index, :new, :transferer_all]
|
||||
ACTIONS_ALLOWED_TO_ANY_USER = [:index, :new, :transferer_all, :deleted_dossiers]
|
||||
ACTIONS_ALLOWED_TO_OWNER_OR_INVITE = [:show, :destroy, :demande, :messagerie, :brouillon, :submit_brouillon, :submit_en_construction, :modifier, :modifier_legacy, :update, :create_commentaire, :papertrail, :restore, :champ]
|
||||
|
||||
before_action :ensure_ownership!, except: ACTIONS_ALLOWED_TO_ANY_USER + ACTIONS_ALLOWED_TO_OWNER_OR_INVITE
|
||||
|
@ -60,7 +60,7 @@ module Users
|
|||
@dossiers_supprimes = (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_historique = deleted_dossiers
|
||||
@dossiers_supprimes_historique = deleted_dossiers
|
||||
|
||||
@statut = statut(@user_dossiers, @dossiers_traites, @dossiers_invites, @dossiers_supprimes, @dossier_transferes, @dossiers_close_to_expiration, params[:statut])
|
||||
|
||||
|
@ -429,6 +429,10 @@ module Users
|
|||
redirect_to dossier_path(@dossier)
|
||||
end
|
||||
|
||||
def deleted_dossiers
|
||||
@deleted_dossiers = current_user.deleted_dossiers.includes(:procedure).order_by_updated_at.page(page)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# if the status tab is filled, then this tab
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
- if deleted_dossiers.present?
|
||||
%h2.fr-h6.fr-mb-2w
|
||||
= page_entries_info deleted_dossiers
|
||||
|
||||
- deleted_dossiers.each do |dossier|
|
||||
.card
|
||||
.flex.justify-between
|
||||
%div
|
||||
%h3.card-title
|
||||
= dossier.procedure.libelle
|
||||
|
||||
%p.fr-icon--sm.fr-icon-delete-line.fr-mb-0
|
||||
= t('views.users.dossiers.dossiers_list.deleted', date: l(dossier.updated_at.to_date))
|
||||
= "-"
|
||||
= t("activerecord.attributes.deleted_dossier.reason.#{dossier.reason}")
|
||||
|
||||
.text-right
|
||||
%p.fr-mb-0
|
||||
= t('views.users.dossiers.dossiers_list.n_dossier')
|
||||
= dossier.dossier_id
|
||||
|
||||
= status_badge(dossier.state, 'fr-mb-1w')
|
||||
|
||||
= paginate deleted_dossiers, views_prefix: 'shared'
|
||||
|
||||
- else
|
||||
.blank-tab
|
||||
%h2.empty-text= t('views.users.dossiers.dossiers_list.no_result_title')
|
||||
%p.empty-text-details
|
||||
= t('views.users.dossiers.dossiers_list.no_result_text_html', app_base: Current.application_base_url)
|
41
app/views/users/dossiers/deleted_dossiers.html.haml
Normal file
41
app/views/users/dossiers/deleted_dossiers.html.haml
Normal file
|
@ -0,0 +1,41 @@
|
|||
- content_for(:title, "Historique des dossiers supprimés")
|
||||
|
||||
= render partial: 'administrateurs/breadcrumbs',
|
||||
locals: { steps: [['Historique des dossiers supprimés']] }
|
||||
|
||||
|
||||
.fr-container
|
||||
.fr-mb-3w
|
||||
= link_to "Retour à la liste des dossiers", dossiers_path(), class: "fr-link fr-icon-arrow-left-line fr-link--icon-left"
|
||||
%h1.fr-h2
|
||||
Historique des dossiers supprimés
|
||||
|
||||
.fr-container
|
||||
- if @deleted_dossiers.present?
|
||||
%h2.fr-h6.fr-mb-2w
|
||||
= page_entries_info @deleted_dossiers
|
||||
|
||||
- @deleted_dossiers.each do |dossier|
|
||||
.card
|
||||
.flex.justify-between
|
||||
%div
|
||||
%h3.card-title
|
||||
= dossier.procedure.libelle
|
||||
|
||||
%p.fr-icon--sm.fr-icon-delete-line.fr-mb-0
|
||||
= t('views.users.dossiers.dossiers_list.deleted', date: l(dossier.updated_at.to_date))
|
||||
= "-"
|
||||
= t("activerecord.attributes.deleted_dossier.reason.#{dossier.reason}")
|
||||
|
||||
.text-right
|
||||
%p.fr-mb-0
|
||||
= t('views.users.dossiers.dossiers_list.n_dossier')
|
||||
= dossier.dossier_id
|
||||
|
||||
= paginate @deleted_dossiers, views_prefix: 'shared'
|
||||
|
||||
- else
|
||||
.blank-tab
|
||||
%h2.empty-text= t('views.users.dossiers.dossiers_list.no_result_title')
|
||||
%p.empty-text-details
|
||||
= t('views.users.dossiers.dossiers_list.no_result_text_html', app_base: Current.application_base_url)
|
|
@ -5,7 +5,11 @@
|
|||
|
||||
.dossiers-headers.sub-header
|
||||
.fr-container
|
||||
.flex.align-center
|
||||
%h1.page-title.fr-h2= t('views.users.dossiers.index.dossiers')
|
||||
- if @dossiers_supprimes_historique.present?
|
||||
%p.ml-auto
|
||||
= link_to('Historique des dossiers supprimés', deleted_dossiers_path(), class: 'fr-link')
|
||||
|
||||
.fr-grid-row.fr-grid-row--gutters
|
||||
- if current_user.dossiers.count > 2 || current_user.dossiers_invites.count > 2
|
||||
|
@ -82,9 +86,4 @@
|
|||
|
||||
- else
|
||||
= render Dossiers::UserFilterComponent.new(statut: @statut, filter: @filter, procedure_id: @procedure_id )
|
||||
|
||||
- if @statut == "dossiers-supprimes-definitivement"
|
||||
-# /!\ in this context, @dossiers is a collection of DeletedDossier not Dossier
|
||||
= render partial: "deleted_dossiers_list", locals: { deleted_dossiers: @dossiers }
|
||||
- else
|
||||
= render partial: "dossiers_list", locals: { dossiers: @dossiers, filter: @filter, statut: @statut, search: false }
|
||||
|
|
|
@ -389,6 +389,7 @@ Rails.application.routes.draw do
|
|||
|
||||
resource :feedback, only: [:create]
|
||||
get 'demarches' => 'demarches#index'
|
||||
get 'deleted_dossiers' => 'dossiers#deleted_dossiers'
|
||||
|
||||
get 'profil' => 'profil#show'
|
||||
patch 'update_email' => 'profil#update_email'
|
||||
|
|
Loading…
Reference in a new issue