From fc2e58fe1505e4761dde3faa16104372fe2ace04 Mon Sep 17 00:00:00 2001 From: fatima Date: Thu, 30 Apr 2026 12:19:37 +0200 Subject: [PATCH] =?UTF-8?q?=20photo=20de=20profil=20ajout=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SIRH/templates/SIRH/parts/menu_principal.html | 15 +++++ .../static/gestion_employe/js/mon_profil.js | 32 +++++----- .../templates/gestion_employe/monprofil.html | 32 ++++++---- .../parts/modalDetailEmploye.html | 3 - gestion_employe/views.py | 14 +++-- .../__pycache__/urls.cpython-312.pyc | Bin 3222 -> 3315 bytes .../__pycache__/views.cpython-312.pyc | Bin 30579 -> 31278 bytes .../js/enregistrement_bailleur.js | 30 +++++++++- .../parts/creation_bailleur.html | 55 ++++++++++++++---- gestion_projet/urls.py | 11 +++- gestion_projet/views.py | 15 +++++ .../__pycache__/views.cpython-312.pyc | Bin 11139 -> 11534 bytes .../parts/modalDetailResevation.html | 9 ++- gestion_salle/views.py | 11 +++- 14 files changed, 174 insertions(+), 53 deletions(-) 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 b941eb2da40b6dcddbbc882a12ee7989b3154b57..f75009124d5e81a03c301e84856942a023f4c862 100644 GIT binary patch delta 558 zcmbOx`B_r^G%qg~0}!m2`jokWhk@ZShyw%CP{!vy8`Z-Y1x44euV#h_F)^evrie}M zW9*-JSAbDwvL2JTr7W7XTq<*x3d|@3og$B>PGNE#P`4tQs1i`O20|B%m7jouZDWPGhnhv$&-uny3~~w*f*IjFqB|rcP&a9s=8U|uA{m6Vv7lapFnRIFdcpOaZ!lBx?A z*__A{!npYus{#|F?BwU{QT%*h1@SNin;kgVnYh$}b}#~QaoFTQu4ECB8(jR?x#TW# p$=%?S|H96~%Jz|G^Lj29Mnr)Z$5)0`~FEN-cVCaMk8ZGg}PW2NYzsneaD$1HBGhbF2I)NKOO zgP>Ck5bDy!qNFPgHH{{}U|zI&IZH630Dn$qaY?FfQetLKPHJgU@#debicE|$lchPL uHn(!HF>$E@O=1M%V%y16xso>va@#X9icAjVnaUf_T*AoD)W}@~3Tyz?Gfe&f diff --git a/gestion_projet/__pycache__/views.cpython-312.pyc b/gestion_projet/__pycache__/views.cpython-312.pyc index 4bc400f186b45b24209e8e0a555b4a7ef27c50bc..84b4b2f6eb7ffc5266b21ab5cf2997c93a30a3e7 100644 GIT binary patch delta 1640 zcmZvce@t6d6vy9vudhJ6mdCFlY@}raMj?odA9IW{vmZnqYy)*DWFv)EEGs{D+irqv zpz;Se9bsn%bvUy4j|7L3r<-%jqJTlBW#qdSY%y#wF!7Hq@tmS@EWEUzeD68; z+#l!Oa~E#0p+#o=+F;NL_??Kq;}pw#j1P%MaX9rbi*kh9*LDbllF+ z?Me693+%}qLWR|yf-JOeKyGbLwOG_Nu`od&hLIBf7vdRo+w(x#69xv&2HpN$f^bx7 z73;!)#YHg*&g!DYRtZXtF_KhgBqI!K(jT#leexiq`2~Rqua{^9Ps~zF5L!jM^nqqj zTxvfhSmc&$7&4mL%$`QC+w5|<&DA!i%jNKLx4A{iaM~?$Ky=!9K1KvWY8o3nwi-`B zcGP39fTqdT>@MP2=(FfKO~SJYIfPuoql9Aw8i2PE+6gZcv(YE8#hW zTZ1s;$G4#f7+p@c$5Hj)+W0GIJW1VJ5beUER)~o6DdtJV>{F5^m82;p#iwLWDw!Y2 zQ%YX@6Mns+eTUz$`i>AH>pPi0bXB*$OYb*^ciX${{;#U(W~vz&g-=?y1xW%n0`*e*hK~Y-j}K#GPP-#s?M)3VeB>7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(80H(G=XMTD z_f8@1=XDrwRlp;e>5V1Ima8j|QWZv4U_b?iP+)?@NdRwMTm|rI1YU~3Z3
-
\ 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)