From 0dd438af9a776c4df329b069e5e3fc852a5579e7 Mon Sep 17 00:00:00 2001 From: Tinka Date: Mon, 24 Mar 2025 14:38:38 +0100 Subject: [PATCH] Fix affichage index admin --- public/css/Index/index.css | 10 ++--- public/js/GestionMenu/GestionMenu.js | 62 ++++++++++++++++++++++++++++ templates/index/admin.html.twig | 35 +++++++++++----- templates/user/list.html.twig | 2 +- 4 files changed, 91 insertions(+), 18 deletions(-) create mode 100644 public/js/GestionMenu/GestionMenu.js diff --git a/public/css/Index/index.css b/public/css/Index/index.css index f09f4d3..07138a8 100644 --- a/public/css/Index/index.css +++ b/public/css/Index/index.css @@ -10,7 +10,7 @@ align-items: center; padding: 0 20px; color: white; - font-size: 18px; + font-size: 16px; box-sizing: border-box; /* Inclut le padding dans la largeur totale */ } @@ -57,7 +57,7 @@ li { .btn-custom { background-color: #FFFFFF; color: black; - padding: 15px 40px; + padding: 20px; font-size: 16px; font-weight: bold; cursor: pointer; @@ -88,8 +88,6 @@ li { .Information-perso { display: flex; justify-content: space-between; - padding: 20px; - margin-top: auto; } .btn-info-compte, .btn-info-exit { @@ -104,12 +102,12 @@ li { .btn-info-compte { width: 50%; - height: 30px; + height: 20px; } .btn-info-exit { width: 10%; - height: 30px; + height: 20px; } /* Style pour la modal (cachée par défaut) */ diff --git a/public/js/GestionMenu/GestionMenu.js b/public/js/GestionMenu/GestionMenu.js new file mode 100644 index 0000000..c4c0a8f --- /dev/null +++ b/public/js/GestionMenu/GestionMenu.js @@ -0,0 +1,62 @@ +document.querySelector('.btn-gestion-menu').addEventListener('click', function(event) { + event.preventDefault(); + + document.getElementById('container_modal'); + + fetch('/plats') + .then(response => { + if (!response.ok) { + throw new Error('Erreur de chargement de la section Table'); + } + return response.text(); + }) + .then(html => { + // Insérer le HTML dans le conteneur et l'afficher + container_modal.innerHTML = html; + container_modal.style.display = 'block'; + }) + .catch(error => { + console.error('Erreur:', error); + }); +}); + +function addPlat (event) { + document.getElementById('container_modal'); + + fetch('/plats/new') + .then(response => { + if (!response.ok) { + throw new Error('Erreur de chargement de la section tables'); + } + return response.text(); + }) + .then(html => { + // Insérer le HTML dans le conteneur et l'afficher + container_modal.innerHTML = html; + container_modal.style.display = 'block'; + }) + .catch(error => { + console.error('Erreur:', error); + }); +} + +function editMenu (event) { + document.getElementById('container_modal'); + const IdString = event.getAttribute('data-id'); + let Id = parseInt(IdString); + fetch(`/plats/${Id}/edit`) + .then(response => { + if (!response.ok) { + throw new Error('Erreur de chargement de la section tables'); + } + return response.text(); + }) + .then(html => { + // Insérer le HTML dans le conteneur et l'afficher + container_modal.innerHTML = html; + container_modal.style.display = 'block'; + }) + .catch(error => { + console.error('Erreur:', error); + }); +} diff --git a/templates/index/admin.html.twig b/templates/index/admin.html.twig index b6ee974..7ffdb66 100644 --- a/templates/index/admin.html.twig +++ b/templates/index/admin.html.twig @@ -26,6 +26,17 @@
Bonjour, {{ app.user.prenom }}
+
+
+ {{ ux_icon('ph:user-circle-fill') }} + Compte +
+ +
@@ -64,8 +75,21 @@ Voir tendances +
  • +
    + {{ ux_icon('icon-park-outline:view-list') }} + Commandes +
    +
  • +
  • +
    + {{ ux_icon('fluent-mdl2:reservation-orders') }} + Réservation +
    +
  • + {% elseif is_granted('ROLE_CUISINIER') %} {% endif %} -
    -
    - {{ ux_icon('ph:user-circle-fill') }} - Compte -
    - -
    diff --git a/templates/user/list.html.twig b/templates/user/list.html.twig index 0a88997..6cade11 100644 --- a/templates/user/list.html.twig +++ b/templates/user/list.html.twig @@ -84,5 +84,5 @@ {% endblock %} {% block javascripts %} - + {% endblock %}