demarches-normaliennes/app/views/users/dossiers/index.html.haml

89 lines
5.5 KiB
Text
Raw Normal View History

- if @search_terms.present?
- content_for(:title, t(".title_search", scope: :metas, terms: @search_terms))
- else
- content_for(:title, t(".title", scope: :metas))
2018-08-29 17:09:48 +02:00
.dossiers-headers.sub-header
.fr-container
%h1.page-title.fr-h2= t('views.users.dossiers.index.dossiers')
- if current_user.dossiers.count > 2 || current_user.dossiers_invites.count > 2 || @procedures_for_select.size > 1
.fr-grid-row.fr-grid-row--gutters
- if current_user.dossiers.count > 2 || current_user.dossiers_invites.count > 2
.fr-col.fr-mb-5w
#search-2.fr-search-bar
= form_tag dossiers_path, method: :get, :role => "search", class: "width-100" do
= hidden_field_tag :procedure_id, params[:procedure_id]
= label_tag "q", t('views.users.dossiers.search.label'), class: 'fr-label fr-mb-1w'
.flex
= text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: t('views.users.dossiers.search.prompt'), class: "fr-input"
%button.fr-btn.fr-btn--sm
= t('views.users.dossiers.search.label')
- if @procedures_for_select.size > 1
.fr-col.fr-mb-5w
= render Dossiers::UserProcedureFilterComponent.new(procedures_for_select: @procedures_for_select)
- if @search_terms.blank?
2024-08-12 15:12:05 +02:00
- if [@user_dossiers, @dossiers_traites, @dossiers_invites, @dossiers_close_to_expiration, @dossiers_supprimes, @dossier_transferes].any?(&:present?)
- cache([I18n.locale, current_user.id, @statut, current_user.dossiers, current_user.dossiers_invites], expires_in: 1.hour) do
%nav.fr-tabs{ role: 'navigation', 'aria-label': t('views.users.dossiers.secondary_menu') }
%ul.fr-tabs__list{ role: 'tablist' }
- if @user_dossiers.present?
= tab_item(t('pluralize.en_cours', count: @user_dossiers.count),
dossiers_path(statut: 'en-cours', procedure_id: params[:procedure_id]),
active: @statut == 'en-cours',
badge: number_with_html_delimiter(@user_dossiers.count))
2024-08-12 15:12:05 +02:00
- if @dossiers_traites.present?
// TODO: when renaming this tab in "Terminé", update notify_near_deletion_to_user email wording accordingly.
= tab_item(t('pluralize.traites', count: @dossiers_traites.count),
dossiers_path(statut: 'traites', procedure_id: params[:procedure_id]),
active: @statut == 'traites',
badge: number_with_html_delimiter(@dossiers_traites.count))
2020-11-26 15:13:32 +01:00
2024-08-12 15:12:05 +02:00
- if @dossiers_invites.present?
= tab_item(t('pluralize.dossiers_invites', count: @dossiers_invites.count),
dossiers_path(statut: 'dossiers-invites', procedure_id: params[:procedure_id]),
active: @statut == 'dossiers-invites',
badge: number_with_html_delimiter(@dossiers_invites.count))
2024-08-12 15:12:05 +02:00
- if @dossiers_close_to_expiration.count > 0
= tab_item(t('pluralize.dossiers_close_to_expiration', count: @dossiers_close_to_expiration.count),
dossiers_path(statut: 'dossiers-expirant', procedure_id: params[:procedure_id]),
active: @statut == 'dossiers-expirant',
badge: number_with_html_delimiter(@dossiers_close_to_expiration.count))
2024-08-12 15:12:05 +02:00
- if @dossiers_supprimes.present?
= tab_item(t('pluralize.dossiers_supprimes', count: @dossiers_supprimes.count),
dossiers_path(statut: 'dossiers-supprimes', procedure_id: params[:procedure_id]),
active: @statut == 'dossiers-supprimes',
badge: number_with_html_delimiter(@dossiers_supprimes.count))
- if @dossier_transferes.present?
= tab_item(t('pluralize.dossiers_transferes', count: @dossier_transferes.count),
dossiers_path(statut: 'dossiers-transferes', procedure_id: params[:procedure_id]),
active: @statut == 'dossiers-transferes',
badge: number_with_html_delimiter(@dossier_transferes.count))
2018-03-28 15:02:37 +02:00
.fr-container
2023-07-06 17:36:28 +02:00
.fr-grid-row.fr-grid-row--center
.fr-col-xl-10
- if @statut == "en-cours" && @search_terms.blank?
2023-07-06 17:36:28 +02:00
- if @first_brouillon_recently_updated.present?
= render Dsfr::CalloutComponent.new(title: t('users.dossiers.header.callout.first_brouillon_recently_updated_title'), heading_level: 'h2') do |c|
- c.with_body do
%p
= t('users.dossiers.header.callout.first_brouillon_recently_updated_text', time_ago: time_ago_in_words(@first_brouillon_recently_updated.created_at), libelle: @first_brouillon_recently_updated.procedure.libelle )
= link_to t('users.dossiers.header.callout.first_brouillon_recently_updated_button'), url_for_dossier(@first_brouillon_recently_updated), class: 'fr-btn'
2023-07-06 17:36:28 +02:00
- if @search_terms.present?
%h2.page-title
= t('views.users.dossiers.search.result_term_title', search_terms: @search_terms)
- if @procedure_id.present?
= t('views.users.dossiers.search.result_procedure_title', procedure_libelle: @procedures_for_select.rassoc(@procedure_id.to_i).first)
= render partial: "dossiers_list", locals: { dossiers: @dossiers_visibles, filter: nil, search: true }
2018-03-28 15:02:37 +02:00
2023-07-06 17:36:28 +02:00
- else
= render Dossiers::UserFilterComponent.new(statut: @statut, filter: @filter, procedure_id: @procedure_id )
= render partial: "dossiers_list", locals: { dossiers: @dossiers, filter: @filter, statut: @statut, search: false }