2015-09-23 19:20:03 +02:00
|
|
|
class Users::RecapitulatifController < UsersController
|
2016-10-26 16:06:01 +02:00
|
|
|
|
2016-01-26 15:52:05 +01:00
|
|
|
before_action only: [:show] do
|
|
|
|
authorized_routes? self.class
|
|
|
|
end
|
2016-01-25 15:54:21 +01:00
|
|
|
|
2015-08-10 11:05:06 +02:00
|
|
|
def show
|
2015-12-24 15:10:20 +01:00
|
|
|
create_dossier_facade
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
2015-09-24 16:51:14 +02:00
|
|
|
|
2015-11-02 15:31:15 +01:00
|
|
|
def initiate
|
2015-12-24 15:10:20 +01:00
|
|
|
create_dossier_facade
|
2015-09-24 16:51:14 +02:00
|
|
|
|
2015-12-24 15:10:20 +01:00
|
|
|
@facade.dossier.next_step! 'user', 'initiate'
|
2015-09-24 16:51:14 +02:00
|
|
|
flash.notice = 'Dossier soumis avec succès.'
|
|
|
|
|
|
|
|
render 'show'
|
|
|
|
end
|
|
|
|
|
2015-11-02 15:46:43 +01:00
|
|
|
def submit
|
2015-12-24 15:10:20 +01:00
|
|
|
create_dossier_facade
|
2015-09-24 16:51:14 +02:00
|
|
|
|
2016-08-08 14:12:16 +02:00
|
|
|
@facade.dossier.submit!
|
2015-09-24 16:51:14 +02:00
|
|
|
flash.notice = 'Dossier déposé avec succès.'
|
|
|
|
|
|
|
|
render 'show'
|
|
|
|
end
|
2015-12-24 15:10:20 +01:00
|
|
|
|
2016-01-26 15:52:05 +01:00
|
|
|
def self.route_authorization
|
|
|
|
{
|
2016-12-05 17:37:13 +01:00
|
|
|
states: [:initiated, :replied, :updated, :validated, :received, :submitted, :without_continuation, :closed, :refused]
|
2016-01-26 15:52:05 +01:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2015-12-24 15:10:20 +01:00
|
|
|
private
|
|
|
|
|
|
|
|
def create_dossier_facade
|
|
|
|
@facade = DossierFacades.new current_user_dossier.id, current_user.email
|
|
|
|
|
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
flash.alert = t('errors.messages.dossier_not_found')
|
|
|
|
redirect_to url_for(root_path)
|
|
|
|
end
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|