instructeur: show deleted dossiers for a procedure
This commit is contained in:
parent
bce2f92d2c
commit
b4b92accf1
8 changed files with 116 additions and 0 deletions
|
@ -17,21 +17,41 @@
|
||||||
border: 1px solid $blue;
|
border: 1px solid $blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.en-instruction {
|
||||||
|
@extend .instruction;
|
||||||
|
}
|
||||||
|
|
||||||
&.construction {
|
&.construction {
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
color: $black;
|
color: $black;
|
||||||
border: 1px solid $black;
|
border: 1px solid $black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.en-construction {
|
||||||
|
@extend .construction;
|
||||||
|
}
|
||||||
|
|
||||||
&.accepted {
|
&.accepted {
|
||||||
background-color: $green;
|
background-color: $green;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.accepte {
|
||||||
|
@extend .accepted;
|
||||||
|
}
|
||||||
|
|
||||||
&.refused {
|
&.refused {
|
||||||
background-color: $dark-red;
|
background-color: $dark-red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.refuse {
|
||||||
|
@extend .refused;
|
||||||
|
}
|
||||||
|
|
||||||
&.without-continuation {
|
&.without-continuation {
|
||||||
background-color: $black;
|
background-color: $black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.sans-suite {
|
||||||
|
@extend .without-continuation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.afficher-dossiers-supprimes {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
.filter {
|
.filter {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
|
|
|
@ -113,6 +113,11 @@ module Instructeurs
|
||||||
assign_exports
|
assign_exports
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def deleted_dossiers
|
||||||
|
@procedure = procedure
|
||||||
|
@deleted_dossiers = @procedure.deleted_dossiers.where.not(state: :brouillon)
|
||||||
|
end
|
||||||
|
|
||||||
def update_displayed_fields
|
def update_displayed_fields
|
||||||
values = params[:values]
|
values = params[:values]
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,12 @@ module DossierHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def status_badge(state)
|
||||||
|
status_text = state.tr('_', ' ')
|
||||||
|
status_class = state.tr('_', '-')
|
||||||
|
content_tag(:span, status_text, class: "label #{status_class} ")
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def dinum_instance?
|
def dinum_instance?
|
||||||
|
|
61
app/views/instructeurs/procedures/deleted_dossiers.html.haml
Normal file
61
app/views/instructeurs/procedures/deleted_dossiers.html.haml
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
- content_for(:title, "#{@procedure.libelle}")
|
||||||
|
|
||||||
|
#procedure-show
|
||||||
|
.sub-header
|
||||||
|
.container.flex
|
||||||
|
|
||||||
|
.procedure-logo{ style: "background-image: url(#{@procedure.logo_url})",
|
||||||
|
role: 'img', 'aria-label': "logo de la démarche #{@procedure.libelle}" }
|
||||||
|
|
||||||
|
.procedure-header
|
||||||
|
%h1= procedure_libelle @procedure
|
||||||
|
= link_to 'gestion des notifications', email_notifications_instructeur_procedure_path(@procedure), class: 'header-link'
|
||||||
|
|
|
||||||
|
= link_to 'statistiques', stats_instructeur_procedure_path(@procedure), class: 'header-link', data: { turbolinks: false } # Turbolinks disabled for Chartkick. See Issue #350
|
||||||
|
|
||||||
|
- if @procedure.routee?
|
||||||
|
|
|
||||||
|
- if current_administrateur.present? && current_administrateur.owns?(@procedure)
|
||||||
|
= link_to 'instructeurs', procedure_groupe_instructeurs_path(@procedure), class: 'header-link'
|
||||||
|
- else
|
||||||
|
= link_to 'instructeurs', instructeur_groupes_path(@procedure), class: 'header-link'
|
||||||
|
|
||||||
|
%ul.tabs
|
||||||
|
= tab_item('à suivre',
|
||||||
|
instructeur_procedure_path(@procedure, statut: 'a-suivre'))
|
||||||
|
= tab_item(t('pluralize.followed', count: 1),
|
||||||
|
instructeur_procedure_path(@procedure, statut: 'suivis'),
|
||||||
|
active: @statut == 'suivis')
|
||||||
|
|
||||||
|
= tab_item(t('pluralize.processed', count: 1),
|
||||||
|
instructeur_procedure_path(@procedure, statut: 'traites'))
|
||||||
|
|
||||||
|
= tab_item('tous les dossiers',
|
||||||
|
instructeur_procedure_path(@procedure, statut: 'tous'))
|
||||||
|
|
||||||
|
= tab_item(t('pluralize.archived', count: 1),
|
||||||
|
instructeur_procedure_path(@procedure, statut: 'archives'),
|
||||||
|
active: true)
|
||||||
|
|
||||||
|
.container
|
||||||
|
%p.explication-onglet Les dossiers ont été supprimés. Vous ne pouvez plus les récupérer depuis Démarches Simplifiées.
|
||||||
|
- if @deleted_dossiers.any?
|
||||||
|
%table.table.dossiers-table.hoverable
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th.notification-col
|
||||||
|
%th.number-col N° dossier
|
||||||
|
%th.status-col Etat
|
||||||
|
%th.status-col Date de suppression
|
||||||
|
%tbody
|
||||||
|
- @deleted_dossiers.each do |deleted_dossier|
|
||||||
|
%tr
|
||||||
|
%td.folder-col
|
||||||
|
%span.icon.folder
|
||||||
|
%td.number-col= deleted_dossier.dossier_id
|
||||||
|
%td.status-col
|
||||||
|
= status_badge(deleted_dossier.state)
|
||||||
|
%td.date-col= l(deleted_dossier.deleted_at, format: '%d/%m/%y')
|
||||||
|
- else
|
||||||
|
Aucun dossier supprimé
|
||||||
|
|
|
@ -63,6 +63,10 @@
|
||||||
%p.explication-onglet Tous les dossiers qui ont été déposés sur cette démarche, sans aucun filtre.
|
%p.explication-onglet Tous les dossiers qui ont été déposés sur cette démarche, sans aucun filtre.
|
||||||
- if @statut == 'archives'
|
- if @statut == 'archives'
|
||||||
%p.explication-onglet Les dossiers de cet onglet sont archivés : vous ne pouvez plus y répondre, et les demandeurs ne peuvent plus les modifier.
|
%p.explication-onglet Les dossiers de cet onglet sont archivés : vous ne pouvez plus y répondre, et les demandeurs ne peuvent plus les modifier.
|
||||||
|
.afficher-dossiers-supprimes
|
||||||
|
= link_to deleted_dossiers_instructeur_procedure_path(@procedure) do
|
||||||
|
%span.icon.delete
|
||||||
|
Afficher les dossiers supprimés
|
||||||
|
|
||||||
- if @dossiers.present? || @current_filters.count > 0
|
- if @dossiers.present? || @current_filters.count > 0
|
||||||
= paginate @dossiers
|
= paginate @dossiers
|
||||||
|
|
|
@ -307,6 +307,7 @@ Rails.application.routes.draw do
|
||||||
get 'stats'
|
get 'stats'
|
||||||
get 'email_notifications'
|
get 'email_notifications'
|
||||||
patch 'update_email_notifications'
|
patch 'update_email_notifications'
|
||||||
|
get 'deleted_dossiers'
|
||||||
|
|
||||||
resources :dossiers, only: [:show], param: :dossier_id do
|
resources :dossiers, only: [:show], param: :dossier_id do
|
||||||
member do
|
member do
|
||||||
|
|
|
@ -411,6 +411,20 @@ describe Instructeurs::ProceduresController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#deleted_dossiers' do
|
||||||
|
let(:instructeur) { create(:instructeur) }
|
||||||
|
let(:procedure) { create(:procedure, instructeurs: [instructeur]) }
|
||||||
|
let(:deleted_dossier) { create(:deleted_dossier, procedure: procedure, state: :en_construction) }
|
||||||
|
let!(:deleted_dossier_brouillon) { create(:deleted_dossier, procedure: procedure, state: :brouillon) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in(instructeur.user)
|
||||||
|
get :deleted_dossiers, params: { procedure_id: procedure.id }
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(assigns(:deleted_dossiers)).to match_array([deleted_dossier]) }
|
||||||
|
end
|
||||||
|
|
||||||
describe '#update_email_notifications' do
|
describe '#update_email_notifications' do
|
||||||
let(:instructeur) { create(:instructeur) }
|
let(:instructeur) { create(:instructeur) }
|
||||||
let!(:procedure) { create(:procedure, instructeurs: [instructeur]) }
|
let!(:procedure) { create(:procedure, instructeurs: [instructeur]) }
|
||||||
|
|
Loading…
Reference in a new issue