2015-08-10 11:05:06 +02:00
|
|
|
class Admin::DossierController < ApplicationController
|
|
|
|
before_action :authenticate_user!
|
|
|
|
|
|
|
|
def show
|
|
|
|
@dossier = Dossier.find(params[:dossier_id])
|
|
|
|
@entreprise = @dossier.entreprise.decorate
|
2015-08-11 15:38:34 +02:00
|
|
|
@etablissement = @dossier.etablissement
|
2015-08-13 15:55:19 +02:00
|
|
|
@pieces_jointes = @dossier.pieces_jointes
|
2015-08-10 11:05:06 +02:00
|
|
|
@commentaires = @dossier.commentaires.order(created_at: :desc)
|
|
|
|
@commentaires = @commentaires.all.decorate
|
|
|
|
@commentaire_email = current_user.email
|
|
|
|
|
2015-08-14 14:05:09 +02:00
|
|
|
@formulaire = @dossier.formulaire
|
|
|
|
@liste_pieces_jointes = TypePieceJointe.get_liste_piece_jointe @dossier.formulaire
|
2015-08-13 15:55:19 +02:00
|
|
|
@array_id_pj_valides = PieceJointe.get_array_id_pj_valid_for_dossier @dossier.id
|
2015-08-10 11:05:06 +02:00
|
|
|
@dossier = @dossier.decorate
|
2015-08-13 15:55:19 +02:00
|
|
|
rescue ActiveRecord::RecordNotFound
|
2015-08-10 11:05:06 +02:00
|
|
|
redirect_start
|
|
|
|
end
|
|
|
|
|
|
|
|
def index
|
|
|
|
@dossier = Dossier.find(params[:dossier_id])
|
|
|
|
redirect_to url_for({controller: 'admin/dossier', action: :show, :dossier_id => @dossier.id})
|
|
|
|
rescue
|
|
|
|
redirect_start
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def redirect_start
|
|
|
|
redirect_to url_for({controller: '/start', action: :error_dossier})
|
|
|
|
end
|
|
|
|
end
|