demarches-normaliennes/app/views/instructeurs/archives/index.html.haml
simon lehericey b8f01d06d7 more style
Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
2021-06-09 10:52:38 +02:00

92 lines
3.9 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- content_for(:title, "Archives pour #{@procedure.libelle}")
= render partial: 'new_administrateur/breadcrumbs',
locals: { steps: [link_to(@procedure.libelle, instructeur_procedure_path(@procedure)),
'Archives'] }
.container
%h1.mb-2 Archives
.card.featured
.card-title Gestion de vos archives
%p
Vous pouvez télécharger les archives des dossiers terminés depuis la publication de la procédure au format Zip.
%p
Cet export contient les demande déposée par l'usager et la liste des pièces justificatives transmises.
%p
Cet export nest pas possible pour le moment pour les démarches à forte volumétrie.
Nous vous invitons à regarder
= link_to 'la documentation', ARCHIVAGE_DOC_URL
afin de voir les options à votre disposition pour mettre en place un système darchive.
%table.table.hoverable.archive-table
%thead
%tr
%th &nbsp;
%th.text-right Nombre de dossiers terminés
%th.text-right Poids estimé
%th.center Télécharger
%tbody
%tr
- matching_archive = @archives.find { |archive| archive.time_span_type == 'everything' }
- if matching_archive.present? && matching_archive.available?
- weight = matching_archive.file.byte_size
- else
- weight = @poids_total
%td
Tous les dossiers
%td.text-right
= @nb_dossiers
%td.text-right
= number_to_human_size(weight)
%td.center
- if matching_archive.try(&:available?)
= link_to url_for(matching_archive.file), class: 'button primary' do
%span.icon.download-white
= t(:archive_ready_html, generated_period: time_ago_in_words(matching_archive.updated_at), scope: [:instructeurs, :procedure])
- elsif matching_archive.try(&:pending?)
%span.icon.retry
= t(:archive_pending_html, created_period: time_ago_in_words(matching_archive.created_at), scope: [:instructeurs, :procedure])
- elsif @nb_dossiers == 0
Rien à télécharger !
- elsif weight < 1.gigabyte
= link_to instructeur_archives_path(@procedure, type: 'everything'), method: :post, class: "button" do
%span.icon.new-folder
Demander la création
- else
Archive trop volumineuse
- @count_dossiers_termines_by_month.each do |count_by_month|
- month = count_by_month["month"].to_date
- nb_dossiers_termines = count_by_month["count"]
- matching_archive = @archives.find { |archive| archive.time_span_type == 'monthly' && archive.month == month }
- if matching_archive.present? && matching_archive.available?
- weight = matching_archive.file.byte_size
- else
- weight = nb_dossiers_termines * @average_dossier_weight
%tr
%td
= I18n.l(month, format: "%B %Y").capitalize
%td.text-right
= nb_dossiers_termines
%td.text-right
= number_to_human_size(weight)
%td.center
- if matching_archive.present?
- if matching_archive.status == 'generated' && matching_archive.file.attached?
= link_to url_for(matching_archive.file), class: 'button primary' do
%span.icon.download-white
= t(:archive_ready_html, generated_period: time_ago_in_words(matching_archive.updated_at), scope: [:instructeurs, :procedure])
- else
%span.icon.retry
= t(:archive_pending_html, created_period: time_ago_in_words(matching_archive.created_at), scope: [:instructeurs, :procedure])
- elsif weight < 1.gigabyte
= link_to instructeur_archives_path(@procedure, type:'monthly', month: month.strftime('%Y-%m')), method: :post, class: "button" do
%span.icon.new-folder
Démander la création
- else
Archive trop volumineuse