diff --git a/public/css/Index/index.css b/public/css/Index/index.css index 7b2c784..11de2c1 100644 --- a/public/css/Index/index.css +++ b/public/css/Index/index.css @@ -43,7 +43,7 @@ ul { } li { - padding-bottom: 20px; + padding-bottom: 4%; } .btn-custom { diff --git a/src/Controller/PlatsController.php b/src/Controller/PlatsController.php index 498590a..373a0ce 100644 --- a/src/Controller/PlatsController.php +++ b/src/Controller/PlatsController.php @@ -72,4 +72,14 @@ final class PlatsController extends AbstractController return $this->redirectToRoute('app_plats_index', [], Response::HTTP_SEE_OTHER); } + + #[Route('/bestplats', name: 'app_plats_best', methods: ['GET'])] + public function getBest(PlatsRepository $platsRepository): Response + { + $bestplats = $platsRepository->findBestPlats(); +// dd($bestplats); + return $this->render('plats/best.html.twig', [ + 'plat' => $bestplats, + ]); + } } diff --git a/src/Repository/PlatsRepository.php b/src/Repository/PlatsRepository.php index a4d8cad..bb0aa7d 100644 --- a/src/Repository/PlatsRepository.php +++ b/src/Repository/PlatsRepository.php @@ -40,4 +40,14 @@ class PlatsRepository extends ServiceEntityRepository // ->getOneOrNullResult() // ; // } + + public function findBestPlats(): ?Plats + { + return $this->createQueryBuilder('p') + ->orderBy('p.Nb_de_commande', 'DESC') + ->setMaxResults(1) + ->getQuery() + ->getOneOrNullResult(); + } + } diff --git a/templates/base.html.twig b/templates/base.html.twig index baf9c01..f85d77c 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -88,7 +88,7 @@
  • - + {{ ux_icon('fluent-emoji-high-contrast:ten-oclock') }} Voir tendances diff --git a/templates/plats/best.html.twig b/templates/plats/best.html.twig new file mode 100644 index 0000000..6373253 --- /dev/null +++ b/templates/plats/best.html.twig @@ -0,0 +1,59 @@ +{% extends 'base.html.twig' %} + +{% block head %} + + + + + +{% endblock %} + +{% block stylesheets %} + + + + + +{% endblock %} + +{% block container_modal %} + +
    +

    Tendance

    + + + + + + + + + + + + + + + {% if plat %} + + + + + + + + + + {% else %} + + + + {% endif %} + +
    IdNomDescriptionPrixCategorieStatutNb_de_commande
    {{ plat.id }}{{ plat.Nom }}{{ plat.Description }}{{ plat.Prix }}{{ plat.Categorie }}{{ plat.Statut ? 'Yes' : 'No' }}{{ plat.NbDeCommande }}
    Aucun enregistrement trouvé
    +
    + +{% endblock %} + + +