Skip to content

Commit

Permalink
Merge pull request #6 from sgmap/feature/3_companypage
Browse files Browse the repository at this point in the history
[3_companypage] Display API results for a specific company
  • Loading branch information
ArnoHolo authored May 12, 2017
2 parents 1291516 + d808162 commit a33aadc
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 3 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ gem 'turbolinks', '~> 5'
gem 'semantic-ui-sass', '~> 2'

gem 'i18n-tasks', '~> 0.8.3'
gem 'wannabe_bool'

# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ GEM
uglifier (3.1.13)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.1.3)
wannabe_bool (0.6.0)
warden (1.2.7)
rack (>= 1.0)
web-console (3.5.0)
Expand Down Expand Up @@ -273,6 +274,7 @@ DEPENDENCIES
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
wannabe_bool
web-console (>= 3.3.0)

RUBY VERSION
Expand Down
121 changes: 119 additions & 2 deletions app/views/companies/search.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,120 @@
%h1= t('.companies')
%p= "SIREN : #{@company['entreprise']['siren']}"
%p= "Nom commercial : #{@company['entreprise']['nom_commercial']}"
%p= t('.result_for_siret_html', siret: @company['etablissement_siege']['siret'])

- company = @company['entreprise']
%table.ui.compact.celled.table
%tbody
%tr
%td= t('.raison_sociale')
%td= company['raison_sociale']
- if company['nom_commercial'] != company['raison_sociale']
%tr
%td= t('.nom_commercial')
%td= company['nom_commercial']
%tr
%td= t('.categorie_entreprise')
%td= company['categorie_entreprise']
%tr
%td= t('.tranche_effectif_salarie_entreprise')
%td= company['tranche_effectif_salarie_entreprise']['intitule']
%tr
%td= t('.siren')
%td= company['siren']
%tr
%td= t('.capital_social')
%td= "#{company['capital_social']}"
%tr
%td= t('.numero_tva_intracommunautaire')
%td= company['numero_tva_intracommunautaire']
%tr
%td= t('.forme_juridique')
%td= company['forme_juridique']
%tr
%td= t('.forme_juridique_code')
%td= company['forme_juridique_code']
%tr
%td= t('.procedure_collective')
%td= company['procedure_collective'].to_b ? t('yes') : t('no')
%tr
%td= t('.date_creation')
%td= I18n.l(DateTime.strptime(company['date_creation'].to_s, '%s').to_date)
- if company['nom'].present?
%tr
%td= t('.nom')
%td= company['nom']
- if company['prenom'].present?
%tr
%td= t('.prenom')
%td= company['prenom']
%tr
%td= t('.date_radiation')
%td= I18n.l(DateTime.strptime(company['date_radiation'].to_s, '%s').to_date) if company['date_radiation']

%h2= t('.siege_social')
- etablissement_siege = @company['etablissement_siege']
%table.ui.compact.celled.table
%tbody
%tr
%td= t('.naf')
%td= "#{etablissement_siege['naf']} - #{etablissement_siege['libelle_naf']}"
%tr
%td= t('.date_mise_a_jour')
%td= I18n.l(DateTime.strptime(etablissement_siege['date_mise_a_jour'].to_s, '%s').to_date)
%tr
%td= t('.tranche_effectif_salarie_etablissement')
%td= etablissement_siege['tranche_effectif_salarie_etablissement']['intitule']
%tr
%td= t('.date_creation_etablissement')
%td= I18n.l(DateTime.strptime(etablissement_siege['date_creation_etablissement'].to_s, '%s').to_date)
%tr
%td= t('.enseigne')
%td= etablissement_siege['enseigne']
%tr
%td= t('.region_implantation')
%td= etablissement_siege['region_implantation']['value']
%tr
%td= t('.commune_implantation')
%td= etablissement_siege['commune_implantation']['value']
%tr
%td= t('.pays_implantation')
%td= etablissement_siege['pays_implantation']['value'] || ''
%tr
%td= t('.diffusable_commercialement')
%td= etablissement_siege['diffusable_commercialement']
%tr
%td= t('.adresse')
%td
- adresse = etablissement_siege['adresse']
- (1..7).each do |i|
%p= adresse["l#{i}"] if adresse["l#{i}"].present?

%h2= t('.mandataires_sociaux')
- company['mandataires_sociaux'].each do |person|
%table.ui.compact.celled.table{class: (person['type'] == 'PM' ? 'violet' : 'teal')}
%tbody
- if person['type'] == 'PM'
%tr
%td{colspan: 2}= t('.personne_morale')
- if person['raison_sociale'].present?
%tr
%td= t('.raison_sociale')
%td= person['raison_sociale'].humanize
- if person['prenom'].present? && person['nom'].present?
%tr
%td= t('.nom')
%td= "#{person['prenom'].humanize} #{person['nom'].humanize}"
- if person['fonction'].present?
%tr
%td= t('.fonction')
%td= person['fonction'].humanize
- if person['date_naissance_timestamp']
%tr
%td= t('.date_naissance')
%td= I18n.l(DateTime.strptime(person['date_naissance_timestamp'].to_s, '%s').to_date)
%tr
%td= t('.dirigeant')
%td= person['dirigeant'].to_b ? t('yes') : t('no')
- if person['identifiant'].present?
%tr
%td= t('.identifiant')
%td= person['identifiant']
4 changes: 3 additions & 1 deletion config/locales/common.fr.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
fr:
app_name: E-Conseils
app_name: E-Conseils
"yes": oui
"no": non
32 changes: 32 additions & 0 deletions config/locales/views/companies.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,35 @@ fr:
search: Rechercher
search:
companies: Entreprises
result_for_siret_html: Résultat pour le SIRET <strong>%{siret}</strong>.
siren: SIREN
capital_social: Capital social
numero_tva_intracommunautaire: Numéro de TVA intracommunautaire
forme_juridique: Forme juridique
forme_juridique_code: Code de la forme juridique
nom_commercial: Nom Commercial
procedure_collective: En cours de procedure collective ?
raison_sociale: Raison Sociale
date_creation: Date de création
nom: Nom
prenom: Prénom
date_radiation: Date de radiation
categorie_entreprise: Categorie de l'entreprise
siege_social: Siège social
naf: Code NAF
date_mise_a_jour: Date de mise à jour
tranche_effectif_salarie_etablissement: Tranche d'effectif de salariés de l'établissement
date_creation_etablissement: Date de création de l'établissement
enseigne: Enseigne
region_implantation: Région d'implantation
commune_implantation: Commune d'implantation
pays_implantation: Pays d'implantation
diffusable_commercialement: Diffusable commercialement
adresse: Adresse
tranche_effectif_salarie_entreprise: Tranche d'effectif de salariés de l'entreprise
mandataires_sociaux: Mandataires sociaux
personne_morale: Personne morale
fonction: Fonction
date_naissance: Date de naissance
dirigeant: Est-ce un dirigeant ?
identifiant: Identifiant

0 comments on commit a33aadc

Please sign in to comment.