2016-08-08 12:52:30 +02:00
|
|
|
class Backoffice::PrivateFormulairesController < ApplicationController
|
|
|
|
before_action :authenticate_gestionnaire!
|
|
|
|
|
|
|
|
def update
|
|
|
|
dossier = current_gestionnaire.dossiers.find(params[:dossier_id])
|
|
|
|
|
2018-01-11 19:04:39 +01:00
|
|
|
if params[:champs].present?
|
2017-03-30 16:12:01 +02:00
|
|
|
ChampsService.save_champs dossier.champs_private, params
|
|
|
|
champs_service_errors = ChampsService.build_error_messages(dossier.champs_private)
|
2016-08-08 12:52:30 +02:00
|
|
|
|
|
|
|
if champs_service_errors.empty?
|
|
|
|
flash[:notice] = "Formulaire enregistré"
|
|
|
|
else
|
2017-06-21 16:16:40 +02:00
|
|
|
flash[:alert] = champs_service_errors
|
2016-08-08 12:52:30 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
render 'backoffice/dossiers/formulaire_private', formats: :js
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|