feat: show entreprise etat "en activité" | "fermé in entreprise summary
Closes #7505
This commit is contained in:
parent
f05e9331a7
commit
22fed3d9de
3 changed files with 36 additions and 1 deletions
|
@ -39,4 +39,13 @@ module EtablissementHelper
|
|||
def pretty_date_exercice(date)
|
||||
date.sub(/(?<year>\d{4})(?<month>\d{2})/, '\k<year>') if date.present?
|
||||
end
|
||||
|
||||
def humanized_entreprise_etat_administratif(etablissement)
|
||||
case etablissement.entreprise_etat_administratif&.to_sym
|
||||
when :actif
|
||||
"en activité"
|
||||
when :fermé
|
||||
"fermé"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,12 @@
|
|||
%td= etablissement.naf
|
||||
%tr
|
||||
%td.libelle Date de création :
|
||||
%td= try_format_date(etablissement.entreprise.date_creation)
|
||||
%td
|
||||
= try_format_date(etablissement.entreprise.date_creation)
|
||||
|
||||
- if etablissement.entreprise_etat_administratif.present?
|
||||
%span.label= humanized_entreprise_etat_administratif(etablissement)
|
||||
|
||||
- if profile == 'instructeur'
|
||||
%tr
|
||||
%td.libelle
|
||||
|
|
|
@ -4,12 +4,14 @@ RSpec.describe EtablissementHelper, type: :helper do
|
|||
let(:enseigne) { "mon enseigne" }
|
||||
let(:nom) { 'mon nom' }
|
||||
let(:prenom) { 'mon prenom' }
|
||||
let(:etat_administratif) { 'actif' }
|
||||
let(:etablissement_params) do
|
||||
{
|
||||
enseigne: enseigne,
|
||||
entreprise_capital_social: 123_000,
|
||||
entreprise_code_effectif_entreprise: code_effectif,
|
||||
entreprise_raison_sociale: raison_sociale,
|
||||
entreprise_etat_administratif: etat_administratif,
|
||||
entreprise_nom: nom,
|
||||
entreprise_prenom: prenom
|
||||
}
|
||||
|
@ -72,4 +74,23 @@ RSpec.describe EtablissementHelper, type: :helper do
|
|||
subject { pretty_date_exercice("201908") }
|
||||
it { is_expected.to eq("2019") }
|
||||
end
|
||||
|
||||
describe "#humanized_entreprise_etat_administratif" do
|
||||
subject { humanized_entreprise_etat_administratif(etablissement) }
|
||||
|
||||
context "when etat_administratif is A" do
|
||||
let(:etat_administratif) { "actif" }
|
||||
it { is_expected.to eq("en activité") }
|
||||
end
|
||||
|
||||
context "when etat_administratif is F" do
|
||||
let(:etat_administratif) { "fermé" }
|
||||
it { is_expected.to eq("fermé") }
|
||||
end
|
||||
|
||||
context "when etat_administratif is nil" do
|
||||
let(:etat_administratif) { nil }
|
||||
it { is_expected.to be_nil }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue