2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-09-08 11:25:39 +02:00
|
|
|
class EditableChamp::PieceJustificativeComponent < EditableChamp::EditableChampBaseComponent
|
2023-08-21 16:18:31 +02:00
|
|
|
def dsfr_input_classname
|
|
|
|
'fr-input'
|
|
|
|
end
|
|
|
|
|
2022-12-08 00:15:05 +01:00
|
|
|
def view_as
|
|
|
|
if @champ.dossier.brouillon?
|
|
|
|
:link
|
|
|
|
else
|
|
|
|
:download
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def user_can_destroy?
|
|
|
|
!@champ.mandatory? || @champ.dossier.brouillon?
|
|
|
|
end
|
|
|
|
|
|
|
|
def max
|
|
|
|
[true, nil].include?(@champ.procedure&.piece_justificative_multiple?) ? Attachment::MultipleComponent::DEFAULT_MAX_ATTACHMENTS : 1
|
|
|
|
end
|
2022-08-12 10:45:04 +02:00
|
|
|
end
|