From a28b177ebafb1388fc56a82e6a190d4c6ce3252f Mon Sep 17 00:00:00 2001 From: fatima Date: Thu, 18 Jun 2026 10:39:07 +0000 Subject: [PATCH 1/3] =?UTF-8?q?Correction=20modification=20profil=20employ?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestion_employe/static/gestion_employe/js/mon_profil.js | 5 ++++- gestion_employe/views.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gestion_employe/static/gestion_employe/js/mon_profil.js b/gestion_employe/static/gestion_employe/js/mon_profil.js index 77178b4..7b4812f 100644 --- a/gestion_employe/static/gestion_employe/js/mon_profil.js +++ b/gestion_employe/static/gestion_employe/js/mon_profil.js @@ -24,7 +24,6 @@ enregistrerProfil.addEventListener("click", (e) => { const csrftoken = document.querySelector("[name='csrfmiddlewaretoken']").value; const formData = new FormData(); - formData.append("nom", $("nom").value); formData.append("prenom", $("prenom").value); formData.append("email", $("email").value); @@ -32,6 +31,10 @@ enregistrerProfil.addEventListener("click", (e) => { formData.append("adresse", $("adresse").value); formData.append("sexe", $("sexe").value); formData.append("date_naissance", $("date_naissance").value); + const photoInput = $("photo"); + if (photoInput.files.length > 0) { + formData.append("photo", photoInput.files[0]); + } fetch(url, { method: "POST", diff --git a/gestion_employe/views.py b/gestion_employe/views.py index 80d902c..df986b7 100644 --- a/gestion_employe/views.py +++ b/gestion_employe/views.py @@ -191,7 +191,7 @@ def modifier_employer(request): except Employe.DoesNotExist: return JsonResponse({"message": "Employé non trouvé."}) if request.method == "POST": - data = json.loads(request.body) + data = request.POST user = User.objects.get(username=request.user) user.last_name = data['nom'] user.first_name = data['prenom'] -- 2.49.1 From 67c14cfc7e12f17b25cc2e381e2f8438ac4fb18a Mon Sep 17 00:00:00 2001 From: fatima Date: Thu, 18 Jun 2026 11:31:54 +0000 Subject: [PATCH 2/3] Correction sur l'affichage des detail de la reservation --- gestion_salle/static/gestion_salle/js/index.js | 3 ++- gestion_salle/views.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gestion_salle/static/gestion_salle/js/index.js b/gestion_salle/static/gestion_salle/js/index.js index 6950c0e..b77bf67 100644 --- a/gestion_salle/static/gestion_salle/js/index.js +++ b/gestion_salle/static/gestion_salle/js/index.js @@ -21,7 +21,8 @@ const calendrier = Schedule(document.getElementById('planning-reservation'), { $("employe").value=data.employe; $("salle").value=data.salle; $("statut-reservation").innerHTML=data.statut; - $("date_evenement").value=data.date_evenement; + $("date_debut").value=data.date_debut; + $("date_fin").value=data.date_fin; $("heure_debut").value=data.heure_debut; $("heure_fin").value=data.heure_fin; $("motif_reservation").value=data.motif_reservation; diff --git a/gestion_salle/views.py b/gestion_salle/views.py index 075aef5..7dbfe8b 100644 --- a/gestion_salle/views.py +++ b/gestion_salle/views.py @@ -153,7 +153,8 @@ def detail_reservation(request:HttpRequest, reservation_id:int): 'employe': f"{employe.first_name} {employe.last_name}", 'salle': reservation.salle, 'statut': dict(Reservation.STATUT).get(reservation.statut), - 'date_evenement': reservation.date_debut.strftime('%Y-%m-%d'), + 'date_debut': reservation.date_debut.strftime('%Y-%m-%d'), + 'date_fin': reservation.date_fin.strftime('%Y-%m-%d'), 'heure_debut': reservation.heure_debut.strftime('%H:%M'), 'heure_fin': reservation.heure_fin.strftime('%H:%M'), 'motif_reservation': reservation.motif_reservation, -- 2.49.1 From 73e0fab052589c984e721cab6d668c086c75b0f6 Mon Sep 17 00:00:00 2001 From: fatima Date: Thu, 18 Jun 2026 15:30:15 +0000 Subject: [PATCH 3/3] =?UTF-8?q?Affichage=20de=20la=20liste=20des=20contrat?= =?UTF-8?q?=20d'un=20employ=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/gestion_employe/js/index.js | 75 ++++++++++++++++++- .../templates/gestion_employe/index.html | 1 + .../parts/modalContratsEmploye.html | 21 ++++++ .../parts/modalDetailEmploye.html | 4 +- gestion_employe/urls.py | 6 ++ gestion_employe/views.py | 40 ++++++++++ 6 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 gestion_employe/templates/gestion_employe/parts/modalContratsEmploye.html diff --git a/gestion_employe/static/gestion_employe/js/index.js b/gestion_employe/static/gestion_employe/js/index.js index 95eb1d8..950142e 100644 --- a/gestion_employe/static/gestion_employe/js/index.js +++ b/gestion_employe/static/gestion_employe/js/index.js @@ -260,4 +260,77 @@ const listeContratExpirant = new Tabulator("#listeContratExpirant", { }, ], ajaxURL: $("boutonContratExpirants").dataset.urlexpirants, -}) \ No newline at end of file +}) + + + +let tabContrats = null; + +document.getElementById("modalContratsEmploye") +.addEventListener("show.bs.modal", function () { + + const employeId = document.getElementById("detail-id").value; + + console.log("Employe ID :", employeId); + + if (!employeId) { + alert("Aucun employé sélectionné"); + return; + } + + fetch(`/employé/employe/${employeId}/contrats/`) + .then(response => { + if (!response.ok) { + throw new Error("Erreur HTTP " + response.status); + } + return response.json(); + }) + .then(data => { + + document.getElementById("nom-employe-contrat").innerText = + data.employe; + + if (tabContrats) { + tabContrats.destroy(); + } + + tabContrats = new Tabulator( + "#table-contrats-tabulator", + { + data: data.contrats, + layout: "fitColumns", + placeholder: "Aucun contrat", + + columns: [ + { title: "Numéro", field: "numero_contrat" }, + { title: "Type", field: "type_contrat" }, + { title: "Date début", field: "date_debut" }, + { title: "Date fin", field: "date_fin" }, + { title: "Salaire", field: "salaire_mensuel" }, + { title: "Statut", field: "statut" }, + + { + title: "Contrat", + field: "fichier", + formatter: function(cell) { + const url = cell.getValue(); + + if (!url) { + return "Aucun fichier"; + } + + return ` + Ouvrir + `; + } + } + ] + } + ); + }) + .catch(error => { + console.error("Erreur :", error); + }); +}); + + diff --git a/gestion_employe/templates/gestion_employe/index.html b/gestion_employe/templates/gestion_employe/index.html index 825dec9..2330546 100644 --- a/gestion_employe/templates/gestion_employe/index.html +++ b/gestion_employe/templates/gestion_employe/index.html @@ -58,6 +58,7 @@ {% block 'modal' %} {% include "gestion_employe/parts/modalDetailEmploye.html" %} {% include "gestion_employe/parts/modalCreationContrat.html" %} + {% include "gestion_employe/parts/modalContratsEmploye.html" %} {% include "gestion_employe/parts/modalAffectationProjet.html" %} {% include "gestion_employe/parts/modalDocument.html" %} {% include "gestion_employe/parts/modalListeContratExpirants.html" %} diff --git a/gestion_employe/templates/gestion_employe/parts/modalContratsEmploye.html b/gestion_employe/templates/gestion_employe/parts/modalContratsEmploye.html new file mode 100644 index 0000000..c26a2e1 --- /dev/null +++ b/gestion_employe/templates/gestion_employe/parts/modalContratsEmploye.html @@ -0,0 +1,21 @@ + + diff --git a/gestion_employe/templates/gestion_employe/parts/modalDetailEmploye.html b/gestion_employe/templates/gestion_employe/parts/modalDetailEmploye.html index 187ef49..216defe 100644 --- a/gestion_employe/templates/gestion_employe/parts/modalDetailEmploye.html +++ b/gestion_employe/templates/gestion_employe/parts/modalDetailEmploye.html @@ -93,8 +93,8 @@ {% if user|has_group:"ressource_humaine" %}
-