feat: onglet Sites Internet dans fiche client + compteur sites dans liste

Onglet Sites Internet (tab=sites) :
- Table : nom, UUID, type (Vitrine bleu / E-Commerce violet),
  statut (Cree / Installation / En ligne / Suspendu / Ferme), date
- Badges colorés par statut
- Message "Aucun site internet" si vide

buildCustomersInfo :
- sites compte maintenant les Website liés au customer (plus hardcodé à 0)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-04-04 21:10:42 +02:00
parent 98db87eb05
commit 45972058ef
2 changed files with 54 additions and 1 deletions

View File

@@ -106,6 +106,7 @@ class ClientsController extends AbstractController
{
$domainRepo = $em->getRepository(\App\Entity\Domain::class);
$emailRepo = $em->getRepository(\App\Entity\DomainEmail::class);
$websiteRepo = $em->getRepository(\App\Entity\Website::class);
$info = [];
foreach ($customers as $customer) {
@@ -116,7 +117,7 @@ class ClientsController extends AbstractController
}
$info[$customer->getId()] = [
'sites' => 0,
'sites' => $websiteRepo->count(['customer' => $customer]),
'domains' => \count($domains),
'emails' => $emailCount,
'esySign' => false,
@@ -374,12 +375,14 @@ class ClientsController extends AbstractController
$contacts = $em->getRepository(\App\Entity\CustomerContact::class)->findBy(['customer' => $customer], ['createdAt' => 'DESC']);
$domains = $em->getRepository(\App\Entity\Domain::class)->findBy(['customer' => $customer]);
$domainsInfo = $this->buildDomainsInfo($domains, $em, $esyMailService, 'ndd' === $tab);
$websites = $em->getRepository(\App\Entity\Website::class)->findBy(['customer' => $customer], ['createdAt' => 'DESC']);
return $this->render('admin/clients/show.html.twig', [
'customer' => $customer,
'contacts' => $contacts,
'domains' => $domains,
'domainsInfo' => $domainsInfo,
'websites' => $websites,
'tab' => $tab,
]);
}

View File

@@ -404,6 +404,56 @@
<div class="glass p-8 text-center text-gray-400 font-bold">Aucun nom de domaine.</div>
{% endif %}
{# Tab: Sites Internet #}
{% elseif tab == 'sites' %}
{% if websites|length > 0 %}
<div class="glass overflow-hidden">
<table class="w-full text-sm">
<thead>
<tr class="glass-dark text-white">
<th class="px-4 py-3 text-left font-bold uppercase text-xs tracking-widest">Nom</th>
<th class="px-4 py-3 text-left font-bold uppercase text-xs tracking-widest">UUID</th>
<th class="px-4 py-3 text-center font-bold uppercase text-xs tracking-widest">Type</th>
<th class="px-4 py-3 text-center font-bold uppercase text-xs tracking-widest">Statut</th>
<th class="px-4 py-3 text-left font-bold uppercase text-xs tracking-widest">Cree le</th>
</tr>
</thead>
<tbody>
{% for site in websites %}
<tr class="border-b border-white/20 hover:bg-white/50">
<td class="px-4 py-3 font-bold">{{ site.name }}</td>
<td class="px-4 py-3 text-xs font-mono text-gray-500">{{ site.uuid }}</td>
<td class="px-4 py-3 text-center">
{% if site.type == 'ecommerce' %}
<span class="px-2 py-0.5 bg-purple-500/20 text-purple-700 font-bold uppercase text-[10px] rounded">E-Commerce</span>
{% else %}
<span class="px-2 py-0.5 bg-blue-500/20 text-blue-700 font-bold uppercase text-[10px] rounded">Vitrine</span>
{% endif %}
</td>
<td class="px-4 py-3 text-center">
{% if site.state == 'open' %}
<span class="px-2 py-0.5 bg-green-500/20 text-green-700 font-bold uppercase text-[10px] rounded">En ligne</span>
{% elseif site.state == 'install_progress' %}
<span class="px-2 py-0.5 bg-yellow-100 text-yellow-800 font-bold uppercase text-[10px] rounded">Installation</span>
{% elseif site.state == 'suspended' %}
<span class="px-2 py-0.5 bg-orange-500/20 text-orange-700 font-bold uppercase text-[10px] rounded">Suspendu</span>
{% elseif site.state == 'closed' %}
<span class="px-2 py-0.5 bg-red-500/20 text-red-700 font-bold uppercase text-[10px] rounded">Ferme</span>
{% else %}
<span class="px-2 py-0.5 bg-gray-100 text-gray-600 font-bold uppercase text-[10px] rounded">Cree</span>
{% endif %}
</td>
<td class="px-4 py-3 text-xs text-gray-500">{{ site.createdAt|date('d/m/Y') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<p class="mt-3 text-xs text-gray-400">{{ websites|length }} site(s)</p>
{% else %}
<div class="glass p-8 text-center text-gray-400 font-bold">Aucun site internet.</div>
{% endif %}
{# Tabs placeholder #}
{% else %}
<div class="glass p-12 text-center">