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])
|
|
|
|
|
|
|
|
unless params[:champs].nil?
|
2017-03-29 13:37:07 +02:00
|
|
|
champs_service_errors = ChampsService.save_champs dossier.champs_private, params
|
2016-08-08 12:52:30 +02:00
|
|
|
|
|
|
|
if champs_service_errors.empty?
|
|
|
|
flash[:notice] = "Formulaire enregistré"
|
|
|
|
else
|
|
|
|
flash[:alert] = (champs_service_errors.inject('') { |acc, error| acc+= error[:message]+'<br>' }).html_safe
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
render 'backoffice/dossiers/formulaire_private', formats: :js
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|