Display etablissement information for siret champ
This commit is contained in:
parent
4c6eeb1fbd
commit
408feaa52e
10 changed files with 108 additions and 65 deletions
5
app/helpers/etablissement_helper.rb
Normal file
5
app/helpers/etablissement_helper.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
module EtablissementHelper
|
||||
def pretty_currency(capital_social)
|
||||
number_to_currency(capital_social, delimiter: ' ', unit: '€', format: '%n %u')
|
||||
end
|
||||
end
|
|
@ -36,6 +36,31 @@ class Etablissement < ApplicationRecord
|
|||
|
||||
attr_accessor :signature
|
||||
|
||||
def entreprise_raison_sociale_or_name
|
||||
entreprise_raison_sociale.presence || "#{entreprise_nom} #{entreprise_prenom}"
|
||||
end
|
||||
|
||||
def entreprise_effectif
|
||||
{
|
||||
'NN' => "Unités non employeuses (pas de salarié au cours de l'année de référence et pas d'effectif au 31/12).",
|
||||
'00' => "0 salarié (n'ayant pas d'effectif au 31/12 mais ayant employé des salariés au cours de l'année de référence)",
|
||||
'01' => '1 ou 2 salariés',
|
||||
'02' => '3 à 5 salariés',
|
||||
'03' => '6 à 9 salariés',
|
||||
'11' => '10 à 19 salariés',
|
||||
'12' => '20 à 49 salariés',
|
||||
'21' => '50 à 99 salariés',
|
||||
'22' => '100 à 199 salariés',
|
||||
'31' => '200 à 249 salariés',
|
||||
'32' => '250 à 499 salariés',
|
||||
'41' => '500 à 999 salariés',
|
||||
'42' => '1 000 à 1 999 salariés',
|
||||
'51' => '2 000 à 4 999 salariés',
|
||||
'52' => '5 000 à 9 999 salariés',
|
||||
'53' => '10 000 salariés et plus'
|
||||
}[entreprise_code_effectif_entreprise]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_signature
|
||||
|
|
|
@ -46,6 +46,12 @@
|
|||
%td.rich-text
|
||||
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
|
||||
= simple_format(c.value)
|
||||
- when "siret"
|
||||
%th.libelle
|
||||
= "#{c.libelle} :"
|
||||
%td.rich-text
|
||||
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
|
||||
= render partial: "new_gestionnaire/dossiers/identite_entreprise", locals: { etablissement: c.etablissement }
|
||||
- else
|
||||
%th.libelle
|
||||
= "#{c.libelle} :"
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
- entreprise = entreprise.decorate
|
||||
- etablissement = entreprise.etablissement
|
||||
|
||||
%table.table.vertical.dossier-champs
|
||||
%tbody
|
||||
%tr
|
||||
%th.libelle Dénomination :
|
||||
%td= entreprise.raison_sociale_or_name
|
||||
%td= etablissement.entreprise_raison_sociale_or_name
|
||||
%tr
|
||||
%th.libelle SIRET :
|
||||
%td= entreprise.siret_siege_social
|
||||
%td= etablissement.entreprise_siret_siege_social
|
||||
%tr
|
||||
%th.libelle Forme juridique :
|
||||
%td= sanitize(entreprise.forme_juridique)
|
||||
- if etablissement.present?
|
||||
%td= sanitize(etablissement.entreprise_forme_juridique)
|
||||
%tr
|
||||
%th.libelle Libellé NAF :
|
||||
%td= etablissement.libelle_naf
|
||||
|
@ -21,17 +17,16 @@
|
|||
%td= etablissement.naf
|
||||
%tr
|
||||
%th.libelle Date de création :
|
||||
%td= Time.at(entreprise.date_creation).localtime.strftime("%d/%m/%Y")
|
||||
%td= etablissement.entreprise_date_creation&.strftime("%d/%m/%Y")
|
||||
%tr
|
||||
%th.libelle Effectif de l'organisation :
|
||||
%td= entreprise.effectif
|
||||
%td= etablissement.entreprise_effectif
|
||||
%tr
|
||||
%th.libelle Code effectif :
|
||||
%td= entreprise.code_effectif_entreprise
|
||||
%td= etablissement.entreprise_code_effectif_entreprise
|
||||
%tr
|
||||
%th.libelle Numéro de TVA intracommunautaire :
|
||||
%td= entreprise.numero_tva_intracommunautaire
|
||||
- if etablissement.present?
|
||||
%td= etablissement.entreprise_numero_tva_intracommunautaire
|
||||
%tr
|
||||
%th.libelle Adresse :
|
||||
%td
|
||||
|
@ -40,31 +35,30 @@
|
|||
%br
|
||||
%tr
|
||||
%th.libelle Capital social :
|
||||
%td= entreprise.pretty_capital_social
|
||||
- if etablissement.present?
|
||||
%td= pretty_currency(etablissement.entreprise_capital_social)
|
||||
%tr
|
||||
%th.libelle Exercices :
|
||||
%td
|
||||
- etablissement.exercices.each_with_index do |exercice, index|
|
||||
= "#{exercice.date_fin_exercice.year} : "
|
||||
= number_to_currency(exercice.ca)
|
||||
= pretty_currency(exercice.ca)
|
||||
%br
|
||||
- if entreprise.rna_information.present?
|
||||
- if etablissement.association_rna.present?
|
||||
%tr
|
||||
%th.libelle Numéro RNA :
|
||||
%td= entreprise.rna_information.association_id
|
||||
%td= etablissement.association_rna
|
||||
%tr
|
||||
%th.libelle Titre :
|
||||
%td= entreprise.rna_information.titre
|
||||
%td= etablissement.association_titre
|
||||
%tr
|
||||
%th.libelle Objet :
|
||||
%td= entreprise.rna_information.objet
|
||||
%td= etablissement.association_objet
|
||||
%tr
|
||||
%th.libelle Date de création :
|
||||
%td= entreprise.rna_information.date_creation&.strftime("%d/%m/%Y")
|
||||
%td= etablissement.association_date_creation&.strftime("%d/%m/%Y")
|
||||
%tr
|
||||
%th.libelle Date de publication :
|
||||
%td= entreprise.rna_information.date_publication&.strftime("%d/%m/%Y")
|
||||
%td= etablissement.association_date_publication&.strftime("%d/%m/%Y")
|
||||
%tr
|
||||
%th.libelle Date de déclaration :
|
||||
%td= entreprise.rna_information.date_declaration&.strftime("%d/%m/%Y")
|
||||
%td= etablissement.association_date_declaration&.strftime("%d/%m/%Y")
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
= render partial: "new_gestionnaire/dossiers/user_infos", locals: { user: @dossier.user }
|
||||
|
||||
- if @dossier.entreprise.present?
|
||||
= render partial: "identite_entreprise", locals: { entreprise: @dossier.entreprise }
|
||||
- if @dossier.etablissement.present?
|
||||
= render partial: "identite_entreprise", locals: { etablissement: @dossier.etablissement }
|
||||
|
||||
- if @dossier.individual.present?
|
||||
= render partial: "identite_individual", locals: { individual: @dossier.individual }
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
.card
|
||||
= render partial: "new_gestionnaire/dossiers/user_infos", locals: { user: dossier.user }
|
||||
|
||||
- if dossier.entreprise.present?
|
||||
= render partial: "new_gestionnaire/dossiers/identite_entreprise", locals: { entreprise: dossier.entreprise }
|
||||
- if dossier.etablissement.present?
|
||||
= render partial: "new_gestionnaire/dossiers/identite_entreprise", locals: { etablissement: dossier.etablissement }
|
||||
|
||||
- if dossier.individual.present?
|
||||
= render partial: "new_gestionnaire/dossiers/identite_individual", locals: { individual: dossier.individual }
|
||||
|
|
|
@ -10,11 +10,5 @@ FactoryBot.define do
|
|||
siret_siege_social '44011762001530'
|
||||
code_effectif_entreprise '51'
|
||||
date_creation Time.at(1453976189).to_datetime
|
||||
|
||||
trait :is_association do
|
||||
after(:create) do |entreprise, _evaluator|
|
||||
create(:rna_information, entreprise: entreprise)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,5 +12,25 @@ FactoryBot.define do
|
|||
code_postal '92270'
|
||||
localite 'BOIS COLOMBES'
|
||||
code_insee_localite '92009'
|
||||
|
||||
entreprise_siren '440117620'
|
||||
entreprise_capital_social 537_100_000
|
||||
entreprise_numero_tva_intracommunautaire 'FR27440117620'
|
||||
entreprise_forme_juridique 'SA à conseil d\'administration (s.a.i.)'
|
||||
entreprise_forme_juridique_code '5599'
|
||||
entreprise_nom_commercial 'GRTGAZ'
|
||||
entreprise_raison_sociale 'GRTGAZ'
|
||||
entreprise_siret_siege_social '44011762001530'
|
||||
entreprise_code_effectif_entreprise '51'
|
||||
entreprise_date_creation "1990-04-24"
|
||||
end
|
||||
|
||||
trait :is_association do
|
||||
association_rna "W072000535"
|
||||
association_titre "ASSOCIATION POUR LA PROMOTION DE SPECTACLES AU CHATEAU DE ROCHEMAURE"
|
||||
association_objet "mise en oeuvre et réalisation de spectacles au chateau de rochemaure"
|
||||
association_date_creation "1990-04-24"
|
||||
association_date_declaration "2014-11-28"
|
||||
association_date_publication "1990-05-16"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
describe 'new_gestionnaire/dossiers/identite_entreprise.html.haml', type: :view do
|
||||
before { render 'new_gestionnaire/dossiers/identite_entreprise.html.haml', entreprise: entreprise }
|
||||
before { render 'new_gestionnaire/dossiers/identite_entreprise.html.haml', etablissement: etablissement }
|
||||
|
||||
context "there is an association" do
|
||||
let(:rna_information) { create(:rna_information) }
|
||||
let(:entreprise) { rna_information.entreprise }
|
||||
let(:etablissement) { create(:etablissement, :is_association) }
|
||||
|
||||
context "date_publication is missing on rna" do
|
||||
before { rna_information.update(date_publication: nil) }
|
||||
before { etablissement.update(association_date_publication: nil) }
|
||||
|
||||
it "can render without error" do
|
||||
expect(rendered).to include("Date de publication :")
|
||||
|
|
|
@ -3,8 +3,8 @@ describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do
|
|||
|
||||
let(:current_gestionnaire) { create(:gestionnaire) }
|
||||
let(:individual) { nil }
|
||||
let(:entreprise) { nil }
|
||||
let(:dossier) { create(:dossier, :en_construction, entreprise: entreprise, individual: individual) }
|
||||
let(:etablissement) { nil }
|
||||
let(:dossier) { create(:dossier, :en_construction, etablissement: etablissement, individual: individual) }
|
||||
|
||||
before do
|
||||
assign(:dossier, dossier)
|
||||
|
@ -12,19 +12,19 @@ describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do
|
|||
render
|
||||
end
|
||||
|
||||
context "when dossier was created by an entreprise" do
|
||||
let(:entreprise) { create(:entreprise) }
|
||||
context "when dossier was created by an etablissement" do
|
||||
let(:etablissement) { create(:etablissement) }
|
||||
|
||||
it { expect(rendered).to include(entreprise.decorate.raison_sociale_or_name) }
|
||||
it { expect(rendered).to include(entreprise.decorate.siret_siege_social) }
|
||||
it { expect(rendered).to include(entreprise.decorate.forme_juridique) }
|
||||
it { expect(rendered).to include(etablissement.entreprise_raison_sociale_or_name) }
|
||||
it { expect(rendered).to include(etablissement.entreprise_siret_siege_social) }
|
||||
it { expect(rendered).to include(etablissement.entreprise_forme_juridique) }
|
||||
|
||||
context "and entreprise is an association" do
|
||||
let(:entreprise) { create(:entreprise, :is_association) }
|
||||
let(:etablissement) { create(:etablissement, :is_association) }
|
||||
|
||||
it { expect(rendered).to include(entreprise.rna_information.association_id) }
|
||||
it { expect(rendered).to include(entreprise.rna_information.titre) }
|
||||
it { expect(rendered).to include(entreprise.rna_information.objet) }
|
||||
it { expect(rendered).to include(etablissement.association_rna) }
|
||||
it { expect(rendered).to include(etablissement.association_titre) }
|
||||
it { expect(rendered).to include(etablissement.association_objet) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue