This commit is contained in:
kara Diaby 2021-04-29 09:33:23 +02:00
parent fdde55f675
commit 6a1ed2e02d
4 changed files with 116 additions and 47 deletions

View file

@ -1,19 +1,19 @@
- if Dossier::EN_CONSTRUCTION_OU_INSTRUCTION.include?(state)
- if dossier_is_followed
= link_to unfollow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'button' do
= link_to unfollow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: defined?(button_class) && button_class.blank? ? '' : 'button' do
%span.icon.unfollow>
Ne plus suivre
- else
= link_to follow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'button' do
= link_to follow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: defined?(button_class) && button_class.blank? ? '' : 'button' do
%span.icon.follow>
Suivre le dossier
- elsif Dossier::TERMINE.include?(state)
- if archived
= link_to unarchive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'button' do
= link_to unarchive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: defined?(button_class) && button_class.blank? ? '' : 'button' do
%span.icon.unarchive>
Désarchiver le dossier
- else
= link_to archive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'button' do
= link_to archive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: defined?(button_class) && button_class.blank? ? '' : 'button' do
%span.icon.archive>
Archiver le dossier

View file

@ -1,42 +0,0 @@
- content_for(:title, "Recherche : #{@search_terms}")
.container
.page-title
Résultat de la recherche :
= t('pluralize.dossier_trouve', count: @dossiers.count)
- if @dossiers.present?
%table.table.dossiers-table.hoverable
%thead
%tr
%th.notification-col
%th.number-col Nº dossier
%th Démarche
%th Demandeur
%th.status-col Statut
%th.action-col.follow-col
%tbody
- @dossiers.each do |dossier|
/ # FIXME: here we have a n+1, we fire a request
/ (due to dossier_linked_path) per result
%tr
%td.folder-col
= link_to(dossier_linked_path(current_instructeur, dossier), class: 'cell-link') do
%span.icon.folder
%td.number-col
= link_to(dossier_linked_path(current_instructeur, dossier), class: 'cell-link') do
= dossier.id
%td= link_to(dossier.procedure.libelle, dossier_linked_path(current_instructeur, dossier), class: 'cell-link')
%td= link_to(dossier.user_email_for(:display), dossier_linked_path(current_instructeur, dossier), class: 'cell-link')
%td.status-col
= link_to(dossier_linked_path(current_instructeur, dossier), class: 'cell-link') do
= status_badge(dossier.state)
%td.action-col.follow-col= render partial: "instructeurs/procedures/dossier_actions",
locals: { procedure_id: dossier.procedure.id,
dossier_id: dossier.id,
state: dossier.state,
archived: dossier.archived,
dossier_is_followed: @followed_dossiers_id.include?(dossier.id) }
- else
%h2 Aucun dossier correspondant à votre recherche n'a été trouvé

View file

@ -50,9 +50,15 @@
= active_link_to "Dossiers", dossiers_path, active: :inclusive, class: 'tab-link'
%ul.header-right-content
- if params[:controller] == 'recherche'
= render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_index_path }
- if nav_bar_profile == :instructeur && instructeur_signed_in?
%li
= render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: instructeur_recherche_path }
= render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_index_path }
- if nav_bar_profile == :expert && expert_signed_in?
= render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_index_path }
- if nav_bar_profile == :user && user_signed_in? && current_user.dossiers.count > 2
%li

View file

@ -0,0 +1,105 @@
- content_for(:title, "Recherche : #{@search_terms}")
- pagination = paginate @paginated_ids
- procedure_libelle_index = 0
- user_email_index = 1
.container
.page-title
Résultat de la recherche :
= t('pluralize.dossier_trouve', count: @dossiers_count)
- if @projected_dossiers.present?
%table.table.dossiers-table.hoverable
%thead
%tr
%th.notification-col
%th.number-col Nº dossier
%th Démarche
%th Demandeur
%th.status-col Statut
%th.action-col.follow-col
%tbody
- @projected_dossiers.each do |p|
- procedure_id = p.columns.last
- if current_expert.present?
- avis_id = @dossier_avis_ids_h[p.dossier_id]
- if (current_expert.present? && current_instructeur.blank?) || (current_instructeur.present? && current_expert.blank?)
- path = current_instructeur.present? ? instructeur_dossier_path(procedure_id, p.dossier_id) : expert_avis_path(procedure_id, avis_id)
%tr
%td.folder-col
= link_to(path, class: 'cell-link') do
%span.icon.folder
%td.number-col
= link_to(path, class: 'cell-link') do
= p.dossier_id
- p.columns.values_at(procedure_libelle_index, user_email_index).each do |column|
%td
%a.cell-link{ href: path }= column
%td.status-col
= link_to(path, class: 'cell-link') do
= status_badge(p.state)
- if current_instructeur.present?
%td.action-col.follow-col= render partial: "instructeurs/procedures/dossier_actions",
locals: { procedure_id: procedure_id,
dossier_id: p.dossier_id,
state: p.state,
archived: p.archived,
button_class: false,
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id) }
- else
%tr
%td.folder-col
%span.icon.folder
%td.number-col
.cell-link
= p.dossier_id
- p.columns.values_at(procedure_libelle_index, user_email_index).each do |column|
%td
.cell-link
= column
%td.status-col
.cell-link
= status_badge(p.state)
%td.action-col.follow-col
.dropdown
.button.dropdown-button
Actions
.dropdown-content.fade-in-down
%ul.dropdown-items.pl-0
- if current_instructeur.present?
%li
.dropdown-description
%h4
= render partial: "instructeurs/procedures/dossier_actions",
locals: { procedure_id: procedure_id,
dossier_id: p.dossier_id,
state: p.state,
archived: p.archived,
button_class: false,
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id) }
%li
= link_to instructeur_dossier_path(procedure_id, p.dossier_id) do
%span.icon.in-progress
.dropdown-description
%h4 Instruire le dossier
- if avis_id.present?
%li
= link_to(expert_avis_path(procedure_id, avis_id)) do
%span.icon.in-progress
.dropdown-description
%h4 Donner mon avis
= pagination
- else
%h2 Aucun dossier correspondant à votre recherche n'a été trouvé