```
✨ feat(Product): Remplace les annotations Vich par des attributs. ♻️ refactor(Customer): Ajoute la relation OneToMany avec l'entité Devis. ✨ feat(DevisController): Affiche la liste des devis paginée. ✨ feat(devis/list.twig): Crée la vue de liste des devis avec pagination. ⚙️ chore(vich_uploader): Configure les mappings pour les fichiers de devis. ```
This commit is contained in:
@@ -5,3 +5,19 @@ vich_uploader:
|
||||
uri_prefix: /images/image_product
|
||||
upload_destination: '%kernel.project_dir%/public/images/image_product'
|
||||
namer: Vich\UploaderBundle\Naming\SmartUniqueNamer
|
||||
devis_file:
|
||||
uri_prefix: /images/devis_file
|
||||
upload_destination: '%kernel.project_dir%/public/images/devis_file'
|
||||
namer: Vich\UploaderBundle\Naming\SmartUniqueNamer
|
||||
devis_docuseal:
|
||||
uri_prefix: /images/devis_docusign
|
||||
upload_destination: '%kernel.project_dir%/public/images/devis_docusign'
|
||||
namer: Vich\UploaderBundle\Naming\SmartUniqueNamer
|
||||
devis_signed:
|
||||
uri_prefix: /images/devis_signed
|
||||
upload_destination: '%kernel.project_dir%/public/images/devis_signed'
|
||||
namer: Vich\UploaderBundle\Naming\SmartUniqueNamer
|
||||
devis_audit:
|
||||
uri_prefix: /images/devis_audit
|
||||
upload_destination: '%kernel.project_dir%/public/images/devis_audit'
|
||||
namer: Vich\UploaderBundle\Naming\SmartUniqueNamer
|
||||
|
||||
37
migrations/Version20260116140149.php
Normal file
37
migrations/Version20260116140149.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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 Version20260116140149 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 devis (id SERIAL NOT NULL, customer_id INT DEFAULT NULL, num VARCHAR(255) NOT NULL, create_a TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, update_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, state VARCHAR(255) NOT NULL, devis_file_name VARCHAR(255) DEFAULT NULL, devis_file_size INT DEFAULT NULL, devis_docu_seal_file_name VARCHAR(255) DEFAULT NULL, devis_docu_seal_file_size INT DEFAULT NULL, devis_signed_file_name VARCHAR(255) DEFAULT NULL, devis_signed_file_size INT DEFAULT NULL, devis_audit_file_name VARCHAR(255) DEFAULT NULL, devis_audit_file_size INT DEFAULT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_8B27C52B9395C3F3 ON devis (customer_id)');
|
||||
$this->addSql('COMMENT ON COLUMN devis.create_a IS \'(DC2Type:datetime_immutable)\'');
|
||||
$this->addSql('COMMENT ON COLUMN devis.update_at IS \'(DC2Type:datetime_immutable)\'');
|
||||
$this->addSql('ALTER TABLE devis ADD CONSTRAINT FK_8B27C52B9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (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 devis DROP CONSTRAINT FK_8B27C52B9395C3F3');
|
||||
$this->addSql('DROP TABLE devis');
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,11 @@ namespace App\Controller\Dashboard;
|
||||
|
||||
use App\Logger\AppLogger;
|
||||
use App\Repository\AccountRepository;
|
||||
use App\Repository\DevisRepository;
|
||||
use Knp\Bundle\PaginatorBundle\KnpPaginatorBundle;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
@@ -14,13 +18,17 @@ class DevisController extends AbstractController
|
||||
* Liste des administrateurs
|
||||
*/
|
||||
#[Route(path: '/crm/devis', name: 'app_crm_devis', options: ['sitemap' => false], methods: ['GET'])]
|
||||
public function devis(AccountRepository $accountRepository, AppLogger $appLogger): Response
|
||||
public function devis(DevisRepository $devisRepository,AppLogger $appLogger,PaginatorInterface $paginator,Request $request): Response
|
||||
{
|
||||
$appLogger->record('VIEW', 'Consultation de la liste des devis');
|
||||
return $this->render('dashboard/devis/list.twig',[
|
||||
'devis' => [],
|
||||
'quotes' => $paginator->paginate($devisRepository->findBy([],['createA'=>'asc']),$request->get('page', 1),20),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route(path: '/crm/devis/add', name: 'app_crm_devis_add', options: ['sitemap' => false], methods: ['GET'])]
|
||||
public function devisAdd(AccountRepository $accountRepository, AppLogger $appLogger): Response
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,9 +45,16 @@ class Customer
|
||||
#[ORM\OneToMany(targetEntity: CustomerAddress::class, mappedBy: 'customer')]
|
||||
private Collection $customerAddresses;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Devis>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Devis::class, mappedBy: 'customer')]
|
||||
private Collection $devis;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->customerAddresses = new ArrayCollection();
|
||||
$this->devis = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -180,4 +187,34 @@ class Customer
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Devis>
|
||||
*/
|
||||
public function getDevis(): Collection
|
||||
{
|
||||
return $this->devis;
|
||||
}
|
||||
|
||||
public function addDevi(Devis $devi): static
|
||||
{
|
||||
if (!$this->devis->contains($devi)) {
|
||||
$this->devis->add($devi);
|
||||
$devi->setCustomer($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeDevi(Devis $devi): static
|
||||
{
|
||||
if ($this->devis->removeElement($devi)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($devi->getCustomer() === $this) {
|
||||
$devi->setCustomer(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
340
src/Entity/Devis.php
Normal file
340
src/Entity/Devis.php
Normal file
@@ -0,0 +1,340 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\DevisRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
use Vich\UploaderBundle\Mapping\Attribute\Uploadable;
|
||||
use Vich\UploaderBundle\Mapping\Attribute\UploadableField;
|
||||
|
||||
#[ORM\Entity(repositoryClass: DevisRepository::class)]
|
||||
#[Uploadable]
|
||||
class Devis
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'devis')]
|
||||
private ?Customer $customer = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $num = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?\DateTimeImmutable $createA = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?\DateTimeImmutable $updateAt = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $state = null;
|
||||
|
||||
#[UploadableField(mapping: 'devis_file', fileNameProperty: 'devisFileName', size: 'devisFileSize')]
|
||||
private ?File $devisFile = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?string $devisFileName = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $devisFileSize = null;
|
||||
|
||||
#[UploadableField(mapping: 'devis_docuseal', fileNameProperty: 'devisDocuSealFileName', size: 'devisDocuSealFileSize')]
|
||||
private ?File $devisDocuSealFile = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?string $devisDocuSealFileName = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $devisDocuSealFileSize = null;
|
||||
|
||||
#[UploadableField(mapping: 'devis_signed', fileNameProperty: 'devisSignedFileName', size: 'devisSignedFileSize')]
|
||||
private ?File $devisSignFile = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?string $devisSignedFileName = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $devisSignedFileSize = null;
|
||||
|
||||
#[UploadableField(mapping: 'devis_audit', fileNameProperty: 'devisAuditFileName', size: 'devisAuditFileSize')]
|
||||
private ?File $devisAuditFile = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?string $devisAuditFileName = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $devisAuditFileSize = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getCustomer(): ?Customer
|
||||
{
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
public function setCustomer(?Customer $customer): static
|
||||
{
|
||||
$this->customer = $customer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNum(): ?string
|
||||
{
|
||||
return $this->num;
|
||||
}
|
||||
|
||||
public function setNum(string $num): static
|
||||
{
|
||||
$this->num = $num;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreateA(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->createA;
|
||||
}
|
||||
|
||||
public function setCreateA(\DateTimeImmutable $createA): static
|
||||
{
|
||||
$this->createA = $createA;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUpdateAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->updateAt;
|
||||
}
|
||||
|
||||
public function setUpdateAt(\DateTimeImmutable $updateAt): static
|
||||
{
|
||||
$this->updateAt = $updateAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getState(): ?string
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
public function setState(string $state): static
|
||||
{
|
||||
$this->state = $state;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param File|null $devisFile
|
||||
*/
|
||||
public function setDevisFile(?File $devisFile): void
|
||||
{
|
||||
$this->devisFile = $devisFile;
|
||||
if (null !== $devisFile) {
|
||||
// It is required that at least one field changes if you are using doctrine
|
||||
// otherwise the event listeners won't be called and the file is lost
|
||||
$this->updateAt = new \DateTimeImmutable();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param File|null $devisDocuSealFile
|
||||
*/
|
||||
public function setDevisDocuSealFile(?File $devisDocuSealFile): void
|
||||
{
|
||||
$this->devisDocuSealFile = $devisDocuSealFile;
|
||||
if (null !== $devisDocuSealFile) {
|
||||
// It is required that at least one field changes if you are using doctrine
|
||||
// otherwise the event listeners won't be called and the file is lost
|
||||
$this->updateAt = new \DateTimeImmutable();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param File|null $devisSignFile
|
||||
*/
|
||||
public function setDevisSignFile(?File $devisSignFile): void
|
||||
{
|
||||
$this->devisSignFile = $devisSignFile;
|
||||
if (null !== $devisSignFile) {
|
||||
// It is required that at least one field changes if you are using doctrine
|
||||
// otherwise the event listeners won't be called and the file is lost
|
||||
$this->updateAt = new \DateTimeImmutable();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param File|null $devisAuditFile
|
||||
*/
|
||||
public function setDevisAuditFile(?File $devisAuditFile): void
|
||||
{
|
||||
$this->devisAuditFile = $devisAuditFile;
|
||||
if (null !== $devisAuditFile) {
|
||||
// It is required that at least one field changes if you are using doctrine
|
||||
// otherwise the event listeners won't be called and the file is lost
|
||||
$this->updateAt = new \DateTimeImmutable();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $devisSignedFileSize
|
||||
*/
|
||||
public function setDevisSignedFileSize(?int $devisSignedFileSize): void
|
||||
{
|
||||
$this->devisSignedFileSize = $devisSignedFileSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $devisSignedFileName
|
||||
*/
|
||||
public function setDevisSignedFileName(?string $devisSignedFileName): void
|
||||
{
|
||||
$this->devisSignedFileName = $devisSignedFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $devisFileSize
|
||||
*/
|
||||
public function setDevisFileSize(?int $devisFileSize): void
|
||||
{
|
||||
$this->devisFileSize = $devisFileSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $devisDocuSealFileSize
|
||||
*/
|
||||
public function setDevisDocuSealFileSize(?int $devisDocuSealFileSize): void
|
||||
{
|
||||
$this->devisDocuSealFileSize = $devisDocuSealFileSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $devisDocuSealFileName
|
||||
*/
|
||||
public function setDevisDocuSealFileName(?string $devisDocuSealFileName): void
|
||||
{
|
||||
$this->devisDocuSealFileName = $devisDocuSealFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $devisFileName
|
||||
*/
|
||||
public function setDevisFileName(?string $devisFileName): void
|
||||
{
|
||||
$this->devisFileName = $devisFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $devisAuditFileSize
|
||||
*/
|
||||
public function setDevisAuditFileSize(?int $devisAuditFileSize): void
|
||||
{
|
||||
$this->devisAuditFileSize = $devisAuditFileSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $devisAuditFileName
|
||||
*/
|
||||
public function setDevisAuditFileName(?string $devisAuditFileName): void
|
||||
{
|
||||
$this->devisAuditFileName = $devisAuditFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return File|null
|
||||
*/
|
||||
public function getDevisAuditFile(): ?File
|
||||
{
|
||||
return $this->devisAuditFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDevisAuditFileName(): ?string
|
||||
{
|
||||
return $this->devisAuditFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getDevisAuditFileSize(): ?int
|
||||
{
|
||||
return $this->devisAuditFileSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return File|null
|
||||
*/
|
||||
public function getDevisDocuSealFile(): ?File
|
||||
{
|
||||
return $this->devisDocuSealFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDevisDocuSealFileName(): ?string
|
||||
{
|
||||
return $this->devisDocuSealFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getDevisDocuSealFileSize(): ?int
|
||||
{
|
||||
return $this->devisDocuSealFileSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return File|null
|
||||
*/
|
||||
public function getDevisFile(): ?File
|
||||
{
|
||||
return $this->devisFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDevisFileName(): ?string
|
||||
{
|
||||
return $this->devisFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getDevisFileSize(): ?int
|
||||
{
|
||||
return $this->devisFileSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDevisSignedFileName(): ?string
|
||||
{
|
||||
return $this->devisSignedFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getDevisSignedFileSize(): ?int
|
||||
{
|
||||
return $this->devisSignedFileSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return File|null
|
||||
*/
|
||||
public function getDevisSignFile(): ?File
|
||||
{
|
||||
return $this->devisSignFile;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,10 +5,11 @@ namespace App\Entity;
|
||||
use App\Repository\ProductRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
use Vich\UploaderBundle\Mapping\Annotation as Vich;
|
||||
use Vich\UploaderBundle\Mapping\Attribute\Uploadable;
|
||||
use Vich\UploaderBundle\Mapping\Attribute\UploadableField;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ProductRepository::class)]
|
||||
#[Vich\Uploadable()]
|
||||
#[Uploadable]
|
||||
class Product
|
||||
{
|
||||
#[ORM\Id]
|
||||
@@ -38,7 +39,7 @@ class Product
|
||||
private ?float $caution = null;
|
||||
|
||||
|
||||
#[Vich\UploadableField(mapping: 'image_product', fileNameProperty: 'imageName', size: 'imageSize')]
|
||||
#[UploadableField(mapping: 'image_product', fileNameProperty: 'imageName', size: 'imageSize')]
|
||||
private ?File $imageFile = null;
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?string $imageName = null;
|
||||
|
||||
43
src/Repository/DevisRepository.php
Normal file
43
src/Repository/DevisRepository.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Devis;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Devis>
|
||||
*/
|
||||
class DevisRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Devis::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Devis[] Returns an array of Devis objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('d')
|
||||
// ->andWhere('d.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('d.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Devis
|
||||
// {
|
||||
// return $this->createQueryBuilder('d')
|
||||
// ->andWhere('d.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
@@ -1 +1,157 @@
|
||||
{% extends 'dashboard/base.twig' %}
|
||||
|
||||
{% block title %}Catalogue Devis{% endblock %}
|
||||
{% block title_header %}Gestion des <span class="text-blue-500">Devis & Offres</span>{% endblock %}
|
||||
|
||||
{% block actions %}
|
||||
<div class="flex items-center space-x-3">
|
||||
<a href="{{ path('app_crm_devis_add') }}" class="flex items-center space-x-2 px-6 py-3 bg-blue-600 hover:bg-blue-500 text-white text-[10px] font-black uppercase tracking-[0.2em] rounded-xl transition-all shadow-lg shadow-blue-600/20 group">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M12 4v16m8-8H4" />
|
||||
</svg>
|
||||
<span>Nouveau Devis</span>
|
||||
</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="backdrop-blur-xl bg-[#1e293b]/40 border border-white/5 rounded-[2.5rem] overflow-hidden shadow-2xl animate-in fade-in duration-700">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-left border-collapse">
|
||||
<thead>
|
||||
<tr class="border-b border-white/5 bg-black/20">
|
||||
<th class="px-6 py-5 text-[10px] font-black text-slate-500 uppercase tracking-[0.2em]">Référence</th>
|
||||
<th class="px-6 py-5 text-[10px] font-black text-slate-500 uppercase tracking-[0.2em]">Client</th>
|
||||
<th class="px-6 py-5 text-[10px] font-black text-slate-500 uppercase tracking-[0.2em]">Date</th>
|
||||
<th class="px-6 py-5 text-[10px] font-black text-slate-500 uppercase tracking-[0.2em]">Statut</th>
|
||||
<th class="px-6 py-5 text-[10px] font-black text-slate-500 uppercase tracking-[0.2em] text-center">Total TTC</th>
|
||||
<th class="px-6 py-5 text-[10px] font-black text-slate-500 uppercase tracking-[0.2em] text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-white/5">
|
||||
{% for quote in quotes %}
|
||||
<tr class="group hover:bg-white/[0.02] transition-colors">
|
||||
{# RÉFÉRENCE #}
|
||||
<td class="px-6 py-4">
|
||||
<div class="flex flex-col">
|
||||
<span class="text-[11px] font-mono font-bold text-blue-500 tracking-wider">
|
||||
{{ quote.ref|default('DEV-' ~ quote.id|upper) }}
|
||||
</span>
|
||||
<span class="text-[8px] text-slate-600 font-bold uppercase tracking-widest mt-0.5">ID: #{{ quote.id }}</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
{# CLIENT #}
|
||||
<td class="px-6 py-4">
|
||||
<div class="flex flex-col">
|
||||
<span class="text-sm font-bold text-white group-hover:text-blue-400 transition-colors capitalize">
|
||||
{{ quote.customer.surname|upper }} {{ quote.customer.name }}
|
||||
</span>
|
||||
<span class="text-[9px] text-slate-500 font-bold uppercase tracking-tighter italic">
|
||||
{{ quote.customer.phone|default(quote.customer.email) }}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
{# DATE #}
|
||||
<td class="px-6 py-4">
|
||||
<span class="text-xs text-slate-400 font-medium">
|
||||
{{ quote.createdAt|date('d/m/Y') }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
{# STATUT DYNAMIQUE #}
|
||||
<td class="px-6 py-4">
|
||||
{% set statusClasses = {
|
||||
'brouillon': 'text-slate-400 bg-slate-500/10 border-slate-500/20',
|
||||
'crée': 'text-indigo-400 bg-indigo-500/10 border-indigo-500/20',
|
||||
'envoyée': 'text-blue-400 bg-blue-500/10 border-blue-500/20',
|
||||
'en attends de signature': 'text-amber-400 bg-amber-500/10 border-amber-500/20',
|
||||
'refusée': 'text-rose-400 bg-rose-500/10 border-rose-500/20',
|
||||
'signée': 'text-emerald-400 bg-emerald-500/10 border-emerald-500/20'
|
||||
} %}
|
||||
|
||||
{% set statusLabels = {
|
||||
'brouillon': 'Brouillon',
|
||||
'crée': 'Créé',
|
||||
'envoyée': 'Envoyé',
|
||||
'en attends de signature': 'Attente Signature',
|
||||
'refusée': 'Refusé',
|
||||
'signée': 'Signé'
|
||||
} %}
|
||||
|
||||
{% set currentStatus = quote.status|lower %}
|
||||
|
||||
<span class="px-3 py-1.5 rounded-lg border text-[8px] font-black uppercase tracking-[0.15em] whitespace-nowrap {{ statusClasses[currentStatus] ?? 'text-slate-400 bg-slate-500/10 border-slate-500/20' }}">
|
||||
{% if currentStatus == 'en attends de signature' %}
|
||||
<span class="inline-block w-1.5 h-1.5 rounded-full bg-amber-500 mr-1.5 animate-pulse"></span>
|
||||
{% elseif currentStatus == 'signée' %}
|
||||
<span class="inline-block w-1.5 h-1.5 rounded-full bg-emerald-500 mr-1.5 shadow-[0_0_5px_#10b981]"></span>
|
||||
{% endif %}
|
||||
{{ statusLabels[currentStatus] ?? currentStatus }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
{# MONTANT #}
|
||||
<td class="px-6 py-4 text-center">
|
||||
<span class="text-sm font-black text-white">
|
||||
{{ quote.totalTtc|number_format(2, ',', ' ') }}€
|
||||
</span>
|
||||
</td>
|
||||
|
||||
{# ACTIONS #}
|
||||
<td class="px-6 py-4 text-right">
|
||||
<div class="flex items-center justify-end space-x-2">
|
||||
{# Modifier #}
|
||||
<a href="{{ path('app_crm_devis_edit', {id: quote.id}) }}" class="p-2 bg-blue-600/10 hover:bg-blue-600 text-blue-500 hover:text-white rounded-xl transition-all border border-blue-500/20 shadow-lg shadow-blue-600/5">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" /></svg>
|
||||
</a>
|
||||
|
||||
{# PDF #}
|
||||
<a href="{{ path('app_crm_devis_pdf', {id: quote.id}) }}" target="_blank" class="p-2 bg-emerald-600/10 hover:bg-emerald-600 text-emerald-500 hover:text-white rounded-xl transition-all border border-emerald-500/20 shadow-lg shadow-emerald-600/5">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" /></svg>
|
||||
</a>
|
||||
|
||||
{# Delete #}
|
||||
<a href="{{ path('app_crm_devis_delete', {id: quote.id}) }}?_token={{ csrf_token('delete' ~ quote.id) }}"
|
||||
data-turbo-method="post"
|
||||
data-turbo-confirm="Confirmer la suppression du devis {{ quote.ref }} ?"
|
||||
class="p-2 bg-rose-500/10 hover:bg-rose-600 text-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/20">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="6" class="py-24 text-center">
|
||||
<p class="text-slate-500 italic uppercase tracking-[0.2em] text-[10px] font-black">Aucun devis trouvé</p>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# PAGINATION #}
|
||||
{% if quotes.getTotalItemCount is defined and quotes.getTotalItemCount > quotes.getItemNumberPerPage %}
|
||||
<div class="mt-8 flex justify-center custom-pagination">
|
||||
{{ knp_pagination_render(quotes) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<style>
|
||||
.custom-pagination nav ul { @apply flex space-x-2; }
|
||||
.custom-pagination nav ul li span,
|
||||
.custom-pagination nav ul li a {
|
||||
@apply px-4 py-2 rounded-xl bg-[#1e293b]/40 backdrop-blur-md border border-white/5 text-slate-400 text-[10px] font-black transition-all;
|
||||
}
|
||||
.custom-pagination nav ul li.active span {
|
||||
@apply bg-blue-600 border-blue-500 text-white shadow-lg shadow-blue-600/20;
|
||||
}
|
||||
.custom-pagination nav ul li a:hover {
|
||||
@apply bg-white/10 text-white border-white/20;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user