diff --git a/SIRH/templates/SIRH/parts/menu_principal.html b/SIRH/templates/SIRH/parts/menu_principal.html index b9021f3..64ee3a5 100644 --- a/SIRH/templates/SIRH/parts/menu_principal.html +++ b/SIRH/templates/SIRH/parts/menu_principal.html @@ -2,6 +2,21 @@ {% load tags_personnaliser %}
+
+ {% if user.employe.photo %} + + {% else %} + + {% endif %} +
+ {{ user.username }} +
+
+ Mon profil diff --git a/gestion_employe/static/gestion_employe/js/mon_profil.js b/gestion_employe/static/gestion_employe/js/mon_profil.js index 64c77f9..77178b4 100644 --- a/gestion_employe/static/gestion_employe/js/mon_profil.js +++ b/gestion_employe/static/gestion_employe/js/mon_profil.js @@ -16,27 +16,31 @@ 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); + 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..ed42962 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 %}
@@ -44,6 +41,13 @@
{% csrf_token %}
+
+ + {% if employe.photo %} + Fichier actuel : {{employe.photo}} + {% endif %} + +
@@ -63,12 +67,13 @@
+ +
+
-
-
@@ -167,6 +172,13 @@ {% csrf_token %}
+
+ + {% if employe.photo %} + Fichier actuel : {{employe.photo}} + {% endif %} + +
{% if employe.CV %} diff --git a/gestion_employe/templates/gestion_employe/parts/modalDetailEmploye.html b/gestion_employe/templates/gestion_employe/parts/modalDetailEmploye.html index 187ef49..029910e 100644 --- a/gestion_employe/templates/gestion_employe/parts/modalDetailEmploye.html +++ b/gestion_employe/templates/gestion_employe/parts/modalDetailEmploye.html @@ -93,9 +93,6 @@ {% if user|has_group:"ressource_humaine" %}
- diff --git a/gestion_employe/views.py b/gestion_employe/views.py index e8e6374..1067b82 100644 --- a/gestion_employe/views.py +++ b/gestion_employe/views.py @@ -204,15 +204,17 @@ def modifier_employer(request): return JsonResponse({"message": "Profil mis à jour avec succès."}) + def enregistrement_document(request): - employe = Employe.objects.get(user__username=request.user) + employe = Employe.objects.get(user=request.user) if request.method == "POST": - employe.CV = request.FILES["cv"] if 'cv' in request.FILES else employe.CV - employe.diplome = request.FILES["diplome"] if 'diplome' in request.FILES else employe.diplome - employe.rib = request.FILES["rib"] if 'rib' in request.FILES else employe.rib - employe.casier_judiciaire = request.FILES["casier_judiciaire"] if 'casier_judiciaire' in request.FILES else employe.casier_judiciaire - messages.success(request, "Documents enregistrés avec succès.") + if request.FILES.get("photo"):employe.photo = request.FILES["photo"] + if "cv" in request.FILES:employe.CV = request.FILES["cv"] + if "diplome" in request.FILES: employe.diplome = request.FILES["diplome"] + if "rib" in request.FILES: employe.rib = request.FILES["rib"] + if "casier_judiciaire" in request.FILES:employe.casier_judiciaire = request.FILES["casier_judiciaire"] employe.save() + messages.success(request, "Documents enregistrés avec succès.") return redirect("gestion_employe:mon-profil") diff --git a/gestion_projet/__pycache__/urls.cpython-312.pyc b/gestion_projet/__pycache__/urls.cpython-312.pyc index b941eb2..f750091 100644 Binary files a/gestion_projet/__pycache__/urls.cpython-312.pyc and b/gestion_projet/__pycache__/urls.cpython-312.pyc differ diff --git a/gestion_projet/__pycache__/views.cpython-312.pyc b/gestion_projet/__pycache__/views.cpython-312.pyc index 4bc400f..84b4b2f 100644 Binary files a/gestion_projet/__pycache__/views.cpython-312.pyc and b/gestion_projet/__pycache__/views.cpython-312.pyc differ diff --git a/gestion_projet/static/gestion_projet/js/enregistrement_bailleur.js b/gestion_projet/static/gestion_projet/js/enregistrement_bailleur.js index afe12ea..c09f502 100644 --- a/gestion_projet/static/gestion_projet/js/enregistrement_bailleur.js +++ b/gestion_projet/static/gestion_projet/js/enregistrement_bailleur.js @@ -1,4 +1,5 @@ const btnEnregistrerBailleur = document.getElementById('btnEnregistrerBailleur'); +let table; btnEnregistrerBailleur.addEventListener('click', function() { const form = document.getElementById('formBailleur'); @@ -20,4 +21,31 @@ btnEnregistrerBailleur.addEventListener('click', function() { alert('Ce bailleur existe déjà dans la base de données.'); } }); -}); \ No newline at end of file +}); + +document.addEventListener("DOMContentLoaded", function () { + + table = new Tabulator("#table-bailleurs", { + ajaxURL: "/gestion-projet/bailleurs/", + layout: "fitColumns", + pagination: "local", + paginationSize: 5, + + columns: [ + {title: "#", formatter: "rownum", width: 60}, + {title: "Organisme", field: "nom_organisme"}, + {title: "Contact", field: "contact"}, + {title: "Email", field: "email"}, + {title: "Pays", field: "pays"}, + ], + rowDblClick: function(e, row) { + const data = row.getData(); + + if (confirm(`Voulez-vous vraiment supprimer ${data.nom_organisme} ?`)) { + supprimerBailleur(data.id); + } + } + }); + +}); + diff --git a/gestion_projet/templates/gestion_projet/parts/creation_bailleur.html b/gestion_projet/templates/gestion_projet/parts/creation_bailleur.html index 6fe4194..2f31a37 100644 --- a/gestion_projet/templates/gestion_projet/parts/creation_bailleur.html +++ b/gestion_projet/templates/gestion_projet/parts/creation_bailleur.html @@ -1,20 +1,51 @@
-
\ No newline at end of file +
diff --git a/gestion_salle/views.py b/gestion_salle/views.py index de589cf..6ffc9d6 100644 --- a/gestion_salle/views.py +++ b/gestion_salle/views.py @@ -18,6 +18,9 @@ def index(request:HttpRequest): messages.error(request, "Impossible d'accéder au menu 'Reservation de salle' car votre profil Utilisateur n'est lié à aucun profil Employe. Veuillez contacter l'administrateur.") return redirect('gestion_conges:conge') + nom = request.user.last_name + prenom = request.user.first_name + if request.method == "POST": form = ReservationForm(request.POST) if form.is_valid(): @@ -42,6 +45,13 @@ def index(request:HttpRequest): besoin_ordi = besoin_ordi, motif_reservation=motif_reservation, ) + + if not nom or not prenom or nom.strip() == "" or prenom.strip() == "": + messages.error( + request, + "Vous devez renseigner un nom et un prénom valides pour effectuer une réservation." + ) + return redirect('gestion_salle:reservation-salle') reservation.save() date_debut = date_debut + timedelta(days=1) @@ -117,7 +127,6 @@ def detail_reservation(request:HttpRequest, reservation_id:int): 'besoin_zoom': reservation.besoin_zoom, 'besoin_ordinateur': reservation.besoin_ordi, 'lien_zoom': reservation.lien_zoom or '', - 'motif_refus': reservation.motif_refus or '', } return JsonResponse(reservation_json, safe=True)