Mise a jour Modals Tables

This commit is contained in:
Joshua 2025-03-24 09:59:03 +01:00
parent 78515d6c87
commit 89fb69f680
6 changed files with 90 additions and 38 deletions

View File

@ -1,15 +1,3 @@
/* Global styles */
body {
font-family: 'Arial', sans-serif;
background-color: #f9f9f9;
color: #333;
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
/* Page container */
.page-container {

View File

@ -1,16 +1,10 @@
/* Global styles */
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f9f9f9;
color: #333;
}
h1 {
text-align: center;
color: #db5559;
margin-bottom: 20px;
}
/*h1 {*/
/* text-align: center;*/
/* color: #db5559;*/
/* margin-bottom: 20px;*/
/*}*/
/* Table styles */
.table {

View File

@ -1,15 +1,3 @@
/* Global styles */
body {
font-family: 'Arial', sans-serif;
background-color: #fff5f5;
color: #333;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
}
/* Page container */
.page-container {

View File

@ -0,0 +1,77 @@
document.querySelector('.btn-gestion-table').addEventListener('click', function(event) {
event.preventDefault();
document.getElementById('container_modal');
fetch('/tables')
.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 addTable (event) {
document.getElementById('container_modal');
fetch(`/tables/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 updateTable (event) {
document.getElementById('container_modal');
const reductionsIdString = event.getAttribute('data-id');
let reductionsId = parseInt(reductionsIdString);
fetch(`/reductions/${reductionsId}/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);
});
}

View File

@ -41,7 +41,7 @@
</div>
</li>
<li>
<div class="btn-custom icon-container">
<div class="btn-custom btn-gestion-table icon-container">
<i class="icon-medium"> {{ ux_icon('ic:outline-table-bar') }}</i>
<span>Gérer Table</span>
</div>
@ -134,4 +134,5 @@
<script src="{{ asset('js/Compte/CompteModal.js') }}" defer></script>
<script src="{{ asset('js/GestionUtilisateurs/GestionUtilisateurs.js') }}" defer></script>
<script src="{{ asset('js/GestionPromotion/GestionPromotion.js') }}" defer></script>
<script src="{{ asset('js/GestionTables/GestionTables.js') }}" defer></script>
{% endblock %}

View File

@ -35,5 +35,9 @@
</tbody>
</table>
<a href="{{ path('app_tables_new') }}">Créer une nouvelle table</a>
<button onclick="addTable(this)" href="{{ path('app_reductions_new') }}">Créer une tables</button>
{% endblock %}
{% block javascripts %}
<script src="{{ asset('js/GestionPromotion/GestionPromotion.js') }}" defer></script>
{% endblock %}