diff --git a/migrations/Version20260127085400.php b/migrations/Version20260127085400.php new file mode 100644 index 0000000..4f80623 --- /dev/null +++ b/migrations/Version20260127085400.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE product ALTER dim_w DROP NOT NULL'); + } + + 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 ALTER dim_w SET NOT NULL'); + } +} diff --git a/migrations/Version20260127085439.php b/migrations/Version20260127085439.php new file mode 100644 index 0000000..a071971 --- /dev/null +++ b/migrations/Version20260127085439.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE product ALTER price_sup DROP NOT NULL'); + } + + 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 ALTER price_sup SET NOT NULL'); + } +} diff --git a/src/Controller/ReserverController.php b/src/Controller/ReserverController.php index b0360c8..3945bff 100644 --- a/src/Controller/ReserverController.php +++ b/src/Controller/ReserverController.php @@ -55,7 +55,7 @@ class ReserverController extends AbstractController #[Route('/reservation', name: 'reservation')] public function revervation(ProductRepository $productRepository): Response { - $products =$productRepository->findBy([], ['updatedAt' => 'DESC']); + $products =$productRepository->findBy([], ['updatedAt' => 'DESC'],3); return $this->render('revervation/home.twig',[ 'products' => $products ]); diff --git a/src/Entity/Product.php b/src/Entity/Product.php index deb8408..1cad335 100644 --- a/src/Entity/Product.php +++ b/src/Entity/Product.php @@ -33,7 +33,7 @@ class Product #[ORM\Column] private ?float $priceDay = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] private ?float $priceSup = null; #[ORM\Column] @@ -78,7 +78,7 @@ class Product #[ORM\OneToMany(targetEntity: ProductDoc::class, mappedBy: 'product')] private Collection $productDocs; - #[ORM\Column] + #[ORM\Column(nullable: true)] private ?float $dimW = null; #[ORM\Column(nullable: true)] diff --git a/src/Form/ProductType.php b/src/Form/ProductType.php index 67967a9..54ed388 100644 --- a/src/Form/ProductType.php +++ b/src/Form/ProductType.php @@ -55,8 +55,7 @@ class ProductType extends AbstractType 'html5' => true, ]) ->add('priceSup',NumberType::class,[ - 'label' => 'Prix Suplémentaire', - 'required' => true, + 'required' => false, 'html5' => true, ]) diff --git a/templates/dashboard/products/add.twig b/templates/dashboard/products/add.twig index 98e5ec9..7045e57 100644 --- a/templates/dashboard/products/add.twig +++ b/templates/dashboard/products/add.twig @@ -5,6 +5,7 @@ {% block actions %}
- A partir de {{ product.priceDay }}€ / Jour +
+ {% if product.category == "barnums" %} + A partir de {{ product.priceDay|format_currency('EUR') }} / Week-End + {% else %} + A partir de {{ product.priceDay|format_currency('EUR') }} / Jour + {% endif %}
Location / Jour
+ {% if product.category == "barnums" %} +Week-End
+ {% else %} +Jour
+ {% endif %}Dès {{ product.priceDay|format_currency('EUR') }}
diff --git a/templates/revervation/produit.twig b/templates/revervation/produit.twig index b2e437c..484168c 100644 --- a/templates/revervation/produit.twig +++ b/templates/revervation/produit.twig @@ -109,18 +109,24 @@