demarches-normaliennes/app/views/shared/archives/_table.html.haml

37 lines
1.9 KiB
Text
Raw Normal View History

2024-11-13 18:40:09 +01:00
.fr-table.fr-table--bordered.fr-my-4w
.fr-table__wrapper
.fr-table__container
.fr-table__content
%table
%thead
%tr
%th{ scope: 'col' }
%th.fr-cell---right{ scope: 'col' } Nombre de dossiers terminés
%th.fr-cell---right{ scope: 'col' } Poids estimé
%th{ scope: 'col' } Télécharger
2024-11-13 18:40:09 +01:00
%tbody
- count_dossiers_termines_by_month.each do |date, count|
- matching_archive = archives.find { |archive| archive.time_span_type == 'monthly' && archive.month == date }
- weight = estimate_weight(matching_archive, count, average_dossier_weight)
2024-11-13 18:40:09 +01:00
%tr
%td
= I18n.l(date, format: "%B %Y").capitalize
%td.fr-cell--right.fr-cell--numeric
= count
%td.fr-cell--right
= number_to_human_size(weight)
%td
- if matching_archive.present?
- if matching_archive.available?
= link_to url_for(matching_archive.file), class: 'fr-btn fr-btn--secondary fr-icon-download-line fr-btn--icon-left fr-btn--sm' do
= t(:archive_ready_html, scope: [:instructeurs, :procedure], generated_period: time_ago_in_words(matching_archive.updated_at))
- else
= dsfr_icon("fr-icon-flashlight-line", :sm)
= t(:archive_pending_html, scope: [:instructeurs, :procedure], created_period: time_ago_in_words(matching_archive.created_at))
- elsif weight.nil? || weight < Archive::MAX_SIZE
= link_to "Demander la création", create_archive_url(procedure, date), method: :post, class: "fr-btn fr-btn--secondary fr-icon-download-line fr-btn--icon-left fr-btn--sm"
- else
Archive trop volumineuse