2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-08-28 14:56:52 +02:00
|
|
|
module Administrateurs
|
|
|
|
class ChorusController < AdministrateurController
|
|
|
|
before_action :retrieve_procedure
|
|
|
|
|
|
|
|
def edit
|
|
|
|
end
|
2023-08-29 09:22:58 +02:00
|
|
|
|
|
|
|
def update
|
|
|
|
@configuration = @procedure.chorus_configuration
|
|
|
|
@configuration.assign_attributes(configurations_params)
|
|
|
|
if @configuration.valid?
|
|
|
|
@procedure.update!(chorus: @configuration.attributes)
|
|
|
|
|
2023-10-20 16:57:20 +02:00
|
|
|
if @configuration.complete?
|
|
|
|
flash.notice = "La configuration Chorus a été mise à jour."
|
|
|
|
redirect_to add_champ_engagement_juridique_admin_procedure_chorus_path(@procedure)
|
|
|
|
else
|
|
|
|
flash.notice = "La configuration Chorus a été mise à jour. Veuillez renseigner le reste des informations pour faciliter le rapprochement des données."
|
|
|
|
redirect_to edit_admin_procedure_chorus_path(@procedure)
|
|
|
|
end
|
2023-08-29 09:22:58 +02:00
|
|
|
else
|
|
|
|
flash.now.alert = "Des erreurs empêchent la validation du connecteur chorus. Corrigez les erreurs"
|
|
|
|
render :edit
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-10-20 16:57:20 +02:00
|
|
|
def add_champ_engagement_juridique
|
|
|
|
end
|
|
|
|
|
2023-08-29 09:22:58 +02:00
|
|
|
private
|
|
|
|
|
2023-09-06 17:16:02 +02:00
|
|
|
def search_params
|
|
|
|
params.permit(:q)
|
|
|
|
end
|
|
|
|
|
2023-08-29 09:22:58 +02:00
|
|
|
def configurations_params
|
2023-09-06 17:16:02 +02:00
|
|
|
params.require(:chorus_configuration)
|
2023-11-09 09:59:04 +01:00
|
|
|
.permit(:centre_de_cout, :domaine_fonctionnel, :referentiel_de_programmation)
|
2023-08-29 09:22:58 +02:00
|
|
|
end
|
2023-08-28 14:56:52 +02:00
|
|
|
end
|
|
|
|
end
|