2022-10-11 12:18:00 +02:00
|
|
|
class Dossiers::EditFooterComponent < ApplicationComponent
|
2023-03-01 18:30:10 +01:00
|
|
|
def initialize(dossier:, annotation:)
|
2022-10-11 12:18:00 +02:00
|
|
|
@dossier = dossier
|
2023-03-01 18:30:10 +01:00
|
|
|
@annotation = annotation
|
2022-10-11 12:18:00 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def owner?
|
|
|
|
controller.current_user.owns?(@dossier)
|
|
|
|
end
|
|
|
|
|
2023-03-01 18:30:10 +01:00
|
|
|
def annotation?
|
2023-03-07 18:48:06 +01:00
|
|
|
@annotation.present?
|
2023-03-01 18:30:10 +01:00
|
|
|
end
|
|
|
|
|
2022-10-11 12:18:00 +02:00
|
|
|
def button_options
|
|
|
|
{
|
|
|
|
class: 'fr-btn fr-btn--sm',
|
|
|
|
disabled: !owner?,
|
|
|
|
method: :post,
|
2022-10-17 11:04:23 +02:00
|
|
|
data: { 'disable-with': t('.submitting'), controller: 'autosave-submit' }
|
2022-10-11 12:18:00 +02:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def render?
|
|
|
|
!@dossier.for_procedure_preview?
|
|
|
|
end
|
|
|
|
end
|