2017-06-29 15:31:29 +02:00
|
|
|
|
module NewGestionnaire
|
|
|
|
|
class DossiersController < ProceduresController
|
|
|
|
|
def attestation
|
|
|
|
|
send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf')
|
|
|
|
|
end
|
|
|
|
|
|
2017-07-06 16:33:36 +02:00
|
|
|
|
def show
|
|
|
|
|
@dossier = dossier
|
|
|
|
|
end
|
|
|
|
|
|
2017-07-19 11:08:53 +02:00
|
|
|
|
def messagerie
|
|
|
|
|
@dossier = dossier
|
|
|
|
|
end
|
|
|
|
|
|
2017-07-11 15:45:20 +02:00
|
|
|
|
def follow
|
2017-07-17 12:11:33 +02:00
|
|
|
|
current_gestionnaire.follow(dossier)
|
2017-07-17 15:14:19 +02:00
|
|
|
|
dossier.next_step!('gestionnaire', 'follow')
|
2017-07-17 12:28:09 +02:00
|
|
|
|
flash.notice = 'Dossier suivi'
|
2017-07-11 15:45:20 +02:00
|
|
|
|
redirect_back(fallback_location: procedures_url)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def unfollow
|
|
|
|
|
current_gestionnaire.followed_dossiers.delete(dossier)
|
2017-07-17 12:28:09 +02:00
|
|
|
|
flash.notice = "Vous ne suivez plus le dossier nº #{dossier.id}"
|
|
|
|
|
|
2017-07-11 15:45:20 +02:00
|
|
|
|
redirect_back(fallback_location: procedures_url)
|
|
|
|
|
end
|
|
|
|
|
|
2017-07-11 15:56:23 +02:00
|
|
|
|
def archive
|
|
|
|
|
dossier.update_attributes(archived: true)
|
|
|
|
|
redirect_back(fallback_location: procedures_url)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def unarchive
|
|
|
|
|
dossier.update_attributes(archived: false)
|
|
|
|
|
redirect_back(fallback_location: procedures_url)
|
|
|
|
|
end
|
|
|
|
|
|
2017-07-19 14:04:49 +02:00
|
|
|
|
def create_commentaire
|
|
|
|
|
Commentaire.create(commentaire_params.merge(email: current_gestionnaire.email, dossier: dossier))
|
|
|
|
|
redirect_to messagerie_dossier_path(dossier.procedure, dossier)
|
|
|
|
|
end
|
|
|
|
|
|
2017-06-29 15:31:29 +02:00
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def dossier
|
2017-07-06 16:33:36 +02:00
|
|
|
|
current_gestionnaire.dossiers.find(params[:dossier_id])
|
2017-06-29 15:31:29 +02:00
|
|
|
|
end
|
2017-07-19 14:04:49 +02:00
|
|
|
|
|
|
|
|
|
def commentaire_params
|
|
|
|
|
params.require(:commentaire).permit(:body)
|
|
|
|
|
end
|
2017-06-29 15:31:29 +02:00
|
|
|
|
end
|
|
|
|
|
end
|