Revert "Revert "Export de tous les dossier d'une démarche""

This reverts commit d9a588b52e.
This commit is contained in:
Christophe Robillard 2021-04-29 17:29:47 +02:00
parent 533fa903bc
commit f40d96fbd2
32 changed files with 675 additions and 36 deletions

View file

@ -0,0 +1,21 @@
- content_for(:title, 'Votre archive est disponible')
%p
Bonjour,
%p
Votre archive pour la démarche
= link_to("#{@procedure.id} #{@procedure.libelle}", instructeur_procedure_url(@procedure.id))
est disponible.
Vous pouvez la télécharger dans votre espace de gestion des archives.
%p
= round_button('Consulter mes archives', instructeur_archives_url(@procedure), :primary)
%p
Ce fichier est
%b valide une semaine
et peut-être téléchargé
%b plusieurs fois.
= render partial: "layouts/mailers/signature"

View file

@ -0,0 +1 @@
= render_flash(sticky: true)

View file

@ -0,0 +1,91 @@
- 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 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 n'est 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 d'archive.
%table.table.hoverable
%thead
%tr
%th  
%th Nombre de dossiers terminés
%th Poids estimé
%th Télécharger
%tbody
- if can_generate_archive?(@dossiers_termines, @poids_total)
%tr
- matching_archive = @archives.find_by(time_span_type: 'everything')
%td
Tous les dossiers
%td
= @dossiers_termines.count
%td
- if matching_archive.present? && matching_archive.available?
- weight = matching_archive.file.byte_size
- else
- weight = @poids_total
= number_to_human_size(weight)
%td
- 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 @dossiers_termines.count > 0
= link_to instructeur_archives_path(@procedure, type: 'everything'), method: :post, class: "button" do
%span.icon.new-folder
Demander la création
- else
Rien à télécharger !
- @archivable_months.each do |month|
- dossiers_termines = @procedure.dossiers.processed_in_month(month)
- nb_dossiers_termines = dossiers_termines.count
- matching_archive = @archives.find_by(time_span_type: 'monthly', month: month)
%tr
%td
= I18n.l(month, format: "%B %Y")
%td
= nb_dossiers_termines
%td
- if matching_archive.present? && matching_archive.available?
- weight = matching_archive.file.byte_size
- else
- weight = ProcedureArchiveService::dossiers_files_size(dossiers_termines)
= number_to_human_size(weight)
%td
- if nb_dossiers_termines > 0
- 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])
- else
= 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
Rien à télécharger !

View file

@ -16,3 +16,6 @@
- else
%span{ 'data-export-poll-url': download_export_instructeur_procedure_path(procedure, export_format: format, no_progress_notification: true) }
= t(:export_pending_html, export_time: time_ago_in_words(export.created_at), export_format: ".#{format}", scope: [:instructeurs, :procedure])
- if procedure.feature_enabled?(:archive_zip_globale)
%li
= link_to t(:download_archive, scope: [:instructeurs, :procedure]), instructeur_archives_path(procedure)