implement first step - accepte without motivation and PJ
This commit is contained in:
parent
378f3c5fb0
commit
d7ebb67889
15 changed files with 217 additions and 39 deletions
|
@ -1,25 +1,33 @@
|
|||
en:
|
||||
archiver:
|
||||
finish:
|
||||
title: The bulk action is finished
|
||||
text:
|
||||
text_success:
|
||||
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:
|
||||
text_success:
|
||||
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"
|
||||
accepter:
|
||||
finish:
|
||||
text_success:
|
||||
one: 1/1 file has been accepted
|
||||
other: "%{success_count}/%{count} files have been accepted"
|
||||
in_progress:
|
||||
text_success:
|
||||
one: 1/1 is being accepted
|
||||
other: "%{progress_count}/%{count} files have been accepted"
|
||||
title:
|
||||
finish: The bulk action is finished
|
||||
in_progress: A bulk action is processing
|
||||
link_text: Refresh this webpage
|
||||
after_link_text: to check if the process is over.
|
||||
|
|
|
@ -1,25 +1,33 @@
|
|||
fr:
|
||||
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"
|
||||
accepter:
|
||||
finish:
|
||||
text_success:
|
||||
one: 1 dossier a été accepté
|
||||
other: "%{success_count}/%{count} dossiers ont été acceptés"
|
||||
in_progress:
|
||||
text_success:
|
||||
one: 1 dossier sera accepté
|
||||
other: "%{progress_count}/%{count} dossiers ont été acceptés"
|
||||
title:
|
||||
finish: L'action de masse est terminée
|
||||
in_progress: Une action de masse est en cours
|
||||
link_text: Recharger la page
|
||||
after_link_text: pour voir si l'opération est finie.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
|
||||
- else
|
||||
= render Dsfr::AlertComponent.new(title: t(".#{batch.operation}.in_progress.title"), state: :info, heading_level: 'h2') do |c|
|
||||
= render Dsfr::AlertComponent.new(title: t(".title.in_progress"), state: :info, heading_level: 'h2') do |c|
|
||||
- c.body do
|
||||
%p= t(".#{batch.operation}.in_progress.text_success", count: @batch.total_count, progress_count: @batch.progress_count)
|
||||
|
||||
|
|
|
@ -11,21 +11,45 @@ class Dossiers::BatchOperationComponent < ApplicationComponent
|
|||
end
|
||||
|
||||
def available_operations
|
||||
options = []
|
||||
case @statut
|
||||
when 'traites' then
|
||||
options.push [t(".operations.archiver"), BatchOperation.operations.fetch(:archiver)]
|
||||
{
|
||||
options:
|
||||
[
|
||||
{
|
||||
label: t(".operations.archiver"),
|
||||
operation: BatchOperation.operations.fetch(:archiver)
|
||||
}
|
||||
]
|
||||
}
|
||||
when 'suivis' then
|
||||
options.push [t(".operations.passer_en_instruction"), BatchOperation.operations.fetch(:passer_en_instruction)]
|
||||
{
|
||||
options:
|
||||
[
|
||||
|
||||
{
|
||||
label: t(".operations.passer_en_instruction"),
|
||||
operation: BatchOperation.operations.fetch(:passer_en_instruction)
|
||||
},
|
||||
|
||||
{
|
||||
label: t(".operations.accepter"),
|
||||
operation: BatchOperation.operations.fetch(:accepter)
|
||||
}
|
||||
]
|
||||
}
|
||||
else
|
||||
{
|
||||
options: []
|
||||
}
|
||||
end
|
||||
options
|
||||
end
|
||||
|
||||
def icons
|
||||
{
|
||||
archiver: 'fr-icon-folder-2-line',
|
||||
passer_en_instruction: 'fr-icon-edit-line'
|
||||
passer_en_instruction: 'fr-icon-edit-line',
|
||||
accepter: 'fr-icon-success-line'
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,3 +2,4 @@ fr:
|
|||
operations:
|
||||
archiver: 'Archive selected files'
|
||||
passer_en_instruction: 'Change selected files to instructing'
|
||||
accepter: 'Accept seleted files'
|
||||
|
|
|
@ -2,3 +2,4 @@ fr:
|
|||
operations:
|
||||
archiver: 'Archiver les dossiers sélectionnés'
|
||||
passer_en_instruction: 'Passer en instruction les dossiers sélectionnés'
|
||||
accepter: 'Accepter les dossiers sélectionnés'
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
= form_for(BatchOperation.new, url: instructeur_batch_operations_path(procedure_id: procedure.id), method: :post, id: dom_id(BatchOperation.new), html: { class: 'flex justify-end' }, data: { "batch-operation-target" => "form"}) do |form|
|
||||
.flex.align-center
|
||||
- available_operations.each do |opt|
|
||||
= form.button opt[0], class: ['fr-btn fr-btn--icon-left', icons[opt[1].to_sym]], disabled: :disabled, name: "#{form.object_name}[operation]", data: { "batch-operation-target" => "submit", "submitter-operation" => opt[1]}
|
||||
- if available_operations[:options].present?
|
||||
- if available_operations[:options].count == 1
|
||||
- opt = available_operations[:options].dig(0)
|
||||
= form_for(BatchOperation.new, url: instructeur_batch_operations_path(procedure_id: procedure.id), method: :post, html: { class: 'flex justify-end', id: "#{dom_id(BatchOperation.new)}_#{opt[:operation]}" }, data: { "batch-operation-target" => "form"}) do |form|
|
||||
= form.button opt[:label], class: ['fr-btn fr-btn--icon-left', icons[opt[:operation].to_sym]], disabled: :disabled, name: "#{form.object_name}[operation]", data: { "batch-operation-target" => "submit", "submitter-operation" => opt[:operation] }
|
||||
|
||||
-else
|
||||
.flex.justify-end
|
||||
.dropdown{ data: { controller: 'menu-button', popover: 'true' } }
|
||||
-# Dropdown button title
|
||||
%button.fr-btn.dropdown-button{ id: 'batch_operation_dropdown', disabled: :disabled, data: { menu_button_target: 'button'} }
|
||||
Actions multiples
|
||||
|
||||
#state-menu.dropdown-content.fade-in-down{ data: { menu_button_target: 'menu' } }
|
||||
|
||||
%ul.dropdown-items
|
||||
- available_operations[:options].each do |opt|
|
||||
%li{ 'data-turbo': 'true' }
|
||||
= form_for(BatchOperation.new, url: instructeur_batch_operations_path(procedure_id: procedure.id), method: :post, html: { class: 'flex justify-end', id: "#{dom_id(BatchOperation.new)}_#{opt[:operation]}" }, data: { "batch-operation-target" => "form"}) do |form|
|
||||
= form.button opt[:label], class: ['fr-btn--icon-left', icons[opt[:operation].to_sym]], disabled: :disabled, name: "#{form.object_name}[operation]", data: { "batch-operation-target" => "submit", "submitter-operation" => opt[:operation]}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue