remove specific partial for dossier transfers and use Dossier instead od DossierTransfer

This commit is contained in:
Lisa Durand 2023-06-28 11:53:41 +02:00
parent 87fceb311a
commit 3d20ef6af9
7 changed files with 34 additions and 58 deletions

View file

@ -183,7 +183,7 @@
text-align: left;
top: 5 * $default-spacer;
cursor: default;
z-index: 10;
z-index: 11;
list-style: none;
a {

View file

@ -6,7 +6,6 @@
border: 1px solid $border-grey;
margin-bottom: $default-spacer * 2;
background: #FFFFFF;
color: $dark-grey;
.card-title {
color: $black;

View file

@ -28,9 +28,9 @@ module Users
@dossiers_invites = current_user.dossiers_invites.merge(dossiers_visibles)
@dossiers_supprimes_recemment = current_user.dossiers.hidden_by_user.merge(dossiers)
@dossiers_supprimes_definitivement = current_user.deleted_dossiers.includes(:procedure).order_by_updated_at
@dossier_transfers = DossierTransfer.for_email(current_user.email)
@dossier_transferes = dossiers_visibles.where(dossier_transfer_id: DossierTransfer.for_email(current_user.email).ids)
@dossiers_close_to_expiration = current_user.dossiers.close_to_expiration.merge(dossiers_visibles)
@statut = statut(@user_dossiers, @dossiers_traites, @dossiers_invites, @dossiers_supprimes_recemment, @dossiers_supprimes_definitivement, @dossier_transfers, @dossiers_close_to_expiration, params[:statut])
@statut = statut(@user_dossiers, @dossiers_traites, @dossiers_invites, @dossiers_supprimes_recemment, @dossiers_supprimes_definitivement, @dossier_transferes, @dossiers_close_to_expiration, params[:statut])
@dossiers = case @statut
when 'en-cours'
@ -44,7 +44,7 @@ module Users
when 'dossiers-supprimes-definitivement'
@dossiers_supprimes_definitivement
when 'dossiers-transferes'
@dossier_transfers
@dossier_transferes
when 'dossiers-expirant'
@dossiers_close_to_expiration
end.page(page)
@ -392,14 +392,14 @@ module Users
# if the status tab is filled, then this tab
# else first filled tab
# else en-cours
def statut(mes_dossiers, dossiers_traites, dossiers_invites, dossiers_supprimes_recemment, dossiers_supprimes_definitivement, dossier_transfers, dossiers_close_to_expiration, params_statut)
def statut(mes_dossiers, dossiers_traites, dossiers_invites, dossiers_supprimes_recemment, dossiers_supprimes_definitivement, dossier_transferes, dossiers_close_to_expiration, params_statut)
tabs = {
'en-cours' => mes_dossiers.present?,
'traites' => dossiers_traites.present?,
'dossiers-invites' => dossiers_invites.present?,
'dossiers-supprimes-recemment' => dossiers_supprimes_recemment.present?,
'dossiers-supprimes-definitivement' => dossiers_supprimes_definitivement.present?,
'dossiers-transferes' => dossier_transfers.present?,
'dossiers-transferes' => dossier_transferes.present?,
'dossiers-expirant' => dossiers_close_to_expiration.present?
}
if tabs[params_statut]

View file

@ -7,8 +7,11 @@
.flex.justify-between
%div
%h2.card-title
= link_to(url_for_dossier(dossier), class: 'cell-link') do
= procedure_libelle(dossier.procedure)
- if @statut == "dossiers-transferes"
= dossier.procedure.libelle
- else
= link_to(url_for_dossier(dossier), class: 'cell-link') do
= dossier.procedure.libelle
%p.fr-icon--sm.fr-icon-user-line
= demandeur_dossier(dossier)
@ -52,16 +55,26 @@
= t('views.users.dossiers.dossiers_list.pending_correction')
- if dossier.transfer.present?
= render Dsfr::AlertComponent.new(state: :info, size: 'small', extra_class_names: "fr-mb-2w") do |c|
- c.body do
%p
= t('views.users.dossiers.transfers.sender_demande_en_cours', id: dossier.id, email: dossier.transfer.email)
%p
= link_to t('views.users.dossiers.transfers.revoke'), transfer_path(dossier.transfer), class: 'fr-link', method: :delete
- if @statut == "dossiers-transferes"
= render Dsfr::AlertComponent.new(state: :info, size: 'small', extra_class_names: "fr-mt-2w") do |c|
- c.body do
%p
= t('views.users.dossiers.transfers.receiver_demande_en_cours', id: dossier.id, email: dossier.user.email)
%p
= link_to t('views.users.dossiers.transfers.accept'), transfer_path(dossier.transfer), class: "fr-link fr-mr-1w", method: :put
= link_to t('views.users.dossiers.transfers.reject'), transfer_path(dossier.transfer), class: "fr-link", method: :delete
- else
= render Dsfr::AlertComponent.new(state: :info, size: 'small', extra_class_names: "fr-mb-2w") do |c|
- c.body do
%p
= t('views.users.dossiers.transfers.sender_demande_en_cours', id: dossier.id, email: dossier.transfer.email)
%p
= link_to t('views.users.dossiers.transfers.revoke'), transfer_path(dossier.transfer), class: 'fr-link', method: :delete
.flex.justify-end
= render partial: 'dossier_actions', locals: { dossier: dossier }
- if @statut != "dossiers-transferes"
.flex.justify-end
= render partial: 'dossier_actions', locals: { dossier: dossier }
= paginate dossiers, views_prefix: 'shared'

View file

@ -1,35 +0,0 @@
- if dossier_transfers.present?
.fr-table.fr-table--bordered
%table.table.dossiers-table.display-table
%thead
%tr
%th.number-col= t('views.users.dossiers.dossiers_list.n_dossier')
%th= t('views.users.dossiers.dossiers_list.procedure')
%th= t('views.users.dossiers.dossiers_list.status')
%th.action-col.follow-col Date de dépot
%tbody
- dossier_transfers.each do |transfer|
- transfer.dossiers.each do |dossier|
%tr.fr-background-alt--blue-france.no-border
%td.fr-py-2w{ colspan: 100 }
.flex.align-center
%p.fr-mb-0
%small
= t('views.users.dossiers.transfers.receiver_demande_en_cours', id: dossier.id, email: transfer.dossiers.first.user.email)
.ml-auto
= link_to t('views.users.dossiers.transfers.accept'), transfer_path(transfer), class: "fr-btn fr-btn--sm fr-btn--tertiary", method: :put
= link_to t('views.users.dossiers.transfers.reject'), transfer_path(transfer), class: "fr-btn fr-btn--sm fr-btn--tertiary-no-outline", method: :delete
%tr{ data: { 'transfer-id': transfer.id } }
%th.number-col{ scope: :row }
%span.icon.folder
= dossier.id
%td= dossier.procedure.libelle
%td= status_badge(dossier.state)
%td.action-col.follow-col{ style: 'padding: 18px;' }= (dossier.depose_at || dossier.created_at).strftime('%d/%m/%Y')
= paginate dossier_transfers, views_prefix: 'shared'
- else
.blank-tab
%h2.empty-text Aucune demande de transfert de dossiers ne vous a été adressée.

View file

@ -56,11 +56,11 @@
active: @statut == 'dossiers-supprimes-definitivement',
badge: number_with_html_delimiter(@dossiers_supprimes_definitivement.count))
- if @dossier_transfers.present?
= tab_item(t('pluralize.dossiers_transferes', count: @dossier_transfers.count),
- if @dossier_transferes.present?
= tab_item(t('pluralize.dossiers_transferes', count: @dossier_transferes.count),
dossiers_path(statut: 'dossiers-transferes'),
active: @statut == 'dossiers-transferes',
badge: number_with_html_delimiter(@dossier_transfers.count))
badge: number_with_html_delimiter(@dossier_transferes.count))
.fr-container
- if @statut == "en-cours"
@ -94,8 +94,7 @@
= render partial: "deleted_dossiers_list", locals: { deleted_dossiers: @dossiers }
- if @statut == "dossiers-transferes"
-# /!\ in this context, @dossiers is a collection of DossierTransfer not Dossier
= render partial: "transfered_dossiers_list", locals: { dossier_transfers: @dossiers }
= render partial: "dossiers_list", locals: { dossiers: @dossiers, filter: @filter, statut: @statut }
- if @statut == "dossiers-expirant"
= render partial: "dossiers_list", locals: { dossiers: @dossiers, filter: @filter, statut: @statut }

View file

@ -16,7 +16,7 @@ describe 'users/dossiers/index', type: :view do
assign(:dossiers_supprimes_recemment, Kaminari.paginate_array(user_dossiers).page(1))
assign(:dossiers_supprimes_definitivement, Kaminari.paginate_array(user_dossiers).page(1))
assign(:dossiers_traites, Kaminari.paginate_array(user_dossiers).page(1))
assign(:dossier_transfers, Kaminari.paginate_array([]).page(1))
assign(:dossier_transferes, Kaminari.paginate_array([]).page(1))
assign(:dossiers_close_to_expiration, Kaminari.paginate_array([]).page(1))
assign(:dossiers, Kaminari.paginate_array(user_dossiers).page(1))
assign(:statut, statut)