✨ feat(nnd.twig): Ajoute un lien vers la page des emails du NDD.
🐛 fix(BackupCommand): Corrige un problème de suppression de fichier SQL. ✨ feat(CustomerDns.php): Ajoute la relation avec les emails du NDD. ✨ feat(email.twig): Crée le template pour afficher les emails du NDD. ✨ feat(CustomerController.php): Récupère les emails du NDD.
This commit is contained in:
36
migrations/Version20250927110817.php
Normal file
36
migrations/Version20250927110817.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250927110817 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE customer_dns_email (id SERIAL NOT NULL, dns_id INT DEFAULT NULL, email VARCHAR(255) NOT NULL, password TEXT DEFAULT NULL, create_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, storage VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_88F27568E42F3693 ON customer_dns_email (dns_id)');
|
||||
$this->addSql('COMMENT ON COLUMN customer_dns_email.create_at IS \'(DC2Type:datetime_immutable)\'');
|
||||
$this->addSql('ALTER TABLE customer_dns_email ADD CONSTRAINT FK_88F27568E42F3693 FOREIGN KEY (dns_id) REFERENCES customer_dns (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE customer_dns_email DROP CONSTRAINT FK_88F27568E42F3693');
|
||||
$this->addSql('DROP TABLE customer_dns_email');
|
||||
}
|
||||
}
|
||||
@@ -96,8 +96,6 @@ class BackupCommand extends Command
|
||||
}
|
||||
$zip->close();
|
||||
unlink($sqlFilename);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -322,10 +322,17 @@ class CustomerController extends AbstractController
|
||||
$orderAdvert = $entityManager->getRepository(CustomerAdvertPayment::class)->findBy(['customer'=>$customer],['id'=>'ASC']);
|
||||
$orderOrder = $entityManager->getRepository(CustomerOrder::class)->findBy(['customer'=>$customer],['id'=>'ASC']);
|
||||
|
||||
$nddEmails = [];
|
||||
if($request->query->has('idNdd')) {
|
||||
$domain = $entityManager->getRepository(CustomerDns::class)->find($request->get('idNdd'));
|
||||
$nddEmails = $domain->getCustomerDnsEmails();
|
||||
}
|
||||
|
||||
return $this->render('artemis/intranet/customer/edit.twig',[
|
||||
'form' => $form->createView(),
|
||||
'formNdd' => $formNdd->createView(),
|
||||
'customer' => $customer,
|
||||
'nddEmails' => $nddEmails,
|
||||
'orderDevis' => $paginator->paginate($orderDevis,$request->get('page',1),20),
|
||||
'orderOrders' => $paginator->paginate($orderOrder,$request->get('page',1),20),
|
||||
'orderAdverts' => $paginator->paginate($orderAdvert,$request->get('page',1),20),
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\CustomerDnsRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: CustomerDnsRepository::class)]
|
||||
@@ -34,6 +36,17 @@ class CustomerDns
|
||||
#[ORM\Column]
|
||||
private ?bool $isBill = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, CustomerDnsEmail>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: CustomerDnsEmail::class, mappedBy: 'dns')]
|
||||
private Collection $customerDnsEmails;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->customerDnsEmails = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
@@ -122,4 +135,34 @@ class CustomerDns
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, CustomerDnsEmail>
|
||||
*/
|
||||
public function getCustomerDnsEmails(): Collection
|
||||
{
|
||||
return $this->customerDnsEmails;
|
||||
}
|
||||
|
||||
public function addCustomerDnsEmail(CustomerDnsEmail $customerDnsEmail): static
|
||||
{
|
||||
if (!$this->customerDnsEmails->contains($customerDnsEmail)) {
|
||||
$this->customerDnsEmails->add($customerDnsEmail);
|
||||
$customerDnsEmail->setDns($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCustomerDnsEmail(CustomerDnsEmail $customerDnsEmail): static
|
||||
{
|
||||
if ($this->customerDnsEmails->removeElement($customerDnsEmail)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($customerDnsEmail->getDns() === $this) {
|
||||
$customerDnsEmail->setDns(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
95
src/Entity/CustomerDnsEmail.php
Normal file
95
src/Entity/CustomerDnsEmail.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\CustomerDnsEmailRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: CustomerDnsEmailRepository::class)]
|
||||
class CustomerDnsEmail
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'customerDnsEmails')]
|
||||
private ?CustomerDns $dns = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\Column(type: 'text', nullable: true)]
|
||||
private ?string $password = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?\DateTimeImmutable $createAt = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $storage = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDns(): ?CustomerDns
|
||||
{
|
||||
return $this->dns;
|
||||
}
|
||||
|
||||
public function setDns(?CustomerDns $dns): static
|
||||
{
|
||||
$this->dns = $dns;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail(string $email): static
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function setPassword(?string $password): static
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreateAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->createAt;
|
||||
}
|
||||
|
||||
public function setCreateAt(\DateTimeImmutable $createAt): static
|
||||
{
|
||||
$this->createAt = $createAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStorage(): ?string
|
||||
{
|
||||
return $this->storage;
|
||||
}
|
||||
|
||||
public function setStorage(string $storage): static
|
||||
{
|
||||
$this->storage = $storage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
43
src/Repository/CustomerDnsEmailRepository.php
Normal file
43
src/Repository/CustomerDnsEmailRepository.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\CustomerDnsEmail;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<CustomerDnsEmail>
|
||||
*/
|
||||
class CustomerDnsEmailRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, CustomerDnsEmail::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return CustomerDnsEmail[] Returns an array of CustomerDnsEmail objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('c.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?CustomerDnsEmail
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
21
templates/artemis/intranet/customer/email.twig
Normal file
21
templates/artemis/intranet/customer/email.twig
Normal file
@@ -0,0 +1,21 @@
|
||||
<div class="overflow-x-auto rounded-lg shadow-lg bg-white dark:bg-gray-800">
|
||||
<table class="min-w-full divide-y divide-gray-300 dark:divide-gray-700">
|
||||
<thead class="bg-gray-50 dark:bg-gray-700">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-semibold uppercase tracking-wider">
|
||||
Domaine
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
|
||||
{% for email in nddEmails %}
|
||||
<tr class="hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<td class="px-6 py-4 whitespace-nowrap font-medium text-blue-600 dark:text-blue-400">{{ email.email }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="mt-5 bg-gray-800 rounded-lg shadow-lg p-6 space-y-4">
|
||||
|
||||
</div>
|
||||
@@ -34,6 +34,7 @@
|
||||
{% if ndd.registar == "ovh" %}
|
||||
<a href="{{ path('artemis_intranet_customer_view',{id:customer.id,current:'nnd',idNddSync:ndd.id}) }}" class="bg-purple-600 hover:bg-purple-700 text-white px-3 py-1 rounded">Sync</a>
|
||||
{% endif %}
|
||||
<a href="{{ path('artemis_intranet_customer_view',{id:customer.id,current:'email',idNdd:ndd.id}) }}" class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded">Email</a>
|
||||
<a href="{{ path('artemis_intranet_customer_view',{id:customer.id,current:'nnd',idNdd:ndd.id}) }}" class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded">Modifier</a>
|
||||
<a href="{{ path('artemis_intranet_customer_view',{id:customer.id,current:'nnd',idNddDelete:ndd.id}) }}" class="bg-red-600 hover:bg-red-700 text-white px-3 py-1 rounded">Supprimer</a>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user