diff --git a/assets/modules/entreprise-search.js b/assets/modules/entreprise-search.js
index d5bb4a0..0fe1360 100644
--- a/assets/modules/entreprise-search.js
+++ b/assets/modules/entreprise-search.js
@@ -27,12 +27,27 @@ const buildRcs = (siren, city) => {
return 'RCS ' + capitalize(city) + ' ' + siren
}
+const resolveTypeCompany = (natureJuridique) => {
+ if (!natureJuridique) return ''
+ const code = String(natureJuridique)
+ if (code.startsWith('92') || code.startsWith('91') || code.startsWith('93')) return 'association'
+ if (code.startsWith('10')) return 'auto-entrepreneur'
+ if (code.startsWith('54') || code.startsWith('55')) return 'sarl'
+ if (code.startsWith('57')) return 'sas'
+ if (code.startsWith('52')) return 'eurl'
+ if (code.startsWith('55') && code === '5599') return 'sa'
+ if (code.startsWith('65')) return 'sci'
+ return ''
+}
+
const renderResult = (e, onSelect) => {
const s = e.siege || {}
const d = (e.dirigeants && e.dirigeants[0]) || {}
const actif = e.etat_administratif === 'A'
const addr = [s.numero_voie, s.type_voie, s.libelle_voie].filter(Boolean).join(' ')
const ape = e.activite_principale || ''
+ const rna = (e.complements && e.complements.identifiant_association) || ''
+ const isAsso = resolveTypeCompany(e.nature_juridique) === 'association'
const div = document.createElement('div')
div.className = 'glass p-4 cursor-pointer hover:bg-white/80 transition-all'
@@ -44,9 +59,11 @@ const renderResult = (e, onSelect) => {
SIREN ${e.siren || '?'}
${s.siret ? ' — SIRET ' + s.siret + '' : ''}
${ape ? ' — APE ' + ape + '' : ''}
+ ${rna ? ' — RNA ' + rna + '' : ''}
${s.geo_adresse || s.adresse || ''}
${d.nom ? 'Dirigeant : ' + (d.prenoms || '') + ' ' + d.nom + '
' : ''}
+ ${isAsso ? 'Association
' : ''}
${actif ? 'Actif' : 'Ferme'}
@@ -63,6 +80,12 @@ const renderResult = (e, onSelect) => {
fillField('zipCode', s.code_postal || '')
fillField('city', s.libelle_commune || '')
+ const typeCompany = resolveTypeCompany(e.nature_juridique)
+ if (typeCompany) fillField('typeCompany', typeCompany)
+
+ const rna = (e.complements && e.complements.identifiant_association) || ''
+ if (rna) fillField('rna', rna)
+
const prenom = (d.prenoms || '').split(' ')[0]
fillFieldIfEmpty('firstName', capitalize(prenom))
fillFieldIfEmpty('lastName', capitalize(d.nom))
diff --git a/migrations/Version20260404090416.php b/migrations/Version20260404090416.php
new file mode 100644
index 0000000..dacda3a
--- /dev/null
+++ b/migrations/Version20260404090416.php
@@ -0,0 +1,31 @@
+addSql('ALTER TABLE customer ADD rna VARCHAR(20) DEFAULT NULL');
+ }
+
+ public function down(Schema $schema): void
+ {
+ // this down() migration is auto-generated, please modify it to your needs
+ $this->addSql('ALTER TABLE customer DROP rna');
+ }
+}
diff --git a/src/Controller/Admin/ClientsController.php b/src/Controller/Admin/ClientsController.php
index 499d21e..cd5817e 100644
--- a/src/Controller/Admin/ClientsController.php
+++ b/src/Controller/Admin/ClientsController.php
@@ -92,6 +92,7 @@ class ClientsController extends AbstractController
$customer->setRcs(trim($request->request->getString('rcs')) ?: null);
$customer->setNumTva(trim($request->request->getString('numTva')) ?: null);
$customer->setApe(trim($request->request->getString('ape')) ?: null);
+ $customer->setRna(trim($request->request->getString('rna')) ?: null);
$customer->setAddress(trim($request->request->getString('address')) ?: null);
$customer->setAddress2(trim($request->request->getString('address2')) ?: null);
$customer->setZipCode(trim($request->request->getString('zipCode')) ?: null);
diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php
index dfb90cb..1336da1 100644
--- a/src/Entity/Customer.php
+++ b/src/Entity/Customer.php
@@ -86,6 +86,9 @@ class Customer
#[ORM\Column(length: 10, nullable: true)]
private ?string $ape = null;
+ #[ORM\Column(length: 20, nullable: true)]
+ private ?string $rna = null;
+
#[ORM\Column(length: 255, nullable: true)]
private ?string $stripeCustomerId = null;
@@ -316,6 +319,18 @@ class Customer
return $this;
}
+ public function getRna(): ?string
+ {
+ return $this->rna;
+ }
+
+ public function setRna(?string $rna): static
+ {
+ $this->rna = $rna;
+
+ return $this;
+ }
+
public function getStripeCustomerId(): ?string
{
return $this->stripeCustomerId;
diff --git a/templates/admin/clients/create.html.twig b/templates/admin/clients/create.html.twig
index 7e028ca..7bed114 100644
--- a/templates/admin/clients/create.html.twig
+++ b/templates/admin/clients/create.html.twig
@@ -103,6 +103,11 @@
+
+
+
+