From 643205a4bbf0fb6c32693d00af0e7cb2327c5485 Mon Sep 17 00:00:00 2001 From: Soriba SYLLA Date: Tue, 4 Aug 2026 09:34:31 +0000 Subject: [PATCH] Premiere implementation de sso --- SIRH/__pycache__/__init__.cpython-310.pyc | Bin 126 -> 123 bytes SIRH/__pycache__/settings.cpython-310.pyc | Bin 3345 -> 3200 bytes SIRH/__pycache__/urls.cpython-310.pyc | Bin 1362 -> 1359 bytes SIRH/__pycache__/wsgi.cpython-310.pyc | Bin 523 -> 520 bytes SIRH/settings.py | 43 ++++++++---------- .../SIRH/parts/menu_application.html | 6 +-- SIRH/templates/SIRH/parts/menu_principal.html | 4 +- .../fonctions_utilitaire.cpython-310.pyc | Bin 2135 -> 2132 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 135 -> 132 bytes .../__pycache__/admin.cpython-310.pyc | Bin 176 -> 173 bytes .../__pycache__/apps.cpython-310.pyc | Bin 427 -> 424 bytes .../__pycache__/forms.cpython-310.pyc | Bin 861 -> 858 bytes .../__pycache__/models.cpython-310.pyc | Bin 1287 -> 1284 bytes .../__pycache__/urls.cpython-310.pyc | Bin 554 -> 551 bytes .../__pycache__/views.cpython-310.pyc | Bin 6053 -> 6050 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 137 -> 134 bytes .../__pycache__/admin.cpython-310.pyc | Bin 628 -> 625 bytes .../__pycache__/forms.cpython-310.pyc | Bin 2742 -> 2739 bytes .../__pycache__/models.cpython-310.pyc | Bin 5607 -> 5604 bytes .../__pycache__/urls.cpython-310.pyc | Bin 1511 -> 1508 bytes .../__pycache__/views.cpython-310.pyc | Bin 14436 -> 14433 bytes .../tags_personnaliser.cpython-310.pyc | Bin 1120 -> 1117 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 136 -> 133 bytes .../__pycache__/admin.cpython-310.pyc | Bin 441 -> 438 bytes .../__pycache__/forms.cpython-310.pyc | Bin 4554 -> 4551 bytes .../__pycache__/models.cpython-310.pyc | Bin 7657 -> 7654 bytes .../__pycache__/urls.cpython-310.pyc | Bin 2349 -> 2346 bytes .../__pycache__/views.cpython-310.pyc | Bin 16653 -> 16650 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 135 -> 132 bytes .../__pycache__/admin.cpython-310.pyc | Bin 176 -> 173 bytes .../__pycache__/apps.cpython-310.pyc | Bin 370 -> 367 bytes .../__pycache__/forms.cpython-310.pyc | Bin 1556 -> 1553 bytes .../__pycache__/models.cpython-310.pyc | Bin 1502 -> 1499 bytes .../__pycache__/urls.cpython-310.pyc | Bin 929 -> 926 bytes .../__pycache__/views.cpython-310.pyc | Bin 7588 -> 7585 bytes staticfiles/gestion_conge/js/index.js | 6 +-- staticfiles/gestion_employe/js/index.js | 1 + staticfiles/gestion_employe/js/mon_profil.js | 32 +++++++------ .../js/enregistrement_bailleur.js | 30 +++++++++++- staticfiles/gestion_salle/js/index.js | 33 ++++++++------ 40 files changed, 93 insertions(+), 62 deletions(-) diff --git a/SIRH/__pycache__/__init__.cpython-310.pyc b/SIRH/__pycache__/__init__.cpython-310.pyc index 92d486cc0f049ea40a94cbcb8e03ab405436c939..95c1059ee5917b770e059c1ec6daad3fc6901aaf 100644 GIT binary patch delta 31 lcmb=c=E>*fZcZgMrxAshf?*M&)0^JRLZ-A}`gpDLKJR;mfd^hpEV8kZq;Zd>g-pqGGFPNbB zfhi!+Kp#0{enbL-{yW0pei*<5FbG4W>+m%qIMPN-8?9{|+g?T(iR#>o5c$|2fg(5>IU=dG}%ud)TSi;lb zz%$^)v*5yWu#D$n1uuXb+h7$hk}h^w!%Jkf^=pJ3CK7Crz{xwX3+M!8+kAS5FhWTM zsTK#C=G_Dr$RxQ`BFXwQF)kDgMH5eU)f-y*(DAJxsmVvyhoG1h3uPzdoVjei#EVdI zo?TTgPMaFPFBA1f*mjUguw1i?FmZ1paTw$LZFVn~NVbD`j7!>(q#+$`>ZY2Fl2L4v zX=_B>t{_bRD! zrO0AW6-TaE`RJmQKR6B?mJV{!<(KEd=FXYtg+IP}8H}F=gPv6QB3^U*(yP*yFB(Y( zxyt2bsSt{tlr~R8QO{{|xppeK>nCLn3sLOe+Dz?6>h2R+KHqk^WWFLhvX}A+FUrEP zkk86OS#;)k=~yT@%Ti%`%j2r>Qk9on%E!(f6i|%%Ioh_YjOt3Xq*Gq&4jGjo%F0*W zcjZf$e@&Vvuay=EG);as;7x^-nE)4yWY~x|6n;-h`>lElevP@RS;9`G zLuvJTq(?m}t-4!fqD@H4Xbp^xW=x1iTAF@lelyREk=D{k{ZDnuXZ?neVbEXIqL%&v Dgu~vy delta 995 zcmZutOHUg~5T0%ZGZ>qP!`p#`1PJC~8;rq_3lltqhw)@RV~6y`GOo5g#(10=gM%+5 ziWKcN8trApVaY9L&iNxFt#a7>g4P4M%D%tu&`#)uKIpyViwJyh zhiUphAPvF51!G7*43Yub4nuDd3?E@52O}_gQ|Z6NaQ6ahhzwQ-SZ0hV$KN7`_Z+bE&s7W;+i7zY z%DHM$55i&aFqc1~RWO6*%ZgT~k*1rG|Gop*c1g*nJ4wmrlj6Q)UAp||-ngiWPeet^ zwkZ2om{z2e-FK6HCMwEvITgR9*p?ObR`^U#sR5TU#3nL^8Q8qjLb$2qodUk4a|F$8 zC|}KVoTBqaCQ>adzBr(yMr(zbwkyK(d|_8smY-w}UQ~AW%sok2N|orzZsH_*mM4mjX49#J1znQ$N9Xi{?TbrWVmhH_w^H(cR@xVL5+6B3X|1;f-zGvO{g{SK-Jlig z@2;uMcZ}sZ!Q(+5)Y~Swy4!qM-~})5#=H+`Zv0IsDA5dZ)H delta 37 rcmX@lb%~2RpO=@50SHph7;ogh#=;}3pOK%Ns$ZO6l$ta76-z1r!AuK@ diff --git a/SIRH/__pycache__/wsgi.cpython-310.pyc b/SIRH/__pycache__/wsgi.cpython-310.pyc index e1f658ca81013663e025ae4eeb9cf88612a8bc31..dae042cccd7c5dc79c90a8cb43c24bed1b2526c4 100644 GIT binary patch delta 35 pcmeBX>0sf>=jG*M0D|+^GqX1G9AV^?(l1La(l0MBpL~Z=9{{BC3WNXv delta 38 scmeBR>1N@{=jG*M0D{_me=;}n9AV^<)z8S!P1P^XFG|gse3MZh0Ldl`&Hw-a diff --git a/SIRH/settings.py b/SIRH/settings.py index a07e0fc..df3bb06 100644 --- a/SIRH/settings.py +++ b/SIRH/settings.py @@ -24,9 +24,10 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = config('DEBUG', default=False, cast=bool) +DEBUG = config('DEBUG', default=True, cast=bool) -ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=[]).split(',') +ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=[]).split(',') +CSRF_TRUSTED_ORIGINS = config("CSRF_TRUSTED_ORIGINS", default=[]).split(",") # Application definition @@ -77,24 +78,16 @@ WSGI_APPLICATION = 'SIRH.wsgi.application' # https://docs.djangoproject.com/en/5.2/ref/settings/#databases -if config('ENVIRONMENT') == 'local': - DATABASES = { +DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } - } -else: - DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': config('DATABASE_NAME'), - 'USER': config('DATABASE_USER'), - 'PASSWORD': config('DATABASE_PASSWORD'), - 'HOST': config('DATABASE_HOST'), - 'PORT': config('DATABASE_PORT'), - } + 'ENGINE': 'django.db.backends.mysql', + 'NAME': config("DB_NAME"), + 'USER': config("DB_USER"), + 'PASSWORD': config("DB_PASSWORD"), + 'HOST': config("DB_HOST"), + 'PORT': config("DB_PORT", cast=int), } +} # Password validation # https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators @@ -151,10 +144,10 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' # LOGIN_URL = '/client/' LOGIN_URL = 'simple-sso-login' -SSO_PRIVATE_KEY = 'wV3nf1YXeZpepf8iJAdWcfJOS4BVXYlIKsKES2RheuJLu5ycgm0ZK3zgdw9ODjdo' # Designe la clé privée -SSO_PUBLIC_KEY = 'E8vV810D8HSmhUwl6abuZALhO5fmUdjjd3wAVCFZyyDX7SsSeAf9XwVyKZ5brilt' # Designe la clé publique -SSO_SERVER = 'http://localhost:8000/server/' -SSO_LOGOUT_URL = 'http://localhost:8000/deconnexion' +SSO_PRIVATE_KEY = 'D2brFY3LnNDLQBBnvYPXAn185Wi9EpPvnHsUosjEZ9vZMyEtXqkcVfFWkVbN0xpG' +SSO_PUBLIC_KEY = 'm9JDP3uGPmGG9ULqPw2BY3ryBNMTGRsuukgIOhk7lIN9lT0wlr2zhoRZiNZ28UCM' +SSO_SERVER = 'http://test-authentification.cerfig.org:89/server/' +#SSO_LOGOUT_URL = 'http://test-authentification.cerfig.org:89/deconnexion' # Configuration de l'email EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' @@ -162,6 +155,6 @@ EMAIL_HOST = 'ssl0.ovh.net' EMAIL_PORT = 465 EMAIL_USE_SSL = True EMAIL_USE_TLS = False -EMAIL_HOST_USER = 'support.it@cerfig.org' -EMAIL_HOST_PASSWORD = 'Cerfig2025' -DEFAULT_FROM_EMAIL = EMAIL_HOST_USER \ No newline at end of file +EMAIL_HOST_USER = config("EMAIL_HOST_USER") +EMAIL_HOST_PASSWORD = config("EMAIL_HOST_PASSWORD") +DEFAULT_FROM_EMAIL = EMAIL_HOST_USER diff --git a/SIRH/templates/SIRH/parts/menu_application.html b/SIRH/templates/SIRH/parts/menu_application.html index e07de74..46b6ab4 100644 --- a/SIRH/templates/SIRH/parts/menu_application.html +++ b/SIRH/templates/SIRH/parts/menu_application.html @@ -1,8 +1,8 @@ \ No newline at end of file + diff --git a/SIRH/templates/SIRH/parts/menu_principal.html b/SIRH/templates/SIRH/parts/menu_principal.html index 54e0a9d..ddf1e44 100644 --- a/SIRH/templates/SIRH/parts/menu_principal.html +++ b/SIRH/templates/SIRH/parts/menu_principal.html @@ -42,7 +42,7 @@ Réservation {% comment %} {% url 'deconnexion' %} {% endcomment %} - + Déconnexion - \ No newline at end of file + diff --git a/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-310.pyc b/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-310.pyc index dae81941abfcbc9d54efb4f892fcc323a0caf915..eb6291db7a8c0e31ff9113b68f13e71544dc27ed 100644 GIT binary patch delta 35 pcmcaEa7BPSpO=@50SFqdWp3m?&%|k|UzS*;UtV6m`599oD*(4`3l#tW delta 38 scmca2a9w~qpO=@50SG$0c{XyNXX3HZ&&bbB)i2I3O3m5)n5mEz0L8%zSO5S3 diff --git a/gestion_conge/__pycache__/__init__.cpython-310.pyc b/gestion_conge/__pycache__/__init__.cpython-310.pyc index 987b2f8dfd8e4b3bc3c7f842c2a83262f093ccf0..bb6608d0253385e1e3be8fd467287206eeffc1e7 100644 GIT binary patch delta 33 ncmZo?Y+>Zd=jG*M0D^{VnOPHgtU1;7%My$9%gf6r2Aco?g6jza delta 36 qcmZo+Y-i-j=jG*M0D{_me=;ZXSo3JKEr1rRGcwFaZFm>xPg%;pO=@50SIdM{mGojlg^{ApOK%Ns$ZO6l$tZK#t;CwHVZ%i diff --git a/gestion_conge/__pycache__/apps.cpython-310.pyc b/gestion_conge/__pycache__/apps.cpython-310.pyc index 609f119ab8c7873be59ef4c65de73a91cca827b5..111e72c07199811904621c07c31a06ee85095f7a 100644 GIT binary patch delta 35 pcmZ3@yn>l0pO=@50SFqdWoB*Ukz(Xj)-Ove(l0MBpKQcf2>_aM32^`b delta 38 scmZ3%yqcLOpO=@50SIdM{mIX#)J>6e$6Z~nu?%>)3fZVH0{ delta 39 tcmZqSYUkp~=jG*M0D{_me=;}nJYnL|(9g)vP1P^XFG|hX{F8~B2>{uv3>^Rf diff --git a/gestion_conge/__pycache__/urls.cpython-310.pyc b/gestion_conge/__pycache__/urls.cpython-310.pyc index 13410875a806db51ac8d70b72271b52a8f77546b..5616d7fa923e94e974d8207368988679a1cf181a 100644 GIT binary patch delta 35 pcmZ3*vYdq{pO=@50SFqdWoB*U*}}-FtY4N`q+ecMKKTq|8~~-m3W@*# delta 38 scmZ3^vWkT#pO=@50SIdM{mIV0LNns%>V!Z diff --git a/gestion_employe/__pycache__/__init__.cpython-310.pyc b/gestion_employe/__pycache__/__init__.cpython-310.pyc index 7ef245dd2b37a82a6dda2dd1795392271af4053e..6ec686352a793424010bfc5adc3feb201ae231a3 100644 GIT binary patch delta 33 ncmeBVY-8lf=jG*M0D}5!nOPHgtT{FH%My$9%gf6r2Acr@gK-H7 delta 36 qcmZo;>}2H0=jG*M0D{_me=;ZXSo7%UXXNLm>KEr1rRGcwFarRpm=MbpO=@50SM}^WoB*U31{L|(=SUb(l0MB-<;3n&H(_i7z!T% delta 39 tcmdlix=oZPpO=@50SIdM{mIBs5diZt43Pi; diff --git a/gestion_employe/__pycache__/urls.cpython-310.pyc b/gestion_employe/__pycache__/urls.cpython-310.pyc index 93ed628222ab9eb45626344d179ca0b930fdfc56..7e541c80f4e66c15f72b9951379f6a4e6d0021da 100644 GIT binary patch delta 35 pcmaFP{e+t*pO=@50SM}^WoB*U`Od|253xWUu diff --git a/gestion_projet/__pycache__/__init__.cpython-310.pyc b/gestion_projet/__pycache__/__init__.cpython-310.pyc index 48bd83f6db8eee71c967ab168b4c0dcfb6fb8caf..065b575bc85baacb46d7130a5de2c7246f73242c 100644 GIT binary patch delta 33 ncmeBRY-Qxh=jG*M0D^PZGqWc0SaWLVmn9bImzS4M3^oM-iDL;> delta 36 qcmZo=>|o@{=jG*M0D{_me=;ZXSo3J>XXNLm>KEr1rRGcwFa-drLJFV& diff --git a/gestion_projet/__pycache__/admin.cpython-310.pyc b/gestion_projet/__pycache__/admin.cpython-310.pyc index 21dd0522e1c49e71433e49752baf8f6796002c25..4bbfbced8c2fb8e0ae4874c9059d68fc40894440 100644 GIT binary patch delta 35 pcmdnVyp5SBpO=@50SL}r&&=A$!_3I3s$Z5^q+ecMK3SS^9sr|#3Dp1q delta 38 scmdnSypx$HpO=@50SIdM{mIpnil}X918CM delta 39 tcmX@Ed`g)opO=@50SIdM{mIx!MbHKS%d`ur delta 40 ucmeBbV(e{VZd=jG*M0D}5!nOPHgtU1;7%My$9%gf6r2Aco?g4YQF delta 36 qcmZo+Y-i-j=jG*M0D{_me=;ZXSo3JKEr1rRGcwFaZFm>xPg%;pO=@50SIdM{mGojlg^{ApOK%Ns$ZO6l$tZK#t;CwHVZ%i diff --git a/gestion_salle/__pycache__/apps.cpython-310.pyc b/gestion_salle/__pycache__/apps.cpython-310.pyc index 8c518c83764c04a530cc77b3759a3e320b7f7e1b..84176b72e5b7143f886ffd861d33ccaed5f949e6 100644 GIT binary patch delta 33 ncmeyw^qz?)pO=@50SM}^WoAv}dCaM-UzS*;UtV55@pm}@sAvml delta 36 qcmaFQ^ofZlpO=@50SIdM{mGoj^O#3XKO;XkRlhjDC^cu|k8%Lh@eKn2 diff --git a/gestion_salle/__pycache__/forms.cpython-310.pyc b/gestion_salle/__pycache__/forms.cpython-310.pyc index fdcd7e108a7602e75c576aec38f55e2d6193dc93..28cb16a6cc312da38faabb0dd87b49f18d73d967 100644 GIT binary patch delta 36 qcmbQjGm(cUpO=@50SM}^WoB*UdCknJqF&&bbB)i2I3O3m5)nsb{l0K0VyPyhe` diff --git a/staticfiles/gestion_conge/js/index.js b/staticfiles/gestion_conge/js/index.js index 1d156cf..5308791 100644 --- a/staticfiles/gestion_conge/js/index.js +++ b/staticfiles/gestion_conge/js/index.js @@ -3,7 +3,7 @@ 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", + // layout : "fitColumns", columns: [ {"title": "Nom et Prénom", "field": "prenom_nom"}, {"title": "Date de début", "field": "date_debut", formatter:"datetime", formatterParams:{ @@ -15,7 +15,7 @@ const tableau_liste_demande_conge = new Tabulator("#liste-demande-conges", { outputFormat:"dd/MM/yy", }}, {"title": "Type de congé", "field": "type"}, - {"title": "Date de la demande", "field": "date_demande"}, + {"title": "Date de la demande", "field": "date_demande", responsive: 1}, {"title": "Validation par supérieur hiérarchique", "field": "validation_hierarchique", formatter:"tickCross", formatterParams :{ allowEmpty : true , }}, @@ -24,7 +24,7 @@ const tableau_liste_demande_conge = new Tabulator("#liste-demande-conges", { }}, ], pagination: true, - paginationSize: 5 + paginationSize: 5, }) const bouton_demande_conges = $("bouton-demande-conge"); diff --git a/staticfiles/gestion_employe/js/index.js b/staticfiles/gestion_employe/js/index.js index 95eb1d8..ba451c1 100644 --- a/staticfiles/gestion_employe/js/index.js +++ b/staticfiles/gestion_employe/js/index.js @@ -12,6 +12,7 @@ const tableau_liste_employe = new Tabulator("#tableau_liste_employe", { // ajaxURL: url_liste_employe, pagination: true, paginationSize: 10, + responsiveLayout : "hide" }) fetch(url_liste_employe) diff --git a/staticfiles/gestion_employe/js/mon_profil.js b/staticfiles/gestion_employe/js/mon_profil.js index 64c77f9..77178b4 100644 --- a/staticfiles/gestion_employe/js/mon_profil.js +++ b/staticfiles/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/staticfiles/gestion_projet/js/enregistrement_bailleur.js b/staticfiles/gestion_projet/js/enregistrement_bailleur.js index afe12ea..c09f502 100644 --- a/staticfiles/gestion_projet/js/enregistrement_bailleur.js +++ b/staticfiles/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/staticfiles/gestion_salle/js/index.js b/staticfiles/gestion_salle/js/index.js index 4f69d09..6950c0e 100644 --- a/staticfiles/gestion_salle/js/index.js +++ b/staticfiles/gestion_salle/js/index.js @@ -15,7 +15,6 @@ const calendrier = Schedule(document.getElementById('planning-reservation'), { .then(response => response.json()) .then(data => { currentReservationId = data.id_reservation; - console.log(data); $("id_reservation_detail").value = data.id_reservation; $("id_reservation_refus").value = data.id_reservation; $("id_reservation_zoom").value = data.id_reservation; @@ -30,11 +29,10 @@ const calendrier = Schedule(document.getElementById('planning-reservation'), { $("besoin_ordinateur").checked=data.besoin_ordinateur; $("lien_zoom").value=data.lien_zoom; - if(data.statut !== "annulee"){ - $("motif_refus_container").className = "d-none"; - }else{ - $("motif_refus").value=data.motif_refus; + if (data.besoin_zoom === false){ + $("lien_zoom_container").className = "d-none"; } + }) } }); @@ -80,6 +78,11 @@ $("bouton-annuler").addEventListener("click", (e) => { const csrf = document.querySelector("[name=csrfmiddlewaretoken]").value; const url_annuler = $("formulaire-details").dataset.urlannuler; + console.log("URL d'annulation :"); + console.log($("formulaire-details")) + + e.preventDefault(); + fetch( url_annuler, { @@ -130,6 +133,9 @@ if($("refuserReservation")){ const url = e.currentTarget.dataset.lienrefus; const idRes = $("id_reservation_detail").value; + console.log(idRes); + e.preventDefault(); + fetch(url, { method: "POST", headers: { @@ -161,16 +167,11 @@ const tableau_reservation_attente = new Tabulator("#tableau-reservation-attente" tableau_reservation_attente.on("rowClick", (row, rowData) => { const data = rowData.getData(); - console.log(data); - if(data.besoin_zoom === false){ $("lien_zoom_container").className = 'd-none'; } - if(data.statut !== "refusee"){ - $("motif_refus_container").className = 'd-none'; - } - + const id_user = $("current-user-id").dataset.userid; $("id_reservation_detail").value = data.id; $("id_reservation_refus").value = data.id; $("id_reservation_zoom").value = data.id; @@ -178,16 +179,20 @@ tableau_reservation_attente.on("rowClick", (row, rowData) => { $("employe").value=data.employe; $("salle").value=data.salle; $("statut-reservation").innerHTML=data.statut; - $("date_evenement").value=data.date_debut; + $("date_debut").value = data.date_debut; + $("date_fin").value = data.date_fin; $("heure_debut").value=data.heure_debut; $("heure_fin").value=data.heure_fin; $("motif_reservation").value=data.motif_reservation; $("besoin_zoom").checked=data.besoin_zoom; $("besoin_ordinateur").checked=data.besoin_ordi; $("lien_zoom").value=data.lien_zoom; - $("motif_refus").value=data.motif_refus; + + if (id_user != data.employe_id){ + $("bouton-annuler").className = "d-none"; + } const modal = new bootstrap.Modal($("modalDetailReservation")); bootstrap.Modal.getOrCreateInstance($("modalReservationAttente")).hide(); modal.show(); -}) +}) \ No newline at end of file