Bug : Affichage des demandes de conges
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@@ -1,6 +0,0 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class GestionCongeConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'gestion_conge'
|
||||
@@ -1,75 +0,0 @@
|
||||
const bouton_enregistrer_detail = document.getElementById("bouton-enregistrer-detail-conge");
|
||||
|
||||
if(bouton_enregistrer_detail){
|
||||
bouton_enregistrer_detail.addEventListener("click", () => {
|
||||
const form = document.getElementById("form-detail-conge");
|
||||
const csrftoken = new FormData(form).get("csrfmiddlewaretoken");
|
||||
const actionUrl = form.action;
|
||||
const id_conge = document.getElementById("id_conge").value;
|
||||
const validation_hierarchique_input = document.querySelector('input[name="validation_hierarchique"]:checked');
|
||||
const validation_hierarchique = validation_hierarchique_input ? validation_hierarchique_input.value : null;
|
||||
const validation_direction_input = document.querySelector('input[name="validation_direction"]:checked');
|
||||
const validation_direction = validation_direction_input ? validation_direction_input.value : null;
|
||||
const motif_refus = document.getElementById("motif_refus").value;
|
||||
|
||||
fetch(actionUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-CSRFToken": csrftoken
|
||||
},
|
||||
body: JSON.stringify({
|
||||
id_conge,
|
||||
validation_hierarchique,
|
||||
validation_direction,
|
||||
motif_refus
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
alert(data.message);
|
||||
navigation.reload();
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
if(document.getElementById("validation_hierarchique_refuse")){
|
||||
document.getElementById("validation_hierarchique_refuse").addEventListener('click', function(){
|
||||
if(this.checked){
|
||||
alert("coucou");
|
||||
document.getElementById("motif_refus_container").className="d-block form-group mt-3";
|
||||
}else{
|
||||
document.getElementById("motif_refus_container").className="d-none";
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if(document.getElementById("validation_hierarchique_refuse")){
|
||||
document.getElementById("validation_hierarchique_refuse").addEventListener('click', function(){
|
||||
if(this.checked){
|
||||
document.getElementById("motif_refus_container").className="d-block form-group mt-3";
|
||||
}else{
|
||||
document.getElementById("motif_refus_container").className="d-none";
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if(document.getElementById("validation_hierarchique_valide")){
|
||||
document.getElementById("validation_hierarchique_valide").addEventListener('click', function(){
|
||||
if(this.checked){
|
||||
document.getElementById("motif_refus_container").className="d-none";
|
||||
}else{
|
||||
document.getElementById("motif_refus_container").className="d-block form-group mt-3";
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if(document.getElementById("validation_direction_valide")){
|
||||
document.getElementById("validation_direction_valide").addEventListener('click', function(){
|
||||
if(this.checked){
|
||||
document.getElementById("motif_refus_container").className="d-block form-group mt-3";
|
||||
}else{
|
||||
document.getElementById("motif_refus_container").className="d-none";
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
const $ = (element) => document.getElementById(element);
|
||||
|
||||
const url_liste_conge_attente = $("liste-demande-conges").dataset.url
|
||||
|
||||
const tableau_liste_demande_conge = new Tabulator("#liste-demande-conges", {
|
||||
layout : "fitColumns",
|
||||
columns: [
|
||||
{"title": "Nom et Prénom", "field": "prenom_nom"},
|
||||
{"title": "Date de début", "field": "date_debut", formatter:"datetime", formatterParams:{
|
||||
inputFormat:"yyyy-MM-dd",
|
||||
outputFormat:"dd/MM/yy",
|
||||
}},
|
||||
{"title": "Date de fin", "field": "date_fin", formatter:"datetime", formatterParams:{
|
||||
inputFormat:"yyyy-MM-dd",
|
||||
outputFormat:"dd/MM/yy",
|
||||
}},
|
||||
{"title": "Type de congé", "field": "type"},
|
||||
{"title": "Date de la demande", "field": "date_demande"},
|
||||
{"title": "Validation par supérieur hiérarchique", "field": "validation_hierarchique", formatter:"tickCross", formatterParams :{
|
||||
allowEmpty : true ,
|
||||
}},
|
||||
{"title": "Validation par supérieur hiérarchique", "field": "validation_direction", formatter:"tickCross", formatterParams :{
|
||||
allowEmpty : true ,
|
||||
}},
|
||||
],
|
||||
pagination: true,
|
||||
paginationSize: 5
|
||||
})
|
||||
|
||||
const bouton_demande_conges = $("bouton-demande-conge");
|
||||
|
||||
bouton_demande_conges.addEventListener("click", (e) => {
|
||||
var modalDemandeConge = new bootstrap.Modal(document.getElementById('modalDemandeConge'));
|
||||
modalDemandeConge.show();
|
||||
})
|
||||
|
||||
tableau_liste_demande_conge.on("rowClick", function(row, rowData) {
|
||||
const data = rowData.getData();
|
||||
$("id_conge").value = data.id;
|
||||
$("employe").value = data.prenom_nom;
|
||||
$("type_conge").value = data.type;
|
||||
$("date_debut").value = data.date_debut;
|
||||
$("date_fin").value = data.date_fin;
|
||||
$("date_demande").value = data.date_demande;
|
||||
$("nombre_jours").value = data.nombre_jours;
|
||||
$("solde_restant").value = data.solde_conge;
|
||||
$("motif_refus").value = data.motif_refus;
|
||||
|
||||
if($("validation_hierarchique_valide") & $("validation_hierarchique_refuse")){
|
||||
$("validation_hierarchique_valide").checked = data.validation_hierarchique === true;
|
||||
$("validation_hierarchique_refuse").checked = data.validation_hierarchique === false;
|
||||
}
|
||||
|
||||
if($("validation_direction_valide") & $("validation_direction_refuse")){
|
||||
$("validation_direction_valide").checked = data.validation_direction === true;
|
||||
$("validation_direction_refuse").checked = data.validation_direction === false;
|
||||
}
|
||||
|
||||
const modal = new bootstrap.Modal(document.getElementById('detailsCongeModal'));
|
||||
modal.show();
|
||||
});
|
||||
|
||||
fetch(url_liste_conge_attente)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if(data.success === true){
|
||||
tableau_liste_demande_conge.setData(data.data)
|
||||
}else{
|
||||
alert(data.message)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user