diff --git a/public/js/GestionMenu/GestionMenu.js b/public/js/GestionMenu/GestionMenu.js new file mode 100644 index 0000000..679f140 --- /dev/null +++ b/public/js/GestionMenu/GestionMenu.js @@ -0,0 +1,77 @@ +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 Promotions'); + } + 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 addPlats (event) { + document.getElementById('container_modal'); + + fetch(`/plats/new`) + .then(response => { + 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 updatePromotion (event) { + document.getElementById('container_modal'); + const reductionsIdString = event.getAttribute('data-id'); + let reductionsId = parseInt(reductionsIdString); + + fetch(`/plats/${platsId}/edit`) + .then(response => { + 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 deletePromotion (event) { + document.getElementById('container_modal'); + const reductionsIdString = event.getAttribute('data-id'); + let reductionsId = parseInt(reductionsIdString); + + fetch(`/reductions/${reductionsId}`) + .then(response => { + 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); + }); +} \ No newline at end of file diff --git a/templates/base.html.twig b/templates/base.html.twig index abbbe3c..88ca0eb 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -11,14 +11,135 @@ {# #} {% block stylesheets %} + + + {% endblock %} {% block javascripts %} + + + + + {% block importmap %}{{ importmap('app') }}{% endblock %} {% endblock %} - {% block body %}{% endblock %} + {% block body %} + + + +
+
+ Bonjour, {{ app.user.prenom }} +
+
+ + +
+ + {% if is_granted('ROLE_ADMIN') %} + + {% elseif is_granted('ROLE_CUISINIER') %} + + {% elseif is_granted('ROLE_SERVEUR') %} + + {% endif %} +
+ + {{ ux_icon('ph:user-circle-fill') }} + Compte + + +
+
+ +
+ +
+ + + + + + {% endblock %} {# bootstrap#} {# #} {# #} diff --git a/templates/index/admin.html.twig b/templates/index/admin.html.twig index b6ee974..8a7f8ef 100644 --- a/templates/index/admin.html.twig +++ b/templates/index/admin.html.twig @@ -36,9 +36,9 @@