dossier: add page for etablissement
This commit is contained in:
parent
310f4b92d1
commit
93f1a53dfc
9 changed files with 229 additions and 0 deletions
54
app/assets/stylesheets/new_design/etablissement.scss
Normal file
54
app/assets/stylesheets/new_design/etablissement.scss
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
@import "constants";
|
||||||
|
@import "colors";
|
||||||
|
|
||||||
|
.etablissement {
|
||||||
|
margin-top: $default-padding * 2;
|
||||||
|
margin-bottom: $default-padding * 2;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin-bottom: $default-padding * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-bottom: $default-padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
.etablissement-infos {
|
||||||
|
margin-top: $default-padding * 2;
|
||||||
|
margin-bottom: $default-padding * 2;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
margin-bottom: $default-padding;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
line-height: 28px;
|
||||||
|
list-style-type: disc;
|
||||||
|
list-style-position: inside;
|
||||||
|
|
||||||
|
// Inner lists
|
||||||
|
ul {
|
||||||
|
margin-left: $default-padding;
|
||||||
|
list-style-type: circle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.etablissement-exercices {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap-reverse;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.button {
|
||||||
|
margin-bottom: $default-padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -103,6 +103,16 @@ module NewUser
|
||||||
redirect_to etablissement_dossier_path
|
redirect_to etablissement_dossier_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def etablissement
|
||||||
|
@dossier = dossier
|
||||||
|
|
||||||
|
# Redirect if the user attempts to access the page URL directly
|
||||||
|
if !@dossier.etablissement
|
||||||
|
flash.alert = 'Aucun établissement n’est associé à ce dossier'
|
||||||
|
return redirect_to siret_dossier_path(@dossier)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def brouillon
|
def brouillon
|
||||||
@dossier = dossier_with_champs
|
@dossier = dossier_with_champs
|
||||||
|
|
||||||
|
|
35
app/views/new_user/dossiers/etablissement.html.haml
Normal file
35
app/views/new_user/dossiers/etablissement.html.haml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
- content_for(:title, "Informations sur l’établissement")
|
||||||
|
|
||||||
|
- content_for :footer do
|
||||||
|
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
|
||||||
|
|
||||||
|
.etablissement
|
||||||
|
.container
|
||||||
|
%h1 Informations sur l’établissement
|
||||||
|
|
||||||
|
%p
|
||||||
|
Nous avons récupéré auprès de l’INSEE et d’Infogreffe les informations suivantes concernant votre établissement.
|
||||||
|
|
||||||
|
%p
|
||||||
|
Ces informations seront jointes à votre dossier.
|
||||||
|
|
||||||
|
.etablissement-infos.card.featured
|
||||||
|
- etablissement = @dossier.etablissement
|
||||||
|
%h2.card-title= raison_sociale_or_name(etablissement)
|
||||||
|
|
||||||
|
= render partial: 'new_user/dossiers/etablissement/infos_entreprise', locals: { etablissement: etablissement }
|
||||||
|
|
||||||
|
- if etablissement.association?
|
||||||
|
= render partial: 'new_user/dossiers/etablissement/infos_association', locals: { etablissement: etablissement }
|
||||||
|
|
||||||
|
.actions
|
||||||
|
= link_to 'Utiliser un autre numéro SIRET', siret_dossier_path(@dossier), class: 'button'
|
||||||
|
|
||||||
|
- if @dossier.procedure.use_api_carto
|
||||||
|
/ Until the old layout is gone, we need to disable turbolinks
|
||||||
|
/ to avoid the map loading twice (once for the turbolinks preview,
|
||||||
|
/ once when turbolinks notices the layout are differents and reloads
|
||||||
|
/ the page.)
|
||||||
|
= link_to 'Continuer avec ces informations', users_dossier_carte_path(@dossier), class: 'button primary', data: { turbolinks: false }
|
||||||
|
- else
|
||||||
|
= link_to 'Continuer avec ces informations', brouillon_dossier_path(@dossier), class: 'button primary'
|
|
@ -0,0 +1,24 @@
|
||||||
|
%ul.etablissement-infos-association
|
||||||
|
%li
|
||||||
|
Numéro d’enregistrement au Registre National des Associations :
|
||||||
|
= etablissement.association_rna
|
||||||
|
|
||||||
|
%li
|
||||||
|
Titre :
|
||||||
|
= etablissement.association_titre
|
||||||
|
|
||||||
|
%li
|
||||||
|
Objet :
|
||||||
|
= etablissement.association_objet
|
||||||
|
|
||||||
|
%li
|
||||||
|
Date de création :
|
||||||
|
= etablissement.association_date_creation&.strftime('%d/%m/%Y')
|
||||||
|
|
||||||
|
%li
|
||||||
|
Date de déclaration :
|
||||||
|
= etablissement.association_date_declaration&.strftime('%d/%m/%Y')
|
||||||
|
|
||||||
|
%li
|
||||||
|
Date de publication :
|
||||||
|
= etablissement.association_date_publication&.strftime('%d/%m/%Y')
|
|
@ -0,0 +1,49 @@
|
||||||
|
%ul.etablissement-infos-entreprise
|
||||||
|
%li
|
||||||
|
Siret :
|
||||||
|
= etablissement.siret
|
||||||
|
|
||||||
|
- if etablissement.siret != etablissement.entreprise.siret_siege_social
|
||||||
|
%li
|
||||||
|
SIRET siègle social :
|
||||||
|
= etablissement.entreprise.siret_siege_social
|
||||||
|
|
||||||
|
%li
|
||||||
|
Forme juridique :
|
||||||
|
= etablissement.entreprise.forme_juridique
|
||||||
|
|
||||||
|
%li
|
||||||
|
Libellé NAF :
|
||||||
|
= etablissement.libelle_naf
|
||||||
|
|
||||||
|
%li
|
||||||
|
Code NAF :
|
||||||
|
= etablissement.naf
|
||||||
|
|
||||||
|
%li
|
||||||
|
Date de création :
|
||||||
|
= etablissement.entreprise.date_creation&.strftime('%d/%m/%Y')
|
||||||
|
|
||||||
|
%li
|
||||||
|
Effectif organisation :
|
||||||
|
= effectif(etablissement)
|
||||||
|
|
||||||
|
%li
|
||||||
|
Code effectif :
|
||||||
|
= etablissement.entreprise.code_effectif_entreprise
|
||||||
|
|
||||||
|
%li
|
||||||
|
Numéro TVA intracommunautaire :
|
||||||
|
= etablissement.entreprise.numero_tva_intracommunautaire
|
||||||
|
|
||||||
|
%li
|
||||||
|
Adresse :
|
||||||
|
- etablissement.adresse.split("\n").each do |line|
|
||||||
|
= line
|
||||||
|
|
||||||
|
%li
|
||||||
|
Capital social :
|
||||||
|
= pretty_currency(etablissement.entreprise.capital_social)
|
||||||
|
|
||||||
|
- if etablissement.exercices.present?
|
||||||
|
%p.etablissement-exercices Les exercices comptables des trois dernières années seront joints à votre dossier.
|
|
@ -280,6 +280,7 @@ Rails.application.routes.draw do
|
||||||
patch 'update_identite'
|
patch 'update_identite'
|
||||||
get 'siret'
|
get 'siret'
|
||||||
post 'siret', to: 'dossiers#update_siret'
|
post 'siret', to: 'dossiers#update_siret'
|
||||||
|
get 'etablissement'
|
||||||
get 'brouillon'
|
get 'brouillon'
|
||||||
patch 'brouillon', to: 'dossiers#update_brouillon'
|
patch 'brouillon', to: 'dossiers#update_brouillon'
|
||||||
get 'modifier', to: 'dossiers#modifier'
|
get 'modifier', to: 'dossiers#modifier'
|
||||||
|
|
|
@ -335,6 +335,21 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#etablissement' do
|
||||||
|
let(:dossier) { create(:dossier, :with_entreprise, user: user) }
|
||||||
|
|
||||||
|
before { sign_in(user) }
|
||||||
|
|
||||||
|
subject { get :etablissement, params: { id: dossier.id } }
|
||||||
|
|
||||||
|
it { is_expected.to render_template(:etablissement) }
|
||||||
|
|
||||||
|
context 'when the dossier has no etablissement yet' do
|
||||||
|
let(:dossier) { create(:dossier, user: user) }
|
||||||
|
it { is_expected.to redirect_to siret_dossier_path(dossier) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#brouillon' do
|
describe '#brouillon' do
|
||||||
before { sign_in(user) }
|
before { sign_in(user) }
|
||||||
let!(:dossier) { create(:dossier, user: user, autorisation_donnees: true) }
|
let!(:dossier) { create(:dossier, user: user, autorisation_donnees: true) }
|
||||||
|
|
|
@ -23,6 +23,12 @@ FactoryBot.define do
|
||||||
entreprise_siret_siege_social { '44011762001530' }
|
entreprise_siret_siege_social { '44011762001530' }
|
||||||
entreprise_code_effectif_entreprise { '51' }
|
entreprise_code_effectif_entreprise { '51' }
|
||||||
entreprise_date_creation { "1990-04-24" }
|
entreprise_date_creation { "1990-04-24" }
|
||||||
|
|
||||||
|
trait :with_exercices do
|
||||||
|
after(:create) do |etablissement, _evaluator|
|
||||||
|
create(:exercice, etablissement: etablissement)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :is_association do
|
trait :is_association do
|
||||||
|
|
35
spec/views/new_user/dossiers/etablissement.html.haml_spec.rb
Normal file
35
spec/views/new_user/dossiers/etablissement.html.haml_spec.rb
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'new_user/dossiers/etablissement.html.haml', type: :view do
|
||||||
|
let(:etablissement) { create(:etablissement, :with_exercices) }
|
||||||
|
let(:dossier) { create(:dossier, etablissement: etablissement) }
|
||||||
|
let(:footer) { view.content_for(:footer) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in dossier.user
|
||||||
|
assign(:dossier, dossier)
|
||||||
|
end
|
||||||
|
|
||||||
|
subject! { render }
|
||||||
|
|
||||||
|
it 'affiche les informations de l’établissement' do
|
||||||
|
expect(rendered).to have_text(etablissement.entreprise_raison_sociale)
|
||||||
|
expect(rendered).to have_text(etablissement.siret)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'n’affiche pas publiquement les derniers exercices comptables' do
|
||||||
|
expect(rendered).not_to have_text(number_to_currency(etablissement.exercices.first.ca))
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'quand l’établissement est une association' do
|
||||||
|
let(:etablissement) { create(:etablissement, :is_association) }
|
||||||
|
|
||||||
|
it 'affiche les informations de l’association' do
|
||||||
|
expect(rendered).to have_text(etablissement.association_titre)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'prépare le footer' do
|
||||||
|
expect(footer).to have_selector('footer')
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue