2022-11-21 16:32:17 +01:00
|
|
|
class Dossiers::BatchOperationComponent < ApplicationComponent
|
|
|
|
attr_reader :statut, :procedure
|
|
|
|
|
|
|
|
def initialize(statut:, procedure:)
|
|
|
|
@statut = statut
|
|
|
|
@procedure = procedure
|
|
|
|
end
|
|
|
|
|
|
|
|
def render?
|
2022-12-15 14:13:13 +01:00
|
|
|
['traites', 'suivis'].include?(@statut)
|
2022-11-21 16:32:17 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def available_operations
|
|
|
|
options = []
|
|
|
|
case @statut
|
|
|
|
when 'traites' then
|
|
|
|
options.push [t(".operations.archiver"), BatchOperation.operations.fetch(:archiver)]
|
2022-12-12 10:02:33 +01:00
|
|
|
when 'suivis' then
|
|
|
|
options.push [t(".operations.passer_en_instruction"), BatchOperation.operations.fetch(:passer_en_instruction)]
|
2022-11-21 16:32:17 +01:00
|
|
|
else
|
|
|
|
end
|
|
|
|
options
|
|
|
|
end
|
2022-12-12 10:28:23 +01:00
|
|
|
|
|
|
|
def icons
|
|
|
|
{
|
|
|
|
archiver: 'fr-icon-folder-2-line',
|
|
|
|
passer_en_instruction: 'fr-icon-edit-line'
|
|
|
|
}
|
|
|
|
end
|
2022-11-21 16:32:17 +01:00
|
|
|
end
|