From 784822478e3d30bb4082fa9694d478917ddfcbf2 Mon Sep 17 00:00:00 2001 From: fatima Date: Thu, 30 Apr 2026 14:16:42 +0200 Subject: [PATCH] feature: Affichage de la liste des bailleur --- .../js/enregistrement_bailleur.js | 30 +++++++++- .../parts/creation_bailleur.html | 55 +++++++++++++++---- gestion_projet/urls.py | 11 +++- gestion_projet/views.py | 18 ++++++ 4 files changed, 100 insertions(+), 14 deletions(-) diff --git a/gestion_projet/static/gestion_projet/js/enregistrement_bailleur.js b/gestion_projet/static/gestion_projet/js/enregistrement_bailleur.js index afe12ea..c09f502 100644 --- a/gestion_projet/static/gestion_projet/js/enregistrement_bailleur.js +++ b/gestion_projet/static/gestion_projet/js/enregistrement_bailleur.js @@ -1,4 +1,5 @@ const btnEnregistrerBailleur = document.getElementById('btnEnregistrerBailleur'); +let table; btnEnregistrerBailleur.addEventListener('click', function() { const form = document.getElementById('formBailleur'); @@ -20,4 +21,31 @@ btnEnregistrerBailleur.addEventListener('click', function() { alert('Ce bailleur existe déjà dans la base de données.'); } }); -}); \ No newline at end of file +}); + +document.addEventListener("DOMContentLoaded", function () { + + table = new Tabulator("#table-bailleurs", { + ajaxURL: "/gestion-projet/bailleurs/", + layout: "fitColumns", + pagination: "local", + paginationSize: 5, + + columns: [ + {title: "#", formatter: "rownum", width: 60}, + {title: "Organisme", field: "nom_organisme"}, + {title: "Contact", field: "contact"}, + {title: "Email", field: "email"}, + {title: "Pays", field: "pays"}, + ], + rowDblClick: function(e, row) { + const data = row.getData(); + + if (confirm(`Voulez-vous vraiment supprimer ${data.nom_organisme} ?`)) { + supprimerBailleur(data.id); + } + } + }); + +}); + diff --git a/gestion_projet/templates/gestion_projet/parts/creation_bailleur.html b/gestion_projet/templates/gestion_projet/parts/creation_bailleur.html index 6fe4194..2f31a37 100644 --- a/gestion_projet/templates/gestion_projet/parts/creation_bailleur.html +++ b/gestion_projet/templates/gestion_projet/parts/creation_bailleur.html @@ -1,20 +1,51 @@