2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-20 18:53:40 +02:00
|
|
|
class Procedure::Card::ServiceComponent < ApplicationComponent
|
|
|
|
def initialize(procedure:, administrateur:)
|
|
|
|
@procedure = procedure
|
|
|
|
@administrateur = administrateur
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def service_link
|
|
|
|
if @procedure.service.present?
|
|
|
|
edit_admin_service_path(@procedure.service, procedure_id: @procedure.id)
|
|
|
|
elsif @administrateur.services.present?
|
|
|
|
admin_services_path(procedure_id: @procedure.id)
|
|
|
|
else
|
|
|
|
new_admin_service_path(procedure_id: @procedure.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def service_button_text
|
|
|
|
if @procedure.service.present?
|
|
|
|
'Modifier'
|
|
|
|
elsif @administrateur.services.present?
|
|
|
|
'Choisir'
|
|
|
|
else
|
|
|
|
'Remplir'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|