2015-10-09 14:43:19 +02:00
|
|
|
class Users::DescriptionController < UsersController
|
2016-03-22 17:36:36 +01:00
|
|
|
def pieces_justificatives
|
|
|
|
invite = current_user.invite? params[:dossier_id]
|
|
|
|
|
|
|
|
@dossier ||= Dossier.find(params[:dossier_id]) if invite
|
|
|
|
@dossier ||= current_user_dossier
|
|
|
|
|
2018-01-11 20:06:38 +01:00
|
|
|
if (errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).present?
|
2016-11-10 17:26:00 +01:00
|
|
|
if flash.alert.nil?
|
2017-07-13 09:46:13 +02:00
|
|
|
flash.alert = errors_upload
|
2016-11-10 17:26:00 +01:00
|
|
|
else
|
2017-07-13 09:46:13 +02:00
|
|
|
flash.alert = [flash.alert] + errors_upload
|
2016-11-10 17:26:00 +01:00
|
|
|
end
|
|
|
|
|
2016-03-22 17:36:36 +01:00
|
|
|
else
|
2016-11-10 17:26:00 +01:00
|
|
|
flash.notice = 'Nouveaux fichiers envoyés' if flash.alert.nil?
|
2016-03-22 17:36:36 +01:00
|
|
|
end
|
|
|
|
|
2018-03-06 13:44:29 +01:00
|
|
|
return redirect_to users_dossiers_invite_path(id: current_user.invites.find_by(dossier_id: @dossier.id).id) if invite
|
2016-03-22 17:36:36 +01:00
|
|
|
|
|
|
|
redirect_to users_dossier_recapitulatif_path
|
|
|
|
end
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|