41 lines
1 KiB
Ruby
41 lines
1 KiB
Ruby
class Backoffice::DossiersController < ApplicationController
|
|
before_action :authenticate_gestionnaire!
|
|
|
|
def show
|
|
@dossier = Dossier.find(params[:id])
|
|
@entreprise = @dossier.entreprise.decorate
|
|
@etablissement = @dossier.etablissement
|
|
@pieces_justificatives = @dossier.pieces_justificatives
|
|
@commentaires = @dossier.commentaires.order(created_at: :desc)
|
|
@commentaires = @commentaires.all.decorate
|
|
@commentaire_email = current_gestionnaire.email
|
|
|
|
@procedure = @dossier.procedure
|
|
|
|
@dossier = @dossier.decorate
|
|
rescue ActiveRecord::RecordNotFound
|
|
flash.alert = t('errors.messages.dossier_not_found')
|
|
redirect_to url_for(controller: '/backoffice')
|
|
end
|
|
|
|
def valid
|
|
params[:id] = params[:dossier_id]
|
|
show
|
|
|
|
@dossier.next_step! 'gestionnaire', 'valid'
|
|
flash.notice = 'Dossier confirmé avec succès.'
|
|
|
|
render 'show'
|
|
end
|
|
|
|
def close
|
|
params[:id] = params[:dossier_id]
|
|
|
|
show
|
|
|
|
@dossier.next_step! 'gestionnaire', 'close'
|
|
flash.notice = 'Dossier traité avec succès.'
|
|
|
|
render 'show'
|
|
end
|
|
end
|