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/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/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" %}
-