Merge pull request #5247 from betagouv/dev

2020-06-09-01
This commit is contained in:
krichtof 2020-06-09 19:19:29 +02:00 committed by GitHub
commit 388e490373
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 76 additions and 58 deletions

View file

@ -703,7 +703,7 @@ GEM
semantic_range (>= 2.3.0) semantic_range (>= 2.3.0)
websocket-driver (0.7.1) websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4) websocket-extensions (0.1.5)
xpath (3.2.0) xpath (3.2.0)
nokogiri (~> 1.8) nokogiri (~> 1.8)
xray-rails (0.3.1) xray-rails (0.3.1)

View file

@ -8,7 +8,7 @@
} }
.libelle { .libelle {
width: 300px; width: 325px;
} }
td.updated-at { td.updated-at {

View file

@ -1,6 +1,11 @@
module EtablissementHelper module EtablissementHelper
def pretty_currency(capital_social) def pretty_currency(capital_social, unit: '€')
number_to_currency(capital_social, locale: :fr) number_to_currency(capital_social, locale: :fr, unit: unit)
end
def pretty_currency_unit(unit)
dict = { 'kEuros' => 'k€' }
dict[unit]
end end
def raison_sociale_or_name(etablissement) def raison_sociale_or_name(etablissement)
@ -35,6 +40,6 @@ module EtablissementHelper
end end
def pretty_date_exercice(date) def pretty_date_exercice(date)
date.sub(/(?<year>\d{4})(?<month>\d{2})/, '\k<month>/\k<year>') if date.present? date.sub(/(?<year>\d{4})(?<month>\d{2})/, '\k<year>') if date.present?
end end
end end

View file

@ -32,13 +32,13 @@
%th.libelle %th.libelle
Effectif mensuel Effectif mensuel
= try_format_mois_effectif(etablissement) = try_format_mois_effectif(etablissement)
(URSSAF) (URSSAF) :
%td= etablissement.entreprise_effectif_mensuel %td= etablissement.entreprise_effectif_mensuel
%tr %tr
%th.libelle %th.libelle
Effectif moyen annuel Effectif moyen annuel
= etablissement.entreprise_effectif_annuel_annee = etablissement.entreprise_effectif_annuel_annee
(URSSAF) (URSSAF) :
%td= etablissement.entreprise_effectif_annuel %td= etablissement.entreprise_effectif_annuel
%tr %tr
%th.libelle Effectif de l'organisation (INSEE) : %th.libelle Effectif de l'organisation (INSEE) :
@ -57,41 +57,39 @@
%th.libelle Capital social : %th.libelle Capital social :
%td= pretty_currency(etablissement.entreprise.capital_social) %td= pretty_currency(etablissement.entreprise.capital_social)
%tr %tr
%th.libelle Exercices : %th.libelle Chiffre d'affaires :
%td %td
- if profile == 'instructeur' - if profile == 'instructeur'
- etablissement.exercices.each_with_index do |exercice, index| %details
= "#{exercice.date_fin_exercice.year} : " - etablissement.exercices.each_with_index do |exercice, index|
= pretty_currency(exercice.ca) = "#{exercice.date_fin_exercice.year} : "
%br = pretty_currency(exercice.ca)
%br
- elsif etablissement.exercices.present? - elsif etablissement.exercices.present?
= t('activemodel.models.exercices_summary', count: etablissement.exercices.count) = t('activemodel.models.exercices_summary', count: etablissement.exercices.count)
- if etablissement.entreprise_attestation_sociale.attached?
%tr
%th.libelle Attestation sociale
- if profile == 'instructeur'
%td= link_to "Consulter l'attestation", url_for(etablissement.entreprise_attestation_sociale)
- else
%td Une attestation de vigilance délivrée par l'ACOSS a été jointe à votre dossier.
- if etablissement.entreprise_attestation_fiscale.attached?
%tr
%th.libelle Attestation fiscale
- if profile == 'instructeur'
%td= link_to "Consulter l'attestation", url_for(etablissement.entreprise_attestation_fiscale)
- else
%td Une attestation fiscale délivrée par l'URSSAF a été jointe à votre dossier.
- if etablissement.entreprise_bilans_bdf.present? - if etablissement.entreprise_bilans_bdf.present?
%tr - if profile == 'instructeur'
%th.libelle = render partial: 'shared/dossiers/identite_entreprise_bilan_detail',
Bilans Banque de France locals: { libelle: 'Résultat exercice', key: 'resultat_exercice', etablissement: etablissement }
= "en #{etablissement.entreprise_bilans_bdf_monnaie}"
- if profile == 'instructeur' = render partial: 'shared/dossiers/identite_entreprise_bilan_detail',
locals: { libelle: "Excédent brut d'exploitation", key: 'excedent_brut_exploitation', etablissement: etablissement }
= render partial: 'shared/dossiers/identite_entreprise_bilan_detail',
locals: { libelle: 'Fonds de roulement net global', key: 'fonds_roulement_net_global', etablissement: etablissement }
= render partial: 'shared/dossiers/identite_entreprise_bilan_detail',
locals: { libelle: 'Besoin en fonds de roulement', key: 'besoin_en_fonds_de_roulement', etablissement: etablissement }
%tr
%th.libelle
Chiffres financiers clés (Banque de France)
= "en #{pretty_currency_unit(etablissement.entreprise_bilans_bdf_monnaie)} :"
- if controller.is_a?(Instructeurs::AvisController) - if controller.is_a?(Instructeurs::AvisController)
%td %td
Consulter les bilans Les consulter
= link_to "au format csv", bilans_bdf_instructeur_avis_path(@avis, format: 'csv') = link_to "au format csv", bilans_bdf_instructeur_avis_path(@avis, format: 'csv')
, ,
= link_to "au format xlsx", bilans_bdf_instructeur_avis_path(@avis, format: 'xlsx') = link_to "au format xlsx", bilans_bdf_instructeur_avis_path(@avis, format: 'xlsx')
@ -99,32 +97,32 @@
= link_to "au format ods", bilans_bdf_instructeur_avis_path(@avis, format: 'ods') = link_to "au format ods", bilans_bdf_instructeur_avis_path(@avis, format: 'ods')
- else - else
%td %td
Consulter les bilans Les consulter
= link_to "au format csv", bilans_bdf_instructeur_dossier_path(procedure_id: @dossier.procedure.id, dossier_id: @dossier.id, format: 'csv') = link_to "au format csv", bilans_bdf_instructeur_dossier_path(procedure_id: @dossier.procedure.id, dossier_id: @dossier.id, format: 'csv')
, ,
= link_to "au format xlsx", bilans_bdf_instructeur_dossier_path(procedure_id: @dossier.procedure.id, dossier_id: @dossier.id, format: 'xlsx') = link_to "au format xlsx", bilans_bdf_instructeur_dossier_path(procedure_id: @dossier.procedure.id, dossier_id: @dossier.id, format: 'xlsx')
ou ou
= link_to "au format ods", bilans_bdf_instructeur_dossier_path(procedure_id: @dossier.procedure.id, dossier_id: @dossier.id, format: 'ods') = link_to "au format ods", bilans_bdf_instructeur_dossier_path(procedure_id: @dossier.procedure.id, dossier_id: @dossier.id, format: 'ods')
%tr - else
%th.libelle %tr
Résultat exercice %th.libelle
= "(#{pretty_date_exercice(etablissement.entreprise_date_arret_exercice)})" Bilans Banque de France :
%td= etablissement.entreprise_resultat_exercice
%tr
%th
Excédent brut d'exploitation
%td= etablissement.entreprise_excedent_brut_exploitation
%tr
%th
Fonds de roulement net global
%td= etablissement.entreprise_fdr_net_global
%tr
%th
Besoin en fonds de roulement
%td= etablissement.entreprise_besoin_fdr
- else
%td Les 3 derniers bilans connus de votre entreprise par la Banque de France ont été joints à votre dossier. %td Les 3 derniers bilans connus de votre entreprise par la Banque de France ont été joints à votre dossier.
- if etablissement.entreprise_attestation_sociale.attached?
%tr
%th.libelle Attestation sociale :
- if profile == 'instructeur'
%td= link_to "Consulter l'attestation", url_for(etablissement.entreprise_attestation_sociale)
- else
%td Une attestation de vigilance délivrée par l'ACOSS a été jointe à votre dossier.
- if etablissement.entreprise_attestation_fiscale.attached?
%tr
%th.libelle Attestation fiscale :
- if profile == 'instructeur'
%td= link_to "Consulter l'attestation", url_for(etablissement.entreprise_attestation_fiscale)
- else
%td Une attestation fiscale délivrée par l'URSSAF a été jointe à votre dossier.
- if etablissement.association? - if etablissement.association?
%tr %tr
@ -147,6 +145,6 @@
%td= try_format_date(etablissement.association_date_declaration) %td= try_format_date(etablissement.association_date_declaration)
%p %p
= link_to '➡ Autres informations sur lorganisme sur « entreprise.data.gouv.fr »', = link_to "➡ Autres informations sur lorganisme sur « entreprise.data.gouv.fr » (ex: fiche d'immatriculation RNCS)",
"https://entreprise.data.gouv.fr/etablissement/#{etablissement.siret}", "https://entreprise.data.gouv.fr/etablissement/#{etablissement.siret}",
target: "_blank" target: "_blank"

View file

@ -0,0 +1,10 @@
%tr
%th.libelle
= "#{libelle} :"
%td
%details
- etablissement.entreprise_bilans_bdf.each do |bilan|
= "#{pretty_date_exercice(bilan["date_arret_exercice"])} : "
= pretty_currency(bilan[key], unit: pretty_currency_unit(etablissement.entreprise_bilans_bdf_monnaie))
%br

View file

@ -52,8 +52,13 @@ RSpec.describe EtablissementHelper, type: :helper do
it { is_expected.to eq('123 000,00 €') } it { is_expected.to eq('123 000,00 €') }
end end
describe '#pretty_currency with special unit' do
subject { pretty_currency(12345, unit: 'k€') }
it { is_expected.to eq('12 345,00 k€') }
end
describe '#pretty_date_exercice' do describe '#pretty_date_exercice' do
subject { pretty_date_exercice("201908") } subject { pretty_date_exercice("201908") }
it { is_expected.to eq("08/2019") } it { is_expected.to eq("2019") }
end end
end end

View file

@ -9683,9 +9683,9 @@ websocket-driver@>=0.5.1:
websocket-extensions ">=0.1.1" websocket-extensions ">=0.1.1"
websocket-extensions@>=0.1.1: websocket-extensions@>=0.1.1:
version "0.1.3" version "0.1.4"
resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42"
integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg== integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==
wgs84@0.0.0: wgs84@0.0.0:
version "0.0.0" version "0.0.0"