diff --git a/migrations/Version20260116103812.php b/migrations/Version20260116103812.php
new file mode 100644
index 0000000..b78745f
--- /dev/null
+++ b/migrations/Version20260116103812.php
@@ -0,0 +1,32 @@
+addSql('CREATE TABLE customer (id SERIAL NOT NULL, civ VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, surname VARCHAR(255) NOT NULL, phone VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, siret VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
+ }
+
+ 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('DROP TABLE customer');
+ }
+}
diff --git a/src/Controller/Dashboard/BackupController.php b/src/Controller/Dashboard/BackupController.php
index d8e3e57..64f1b8b 100644
--- a/src/Controller/Dashboard/BackupController.php
+++ b/src/Controller/Dashboard/BackupController.php
@@ -22,6 +22,7 @@ class BackupController extends AbstractController
#[Route(path: '/crm/sauvegarde', name: 'app_crm_backup', methods: ['GET'])]
public function crmSauvegarde(BackupRepository $backupRepository): Response
{
+ $this->appLogger->record('VIEW', 'Consultation de la liste des sauvegardes système');
return $this->render('dashboard/backup.twig', [
'backups' => $backupRepository->findBy([], ['createdAt' => 'DESC']),
]);
diff --git a/src/Controller/Dashboard/CustomerController.php b/src/Controller/Dashboard/CustomerController.php
new file mode 100644
index 0000000..3728b85
--- /dev/null
+++ b/src/Controller/Dashboard/CustomerController.php
@@ -0,0 +1,73 @@
+appLogger->record('VIEW', 'Consultation de la liste des clients');
+
+ // Utilisation d'un QueryBuilder (recommandé pour KNP) ou findAll
+ $query = $customerRepository->createQueryBuilder('c')
+ ->orderBy('c.surname', 'ASC')
+ ->getQuery();
+
+ $pagination = $paginator->paginate(
+ $query,
+ $request->query->getInt('page', 1),
+ 20
+ );
+
+ return $this->render('dashboard/customer.twig', [
+ 'customers' => $pagination,
+ ]);
+ }
+
+ #[Route(path: '/crm/customer/add', name: 'app_crm_customer_add', methods: ['GET', 'POST'])]
+ public function add(Request $request): Response
+ {
+ $this->appLogger->record('VIEW', 'Consultation de la page de création client');
+
+ $c = new Customer();
+ //$form = $this->createForm(,$c);
+ // Ici, tu pourras ajouter ta logique de formulaire (CustomerType)
+
+ return $this->render('dashboard/customer/add.twig');
+ }
+
+ #[Route(path: '/crm/customer/show/{id}', name: 'app_crm_customer_show', methods: ['GET'])]
+ public function show(int $id, CustomerRepository $customerRepository): Response
+ {
+ $customer = $customerRepository->find($id);
+
+ if (!$customer) {
+ throw $this->createNotFoundException('Client introuvable');
+ }
+
+ $this->appLogger->record('VIEW', sprintf('Consultation de la fiche client : %s', $customer->getName()));
+
+ return $this->render('dashboard/customer/show.twig', [
+ 'customer' => $customer
+ ]);
+ }
+}
diff --git a/src/Entity/Customer.php b/src/Entity/Customer.php
new file mode 100644
index 0000000..3e7d02f
--- /dev/null
+++ b/src/Entity/Customer.php
@@ -0,0 +1,125 @@
+id;
+ }
+
+ public function getCiv(): ?string
+ {
+ return $this->civ;
+ }
+
+ public function setCiv(string $civ): static
+ {
+ $this->civ = $civ;
+
+ return $this;
+ }
+
+ public function getName(): ?string
+ {
+ return $this->name;
+ }
+
+ public function setName(string $name): static
+ {
+ $this->name = $name;
+
+ return $this;
+ }
+
+ public function getSurname(): ?string
+ {
+ return $this->surname;
+ }
+
+ public function setSurname(string $surname): static
+ {
+ $this->surname = $surname;
+
+ return $this;
+ }
+
+ public function getPhone(): ?string
+ {
+ return $this->phone;
+ }
+
+ public function setPhone(string $phone): static
+ {
+ $this->phone = $phone;
+
+ return $this;
+ }
+
+ public function getEmail(): ?string
+ {
+ return $this->email;
+ }
+
+ public function setEmail(string $email): static
+ {
+ $this->email = $email;
+
+ return $this;
+ }
+
+ public function getType(): ?string
+ {
+ return $this->type;
+ }
+
+ public function setType(string $type): static
+ {
+ $this->type = $type;
+
+ return $this;
+ }
+
+ public function getSiret(): ?string
+ {
+ return $this->siret;
+ }
+
+ public function setSiret(?string $siret): static
+ {
+ $this->siret = $siret;
+
+ return $this;
+ }
+}
diff --git a/src/Repository/CustomerRepository.php b/src/Repository/CustomerRepository.php
new file mode 100644
index 0000000..9e3b066
--- /dev/null
+++ b/src/Repository/CustomerRepository.php
@@ -0,0 +1,43 @@
+
+ */
+class CustomerRepository extends ServiceEntityRepository
+{
+ public function __construct(ManagerRegistry $registry)
+ {
+ parent::__construct($registry, Customer::class);
+ }
+
+ // /**
+ // * @return Customer[] Returns an array of Customer 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): ?Customer
+ // {
+ // return $this->createQueryBuilder('c')
+ // ->andWhere('c.exampleField = :val')
+ // ->setParameter('val', $value)
+ // ->getQuery()
+ // ->getOneOrNullResult()
+ // ;
+ // }
+}
diff --git a/templates/dashboard/base.twig b/templates/dashboard/base.twig
index 5a675f2..b1c3516 100644
--- a/templates/dashboard/base.twig
+++ b/templates/dashboard/base.twig
@@ -41,7 +41,7 @@
{% import _self as menu %}
{{ menu.nav_link(path('app_crm'), 'Dashboard', '
Base de données centralisée
+