2015-09-22 15:00:59 +02:00
|
|
|
class Backoffice::DossiersController < ApplicationController
|
2015-09-22 10:15:12 +02:00
|
|
|
before_action :authenticate_gestionnaire!
|
2015-08-10 11:05:06 +02:00
|
|
|
|
|
|
|
def show
|
2015-09-22 15:00:59 +02:00
|
|
|
@dossier = Dossier.find(params[:id])
|
2015-08-10 11:05:06 +02:00
|
|
|
@entreprise = @dossier.entreprise.decorate
|
2015-08-11 15:38:34 +02:00
|
|
|
@etablissement = @dossier.etablissement
|
2015-09-21 17:59:03 +02:00
|
|
|
@pieces_justificatives = @dossier.pieces_justificatives
|
2015-08-10 11:05:06 +02:00
|
|
|
@commentaires = @dossier.commentaires.order(created_at: :desc)
|
|
|
|
@commentaires = @commentaires.all.decorate
|
2015-09-22 10:15:12 +02:00
|
|
|
@commentaire_email = current_gestionnaire.email
|
2015-08-10 11:05:06 +02:00
|
|
|
|
2015-09-21 17:59:03 +02:00
|
|
|
@procedure = @dossier.procedure
|
2015-08-20 12:20:54 +02:00
|
|
|
|
2015-08-10 11:05:06 +02:00
|
|
|
@dossier = @dossier.decorate
|
2015-08-13 15:55:19 +02:00
|
|
|
rescue ActiveRecord::RecordNotFound
|
2015-09-23 16:56:30 +02:00
|
|
|
flash.alert = t('errors.messages.dossier_not_found')
|
|
|
|
redirect_to url_for(controller: '/backoffice')
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
2015-09-24 16:51:14 +02:00
|
|
|
def confirme
|
|
|
|
params[:id] = params[:dossier_id]
|
|
|
|
show
|
|
|
|
|
|
|
|
@dossier.next_step! 'gestionnaire', 'confirme'
|
|
|
|
flash.notice = 'Dossier confirmé avec succès.'
|
|
|
|
|
|
|
|
render 'show'
|
|
|
|
end
|
2015-10-09 12:05:07 +02:00
|
|
|
|
|
|
|
def process_end
|
|
|
|
params[:id] = params[:dossier_id]
|
|
|
|
|
|
|
|
show
|
|
|
|
|
|
|
|
@dossier.next_step! 'gestionnaire', 'process'
|
|
|
|
flash.notice = 'Dossier traité avec succès.'
|
|
|
|
|
|
|
|
render 'show'
|
|
|
|
end
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|