Affichage de la liste des departements pour la modification de l'employer
All checks were successful
Organisation/sirh/pipeline/head This commit looks good
Organisation/sirh/pipeline/pr-main This commit looks good
SGL/sirh/pipeline/head This commit looks good

This commit is contained in:
Fatimac2804
2026-09-02 14:33:51 +02:00
parent 3b587d2a1a
commit d28bf85556
5 changed files with 21 additions and 92 deletions

View File

@@ -12,6 +12,7 @@ const tableau_liste_employe = new Tabulator("#tableau_liste_employe", {
// ajaxURL: url_liste_employe,
pagination: true,
paginationSize: 10,
responsiveLayout : "hide"
})
fetch(url_liste_employe)
@@ -28,8 +29,6 @@ fetch(url_liste_employe)
tableau_liste_employe.on("rowClick", function (row, rowData) {
const data = rowData.getData();
console.log('Employé cliqué:', data);
document.getElementById('detail-id').value = data.id;
document.getElementById('detail-matricule').value = data.matricule;
document.getElementById('detail-employe').value = data.employe;
@@ -212,41 +211,23 @@ $("enregistrerDetail").addEventListener("click", function() {
const fonction = document.getElementById('detail-fonction').value;
const dateEmbauche = document.getElementById('detail-dateEmbauche').value;
const matricule = document.getElementById('detail-matricule').value;
const departement = document.getElementById('detail-departement').value;
console.log('=== ENREGISTREMENT DÉTAILS ===');
console.log('ID:', id_);
console.log('Fonction:', fonction);
console.log('Date embauche:', dateEmbauche);
console.log('Matricule:', matricule);
console.log('Département (valeur brute):', departement);
console.log('Département (type):', typeof departement);
console.log('Département est vide:', !departement);
const url_enregistrer_detail = $("modalDetailEmployeBody").dataset.url;
const payload = {
"id": id_,
"fonction": fonction,
"date_embauche": dateEmbauche,
"matricule": matricule,
"departement": departement
};
console.log('Payload JSON:', payload);
console.log('Payload stringifié:', JSON.stringify(payload));
fetch(url_enregistrer_detail, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-CSRFToken": document.querySelector('[name=csrfmiddlewaretoken]').value
},
body: JSON.stringify(payload)
body: JSON.stringify({
"id": id_,
"fonction": fonction,
"date_embauche": dateEmbauche,
"matricule": matricule
})
})
.then(response => response.json())
.then(data => {
console.log('Réponse du serveur:', data);
alert(data.message);
location.reload();
})