diff --git a/config/packages/vich_uploader.yaml b/config/packages/vich_uploader.yaml
index bea9ec2..9a6938c 100644
--- a/config/packages/vich_uploader.yaml
+++ b/config/packages/vich_uploader.yaml
@@ -1,4 +1,7 @@
vich_uploader:
db_driver: orm
mappings:
-
+ image_product:
+ uri_prefix: /images/image_product
+ upload_destination: '%kernel.project_dir%/public/images/image_product'
+ namer: Vich\UploaderBundle\Naming\SmartUniqueNamer
diff --git a/migrations/Version20260116124736.php b/migrations/Version20260116124736.php
new file mode 100644
index 0000000..caa90fa
--- /dev/null
+++ b/migrations/Version20260116124736.php
@@ -0,0 +1,37 @@
+addSql('ALTER TABLE product ADD image_name VARCHAR(255) DEFAULT NULL');
+ $this->addSql('ALTER TABLE product ADD image_size INT DEFAULT NULL');
+ $this->addSql('ALTER TABLE product ADD updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
+ $this->addSql('COMMENT ON COLUMN product.updated_at IS \'(DC2Type:datetime_immutable)\'');
+ }
+
+ 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 product DROP image_name');
+ $this->addSql('ALTER TABLE product DROP image_size');
+ $this->addSql('ALTER TABLE product DROP updated_at');
+ }
+}
diff --git a/migrations/Version20260116124808.php b/migrations/Version20260116124808.php
new file mode 100644
index 0000000..3665171
--- /dev/null
+++ b/migrations/Version20260116124808.php
@@ -0,0 +1,31 @@
+addSql('CREATE SCHEMA public');
+ }
+}
diff --git a/src/Controller/Dashboard/ProductController.php b/src/Controller/Dashboard/ProductController.php
new file mode 100644
index 0000000..b470830
--- /dev/null
+++ b/src/Controller/Dashboard/ProductController.php
@@ -0,0 +1,56 @@
+ false], methods: ['GET'])]
+ public function products(ProductRepository $productRepository,AppLogger $appLogger,PaginatorInterface $paginator,Request $request): Response
+ {
+ $appLogger->record('VIEW','Consultation liste des produits');
+
+ return $this->render('product/products.twig', [
+ 'products' => $paginator->paginate($productRepository->findBy([],['ref'=>'asc']), $request->get('page', 1), 10),
+ ]);
+ }
+ #[Route(path: '/crm/products/add', name: 'app_crm_product_add', options: ['sitemap' => false], methods: ['GET'])]
+ public function productAdd(ProductRepository $productRepository,AppLogger $appLogger): Response
+ {
+
+ }
+
+ #[Route(path: '/crm/products/edit/{id}', name: 'app_crm_product_edit', options: ['sitemap' => false], methods: ['GET'])]
+ public function productEdit(ProductRepository $productRepository,AppLogger $appLogger): Response
+ {
+
+ }
+ #[Route(path: '/crm/products/delete/{id}', name: 'app_crm_product_delete', options: ['sitemap' => false], methods: ['GET'])]
+ public function productDelete(ProductRepository $productRepository,AppLogger $appLogger): Response
+ {
+
+ }
+}
diff --git a/src/Entity/Product.php b/src/Entity/Product.php
index 160d457..5a25833 100644
--- a/src/Entity/Product.php
+++ b/src/Entity/Product.php
@@ -4,8 +4,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;
#[ORM\Entity(repositoryClass: ProductRepository::class)]
+#[Vich\Uploadable()]
class Product
{
#[ORM\Id]
@@ -34,6 +37,18 @@ class Product
#[ORM\Column]
private ?float $caution = null;
+
+ #[Vich\UploadableField(mapping: 'image_product', fileNameProperty: 'imageName', size: 'imageSize')]
+ private ?File $imageFile = null;
+ #[ORM\Column(nullable: true)]
+ private ?string $imageName = null;
+
+ #[ORM\Column(nullable: true)]
+ private ?int $imageSize = null;
+
+ #[ORM\Column(nullable: true)]
+ private ?\DateTimeImmutable $updatedAt = null;
+
public function getId(): ?int
{
return $this->id;
@@ -122,4 +137,40 @@ class Product
return $this;
}
+
+ public function setImageFile(?File $imageFile = null): void
+ {
+ $this->imageFile = $imageFile;
+
+ if (null !== $imageFile) {
+ // 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->updatedAt = new \DateTimeImmutable();
+ }
+ }
+
+ public function getImageFile(): ?File
+ {
+ return $this->imageFile;
+ }
+
+ public function setImageName(?string $imageName): void
+ {
+ $this->imageName = $imageName;
+ }
+
+ public function getImageName(): ?string
+ {
+ return $this->imageName;
+ }
+
+ public function setImageSize(?int $imageSize): void
+ {
+ $this->imageSize = $imageSize;
+ }
+
+ public function getImageSize(): ?int
+ {
+ return $this->imageSize;
+ }
}
diff --git a/templates/dashboard/base.twig b/templates/dashboard/base.twig
index 0b9dbc7..885a912 100644
--- a/templates/dashboard/base.twig
+++ b/templates/dashboard/base.twig
@@ -41,6 +41,7 @@
{% import _self as menu %}
{{ menu.nav_link(path('app_crm'), 'Dashboard', '
{{ product.ref }}
+Prix Journée
+{{ product.priceDay|number_format(2, ',', ' ') }}€
+Jour Sup.
+{{ product.priceSup|number_format(2, ',', ' ') }}€
+Le catalogue est actuellement vide
+