add bulk action 'follow'
This commit is contained in:
parent
177dec2bdb
commit
25a7fa5a34
10 changed files with 126 additions and 5 deletions
|
@ -26,6 +26,15 @@ en:
|
|||
text_success:
|
||||
one: 1/1 is being accepted
|
||||
other: "%{progress_count}/%{count} files have been accepted"
|
||||
follow:
|
||||
finish:
|
||||
text_success:
|
||||
one: 1/1 file has been followed
|
||||
other: "%{success_count}/%{count} files have been followed"
|
||||
in_progress:
|
||||
text_success:
|
||||
one: 1/1 is being followed
|
||||
other: "%{progress_count}/%{count} files have been followed"
|
||||
title:
|
||||
finish: The bulk action is finished
|
||||
in_progress: A bulk action is processing
|
||||
|
|
|
@ -26,6 +26,15 @@ fr:
|
|||
text_success:
|
||||
one: 1 dossier sera accepté
|
||||
other: "%{progress_count}/%{count} dossiers ont été acceptés"
|
||||
follow:
|
||||
finish:
|
||||
text_success:
|
||||
one: 1 dossier a été suivi
|
||||
other: "%{success_count}/%{count} dossiers ont été suivis"
|
||||
in_progress:
|
||||
text_success:
|
||||
one: 1 dossier sera suivi
|
||||
other: "%{progress_count}/%{count} dossiers ont été suivis"
|
||||
title:
|
||||
finish: L'action de masse est terminée
|
||||
in_progress: Une action de masse est en cours
|
||||
|
|
|
@ -7,11 +7,21 @@ class Dossiers::BatchOperationComponent < ApplicationComponent
|
|||
end
|
||||
|
||||
def render?
|
||||
['traites', 'suivis'].include?(@statut)
|
||||
['a-suivre', 'traites', 'suivis'].include?(@statut)
|
||||
end
|
||||
|
||||
def available_operations
|
||||
case @statut
|
||||
when 'a-suivre' then
|
||||
{
|
||||
options:
|
||||
[
|
||||
{
|
||||
label: t(".operations.follow"),
|
||||
operation: BatchOperation.operations.fetch(:follow)
|
||||
}
|
||||
]
|
||||
}
|
||||
when 'traites' then
|
||||
{
|
||||
options:
|
||||
|
@ -47,9 +57,10 @@ class Dossiers::BatchOperationComponent < ApplicationComponent
|
|||
|
||||
def icons
|
||||
{
|
||||
accepter: 'fr-icon-success-line',
|
||||
archiver: 'fr-icon-folder-2-line',
|
||||
passer_en_instruction: 'fr-icon-edit-line',
|
||||
accepter: 'fr-icon-success-line'
|
||||
follow: 'fr-icon-star-line',
|
||||
passer_en_instruction: 'fr-icon-edit-line'
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,3 +3,4 @@ fr:
|
|||
archiver: 'Archive selected files'
|
||||
passer_en_instruction: 'Change selected files to instructing'
|
||||
accepter: 'Accept seleted files'
|
||||
follow: 'Follow seleted files'
|
||||
|
|
|
@ -3,3 +3,4 @@ fr:
|
|||
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'
|
||||
follow: 'Suivre les dossiers sélectionnés'
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
|
||||
class BatchOperation < ApplicationRecord
|
||||
enum operation: {
|
||||
accepter: 'accepter',
|
||||
archiver: 'archiver',
|
||||
passer_en_instruction: 'passer_en_instruction',
|
||||
accepter: 'accepter'
|
||||
follow: 'follow',
|
||||
passer_en_instruction: 'passer_en_instruction'
|
||||
}
|
||||
|
||||
has_many :dossiers, dependent: :nullify
|
||||
|
@ -58,6 +59,8 @@ class BatchOperation < ApplicationRecord
|
|||
query.state_en_construction
|
||||
when BatchOperation.operations.fetch(:accepter) then
|
||||
query.state_en_instruction
|
||||
when BatchOperation.operations.fetch(:follow) then
|
||||
query.without_followers
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -74,6 +77,8 @@ class BatchOperation < ApplicationRecord
|
|||
dossier.passer_en_instruction(instructeur: instructeur)
|
||||
when BatchOperation.operations.fetch(:accepter)
|
||||
dossier.accepter(instructeur: instructeur, motivation: motivation, justificatif: justificatif_motivation)
|
||||
when BatchOperation.operations.fetch(:follow)
|
||||
instructeur.follow(dossier)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue