Fix/Correction affectation departement
Some checks failed
Organisation/sirh/pipeline/head There was a failure building this commit

This commit is contained in:
Soriba SYLLA
2026-10-07 10:30:08 +00:00
parent f061f482d9
commit 0abbb26149
59 changed files with 170 additions and 2780 deletions

View File

@@ -9,7 +9,6 @@ const tableau_liste_employe = new Tabulator("#tableau_liste_employe", {
{"title": "Projet", "field": "projet"},
{"title": "Téléphone", "field": "telephone"},
],
// ajaxURL: url_liste_employe,
pagination: true,
paginationSize: 10,
responsiveLayout : "hide"
@@ -19,7 +18,6 @@ fetch(url_liste_employe)
.then(response => response.json())
.then(data => {
if (data.success){
console.log(data.data)
tableau_liste_employe.setData(data.data);
}else{
alert(data.message);
@@ -29,7 +27,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;
@@ -215,17 +212,10 @@ $("enregistrerDetail").addEventListener("click", function() {
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 url_enregistrer_detail = document.getElementById("modalDetailEmployeBody").dataset.url;
console.log("Le lien de l'enregistrement :", document.getElementById("modalDetailEmployeBody").dataset)
const payload = {
"id": id_,
"fonction": fonction,
@@ -234,9 +224,6 @@ $("enregistrerDetail").addEventListener("click", function() {
"departement": departement
};
console.log('Payload JSON:', payload);
console.log('Payload stringifié:', JSON.stringify(payload));
fetch(url_enregistrer_detail, {
method: "POST",
headers: {
@@ -283,15 +270,12 @@ const listeContratExpirant = new Tabulator("#listeContratExpirant", {
ajaxURL: $("boutonContratExpirants").dataset.urlexpirants,
})
let tabContrats = null;
/* let tabContrats = null;
document.getElementById("modalContratsEmploye")
.addEventListener("show.bs.modal", function () {
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;
@@ -350,4 +334,4 @@ document.getElementById("modalContratsEmploye")
.catch(error => {
console.error("Erreur :", error);
});
});
}); */

View File

@@ -64,4 +64,4 @@
{% endblock %}
{% block 'js' %}
<script type="text/javascript" src="{% static 'gestion_employe/js/index.js' %}"></script>
{% endblock %}
{% endblock %}

View File

@@ -25,4 +25,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@@ -54,4 +54,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@@ -8,7 +8,7 @@
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body" id="modalDetailEmployeBody">
<div class="modal-body" id="modalDetailEmployeBody" data-url="{% url 'gestion_employe:enregistrer-detail-employe' %}">
<div class="row g-3">
<input type="hidden" id="detail-id">
<div class="col-md-6">
@@ -135,4 +135,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@@ -91,4 +91,4 @@ urlpatterns = [
views.liste_contrat_expirants,
name='liste-contrat-expirants'
)
]
]

View File

@@ -353,9 +353,6 @@ def enregistrer_detail_employe(request):
# Traiter le département
dept_value = data.get('departement')
print(f"[DEBUG] Département brut: {dept_value!r}")
print(f"[DEBUG] Type département: {type(dept_value).__name__}")
print(f"[DEBUG] Est vide: {not dept_value}")
if dept_value and str(dept_value).strip():
try: