add bulk action feature for 'passer_en_instruction'

This commit is contained in:
Lisa Durand 2022-12-12 10:02:33 +01:00 committed by mfo
parent 2e072702ce
commit 89730b485b
14 changed files with 256 additions and 76 deletions

View file

@ -1,13 +1,25 @@
en:
finish:
title: The bulk action is finished
text:
one: 1/1 file has been archived
other: "%{success_count}/%{count} files have been archived"
in_progress:
title: A bulk action is processing
text_success:
one: 1/1 is being archived
other: "%{progress_count}/%{count} files have been archived"
archiver:
finish:
title: The bulk action is finished
text:
one: 1/1 file has been archived
other: "%{success_count}/%{count} files have been archived"
in_progress:
title: A bulk action is processing
text_success:
one: 1/1 is being archived
other: "%{progress_count}/%{count} files have been archived"
passer_en_instruction:
finish:
title: The bulk action is finished
text:
one: 1/1 file has been changed to instructing
other: "%{success_count}/%{count} files have been changed to instructing"
in_progress:
title: A bulk action is processing
text_success:
one: 1/1 is being changed to instructing
other: "%{progress_count}/%{count} files have been changed to instructing"
link_text: Refresh this webpage
after_link_text: to check if the process is over.

View file

@ -1,13 +1,25 @@
fr:
finish:
title: L'action de masse est terminée
text_success:
one: 1 dossier a été archivé
other: "%{success_count}/%{count} dossiers ont été archivés"
in_progress:
title: Une action de masse est en cours
text_success:
one: 1 dossier sera archivé
other: "%{progress_count}/%{count} dossiers ont été archivés"
archiver:
finish:
title: L'action de masse est terminée
text_success:
one: 1 dossier a été archivé
other: "%{success_count}/%{count} dossiers ont été archivés"
in_progress:
title: Une action de masse est en cours
text_success:
one: 1 dossier sera archivé
other: "%{progress_count}/%{count} dossiers ont été archivés"
passer_en_instruction:
finish:
title: L'action de masse est terminée
text_success:
one: 1 dossier a été passé en instruction
other: "%{success_count}/%{count} dossiers ont été passés en instruction"
in_progress:
title: Une action de masse est en cours
text_success:
one: 1 dossier sera passé en instruction
other: "%{progress_count}/%{count} dossiers ont été passés en instruction"
link_text: Recharger la page
after_link_text: pour voir si l'opération est finie.

View file

@ -1,15 +1,15 @@
.fr-mb-5v
- if @batch.finished_at.present?
= render Dsfr::AlertComponent.new(title: t('.finish.title'), state: (@batch.failed_dossier_ids.size.positive? ? :warning : :success), heading_level: 'h2') do |c|
= render Dsfr::AlertComponent.new(title: t(".#{batch.operation}.finish.title"), state: (@batch.failed_dossier_ids.size.positive? ? :warning : :success), heading_level: 'h2') do |c|
- c.body do
%p
= t('.finish.text_success', count: @batch.total_count, success_count: @batch.success_dossier_ids.size)
= t(".#{batch.operation}.finish.text_success", count: @batch.total_count, success_count: @batch.success_dossier_ids.size)
- else
= render Dsfr::AlertComponent.new(title: t('.in_progress.title'), state: :info, heading_level: 'h2') do |c|
= render Dsfr::AlertComponent.new(title: t(".#{batch.operation}.in_progress.title"), state: :info, heading_level: 'h2') do |c|
- c.body do
%p= t('.in_progress.text_success', count: @batch.total_count, progress_count: @batch.progress_count)
%p= t(".#{batch.operation}.in_progress.text_success", count: @batch.total_count, progress_count: @batch.progress_count)
%p
= link_to t('.link_text'), instructeur_procedure_path(@procedure, statut: params["statut"]), data: { action: 'turbo-poll#refresh' }

View file

@ -7,7 +7,7 @@ class Dossiers::BatchOperationComponent < ApplicationComponent
end
def render?
@statut == 'traites'
@statut == 'traites' || 'suivis'
end
def available_operations
@ -15,9 +15,10 @@ class Dossiers::BatchOperationComponent < ApplicationComponent
case @statut
when 'traites' then
options.push [t(".operations.archiver"), BatchOperation.operations.fetch(:archiver)]
when 'suivis' then
options.push [t(".operations.passer_en_instruction"), BatchOperation.operations.fetch(:passer_en_instruction)]
else
end
options
end
end

View file

@ -1,3 +1,4 @@
fr:
operations:
archiver: 'Archive selected files'
passer_en_instruction: 'Change selected files to instructing'

View file

@ -1,3 +1,4 @@
fr:
operations:
archiver: 'Archiver les dossiers sélectionnés'
passer_en_instruction: 'Passer en instruction les dossiers sélectionnés'