feat(EsyWebController): Permet de définir un nom de domaine principal.

 feat(ndd.twig): Affiche un lien pour définir le NDD comme principal.
This commit is contained in:
Serreau Jovann
2025-11-12 16:27:42 +01:00
parent c3a1c8143b
commit 7c8e327672
2 changed files with 20 additions and 1 deletions

View File

@@ -145,6 +145,20 @@ class EsyWebController extends AbstractController
return $this->redirectToRoute('artemis_esyweb_view', ['id' => $website->getId(), 'current' => 'ndd']);
}
if ($request->query->has('idMain')) {
$oldMain = $entityManager->getRepository(WebsiteDns::class)->findOneBy(['website'=>$website,'isMain'=>true]);
if($oldMain instanceof WebsiteDns){
$oldMain->setIsMain(false);
$entityManager->persist($oldMain);
}
$ndd = $entityManager->getRepository(WebsiteDns::class)->find($request->query->get('idMain'));
$ndd->setIsMain(true);
$entityManager->persist($ndd);
$website->setMainDns($ndd->getDns());
$entityManager->persist($website);
$entityManager->flush();
return $this->redirectToRoute('artemis_esyweb_view', ['id' => $website->getId(), 'current' => 'ndd']);
}
if ($request->query->has('idNddDelete')) {
$ndd = $entityManager->getRepository(WebsiteDns::class)->find($request->query->get('idNddDelete'));

View File

@@ -38,7 +38,12 @@
{# Actions et Liens #}
<div class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-4 text-sm">
{% if dns.isMain == false %}
<a href="{{ path('artemis_esyweb_view', {id: website.id,'current':'ndd',idMain:dns.id}) }}" class="px-3 py-1 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition duration-300 font-semibold inline-flex items-center">
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path></svg>
Nom de domaine principale
</a>
{% endif %}
{% if dns.customerDns is not null %}
{# Lien vers la fiche client du NDD #}
<a target="_blank" href="{{ path('artemis_intranet_customer_view',{id:dns.customerDns.customer.id,current:'dns'}) }}" class="text-cyan-400 hover:text-cyan-300 inline-flex items-center">