Bug : Affichages des conges
This commit is contained in:
42
staticfiles/gestion_employe/js/mon_profil.js
Normal file
42
staticfiles/gestion_employe/js/mon_profil.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const $ = (element) => document.getElementById(element);
|
||||
|
||||
url_certificat = $("tableau-certificat").dataset.url;
|
||||
const tableau_certificat = new Tabulator("#tableau-certificat", {
|
||||
columns: [
|
||||
{"title": "Nom du certificat", "field": "titre"},
|
||||
{"title": "Nom de l'organisme", "field": "organisme"},
|
||||
{"title": "Date d'obtention", "field": "date_obtention", formatter:"datetime", formatterParams:{
|
||||
inputFormat:"yyyy-MM-dd",
|
||||
outputFormat:"dd/MM/yy",
|
||||
}},
|
||||
{"title": "Date de fin de validité", "field": "date_fin", formatter:"datetime", formatterParams:{
|
||||
inputFormat:"yyyy-MM-dd",
|
||||
outputFormat:"dd/MM/yy",
|
||||
}},
|
||||
],
|
||||
ajaxURL: url_certificat,
|
||||
})
|
||||
|
||||
const enregistrerProfil = $("enregistrerProfil");
|
||||
enregistrerProfil.addEventListener("click", (e) => {
|
||||
const url = $("information-personnelles").dataset.url;
|
||||
const csrftoken = document.querySelector("[name='csrfmiddlewaretoken']").value;
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrftoken
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"nom": $("nom").value,
|
||||
"prenom": $("prenom").value,
|
||||
"email": $("email").value,
|
||||
"telephone": $("telephone").value,
|
||||
"adresse": $("adresse").value,
|
||||
"sexe": $("sexe").value,
|
||||
"date_naissance": $("date_naissance").value,
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => alert(data.message))
|
||||
})
|
||||
Reference in New Issue
Block a user