+ {% if user.employe.photo %}
+

+ {% else %}
+
+ {% endif %}
+
+ {{ user.username }}
+
+
diff --git a/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-312.pyc b/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-312.pyc
new file mode 100644
index 0000000..99904e8
Binary files /dev/null and b/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-312.pyc differ
diff --git a/fonction_utilitaire/fonctions_utilitaire.py b/fonction_utilitaire/fonctions_utilitaire.py
index 1ccdba0..de18744 100644
--- a/fonction_utilitaire/fonctions_utilitaire.py
+++ b/fonction_utilitaire/fonctions_utilitaire.py
@@ -1,7 +1,8 @@
from django.utils import timezone
from gestion_employe.models import Contrat
from gestion_conge.models import Conge
-
+from django.core.mail import send_mail
+from gestion_salle.models import Reservation
QUOTA_CONGE_ANNUEL = 30
NOMBRE_PAGINATION = 8
@@ -11,7 +12,6 @@ DUREE_FIN_CONTRAT = 90
def solde_conge(employe):
"""Fonction de calcul du solde de congé restant l'employé"""
contrat = Contrat.objects.filter(employe=employe, statut='actif').order_by('-date_debut').first()
-
if contrat is None or not contrat.date_debut:
return {
"success": False,
@@ -31,4 +31,38 @@ def solde_conge(employe):
"success": True,
"quota_annuel": QUOTA_CONGE_ANNUEL - jours_conges_valider,
"nombre_jours_valide": jours_conges_valider
- }
\ No newline at end of file
+ }
+
+def envoyer_email(type_notification, utilisateur, contexte=None):
+ sujet = ""
+ message = ""
+ nom = f"{utilisateur.first_name} {utilisateur.last_name}"
+
+ if type_notification == "reservation_creee":
+ sujet = "Confirmation de votre réservation"
+ message = f"Bonjour {nom}, votre réservation a été enregistrée."
+
+ elif type_notification == "reservation_validee":
+ sujet = "Réservation validée"
+ message = f"Bonjour {nom}, votre réservation a été validée."
+
+ elif type_notification == "reservation_refusee":
+ sujet = "Réservation refusée"
+ message = f"Bonjour {nom}, votre réservation a été refusée."
+
+ elif type_notification == "reservation_annulee":
+ sujet = "Réservation annulée"
+ message = f"Bonjour {nom}, votre réservation a été annulée."
+
+ elif type_notification == "lien_zoom":
+ sujet = "Lien Zoom ajouté"
+ message = f"Bonjour {nom}, un lien Zoom a été ajouté à votre réservation : {Reservation.lien_zoom}"
+
+ send_mail(
+ sujet,
+ message,
+ "admin@tonsite.com",
+ [utilisateur.email],
+ fail_silently=False,
+ )
+
diff --git a/gestion_conge/__pycache__/__init__.cpython-312.pyc b/gestion_conge/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 0000000..3163171
Binary files /dev/null and b/gestion_conge/__pycache__/__init__.cpython-312.pyc differ
diff --git a/gestion_conge/__pycache__/admin.cpython-312.pyc b/gestion_conge/__pycache__/admin.cpython-312.pyc
new file mode 100644
index 0000000..fc5338f
Binary files /dev/null and b/gestion_conge/__pycache__/admin.cpython-312.pyc differ
diff --git a/gestion_conge/__pycache__/apps.cpython-312.pyc b/gestion_conge/__pycache__/apps.cpython-312.pyc
new file mode 100644
index 0000000..9e13ffe
Binary files /dev/null and b/gestion_conge/__pycache__/apps.cpython-312.pyc differ
diff --git a/gestion_conge/__pycache__/forms.cpython-312.pyc b/gestion_conge/__pycache__/forms.cpython-312.pyc
new file mode 100644
index 0000000..a39b119
Binary files /dev/null and b/gestion_conge/__pycache__/forms.cpython-312.pyc differ
diff --git a/gestion_conge/__pycache__/models.cpython-312.pyc b/gestion_conge/__pycache__/models.cpython-312.pyc
new file mode 100644
index 0000000..3f9a896
Binary files /dev/null and b/gestion_conge/__pycache__/models.cpython-312.pyc differ
diff --git a/gestion_conge/__pycache__/urls.cpython-312.pyc b/gestion_conge/__pycache__/urls.cpython-312.pyc
new file mode 100644
index 0000000..c39278b
Binary files /dev/null and b/gestion_conge/__pycache__/urls.cpython-312.pyc differ
diff --git a/gestion_conge/__pycache__/views.cpython-312.pyc b/gestion_conge/__pycache__/views.cpython-312.pyc
new file mode 100644
index 0000000..a77c215
Binary files /dev/null and b/gestion_conge/__pycache__/views.cpython-312.pyc differ
diff --git a/gestion_conge/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestion_conge/migrations/__pycache__/0001_initial.cpython-312.pyc
new file mode 100644
index 0000000..9390055
Binary files /dev/null and b/gestion_conge/migrations/__pycache__/0001_initial.cpython-312.pyc differ
diff --git a/gestion_conge/migrations/__pycache__/__init__.cpython-312.pyc b/gestion_conge/migrations/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 0000000..dad8cda
Binary files /dev/null and b/gestion_conge/migrations/__pycache__/__init__.cpython-312.pyc differ
diff --git a/gestion_conge/static/gestion_conge/js/detail_conges.js b/gestion_conge/static/gestion_conge/js/detail_conges.js
index fd39b94..d7aff14 100644
--- a/gestion_conge/static/gestion_conge/js/detail_conges.js
+++ b/gestion_conge/static/gestion_conge/js/detail_conges.js
@@ -36,14 +36,12 @@ if(bouton_enregistrer_detail){
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){
@@ -67,9 +65,9 @@ if(document.getElementById("validation_hierarchique_valide")){
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";
+ }else{
+ document.getElementById("motif_refus_container").className="d-block form-group mt-3";
}
})
}
\ No newline at end of file
diff --git a/gestion_conge/templates/gestion_conge/parts/modalDetailConge.html b/gestion_conge/templates/gestion_conge/parts/modalDetailConge.html
index d3d3051..5c81ca0 100644
--- a/gestion_conge/templates/gestion_conge/parts/modalDetailConge.html
+++ b/gestion_conge/templates/gestion_conge/parts/modalDetailConge.html
@@ -65,7 +65,7 @@
-
+
diff --git a/gestion_employe/__pycache__/__init__.cpython-312.pyc b/gestion_employe/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 0000000..cc1b99e
Binary files /dev/null and b/gestion_employe/__pycache__/__init__.cpython-312.pyc differ
diff --git a/gestion_employe/__pycache__/admin.cpython-312.pyc b/gestion_employe/__pycache__/admin.cpython-312.pyc
new file mode 100644
index 0000000..10d005f
Binary files /dev/null and b/gestion_employe/__pycache__/admin.cpython-312.pyc differ
diff --git a/gestion_employe/__pycache__/forms.cpython-312.pyc b/gestion_employe/__pycache__/forms.cpython-312.pyc
new file mode 100644
index 0000000..af0aa03
Binary files /dev/null and b/gestion_employe/__pycache__/forms.cpython-312.pyc differ
diff --git a/gestion_employe/__pycache__/models.cpython-312.pyc b/gestion_employe/__pycache__/models.cpython-312.pyc
new file mode 100644
index 0000000..25334f8
Binary files /dev/null and b/gestion_employe/__pycache__/models.cpython-312.pyc differ
diff --git a/gestion_employe/__pycache__/urls.cpython-312.pyc b/gestion_employe/__pycache__/urls.cpython-312.pyc
new file mode 100644
index 0000000..4a6237c
Binary files /dev/null and b/gestion_employe/__pycache__/urls.cpython-312.pyc differ
diff --git a/gestion_employe/__pycache__/views.cpython-312.pyc b/gestion_employe/__pycache__/views.cpython-312.pyc
new file mode 100644
index 0000000..86e62fa
Binary files /dev/null and b/gestion_employe/__pycache__/views.cpython-312.pyc differ
diff --git a/gestion_employe/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestion_employe/migrations/__pycache__/0001_initial.cpython-312.pyc
new file mode 100644
index 0000000..dcb5fe0
Binary files /dev/null and b/gestion_employe/migrations/__pycache__/0001_initial.cpython-312.pyc differ
diff --git a/gestion_employe/migrations/__pycache__/__init__.cpython-312.pyc b/gestion_employe/migrations/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 0000000..f712f59
Binary files /dev/null and b/gestion_employe/migrations/__pycache__/__init__.cpython-312.pyc differ
diff --git a/gestion_employe/static/gestion_employe/js/index.js b/gestion_employe/static/gestion_employe/js/index.js
index 95eb1d8..0d04aaa 100644
--- a/gestion_employe/static/gestion_employe/js/index.js
+++ b/gestion_employe/static/gestion_employe/js/index.js
@@ -1,6 +1,7 @@
const $ = (element) => document.getElementById(element);
const url_liste_employe = $("tableau_liste_employe").dataset.url;
+
const tableau_liste_employe = new Tabulator("#tableau_liste_employe", {
columns: [
{"title": "Matricule", "field": "matricule"},
@@ -12,6 +13,8 @@ const tableau_liste_employe = new Tabulator("#tableau_liste_employe", {
// ajaxURL: url_liste_employe,
pagination: true,
paginationSize: 10,
+
+
})
fetch(url_liste_employe)
@@ -44,6 +47,8 @@ tableau_liste_employe.on("rowClick", function (row, rowData) {
document.getElementById('document-diplome').href = data.diplome;
document.getElementById('document-diplome').textContent = data.diplome || "Aucun diplôme";
+ document.getElementById('document-photo').href = data.photo;
+ document.getElementById('document-photo').textContent = data.photo || "Aucune photo";
document.getElementById('document-cv').href = data.CV;
document.getElementById('document-cv').textContent = data.CV || "Aucun CV";
document.getElementById('document-rib').href = data.rib;
@@ -123,6 +128,7 @@ tableau_liste_employe.on("rowClick", function (row, rowData) {
`
};
+
const supprimerButtons = document.getElementsByClassName("btn-supprimer-contrat");
Array.from(supprimerButtons).forEach(button => {
@@ -144,8 +150,46 @@ tableau_liste_employe.on("rowClick", function (row, rowData) {
location.reload();
})
});
- })
+ }),
+
+ document.addEventListener("click", function (e) {
+ if (e.target.closest(".btn-modifier-contrat")) {
+
+ const button = e.target.closest(".btn-modifier-contrat");
+ const parent = button.closest(".col-6");
+
+ const contratId = button.dataset.contratid;
+
+ const data = {
+ type_contrat: parent.querySelector("select").value,
+ date_debut: parent.querySelectorAll("input")[1].value,
+ date_fin: parent.querySelectorAll("input")[2].value,
+ salaire_mensuel: parent.querySelectorAll("input")[3].value,
+ statut: parent.querySelectorAll("input")[4].value,
+ };
+
+ fetch(`/contrat/modifier/${contratId}/`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "X-CSRFToken": document.querySelector('[name=csrfmiddlewaretoken]').value
+ },
+ body: JSON.stringify(data)
+ })
+ .then(response => response.json())
+ .then(data => {
+ if (data.message) {
+ alert(data.message);
+ } else {
+ alert(data.error || "Erreur");
+ }
+ })
+ .catch(error => {
+ console.error("Erreur:", error);
+ });
+ }
+ });
document.getElementById("affectation-nom-employe").textContent = data.employe || "Employé inconnu";
document.getElementById("affecter_employe_id").value = data.id;
@@ -204,7 +248,7 @@ tableau_liste_employe.on("rowClick", function (row, rowData) {
const modal = new bootstrap.Modal($("modalDetailEmploye"));
modal.show();
})
-
+
$("enregistrerDetail").addEventListener("click", function() {
const id_ = document.getElementById('detail-id').value;
const fonction = document.getElementById('detail-fonction').value;
diff --git a/gestion_employe/static/gestion_employe/js/mon_profil.js b/gestion_employe/static/gestion_employe/js/mon_profil.js
index 64c77f9..186e5a4 100644
--- a/gestion_employe/static/gestion_employe/js/mon_profil.js
+++ b/gestion_employe/static/gestion_employe/js/mon_profil.js
@@ -16,27 +16,36 @@ const tableau_certificat = new Tabulator("#tableau-certificat", {
],
ajaxURL: url_certificat,
})
-
const enregistrerProfil = $("enregistrerProfil");
+
enregistrerProfil.addEventListener("click", (e) => {
+
const url = $("information-personnelles").dataset.url;
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);
+ formData.append("telephone", $("telephone").value);
+ 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',
+ method: "POST",
headers: {
- 'Content-Type': 'application/json',
- 'X-CSRFToken': csrftoken
+ "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,
- })
+ body: formData
})
.then(response => response.json())
.then(data => alert(data.message))
-})
\ No newline at end of file
+ .catch(error => console.error("Erreur:", error));
+});
\ No newline at end of file
diff --git a/gestion_employe/templates/gestion_employe/monprofil.html b/gestion_employe/templates/gestion_employe/monprofil.html
index 410fd7f..850837f 100644
--- a/gestion_employe/templates/gestion_employe/monprofil.html
+++ b/gestion_employe/templates/gestion_employe/monprofil.html
@@ -19,17 +19,14 @@
{% endfor %}
{% endif %}
-
-{% if expiration_contrat %}
- {% if contrat_nb_jours_restant %}
+{% if not expiration_contrat %}
+
+ Important : Les informations sur votre contrat n'ont pas été renseignées, veuillez contacter les ressources humaines.
+
+{% elif contrat_nb_jours_restant %}
Important : Votre contrat de travail expire dans {{ contrat_nb_jours_restant }} jours, veuillez contacter les ressources humaines.
- {% endif %}
-{% else %}
-
- Important : Les informations sur votre contrat n'ont pas été renseignées, veuillez contacter les ressources humaines.
-
{% endif %}
\ No newline at end of file
+
+
+
diff --git a/gestion_salle/templates/gestion_salle/parts/modalDetailResevation.html b/gestion_salle/templates/gestion_salle/parts/modalDetailResevation.html
index fb84ee8..27d7d1f 100644
--- a/gestion_salle/templates/gestion_salle/parts/modalDetailResevation.html
+++ b/gestion_salle/templates/gestion_salle/parts/modalDetailResevation.html
@@ -21,8 +21,12 @@