refactor(instructeur): improuve dossiers list view
This commit is contained in:
parent
a50d07400e
commit
0695ea322a
7 changed files with 59 additions and 31 deletions
|
@ -39,7 +39,7 @@ module Instructeurs
|
||||||
'dossiers' => @dossiers_count_per_procedure.sum { |_, v| v },
|
'dossiers' => @dossiers_count_per_procedure.sum { |_, v| v },
|
||||||
'expirant' => @dossiers_expirant_count_per_procedure.sum { |_, v| v },
|
'expirant' => @dossiers_expirant_count_per_procedure.sum { |_, v| v },
|
||||||
'archivés' => @dossiers_archived_count_per_procedure.sum { |_, v| v },
|
'archivés' => @dossiers_archived_count_per_procedure.sum { |_, v| v },
|
||||||
'supprimes_recemment' => @dossiers_supprimes_recemment_count_per_procedure.sum { |_, v| v }
|
'supprimés récemment' => @dossiers_supprimes_recemment_count_per_procedure.sum { |_, v| v }
|
||||||
}
|
}
|
||||||
|
|
||||||
@procedure_ids_en_cours_with_notifications = current_instructeur.procedure_ids_with_notifications(:en_cours)
|
@procedure_ids_en_cours_with_notifications = current_instructeur.procedure_ids_with_notifications(:en_cours)
|
||||||
|
@ -137,15 +137,18 @@ module Instructeurs
|
||||||
.order(:dossier_id)
|
.order(:dossier_id)
|
||||||
.page params[:page]
|
.page params[:page]
|
||||||
|
|
||||||
@a_suivre_count, @suivis_count, @traites_count, @tous_count, @archives_count = current_instructeur
|
@a_suivre_count, @suivis_count, @traites_count, @tous_count, @archives_count, @supprimes_recemment_count, @expirant_count = current_instructeur
|
||||||
.dossiers_count_summary(groupe_instructeur_ids)
|
.dossiers_count_summary(groupe_instructeur_ids)
|
||||||
.fetch_values('a_suivre', 'suivis', 'traites', 'tous', 'archives')
|
.fetch_values('a_suivre', 'suivis', 'traites', 'tous', 'archives', 'supprimes_recemment', 'expirant')
|
||||||
|
@can_download_dossiers = (@tous_count + @archives_count) > 0
|
||||||
|
|
||||||
notifications = current_instructeur.notifications_for_groupe_instructeurs(groupe_instructeur_ids)
|
notifications = current_instructeur.notifications_for_groupe_instructeurs(groupe_instructeur_ids)
|
||||||
@has_en_cours_notifications = notifications[:en_cours].present?
|
@has_en_cours_notifications = notifications[:en_cours].present?
|
||||||
@has_termine_notifications = notifications[:termines].present?
|
@has_termine_notifications = notifications[:termines].present?
|
||||||
|
|
||||||
@statut = 'supprime'
|
@statut = 'supprime'
|
||||||
|
|
||||||
|
assign_exports
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_displayed_fields
|
def update_displayed_fields
|
||||||
|
|
|
@ -140,6 +140,7 @@ class Instructeur < ApplicationRecord
|
||||||
|
|
||||||
def notifications_for_groupe_instructeurs(groupe_instructeurs)
|
def notifications_for_groupe_instructeurs(groupe_instructeurs)
|
||||||
Dossier
|
Dossier
|
||||||
|
.visible_by_administration
|
||||||
.not_archived
|
.not_archived
|
||||||
.where(groupe_instructeur: groupe_instructeurs)
|
.where(groupe_instructeur: groupe_instructeurs)
|
||||||
.merge(followed_dossiers)
|
.merge(followed_dossiers)
|
||||||
|
@ -180,8 +181,8 @@ class Instructeur < ApplicationRecord
|
||||||
nb_notification = notifications[:en_cours].count + notifications[:termines].count
|
nb_notification = notifications[:en_cours].count + notifications[:termines].count
|
||||||
|
|
||||||
h = {
|
h = {
|
||||||
nb_en_construction: groupe.dossiers.en_construction.count,
|
nb_en_construction: groupe.dossiers.visible_by_administration.en_construction.count,
|
||||||
nb_en_instruction: groupe.dossiers.en_instruction.count,
|
nb_en_instruction: groupe.dossiers.visible_by_administration.en_instruction.count,
|
||||||
nb_accepted: Traitement.where(dossier: groupe.dossiers.accepte, processed_at: Time.zone.yesterday.beginning_of_day..Time.zone.yesterday.end_of_day).count,
|
nb_accepted: Traitement.where(dossier: groupe.dossiers.accepte, processed_at: Time.zone.yesterday.beginning_of_day..Time.zone.yesterday.end_of_day).count,
|
||||||
nb_notification: nb_notification
|
nb_notification: nb_notification
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
state: dossier.state,
|
state: dossier.state,
|
||||||
archived: dossier.archived,
|
archived: dossier.archived,
|
||||||
dossier_is_followed: current_instructeur&.follow?(dossier),
|
dossier_is_followed: current_instructeur&.follow?(dossier),
|
||||||
close_to_expiration: dossier.close_to_expiration? }
|
close_to_expiration: dossier.close_to_expiration?,
|
||||||
|
hidden_by_administration: dossier.hidden_by_administration? }
|
||||||
|
|
||||||
|
|
||||||
.state-button
|
.state-button
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
- if close_to_expiration || Dossier::TERMINE.include?(state)
|
- if hidden_by_administration
|
||||||
|
= link_to restore_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: "button" do
|
||||||
|
= t('views.instructeurs.dossiers.restore')
|
||||||
|
- elsif close_to_expiration || Dossier::TERMINE.include?(state)
|
||||||
.dropdown.user-dossier-actions
|
.dropdown.user-dossier-actions
|
||||||
%button.button.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'actions-menu' }
|
%button.button.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'actions-menu' }
|
||||||
Actions
|
Actions
|
||||||
|
|
|
@ -7,13 +7,21 @@
|
||||||
.procedure-logo{ style: "background-image: url(#{@procedure.logo_url})",
|
.procedure-logo{ style: "background-image: url(#{@procedure.logo_url})",
|
||||||
role: 'img', 'aria-label': "logo de la démarche #{@procedure.libelle}" }
|
role: 'img', 'aria-label': "logo de la démarche #{@procedure.libelle}" }
|
||||||
|
|
||||||
= render partial: 'header', locals: { procedure: @procedure,
|
= render partial: 'header', locals: { procedure: @procedure, statut: @statut }
|
||||||
|
|
||||||
|
.procedure-actions
|
||||||
|
- if @can_download_dossiers
|
||||||
|
= render partial: "download_dossiers", locals: { procedure: @procedure, exports: @exports }
|
||||||
|
|
||||||
|
.container.flex= render partial: "tabs", locals: { procedure: @procedure,
|
||||||
statut: @statut,
|
statut: @statut,
|
||||||
a_suivre_count: @a_suivre_count,
|
a_suivre_count: @a_suivre_count,
|
||||||
suivis_count: @suivis_count,
|
suivis_count: @suivis_count,
|
||||||
traites_count: @traites_count,
|
traites_count: @traites_count,
|
||||||
tous_count: @tous_count,
|
tous_count: @tous_count,
|
||||||
|
supprimes_recemment_count: @supprimes_recemment_count,
|
||||||
archives_count: @archives_count,
|
archives_count: @archives_count,
|
||||||
|
expirant_count: @expirant_count,
|
||||||
has_en_cours_notifications: @has_en_cours_notifications,
|
has_en_cours_notifications: @has_en_cours_notifications,
|
||||||
has_termine_notifications: @has_termine_notifications }
|
has_termine_notifications: @has_termine_notifications }
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
.procedure-actions
|
.procedure-actions
|
||||||
- if @can_download_dossiers
|
- if @can_download_dossiers
|
||||||
= render partial: "download_dossiers", locals: { procedure: @procedure, exports: @exports }
|
= render partial: "download_dossiers", locals: { procedure: @procedure, exports: @exports }
|
||||||
|
|
||||||
.container.flex= render partial: "tabs", locals: { procedure: @procedure,
|
.container.flex= render partial: "tabs", locals: { procedure: @procedure,
|
||||||
statut: @statut,
|
statut: @statut,
|
||||||
a_suivre_count: @a_suivre_count,
|
a_suivre_count: @a_suivre_count,
|
||||||
|
@ -116,36 +117,46 @@
|
||||||
- path = instructeur_dossier_path(@procedure, p.dossier_id)
|
- path = instructeur_dossier_path(@procedure, p.dossier_id)
|
||||||
%tr{ class: [p.hidden_by_user_at.present? && "file-hidden-by-user"] }
|
%tr{ class: [p.hidden_by_user_at.present? && "file-hidden-by-user"] }
|
||||||
%td.folder-col
|
%td.folder-col
|
||||||
%a.cell-link{ href: path }
|
- if p.hidden_by_administration_at.present?
|
||||||
%span.icon.folder
|
%span.cell-link
|
||||||
- if @not_archived_notifications_dossier_ids.include?(p.dossier_id)
|
%span.icon.folder
|
||||||
%span.notifications{ 'aria-label': 'notifications' }
|
- else
|
||||||
|
%a.cell-link{ href: path }
|
||||||
|
%span.icon.folder
|
||||||
|
- if @not_archived_notifications_dossier_ids.include?(p.dossier_id)
|
||||||
|
%span.notifications{ 'aria-label': 'notifications' }
|
||||||
|
|
||||||
%td.number-col
|
%td.number-col
|
||||||
%a.cell-link{ href: path }= p.dossier_id
|
- if p.hidden_by_administration_at.present?
|
||||||
|
%span.cell-link= p.dossier_id
|
||||||
|
- else
|
||||||
|
%a.cell-link{ href: path }= p.dossier_id
|
||||||
|
|
||||||
- p.columns.each do |column|
|
- p.columns.each do |column|
|
||||||
%td
|
%td
|
||||||
%a.cell-link{ href: path }
|
- if p.hidden_by_administration_at.present?
|
||||||
= column
|
%span.cell-link
|
||||||
= "- #{t('views.instructeurs.dossiers.deleted_by_user')}" if p.hidden_by_user_at.present?
|
= column
|
||||||
|
= "- #{t('views.instructeurs.dossiers.deleted_by_user')}" if p.hidden_by_user_at.present?
|
||||||
|
- else
|
||||||
|
%a.cell-link{ href: path }
|
||||||
|
= column
|
||||||
|
= "- #{t('views.instructeurs.dossiers.deleted_by_user')}" if p.hidden_by_user_at.present?
|
||||||
|
|
||||||
%td.status-col
|
%td.status-col
|
||||||
%a.cell-link{ href: path }= status_badge(p.state)
|
- if p.hidden_by_administration_at.present?
|
||||||
|
%span.cell-link= status_badge(p.state)
|
||||||
|
- else
|
||||||
|
%a.cell-link{ href: path }= status_badge(p.state)
|
||||||
|
|
||||||
- if @statut == 'supprimes_recemment'
|
%td.action-col.follow-col= render partial: 'dossier_actions',
|
||||||
%td.action-col.follow-col
|
locals: { procedure_id: @procedure.id,
|
||||||
= link_to restore_instructeur_dossier_path(@procedure, p.dossier_id), method: :patch, class: "button primary" do
|
dossier_id: p.dossier_id,
|
||||||
= t('views.instructeurs.dossiers.restore')
|
state: p.state,
|
||||||
|
archived: p.archived,
|
||||||
- else
|
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
||||||
%td.action-col.follow-col= render partial: 'dossier_actions',
|
close_to_expiration: @statut == 'expirant',
|
||||||
locals: { procedure_id: @procedure.id,
|
hidden_by_administration: @statut == 'supprimes_recemment' }
|
||||||
dossier_id: p.dossier_id,
|
|
||||||
state: p.state,
|
|
||||||
archived: p.archived,
|
|
||||||
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
|
||||||
close_to_expiration: @statut == 'expirant' }
|
|
||||||
|
|
||||||
= pagination
|
= pagination
|
||||||
- else
|
- else
|
||||||
|
|
|
@ -93,7 +93,8 @@
|
||||||
state: p.state,
|
state: p.state,
|
||||||
archived: p.archived,
|
archived: p.archived,
|
||||||
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
||||||
close_to_expiration: nil }
|
close_to_expiration: nil,
|
||||||
|
hidden_by_administration: nil }
|
||||||
|
|
||||||
- else
|
- else
|
||||||
%td
|
%td
|
||||||
|
|
Loading…
Add table
Reference in a new issue