move controller into users folder
This commit is contained in:
parent
4f3b35fe41
commit
5772b99d42
33 changed files with 460 additions and 250 deletions
|
@ -1,73 +1,73 @@
|
|||
class DossiersController < ApplicationController
|
||||
def show
|
||||
@dossier = Dossier.find(params[:id])
|
||||
# def show
|
||||
# @dossier = Dossier.find(params[:id])
|
||||
|
||||
@etablissement = @dossier.etablissement
|
||||
@entreprise = @dossier.entreprise.decorate
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
redirect_to url_for(controller: :siret)
|
||||
end
|
||||
# @etablissement = @dossier.etablissement
|
||||
# @entreprise = @dossier.entreprise.decorate
|
||||
# rescue ActiveRecord::RecordNotFound
|
||||
# flash.alert = t('errors.messages.dossier_not_found')
|
||||
# redirect_to url_for(controller: :siret)
|
||||
# end
|
||||
|
||||
def create
|
||||
procedure = Procedure.find(params['procedure_id'])
|
||||
@etablissement = Etablissement.new(SIADE::EtablissementAdapter.new(siret).to_params)
|
||||
@entreprise = Entreprise.new(SIADE::EntrepriseAdapter.new(siren).to_params)
|
||||
@dossier = Dossier.create
|
||||
@dossier.draft!
|
||||
# def create
|
||||
# procedure = Procedure.find(params['procedure_id'])
|
||||
# @etablissement = Etablissement.new(SIADE::EtablissementAdapter.new(siret).to_params)
|
||||
# @entreprise = Entreprise.new(SIADE::EntrepriseAdapter.new(siren).to_params)
|
||||
# @dossier = Dossier.create
|
||||
# @dossier.draft!
|
||||
|
||||
@dossier.procedure = procedure
|
||||
@dossier.save
|
||||
# @dossier.procedure = procedure
|
||||
# @dossier.save
|
||||
|
||||
@entreprise.dossier = @dossier
|
||||
@entreprise.save
|
||||
# @entreprise.dossier = @dossier
|
||||
# @entreprise.save
|
||||
|
||||
@etablissement.dossier = @dossier
|
||||
@etablissement.entreprise = @entreprise
|
||||
@etablissement.save
|
||||
# @etablissement.dossier = @dossier
|
||||
# @etablissement.entreprise = @entreprise
|
||||
# @etablissement.save
|
||||
|
||||
redirect_to url_for(controller: :dossiers, action: :show, id: @dossier.id)
|
||||
# redirect_to url_for(controller: :dossiers, action: :show, id: @dossier.id)
|
||||
|
||||
rescue RestClient::ResourceNotFound
|
||||
flash.alert = t('errors.messages.invalid_siret')
|
||||
redirect_to url_for(controller: :siret, procedure_id: params['procedure_id'])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
redirect_to url_for(controller: :siret)
|
||||
end
|
||||
# rescue RestClient::ResourceNotFound
|
||||
# flash.alert = t('errors.messages.invalid_siret')
|
||||
# redirect_to url_for(controller: :siret, procedure_id: params['procedure_id'])
|
||||
# rescue ActiveRecord::RecordNotFound
|
||||
# flash.alert = t('errors.messages.dossier_not_found')
|
||||
# redirect_to url_for(controller: :siret)
|
||||
# end
|
||||
|
||||
def update
|
||||
@dossier = Dossier.find(params[:id])
|
||||
if checked_autorisation_donnees?
|
||||
@dossier.update_attributes(update_params)
|
||||
redirect_to url_for(controller: :description, action: :show, dossier_id: @dossier.id)
|
||||
else
|
||||
@etablissement = @dossier.etablissement
|
||||
@entreprise = @dossier.entreprise.decorate
|
||||
flash.now.alert = 'Les conditions sont obligatoires.'
|
||||
render 'show'
|
||||
end
|
||||
end
|
||||
# def update
|
||||
# @dossier = Dossier.find(params[:id])
|
||||
# if checked_autorisation_donnees?
|
||||
# @dossier.update_attributes(update_params)
|
||||
# redirect_to url_for(controller: :description, action: :show, dossier_id: @dossier.id)
|
||||
# else
|
||||
# @etablissement = @dossier.etablissement
|
||||
# @entreprise = @dossier.entreprise.decorate
|
||||
# flash.now.alert = 'Les conditions sont obligatoires.'
|
||||
# render 'show'
|
||||
# end
|
||||
# end
|
||||
|
||||
private
|
||||
# private
|
||||
|
||||
def update_params
|
||||
params.require(:dossier).permit(:autorisation_donnees)
|
||||
end
|
||||
# def update_params
|
||||
# params.require(:dossier).permit(:autorisation_donnees)
|
||||
# end
|
||||
|
||||
def dossier_id_is_present?
|
||||
@dossier_id != ''
|
||||
end
|
||||
# def dossier_id_is_present?
|
||||
# @dossier_id != ''
|
||||
# end
|
||||
|
||||
def checked_autorisation_donnees?
|
||||
update_params[:autorisation_donnees] == '1'
|
||||
end
|
||||
# def checked_autorisation_donnees?
|
||||
# update_params[:autorisation_donnees] == '1'
|
||||
# end
|
||||
|
||||
def siret
|
||||
params[:siret]
|
||||
end
|
||||
# def siret
|
||||
# params[:siret]
|
||||
# end
|
||||
|
||||
def siren
|
||||
siret[0..8]
|
||||
end
|
||||
# def siren
|
||||
# siret[0..8]
|
||||
# end
|
||||
end
|
||||
|
|
3
app/controllers/users/commentaires_controller.rb
Normal file
3
app/controllers/users/commentaires_controller.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class Users::CommentairesController < CommentairesController
|
||||
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class DescriptionController < ApplicationController
|
||||
class Users::DescriptionController < ApplicationController
|
||||
def show
|
||||
@dossier = Dossier.find(params[:dossier_id])
|
||||
@dossier = @dossier.decorate
|
|
@ -1,6 +1,79 @@
|
|||
class Users::DossiersController < ApplicationController
|
||||
class Users::DossiersController < UsersController
|
||||
before_action :authenticate_user!
|
||||
def index
|
||||
@dossiers = Dossier.all.decorate
|
||||
end
|
||||
def show
|
||||
|
||||
@dossier = Dossier.find(params[:id])
|
||||
|
||||
@etablissement = @dossier.etablissement
|
||||
@entreprise = @dossier.entreprise.decorate
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
redirect_to url_for(controller: :siret)
|
||||
end
|
||||
|
||||
def create
|
||||
procedure = Procedure.find(params['procedure_id'])
|
||||
@etablissement = Etablissement.new(SIADE::EtablissementAdapter.new(siret).to_params)
|
||||
@entreprise = Entreprise.new(SIADE::EntrepriseAdapter.new(siren).to_params)
|
||||
@dossier = Dossier.create
|
||||
@dossier.draft!
|
||||
|
||||
@dossier.procedure = procedure
|
||||
@dossier.save
|
||||
|
||||
@entreprise.dossier = @dossier
|
||||
@entreprise.save
|
||||
|
||||
@etablissement.dossier = @dossier
|
||||
@etablissement.entreprise = @entreprise
|
||||
@etablissement.save
|
||||
|
||||
redirect_to url_for(controller: :dossiers, action: :show, id: @dossier.id)
|
||||
|
||||
rescue RestClient::ResourceNotFound
|
||||
flash.alert = t('errors.messages.invalid_siret')
|
||||
redirect_to url_for(controller: :siret, procedure_id: params['procedure_id'])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
redirect_to url_for(controller: :siret)
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@dossier = Dossier.find(params[:id])
|
||||
if checked_autorisation_donnees?
|
||||
@dossier.update_attributes(update_params)
|
||||
redirect_to url_for(controller: :description, action: :show, dossier_id: @dossier.id)
|
||||
else
|
||||
@etablissement = @dossier.etablissement
|
||||
@entreprise = @dossier.entreprise.decorate
|
||||
flash.now.alert = 'Les conditions sont obligatoires.'
|
||||
render 'show'
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_params
|
||||
params.require(:dossier).permit(:autorisation_donnees)
|
||||
end
|
||||
|
||||
def dossier_id_is_present?
|
||||
@dossier_id != ''
|
||||
end
|
||||
|
||||
def checked_autorisation_donnees?
|
||||
update_params[:autorisation_donnees] == '1'
|
||||
end
|
||||
|
||||
def siret
|
||||
params[:siret]
|
||||
end
|
||||
|
||||
def siren
|
||||
siret[0..8]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class RecapitulatifController < ApplicationController
|
||||
class Users::RecapitulatifController < UsersController
|
||||
def show
|
||||
|
||||
@dossier = Dossier.find(params[:dossier_id])
|
||||
@dossier = @dossier.decorate
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
class SiretController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
class Users::SiretController < UsersController
|
||||
def index
|
||||
@procedure = Procedure.find(params['procedure_id'])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
@ -9,5 +8,4 @@ class SiretController < ApplicationController
|
|||
def error_procedure
|
||||
render :file => "#{Rails.root}/public/404_procedure_not_found.html", :status => 404
|
||||
end
|
||||
|
||||
end
|
3
app/controllers/users_controller.rb
Normal file
3
app/controllers/users_controller.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class UsersController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
end
|
|
@ -44,7 +44,7 @@
|
|||
= render partial: '/carte/carte_sources_JS_backend'
|
||||
%br
|
||||
|
||||
= render partial: '/recapitulatif/commentaires_flux'
|
||||
= render partial: '/users/recapitulatif/commentaires_flux'
|
||||
%br
|
||||
%br
|
||||
|
||||
|
|
13
app/views/dossiers/_show.html.haml
Normal file
13
app/views/dossiers/_show.html.haml
Normal file
|
@ -0,0 +1,13 @@
|
|||
.container#recap_info_entreprise
|
||||
%h2 Récapitulatif de vos informations <em id="insee_infogreffe" class='small'>(récupérées auprès de l'INSEE et d'INFOGREFFE)</em>
|
||||
%br
|
||||
|
||||
%div.row
|
||||
= render partial: '/dossiers/infos_entreprise'
|
||||
%br
|
||||
= form_for @dossier, url: { controller: '/users/dossiers', action: :create } do |f|
|
||||
%label{ style:'font-weight:normal' }
|
||||
= f.check_box :autorisation_donnees
|
||||
J'autorise les organismes publics à vérifier les informations de mon entreprise auprès des administrations concernées. Ces informations resteront strictement confidentielles.
|
||||
%br
|
||||
= f.submit 'Etape suivante', class: "btn btn btn-info", style: 'float:right', id: 'etape_suivante'
|
|
@ -1,13 +1 @@
|
|||
.container#recap_info_entreprise
|
||||
%h2 Récapitulatif de vos informations <em id="insee_infogreffe" class='small'>(récupérées auprès de l'INSEE et d'INFOGREFFE)</em>
|
||||
%br
|
||||
|
||||
%div.row
|
||||
= render partial: 'infos_entreprise'
|
||||
%br
|
||||
= form_for @dossier do |f|
|
||||
%label{ style:'font-weight:normal' }
|
||||
= f.check_box :autorisation_donnees
|
||||
J'autorise les organismes publics à vérifier les informations de mon entreprise auprès des administrations concernées. Ces informations resteront strictement confidentielles.
|
||||
%br
|
||||
= f.submit 'Etape suivante', class: "btn btn btn-info", style: 'float:right', id: 'etape_suivante'
|
||||
= render partial: 'show'
|
|
@ -1,24 +0,0 @@
|
|||
/ %p.lead{id: 'admin_section'}
|
||||
/ %span{class:'text-info', style:'font-weight:bold'}
|
||||
/ -if user_signed_in?
|
||||
/ ='Vous êtes identifié comme une administration'
|
||||
/ -else
|
||||
/ ='Si vous êtes une administration, '
|
||||
|
||||
/ %p.lead
|
||||
/ -if user_signed_in?
|
||||
/ = form_tag(url_for({controller: 'admin/dossier', action: :index}), class: 'form-inline', method: 'GET') do
|
||||
/ .form-group.form-group-lg
|
||||
/ = text_field_tag :siret, nil, :class => "form-control", :style => 'margin-bottom:10px', :placeholder => "N° de dossier", :id => "dossier_id", :name => "dossier_id"
|
||||
/ %br
|
||||
/ = submit_tag "Accéder", class: %w(btn btn-lg btn-success), style: 'margin-top:20px;', data: { disable_with: "Accéder", submit: true}
|
||||
/ -else
|
||||
/ = form_tag(url_for({controller: 'user/sessions', action: :create}), class: 'form-inline', method: 'POST') do
|
||||
/ .form-group.form-group-lg
|
||||
/ = text_field_tag :siret, nil, :class => "form-control", :style => 'margin-bottom:10px', :placeholder => "Identifiant", :id => "user_email", :name => "user[email]"
|
||||
/ %br
|
||||
/ = password_field_tag :siret, nil, :class => "form-control", :style => 'margin-bottom:10px', :placeholder => "Mot de passe", :id => "user_password", :name => "user[password]"
|
||||
/ %br
|
||||
/ = text_field_tag :siret, nil, :class => "form-control", :style => 'margin-bottom:10px', :placeholder => "N° de dossier", :id => "dossier_id", :name => "dossier_id"
|
||||
/ %br
|
||||
/ = submit_tag "Accéder", class: %w(btn btn-lg btn-success), style: 'margin-top:20px;', data: { disable_with: "Accéder", submit: true}
|
1
app/views/users/dossiers/show.html.haml
Normal file
1
app/views/users/dossiers/show.html.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render partial: '/dossiers/show'
|
|
@ -5,5 +5,5 @@
|
|||
Site de démonstration d’un service public de saisie d’un projet ou de dépôt d’une démarche administrative, auprès d’un ou plusieurs organismes publics, simplifié des informations déjà connues des administrations, grâce à la fourniture du numéro SIRET.
|
||||
|
||||
.row
|
||||
= render partial: '/siret/pro'
|
||||
= render partial: 'pro'
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue