diff --git a/.gitignore b/.gitignore index 10a233e..c186c1f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ +# db.sqlite3 +# venv/* +# media/* + +__pycache__/ +*.pyc + db.sqlite3 -venv/* -media/* \ No newline at end of file +venv/ +.env \ No newline at end of file diff --git a/SIRH/__pycache__/__init__.cpython-310.pyc b/SIRH/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index ac4fa12..0000000 Binary files a/SIRH/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/SIRH/__pycache__/__init__.cpython-312.pyc b/SIRH/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index ed69fcf..0000000 Binary files a/SIRH/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/SIRH/__pycache__/__init__.cpython-313.pyc b/SIRH/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index e48fe1b..0000000 Binary files a/SIRH/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/SIRH/__pycache__/__init__.cpython-314.pyc b/SIRH/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index f5c536a..0000000 Binary files a/SIRH/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/SIRH/__pycache__/settings.cpython-310.pyc b/SIRH/__pycache__/settings.cpython-310.pyc deleted file mode 100644 index c0839f3..0000000 Binary files a/SIRH/__pycache__/settings.cpython-310.pyc and /dev/null differ diff --git a/SIRH/__pycache__/settings.cpython-312.pyc b/SIRH/__pycache__/settings.cpython-312.pyc deleted file mode 100644 index 9626795..0000000 Binary files a/SIRH/__pycache__/settings.cpython-312.pyc and /dev/null differ diff --git a/SIRH/__pycache__/settings.cpython-313.pyc b/SIRH/__pycache__/settings.cpython-313.pyc deleted file mode 100644 index de1bab6..0000000 Binary files a/SIRH/__pycache__/settings.cpython-313.pyc and /dev/null differ diff --git a/SIRH/__pycache__/settings.cpython-314.pyc b/SIRH/__pycache__/settings.cpython-314.pyc deleted file mode 100644 index 20060b0..0000000 Binary files a/SIRH/__pycache__/settings.cpython-314.pyc and /dev/null differ diff --git a/SIRH/__pycache__/urls.cpython-310.pyc b/SIRH/__pycache__/urls.cpython-310.pyc deleted file mode 100644 index b14ef2c..0000000 Binary files a/SIRH/__pycache__/urls.cpython-310.pyc and /dev/null differ diff --git a/SIRH/__pycache__/urls.cpython-312.pyc b/SIRH/__pycache__/urls.cpython-312.pyc deleted file mode 100644 index f7fbb04..0000000 Binary files a/SIRH/__pycache__/urls.cpython-312.pyc and /dev/null differ diff --git a/SIRH/__pycache__/urls.cpython-313.pyc b/SIRH/__pycache__/urls.cpython-313.pyc deleted file mode 100644 index e144e35..0000000 Binary files a/SIRH/__pycache__/urls.cpython-313.pyc and /dev/null differ diff --git a/SIRH/__pycache__/urls.cpython-314.pyc b/SIRH/__pycache__/urls.cpython-314.pyc deleted file mode 100644 index cc6f331..0000000 Binary files a/SIRH/__pycache__/urls.cpython-314.pyc and /dev/null differ diff --git a/SIRH/__pycache__/views.cpython-310.pyc b/SIRH/__pycache__/views.cpython-310.pyc deleted file mode 100644 index 7e8ca40..0000000 Binary files a/SIRH/__pycache__/views.cpython-310.pyc and /dev/null differ diff --git a/SIRH/__pycache__/views.cpython-312.pyc b/SIRH/__pycache__/views.cpython-312.pyc deleted file mode 100644 index 21272c6..0000000 Binary files a/SIRH/__pycache__/views.cpython-312.pyc and /dev/null differ diff --git a/SIRH/__pycache__/views.cpython-313.pyc b/SIRH/__pycache__/views.cpython-313.pyc deleted file mode 100644 index 375885f..0000000 Binary files a/SIRH/__pycache__/views.cpython-313.pyc and /dev/null differ diff --git a/SIRH/__pycache__/views.cpython-314.pyc b/SIRH/__pycache__/views.cpython-314.pyc deleted file mode 100644 index 6eab784..0000000 Binary files a/SIRH/__pycache__/views.cpython-314.pyc and /dev/null differ diff --git a/SIRH/__pycache__/wsgi.cpython-310.pyc b/SIRH/__pycache__/wsgi.cpython-310.pyc deleted file mode 100644 index c64a40c..0000000 Binary files a/SIRH/__pycache__/wsgi.cpython-310.pyc and /dev/null differ diff --git a/SIRH/__pycache__/wsgi.cpython-312.pyc b/SIRH/__pycache__/wsgi.cpython-312.pyc deleted file mode 100644 index c0a33c3..0000000 Binary files a/SIRH/__pycache__/wsgi.cpython-312.pyc and /dev/null differ diff --git a/SIRH/__pycache__/wsgi.cpython-313.pyc b/SIRH/__pycache__/wsgi.cpython-313.pyc deleted file mode 100644 index 50ceb74..0000000 Binary files a/SIRH/__pycache__/wsgi.cpython-313.pyc and /dev/null differ diff --git a/SIRH/__pycache__/wsgi.cpython-314.pyc b/SIRH/__pycache__/wsgi.cpython-314.pyc deleted file mode 100644 index 681d9b6..0000000 Binary files a/SIRH/__pycache__/wsgi.cpython-314.pyc and /dev/null differ 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/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-310.pyc b/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-310.pyc deleted file mode 100644 index 6ff146b..0000000 Binary files a/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-310.pyc and /dev/null differ diff --git a/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-312.pyc b/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-312.pyc deleted file mode 100644 index 3e037d4..0000000 Binary files a/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-312.pyc and /dev/null differ diff --git a/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-314.pyc b/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-314.pyc deleted file mode 100644 index af82555..0000000 Binary files a/fonction_utilitaire/__pycache__/fonctions_utilitaire.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/__init__.cpython-310.pyc b/gestion_conge/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 7832e91..0000000 Binary files a/gestion_conge/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/__init__.cpython-312.pyc b/gestion_conge/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 624169f..0000000 Binary files a/gestion_conge/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/__init__.cpython-313.pyc b/gestion_conge/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 64ce283..0000000 Binary files a/gestion_conge/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/__init__.cpython-314.pyc b/gestion_conge/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index cc16157..0000000 Binary files a/gestion_conge/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/admin.cpython-310.pyc b/gestion_conge/__pycache__/admin.cpython-310.pyc deleted file mode 100644 index e1fa73b..0000000 Binary files a/gestion_conge/__pycache__/admin.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/admin.cpython-312.pyc b/gestion_conge/__pycache__/admin.cpython-312.pyc deleted file mode 100644 index 5563e5d..0000000 Binary files a/gestion_conge/__pycache__/admin.cpython-312.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/admin.cpython-313.pyc b/gestion_conge/__pycache__/admin.cpython-313.pyc deleted file mode 100644 index 5f7b198..0000000 Binary files a/gestion_conge/__pycache__/admin.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/admin.cpython-314.pyc b/gestion_conge/__pycache__/admin.cpython-314.pyc deleted file mode 100644 index 4765d1a..0000000 Binary files a/gestion_conge/__pycache__/admin.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/apps.cpython-310.pyc b/gestion_conge/__pycache__/apps.cpython-310.pyc deleted file mode 100644 index 45bdc52..0000000 Binary files a/gestion_conge/__pycache__/apps.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/apps.cpython-312.pyc b/gestion_conge/__pycache__/apps.cpython-312.pyc deleted file mode 100644 index 01b4170..0000000 Binary files a/gestion_conge/__pycache__/apps.cpython-312.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/apps.cpython-313.pyc b/gestion_conge/__pycache__/apps.cpython-313.pyc deleted file mode 100644 index d7cd8c8..0000000 Binary files a/gestion_conge/__pycache__/apps.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/apps.cpython-314.pyc b/gestion_conge/__pycache__/apps.cpython-314.pyc deleted file mode 100644 index dc8e33b..0000000 Binary files a/gestion_conge/__pycache__/apps.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/forms.cpython-310.pyc b/gestion_conge/__pycache__/forms.cpython-310.pyc deleted file mode 100644 index 9671551..0000000 Binary files a/gestion_conge/__pycache__/forms.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/forms.cpython-312.pyc b/gestion_conge/__pycache__/forms.cpython-312.pyc deleted file mode 100644 index 2bc7e19..0000000 Binary files a/gestion_conge/__pycache__/forms.cpython-312.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/forms.cpython-313.pyc b/gestion_conge/__pycache__/forms.cpython-313.pyc deleted file mode 100644 index 266e2a0..0000000 Binary files a/gestion_conge/__pycache__/forms.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/forms.cpython-314.pyc b/gestion_conge/__pycache__/forms.cpython-314.pyc deleted file mode 100644 index ba2534b..0000000 Binary files a/gestion_conge/__pycache__/forms.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/models.cpython-310.pyc b/gestion_conge/__pycache__/models.cpython-310.pyc deleted file mode 100644 index 6725e07..0000000 Binary files a/gestion_conge/__pycache__/models.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/models.cpython-312.pyc b/gestion_conge/__pycache__/models.cpython-312.pyc deleted file mode 100644 index daf953a..0000000 Binary files a/gestion_conge/__pycache__/models.cpython-312.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/models.cpython-313.pyc b/gestion_conge/__pycache__/models.cpython-313.pyc deleted file mode 100644 index c92c4b9..0000000 Binary files a/gestion_conge/__pycache__/models.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/models.cpython-314.pyc b/gestion_conge/__pycache__/models.cpython-314.pyc deleted file mode 100644 index 46515aa..0000000 Binary files a/gestion_conge/__pycache__/models.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/urls.cpython-310.pyc b/gestion_conge/__pycache__/urls.cpython-310.pyc deleted file mode 100644 index 3a92d23..0000000 Binary files a/gestion_conge/__pycache__/urls.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/urls.cpython-312.pyc b/gestion_conge/__pycache__/urls.cpython-312.pyc deleted file mode 100644 index 70e6b22..0000000 Binary files a/gestion_conge/__pycache__/urls.cpython-312.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/urls.cpython-313.pyc b/gestion_conge/__pycache__/urls.cpython-313.pyc deleted file mode 100644 index e4b6119..0000000 Binary files a/gestion_conge/__pycache__/urls.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/urls.cpython-314.pyc b/gestion_conge/__pycache__/urls.cpython-314.pyc deleted file mode 100644 index 7fbcf59..0000000 Binary files a/gestion_conge/__pycache__/urls.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/views.cpython-310.pyc b/gestion_conge/__pycache__/views.cpython-310.pyc deleted file mode 100644 index f8a7f0b..0000000 Binary files a/gestion_conge/__pycache__/views.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/views.cpython-312.pyc b/gestion_conge/__pycache__/views.cpython-312.pyc deleted file mode 100644 index a025256..0000000 Binary files a/gestion_conge/__pycache__/views.cpython-312.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/views.cpython-313.pyc b/gestion_conge/__pycache__/views.cpython-313.pyc deleted file mode 100644 index 60c9b00..0000000 Binary files a/gestion_conge/__pycache__/views.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/__pycache__/views.cpython-314.pyc b/gestion_conge/__pycache__/views.cpython-314.pyc deleted file mode 100644 index 26c5ef7..0000000 Binary files a/gestion_conge/__pycache__/views.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0001_initial.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0001_initial.cpython-310.pyc deleted file mode 100644 index 4159299..0000000 Binary files a/gestion_conge/migrations/__pycache__/0001_initial.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestion_conge/migrations/__pycache__/0001_initial.cpython-312.pyc deleted file mode 100644 index 01f7119..0000000 Binary files a/gestion_conge/migrations/__pycache__/0001_initial.cpython-312.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0001_initial.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0001_initial.cpython-313.pyc deleted file mode 100644 index 355ad96..0000000 Binary files a/gestion_conge/migrations/__pycache__/0001_initial.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0001_initial.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0001_initial.cpython-314.pyc deleted file mode 100644 index 4ee60f1..0000000 Binary files a/gestion_conge/migrations/__pycache__/0001_initial.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0002_alter_conge_type.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0002_alter_conge_type.cpython-310.pyc deleted file mode 100644 index 1206a7d..0000000 Binary files a/gestion_conge/migrations/__pycache__/0002_alter_conge_type.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0002_alter_conge_type.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0002_alter_conge_type.cpython-314.pyc deleted file mode 100644 index 2ef6f1c..0000000 Binary files a/gestion_conge/migrations/__pycache__/0002_alter_conge_type.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0002_initial.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0002_initial.cpython-310.pyc deleted file mode 100644 index c2fe4a2..0000000 Binary files a/gestion_conge/migrations/__pycache__/0002_initial.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0002_initial.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0002_initial.cpython-313.pyc deleted file mode 100644 index 54f98fb..0000000 Binary files a/gestion_conge/migrations/__pycache__/0002_initial.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0002_initial.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0002_initial.cpython-314.pyc deleted file mode 100644 index 946c102..0000000 Binary files a/gestion_conge/migrations/__pycache__/0002_initial.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0002_remove_conge_validateur_chef_and_more.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0002_remove_conge_validateur_chef_and_more.cpython-314.pyc deleted file mode 100644 index 1ba98d2..0000000 Binary files a/gestion_conge/migrations/__pycache__/0002_remove_conge_validateur_chef_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0003_alter_conge_date_demande.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0003_alter_conge_date_demande.cpython-314.pyc deleted file mode 100644 index b978723..0000000 Binary files a/gestion_conge/migrations/__pycache__/0003_alter_conge_date_demande.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0003_alter_reservation_motif.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0003_alter_reservation_motif.cpython-310.pyc deleted file mode 100644 index 96338ee..0000000 Binary files a/gestion_conge/migrations/__pycache__/0003_alter_reservation_motif.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0003_alter_reservation_motif.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0003_alter_reservation_motif.cpython-313.pyc deleted file mode 100644 index 7bcf2ef..0000000 Binary files a/gestion_conge/migrations/__pycache__/0003_alter_reservation_motif.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0003_alter_reservation_motif.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0003_alter_reservation_motif.cpython-314.pyc deleted file mode 100644 index c51c0c3..0000000 Binary files a/gestion_conge/migrations/__pycache__/0003_alter_reservation_motif.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0004_notification_reservation.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0004_notification_reservation.cpython-310.pyc deleted file mode 100644 index 67ed7d8..0000000 Binary files a/gestion_conge/migrations/__pycache__/0004_notification_reservation.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0004_notification_reservation.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0004_notification_reservation.cpython-313.pyc deleted file mode 100644 index 523f97d..0000000 Binary files a/gestion_conge/migrations/__pycache__/0004_notification_reservation.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0004_notification_reservation.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0004_notification_reservation.cpython-314.pyc deleted file mode 100644 index 1e63f9d..0000000 Binary files a/gestion_conge/migrations/__pycache__/0004_notification_reservation.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0005_remove_notification_reservation.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0005_remove_notification_reservation.cpython-310.pyc deleted file mode 100644 index 2aaaa73..0000000 Binary files a/gestion_conge/migrations/__pycache__/0005_remove_notification_reservation.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0005_remove_notification_reservation.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0005_remove_notification_reservation.cpython-313.pyc deleted file mode 100644 index e4b5328..0000000 Binary files a/gestion_conge/migrations/__pycache__/0005_remove_notification_reservation.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0005_remove_notification_reservation.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0005_remove_notification_reservation.cpython-314.pyc deleted file mode 100644 index 83dce27..0000000 Binary files a/gestion_conge/migrations/__pycache__/0005_remove_notification_reservation.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi.cpython-310.pyc deleted file mode 100644 index b0b250e..0000000 Binary files a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi.cpython-313.pyc deleted file mode 100644 index c5437fc..0000000 Binary files a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi.cpython-314.pyc deleted file mode 100644 index 9446958..0000000 Binary files a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi_reservation_date_debut_range_and_more.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi_reservation_date_debut_range_and_more.cpython-310.pyc deleted file mode 100644 index 85eb363..0000000 Binary files a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi_reservation_date_debut_range_and_more.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi_reservation_date_debut_range_and_more.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi_reservation_date_debut_range_and_more.cpython-313.pyc deleted file mode 100644 index 0b5130d..0000000 Binary files a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi_reservation_date_debut_range_and_more.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi_reservation_date_debut_range_and_more.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi_reservation_date_debut_range_and_more.cpython-314.pyc deleted file mode 100644 index 4150674..0000000 Binary files a/gestion_conge/migrations/__pycache__/0006_reservation_besoin_ordi_reservation_date_debut_range_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0007_remove_reservation_besoin_ordi.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0007_remove_reservation_besoin_ordi.cpython-310.pyc deleted file mode 100644 index 6c10521..0000000 Binary files a/gestion_conge/migrations/__pycache__/0007_remove_reservation_besoin_ordi.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0007_remove_reservation_besoin_ordi.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0007_remove_reservation_besoin_ordi.cpython-313.pyc deleted file mode 100644 index f360bca..0000000 Binary files a/gestion_conge/migrations/__pycache__/0007_remove_reservation_besoin_ordi.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0007_remove_reservation_besoin_ordi.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0007_remove_reservation_besoin_ordi.cpython-314.pyc deleted file mode 100644 index 98e0fa7..0000000 Binary files a/gestion_conge/migrations/__pycache__/0007_remove_reservation_besoin_ordi.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0008_reservation_besoin_ordi.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0008_reservation_besoin_ordi.cpython-310.pyc deleted file mode 100644 index 0ebe3bb..0000000 Binary files a/gestion_conge/migrations/__pycache__/0008_reservation_besoin_ordi.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0008_reservation_besoin_ordi.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0008_reservation_besoin_ordi.cpython-313.pyc deleted file mode 100644 index 3073b82..0000000 Binary files a/gestion_conge/migrations/__pycache__/0008_reservation_besoin_ordi.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0008_reservation_besoin_ordi.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0008_reservation_besoin_ordi.cpython-314.pyc deleted file mode 100644 index 07ae4d0..0000000 Binary files a/gestion_conge/migrations/__pycache__/0008_reservation_besoin_ordi.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0009_reservation_date_debut_range_and_more.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0009_reservation_date_debut_range_and_more.cpython-310.pyc deleted file mode 100644 index 7e26092..0000000 Binary files a/gestion_conge/migrations/__pycache__/0009_reservation_date_debut_range_and_more.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0009_reservation_date_debut_range_and_more.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0009_reservation_date_debut_range_and_more.cpython-313.pyc deleted file mode 100644 index 9096966..0000000 Binary files a/gestion_conge/migrations/__pycache__/0009_reservation_date_debut_range_and_more.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0009_reservation_date_debut_range_and_more.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0009_reservation_date_debut_range_and_more.cpython-314.pyc deleted file mode 100644 index bedff98..0000000 Binary files a/gestion_conge/migrations/__pycache__/0009_reservation_date_debut_range_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0010_merge_20260122_1101.cpython-310.pyc b/gestion_conge/migrations/__pycache__/0010_merge_20260122_1101.cpython-310.pyc deleted file mode 100644 index 261c85d..0000000 Binary files a/gestion_conge/migrations/__pycache__/0010_merge_20260122_1101.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0010_merge_20260122_1101.cpython-313.pyc b/gestion_conge/migrations/__pycache__/0010_merge_20260122_1101.cpython-313.pyc deleted file mode 100644 index 2a7e3e6..0000000 Binary files a/gestion_conge/migrations/__pycache__/0010_merge_20260122_1101.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/0010_merge_20260122_1101.cpython-314.pyc b/gestion_conge/migrations/__pycache__/0010_merge_20260122_1101.cpython-314.pyc deleted file mode 100644 index b38b52a..0000000 Binary files a/gestion_conge/migrations/__pycache__/0010_merge_20260122_1101.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/__init__.cpython-310.pyc b/gestion_conge/migrations/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index fcf91ef..0000000 Binary files a/gestion_conge/migrations/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/__init__.cpython-312.pyc b/gestion_conge/migrations/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 5c5fd24..0000000 Binary files a/gestion_conge/migrations/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/__init__.cpython-313.pyc b/gestion_conge/migrations/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index bd80a58..0000000 Binary files a/gestion_conge/migrations/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/gestion_conge/migrations/__pycache__/__init__.cpython-314.pyc b/gestion_conge/migrations/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 2870925..0000000 Binary files a/gestion_conge/migrations/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/gestion_conge/views.py b/gestion_conge/views.py index 0b92e84..c5d0402 100644 --- a/gestion_conge/views.py +++ b/gestion_conge/views.py @@ -129,66 +129,69 @@ def demander_conge(request): @login_required def liste_demande_conges(request): - """Vue de liste des demandes de congés en attente de validation selon le statut de l'utilisateur actuel""" + try: - employe = Employe.objects.get(user__username = request.user) + employe = Employe.objects.get(user=request.user) except Employe.DoesNotExist: return JsonResponse({ "success": False, - "message": "Votre profil Utilisateur n'est lié à aucun profil Employé. Veuillez contacter l'administrateur." + "message": "Profil employé introuvable" }) - try: - affectation = Affectation.objects.get( - employe=employe, - date_fin_daffectation__gte=timezone.now().date() - ) - except Affectation.DoesNotExist: - affectation = None + affectation = Affectation.objects.filter( + employe=employe, + date_fin_daffectation__gte=timezone.now().date() + ).first() + + is_direction = employe.user.groups.filter(name='direction').exists() if employe.chef: - print("chef") - conges_en_attente = Conge.objects.filter( - employe__departement = employe.departement, - validation_hierarchique = None + + conges = Conge.objects.filter( + Q(employe__departement=employe.departement) | + Q(employe=employe) ).order_by('-date_demande') elif affectation and affectation.role == "chef_projet": + employes_du_projet = Affectation.objects.filter( - projet = affectation.projet, - date_fin_daffectation__gte = timezone.now().date() - ).values('employe') + projet=affectation.projet, + date_fin_daffectation__gte=timezone.now().date() + ).values_list('employe', flat=True) - conges_en_attente = Conge.objects.filter( - employe__in = employes_du_projet, - validation_hierarchique = None + conges = Conge.objects.filter( + Q(employe__in=employes_du_projet) | + Q(employe=employe) ).order_by('-date_demande') - elif 'direction' in employe.user.groups.values_list('name', flat=True): - conges_en_attente = Conge.objects.filter( - validation_hierarchique = True, - validation_direction = None - ).order_by('-date_demande') + + elif is_direction: + + conges = Conge.objects.filter( + Q(validation_hierarchique=True) | + Q(employe__user__groups__name='direction') + ).distinct().order_by('-date_demande') else: - conges_en_attente = Conge.objects.filter( - employe__user__username = request.user + + conges = Conge.objects.filter( + employe=employe ).order_by('-date_demande') return JsonResponse({ "success": True, - "data":[ - { - **model_to_dict(conge), - "prenom_nom": f"{conge.employe.user.first_name} {conge.employe.user.last_name}", - "date_demande": conge.date_demande, - "nombre_jours": conge.nombre_jours, - "type": dict(conge.TYPE_CHOICES).get(conge.type), - "solde_conge": fonctions_utilitaire.solde_conge(conge.employe)["quota_annuel"] - } - for conge in conges_en_attente]}, - safe=False - ) + "data": [ + { + **model_to_dict(conge), + "prenom_nom": f"{conge.employe.user.first_name} {conge.employe.user.last_name}", + "date_demande": conge.date_demande, + "nombre_jours": conge.nombre_jours, + "type": dict(conge.TYPE_CHOICES).get(conge.type), + "solde_conge": fonctions_utilitaire.solde_conge(conge.employe)["quota_annuel"] + } + for conge in conges + ] + }) @login_required def validation_de_conge(request): diff --git a/gestion_employe/__pycache__/__init__.cpython-310.pyc b/gestion_employe/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index ee0df52..0000000 Binary files a/gestion_employe/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/__init__.cpython-312.pyc b/gestion_employe/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 2a0cb68..0000000 Binary files a/gestion_employe/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/__init__.cpython-313.pyc b/gestion_employe/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 834a176..0000000 Binary files a/gestion_employe/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/__init__.cpython-314.pyc b/gestion_employe/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 7e654d6..0000000 Binary files a/gestion_employe/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/admin.cpython-310.pyc b/gestion_employe/__pycache__/admin.cpython-310.pyc deleted file mode 100644 index 7326f43..0000000 Binary files a/gestion_employe/__pycache__/admin.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/admin.cpython-312.pyc b/gestion_employe/__pycache__/admin.cpython-312.pyc deleted file mode 100644 index e0ae98a..0000000 Binary files a/gestion_employe/__pycache__/admin.cpython-312.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/admin.cpython-313.pyc b/gestion_employe/__pycache__/admin.cpython-313.pyc deleted file mode 100644 index d018c0b..0000000 Binary files a/gestion_employe/__pycache__/admin.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/admin.cpython-314.pyc b/gestion_employe/__pycache__/admin.cpython-314.pyc deleted file mode 100644 index 73b477b..0000000 Binary files a/gestion_employe/__pycache__/admin.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/api.cpython-313.pyc b/gestion_employe/__pycache__/api.cpython-313.pyc deleted file mode 100644 index be5e3a8..0000000 Binary files a/gestion_employe/__pycache__/api.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/api_urls.cpython-313.pyc b/gestion_employe/__pycache__/api_urls.cpython-313.pyc deleted file mode 100644 index fb50ac8..0000000 Binary files a/gestion_employe/__pycache__/api_urls.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/api_urls.cpython-314.pyc b/gestion_employe/__pycache__/api_urls.cpython-314.pyc deleted file mode 100644 index 11bf6f4..0000000 Binary files a/gestion_employe/__pycache__/api_urls.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/apps.cpython-310.pyc b/gestion_employe/__pycache__/apps.cpython-310.pyc deleted file mode 100644 index 926c088..0000000 Binary files a/gestion_employe/__pycache__/apps.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/apps.cpython-313.pyc b/gestion_employe/__pycache__/apps.cpython-313.pyc deleted file mode 100644 index 853818e..0000000 Binary files a/gestion_employe/__pycache__/apps.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/apps.cpython-314.pyc b/gestion_employe/__pycache__/apps.cpython-314.pyc deleted file mode 100644 index 8134206..0000000 Binary files a/gestion_employe/__pycache__/apps.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/forms.cpython-310.pyc b/gestion_employe/__pycache__/forms.cpython-310.pyc deleted file mode 100644 index 17adcdd..0000000 Binary files a/gestion_employe/__pycache__/forms.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/forms.cpython-312.pyc b/gestion_employe/__pycache__/forms.cpython-312.pyc deleted file mode 100644 index 16ad728..0000000 Binary files a/gestion_employe/__pycache__/forms.cpython-312.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/forms.cpython-313.pyc b/gestion_employe/__pycache__/forms.cpython-313.pyc deleted file mode 100644 index af96bda..0000000 Binary files a/gestion_employe/__pycache__/forms.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/forms.cpython-314.pyc b/gestion_employe/__pycache__/forms.cpython-314.pyc deleted file mode 100644 index 2c5dab8..0000000 Binary files a/gestion_employe/__pycache__/forms.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/models.cpython-310.pyc b/gestion_employe/__pycache__/models.cpython-310.pyc deleted file mode 100644 index 56a5618..0000000 Binary files a/gestion_employe/__pycache__/models.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/models.cpython-312.pyc b/gestion_employe/__pycache__/models.cpython-312.pyc deleted file mode 100644 index e3ece7e..0000000 Binary files a/gestion_employe/__pycache__/models.cpython-312.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/models.cpython-313.pyc b/gestion_employe/__pycache__/models.cpython-313.pyc deleted file mode 100644 index b370343..0000000 Binary files a/gestion_employe/__pycache__/models.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/models.cpython-314.pyc b/gestion_employe/__pycache__/models.cpython-314.pyc deleted file mode 100644 index a270e41..0000000 Binary files a/gestion_employe/__pycache__/models.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/urls.cpython-310.pyc b/gestion_employe/__pycache__/urls.cpython-310.pyc deleted file mode 100644 index 38898c6..0000000 Binary files a/gestion_employe/__pycache__/urls.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/urls.cpython-312.pyc b/gestion_employe/__pycache__/urls.cpython-312.pyc deleted file mode 100644 index 618a5d8..0000000 Binary files a/gestion_employe/__pycache__/urls.cpython-312.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/urls.cpython-313.pyc b/gestion_employe/__pycache__/urls.cpython-313.pyc deleted file mode 100644 index a2c48f5..0000000 Binary files a/gestion_employe/__pycache__/urls.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/urls.cpython-314.pyc b/gestion_employe/__pycache__/urls.cpython-314.pyc deleted file mode 100644 index 8061e3f..0000000 Binary files a/gestion_employe/__pycache__/urls.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/views.cpython-310.pyc b/gestion_employe/__pycache__/views.cpython-310.pyc deleted file mode 100644 index d7f56a9..0000000 Binary files a/gestion_employe/__pycache__/views.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/views.cpython-312.pyc b/gestion_employe/__pycache__/views.cpython-312.pyc deleted file mode 100644 index 6754690..0000000 Binary files a/gestion_employe/__pycache__/views.cpython-312.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/views.cpython-313.pyc b/gestion_employe/__pycache__/views.cpython-313.pyc deleted file mode 100644 index 954bb6a..0000000 Binary files a/gestion_employe/__pycache__/views.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/__pycache__/views.cpython-314.pyc b/gestion_employe/__pycache__/views.cpython-314.pyc deleted file mode 100644 index 0185fd3..0000000 Binary files a/gestion_employe/__pycache__/views.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0001_initial.cpython-310.pyc b/gestion_employe/migrations/__pycache__/0001_initial.cpython-310.pyc deleted file mode 100644 index fb1dd03..0000000 Binary files a/gestion_employe/migrations/__pycache__/0001_initial.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestion_employe/migrations/__pycache__/0001_initial.cpython-312.pyc deleted file mode 100644 index b2e823a..0000000 Binary files a/gestion_employe/migrations/__pycache__/0001_initial.cpython-312.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0001_initial.cpython-313.pyc b/gestion_employe/migrations/__pycache__/0001_initial.cpython-313.pyc deleted file mode 100644 index ea8f5b7..0000000 Binary files a/gestion_employe/migrations/__pycache__/0001_initial.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0001_initial.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0001_initial.cpython-314.pyc deleted file mode 100644 index 3c4db69..0000000 Binary files a/gestion_employe/migrations/__pycache__/0001_initial.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0002_alter_contrat_type_contrat.cpython-312.pyc b/gestion_employe/migrations/__pycache__/0002_alter_contrat_type_contrat.cpython-312.pyc deleted file mode 100644 index eded6f8..0000000 Binary files a/gestion_employe/migrations/__pycache__/0002_alter_contrat_type_contrat.cpython-312.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0002_alter_employe_cv_alter_employe_casier_judiciaire_and_more.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0002_alter_employe_cv_alter_employe_casier_judiciaire_and_more.cpython-314.pyc deleted file mode 100644 index 633cc2e..0000000 Binary files a/gestion_employe/migrations/__pycache__/0002_alter_employe_cv_alter_employe_casier_judiciaire_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0002_alter_employe_email_alter_employe_username.cpython-310.pyc b/gestion_employe/migrations/__pycache__/0002_alter_employe_email_alter_employe_username.cpython-310.pyc deleted file mode 100644 index 92ad5b7..0000000 Binary files a/gestion_employe/migrations/__pycache__/0002_alter_employe_email_alter_employe_username.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0002_alter_employe_email_alter_employe_username.cpython-313.pyc b/gestion_employe/migrations/__pycache__/0002_alter_employe_email_alter_employe_username.cpython-313.pyc deleted file mode 100644 index d5c4ab1..0000000 Binary files a/gestion_employe/migrations/__pycache__/0002_alter_employe_email_alter_employe_username.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0002_alter_employe_email_alter_employe_username.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0002_alter_employe_email_alter_employe_username.cpython-314.pyc deleted file mode 100644 index 4ccea1a..0000000 Binary files a/gestion_employe/migrations/__pycache__/0002_alter_employe_email_alter_employe_username.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0003_alter_employe_cv_alter_employe_casier_judiciaire_and_more.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0003_alter_employe_cv_alter_employe_casier_judiciaire_and_more.cpython-314.pyc deleted file mode 100644 index 69cbd16..0000000 Binary files a/gestion_employe/migrations/__pycache__/0003_alter_employe_cv_alter_employe_casier_judiciaire_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0003_alter_employe_email_alter_employe_username.cpython-310.pyc b/gestion_employe/migrations/__pycache__/0003_alter_employe_email_alter_employe_username.cpython-310.pyc deleted file mode 100644 index 6959070..0000000 Binary files a/gestion_employe/migrations/__pycache__/0003_alter_employe_email_alter_employe_username.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0003_alter_employe_email_alter_employe_username.cpython-313.pyc b/gestion_employe/migrations/__pycache__/0003_alter_employe_email_alter_employe_username.cpython-313.pyc deleted file mode 100644 index d7d4886..0000000 Binary files a/gestion_employe/migrations/__pycache__/0003_alter_employe_email_alter_employe_username.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0003_alter_employe_email_alter_employe_username.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0003_alter_employe_email_alter_employe_username.cpython-314.pyc deleted file mode 100644 index f12ddef..0000000 Binary files a/gestion_employe/migrations/__pycache__/0003_alter_employe_email_alter_employe_username.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0004_alter_departement_chef.cpython-310.pyc b/gestion_employe/migrations/__pycache__/0004_alter_departement_chef.cpython-310.pyc deleted file mode 100644 index 707adae..0000000 Binary files a/gestion_employe/migrations/__pycache__/0004_alter_departement_chef.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0004_alter_departement_chef.cpython-313.pyc b/gestion_employe/migrations/__pycache__/0004_alter_departement_chef.cpython-313.pyc deleted file mode 100644 index 1b0f0fa..0000000 Binary files a/gestion_employe/migrations/__pycache__/0004_alter_departement_chef.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0004_alter_departement_chef.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0004_alter_departement_chef.cpython-314.pyc deleted file mode 100644 index 9b3e7ac..0000000 Binary files a/gestion_employe/migrations/__pycache__/0004_alter_departement_chef.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0004_alter_employe_formations_alter_formation_certificat_and_more.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0004_alter_employe_formations_alter_formation_certificat_and_more.cpython-314.pyc deleted file mode 100644 index fe9aa4a..0000000 Binary files a/gestion_employe/migrations/__pycache__/0004_alter_employe_formations_alter_formation_certificat_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0005_alter_employe_email_alter_employe_username.cpython-310.pyc b/gestion_employe/migrations/__pycache__/0005_alter_employe_email_alter_employe_username.cpython-310.pyc deleted file mode 100644 index f7b2b74..0000000 Binary files a/gestion_employe/migrations/__pycache__/0005_alter_employe_email_alter_employe_username.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0005_alter_employe_email_alter_employe_username.cpython-313.pyc b/gestion_employe/migrations/__pycache__/0005_alter_employe_email_alter_employe_username.cpython-313.pyc deleted file mode 100644 index cdcffdc..0000000 Binary files a/gestion_employe/migrations/__pycache__/0005_alter_employe_email_alter_employe_username.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0005_alter_employe_email_alter_employe_username.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0005_alter_employe_email_alter_employe_username.cpython-314.pyc deleted file mode 100644 index 06b5f34..0000000 Binary files a/gestion_employe/migrations/__pycache__/0005_alter_employe_email_alter_employe_username.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0005_remove_employe_projet_employe_sexe.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0005_remove_employe_projet_employe_sexe.cpython-314.pyc deleted file mode 100644 index 0fce41c..0000000 Binary files a/gestion_employe/migrations/__pycache__/0005_remove_employe_projet_employe_sexe.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0006_alter_employe_email_alter_employe_username.cpython-310.pyc b/gestion_employe/migrations/__pycache__/0006_alter_employe_email_alter_employe_username.cpython-310.pyc deleted file mode 100644 index 0b24c38..0000000 Binary files a/gestion_employe/migrations/__pycache__/0006_alter_employe_email_alter_employe_username.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0006_alter_employe_email_alter_employe_username.cpython-313.pyc b/gestion_employe/migrations/__pycache__/0006_alter_employe_email_alter_employe_username.cpython-313.pyc deleted file mode 100644 index 8f570fa..0000000 Binary files a/gestion_employe/migrations/__pycache__/0006_alter_employe_email_alter_employe_username.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0006_alter_employe_email_alter_employe_username.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0006_alter_employe_email_alter_employe_username.cpython-314.pyc deleted file mode 100644 index c7af863..0000000 Binary files a/gestion_employe/migrations/__pycache__/0006_alter_employe_email_alter_employe_username.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0006_employe_date_naissance_alter_employe_sexe.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0006_employe_date_naissance_alter_employe_sexe.cpython-314.pyc deleted file mode 100644 index fb636de..0000000 Binary files a/gestion_employe/migrations/__pycache__/0006_employe_date_naissance_alter_employe_sexe.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0007_remove_employe_formations_formation_employe.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0007_remove_employe_formations_formation_employe.cpython-314.pyc deleted file mode 100644 index 3a163c7..0000000 Binary files a/gestion_employe/migrations/__pycache__/0007_remove_employe_formations_formation_employe.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0007_tachehebdomadaire.cpython-310.pyc b/gestion_employe/migrations/__pycache__/0007_tachehebdomadaire.cpython-310.pyc deleted file mode 100644 index 8017401..0000000 Binary files a/gestion_employe/migrations/__pycache__/0007_tachehebdomadaire.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0007_tachehebdomadaire.cpython-313.pyc b/gestion_employe/migrations/__pycache__/0007_tachehebdomadaire.cpython-313.pyc deleted file mode 100644 index 71c9e23..0000000 Binary files a/gestion_employe/migrations/__pycache__/0007_tachehebdomadaire.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0007_tachehebdomadaire.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0007_tachehebdomadaire.cpython-314.pyc deleted file mode 100644 index 276bdbf..0000000 Binary files a/gestion_employe/migrations/__pycache__/0007_tachehebdomadaire.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0008_remove_departement_chef_employe_chef.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0008_remove_departement_chef_employe_chef.cpython-314.pyc deleted file mode 100644 index 7cba6b9..0000000 Binary files a/gestion_employe/migrations/__pycache__/0008_remove_departement_chef_employe_chef.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0008_tachehebdomadaire_statut.cpython-310.pyc b/gestion_employe/migrations/__pycache__/0008_tachehebdomadaire_statut.cpython-310.pyc deleted file mode 100644 index 9e0bcce..0000000 Binary files a/gestion_employe/migrations/__pycache__/0008_tachehebdomadaire_statut.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0008_tachehebdomadaire_statut.cpython-313.pyc b/gestion_employe/migrations/__pycache__/0008_tachehebdomadaire_statut.cpython-313.pyc deleted file mode 100644 index 3a12f6b..0000000 Binary files a/gestion_employe/migrations/__pycache__/0008_tachehebdomadaire_statut.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0008_tachehebdomadaire_statut.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0008_tachehebdomadaire_statut.cpython-314.pyc deleted file mode 100644 index 7e43547..0000000 Binary files a/gestion_employe/migrations/__pycache__/0008_tachehebdomadaire_statut.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0009_alter_employe_adresse_alter_employe_telephone.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0009_alter_employe_adresse_alter_employe_telephone.cpython-314.pyc deleted file mode 100644 index d248530..0000000 Binary files a/gestion_employe/migrations/__pycache__/0009_alter_employe_adresse_alter_employe_telephone.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0009_alter_tachehebdomadaire_created_at_and_more.cpython-310.pyc b/gestion_employe/migrations/__pycache__/0009_alter_tachehebdomadaire_created_at_and_more.cpython-310.pyc deleted file mode 100644 index cef3ed8..0000000 Binary files a/gestion_employe/migrations/__pycache__/0009_alter_tachehebdomadaire_created_at_and_more.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0009_alter_tachehebdomadaire_created_at_and_more.cpython-313.pyc b/gestion_employe/migrations/__pycache__/0009_alter_tachehebdomadaire_created_at_and_more.cpython-313.pyc deleted file mode 100644 index 269b7e2..0000000 Binary files a/gestion_employe/migrations/__pycache__/0009_alter_tachehebdomadaire_created_at_and_more.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0009_alter_tachehebdomadaire_created_at_and_more.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0009_alter_tachehebdomadaire_created_at_and_more.cpython-314.pyc deleted file mode 100644 index 38d4826..0000000 Binary files a/gestion_employe/migrations/__pycache__/0009_alter_tachehebdomadaire_created_at_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0010_tachehebdomadaire_date_tache_and_more.cpython-310.pyc b/gestion_employe/migrations/__pycache__/0010_tachehebdomadaire_date_tache_and_more.cpython-310.pyc deleted file mode 100644 index bb5f52d..0000000 Binary files a/gestion_employe/migrations/__pycache__/0010_tachehebdomadaire_date_tache_and_more.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0010_tachehebdomadaire_date_tache_and_more.cpython-313.pyc b/gestion_employe/migrations/__pycache__/0010_tachehebdomadaire_date_tache_and_more.cpython-313.pyc deleted file mode 100644 index a486ee0..0000000 Binary files a/gestion_employe/migrations/__pycache__/0010_tachehebdomadaire_date_tache_and_more.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/0010_tachehebdomadaire_date_tache_and_more.cpython-314.pyc b/gestion_employe/migrations/__pycache__/0010_tachehebdomadaire_date_tache_and_more.cpython-314.pyc deleted file mode 100644 index 27da2cd..0000000 Binary files a/gestion_employe/migrations/__pycache__/0010_tachehebdomadaire_date_tache_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/__init__.cpython-310.pyc b/gestion_employe/migrations/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index fa0bf21..0000000 Binary files a/gestion_employe/migrations/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/__init__.cpython-312.pyc b/gestion_employe/migrations/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index bda6b65..0000000 Binary files a/gestion_employe/migrations/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/__init__.cpython-313.pyc b/gestion_employe/migrations/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 94382e6..0000000 Binary files a/gestion_employe/migrations/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/gestion_employe/migrations/__pycache__/__init__.cpython-314.pyc b/gestion_employe/migrations/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 0954f9a..0000000 Binary files a/gestion_employe/migrations/__pycache__/__init__.cpython-314.pyc and /dev/null differ 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..6a394a3 100644 --- a/gestion_employe/templates/gestion_employe/monprofil.html +++ b/gestion_employe/templates/gestion_employe/monprofil.html @@ -19,17 +19,15 @@ {% endfor %} {% endif %} +{% if not has_contrat %} +
+ Important : Les informations sur votre contrat n'ont pas été renseignées, veuillez contacter les ressources humaines. +
-{% if expiration_contrat %} - {% if contrat_nb_jours_restant %} -
+{% elif expiration_contrat %} +
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 +42,13 @@
{% csrf_token %}
+
+ + {% if employe.photo %} + Fichier actuel : {{employe.photo}} + {% endif %} + +
@@ -63,12 +68,13 @@
+ +
+
-
-
@@ -167,6 +173,13 @@ {% csrf_token %}
+
+ + {% if employe.photo %} + Fichier actuel : {{employe.photo}} + {% endif %} + +
{% if employe.CV %} diff --git a/gestion_employe/templatetags/__pycache__/tags_personnaliser.cpython-310.pyc b/gestion_employe/templatetags/__pycache__/tags_personnaliser.cpython-310.pyc deleted file mode 100644 index de89fbc..0000000 Binary files a/gestion_employe/templatetags/__pycache__/tags_personnaliser.cpython-310.pyc and /dev/null differ diff --git a/gestion_employe/templatetags/__pycache__/tags_personnaliser.cpython-312.pyc b/gestion_employe/templatetags/__pycache__/tags_personnaliser.cpython-312.pyc deleted file mode 100644 index 17d6b77..0000000 Binary files a/gestion_employe/templatetags/__pycache__/tags_personnaliser.cpython-312.pyc and /dev/null differ diff --git a/gestion_employe/templatetags/__pycache__/tags_personnaliser.cpython-314.pyc b/gestion_employe/templatetags/__pycache__/tags_personnaliser.cpython-314.pyc deleted file mode 100644 index 831b289..0000000 Binary files a/gestion_employe/templatetags/__pycache__/tags_personnaliser.cpython-314.pyc and /dev/null differ diff --git a/gestion_employe/views.py b/gestion_employe/views.py index e8e6374..fb40eec 100644 --- a/gestion_employe/views.py +++ b/gestion_employe/views.py @@ -1,5 +1,5 @@ import json -from datetime import timedelta, datetime +from datetime import date, timedelta, datetime from dateutil.relativedelta import relativedelta from django.utils import timezone @@ -122,26 +122,41 @@ def mon_profil(request): try: employe = Employe.objects.get(user__username=request.user) except Employe.DoesNotExist: - messages.error(request, "Impossible d'acceder au menu 'Mon profil' car votre profil Utilisateur n'est lié à aucun profil Employé. Veuillez contacter l'Administrateur.") + messages.error( + request, + "Impossible d'acceder au menu 'Mon profil' car votre profil Utilisateur n'est lié à aucun profil Employé. Veuillez contacter l'Administrateur." + ) return redirect("gestion_conges:conge") - + contrats = Contrat.objects.filter(employe=employe, statut='actif').first() + projets = Affectation.objects.filter( - employe = employe, - date_fin_daffectation__gte = timezone.now().date() + employe=employe, + date_fin_daffectation__gte=timezone.now().date() ).select_related('projet') + has_contrat = contrats is not None + expiration_contrat = False + contrat_nb_jours_restant = None + + if contrats: + nb_jours = contrats.nombre_jours_restant + contrat_nb_jours_restant = nb_jours + expiration_contrat = nb_jours <= fonctions_utilitaire.DUREE_FIN_CONTRAT + return render( - request, - 'gestion_employe/monprofil.html', + request, + 'gestion_employe/monprofil.html', { 'employe': employe, + 'contrats': [{ **model_to_dict(contrats), "type_contrat": dict(Contrat.TYPE_CONTRAT).get(contrats.type_contrat), "statut": dict(Contrat.STATUT_CONTRAT).get(contrats.statut), "fichier_contrat": contrats.fichier_contrat.url if contrats.fichier_contrat else "", - } if contrats else []], + }] if contrats else [], + 'projets': [ { **model_to_dict(a.projet), @@ -151,12 +166,13 @@ def mon_profil(request): "pourcentage_temps_affectation": a.pourcentage_temps_affectation } for a in projets ], + "formation_form": FormationForm(), - "expiration_contrat": contrats.nombre_jours_restant <= fonctions_utilitaire.DUREE_FIN_CONTRAT if contrats else False, - "contrat_nb_jours_restant": contrats.nombre_jours_restant if contrats else None + "has_contrat": has_contrat, + "expiration_contrat": expiration_contrat, + "contrat_nb_jours_restant": contrat_nb_jours_restant } ) - @login_required def modifier_mot_passe(request): """Vue pour permettre à un utilisateur de modifier son mot de passe et ses informations de profil""" @@ -176,7 +192,6 @@ def modifier_mot_passe(request): messages.success(request, "Mot de passe modifié avec succès.") return redirect("gestion_employe:mon-profil") - def modifier_employer(request): """Vue pour permettre à un utilisateur de modifier les informations d'un employé""" try: @@ -192,7 +207,8 @@ def modifier_employer(request): employe.telephone = data['telephone'] employe.adresse = data['adresse'] employe.sexe = data['sexe'] - + if request.FILES.get("photo"): + employe.photo = request.FILES["photo"] if data['date_naissance']: difference = relativedelta(timezone.now().date(), datetime.strptime(data['date_naissance'], "%Y-%m-%d").date()) if difference.years >= 18: @@ -201,18 +217,18 @@ def modifier_employer(request): return JsonResponse({"message": "Veuillez entrez une date de naissance correcte."}) employe.save() user.save() - 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") @@ -240,14 +256,25 @@ def suppression_affectation(request): return JsonResponse({"message": "Affectation supprimée avec succès."}) def creation_contrat(request): - """Vue pour permettre à un utilisateur de créer un contrat pour un employé""" + """Créer un contrat pour un employé (avec contrôle d'existence de contrat actif)""" + try: employe = Employe.objects.get(id=request.POST.get('employe_id')) except Employe.DoesNotExist: messages.error(request, "Employé non trouvé.") return redirect('employe-index') - + contrat_actif = Contrat.objects.filter( + employe=employe, + date_fin__gte=date.today() + ).exists() + if request.method == "POST": + if contrat_actif: + messages.error( + request, + "Impossible de créer un contrat : cet employé a déjà un contrat actif." + ) + return redirect('gestion_employe:index') form = ContratForm(request.POST, request.FILES) if form.is_valid(): contrat = form.save(commit=False) @@ -256,9 +283,13 @@ def creation_contrat(request): messages.success(request, "Contrat créé avec succès.") return redirect('gestion_employe:index') messages.error(request, "Formulaire non valide") + else: form = ContratForm(initial={'employe': employe}) - return render(request, 'gestion_employe/index.html', {'contrat_form': form}) + + return render(request, 'gestion_employe/index.html', { + 'contrat_form': form + }) @login_required def enregistrer_detail_employe(request): diff --git a/gestion_projet/__pycache__/__init__.cpython-310.pyc b/gestion_projet/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 466a5f3..0000000 Binary files a/gestion_projet/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/__init__.cpython-312.pyc b/gestion_projet/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 8423da3..0000000 Binary files a/gestion_projet/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/__init__.cpython-313.pyc b/gestion_projet/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 3ef0681..0000000 Binary files a/gestion_projet/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/__init__.cpython-314.pyc b/gestion_projet/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 191e40a..0000000 Binary files a/gestion_projet/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/admin.cpython-310.pyc b/gestion_projet/__pycache__/admin.cpython-310.pyc deleted file mode 100644 index 63d8b4a..0000000 Binary files a/gestion_projet/__pycache__/admin.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/admin.cpython-312.pyc b/gestion_projet/__pycache__/admin.cpython-312.pyc deleted file mode 100644 index c527bb0..0000000 Binary files a/gestion_projet/__pycache__/admin.cpython-312.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/admin.cpython-313.pyc b/gestion_projet/__pycache__/admin.cpython-313.pyc deleted file mode 100644 index 4673092..0000000 Binary files a/gestion_projet/__pycache__/admin.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/admin.cpython-314.pyc b/gestion_projet/__pycache__/admin.cpython-314.pyc deleted file mode 100644 index 26641d2..0000000 Binary files a/gestion_projet/__pycache__/admin.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/apps.cpython-310.pyc b/gestion_projet/__pycache__/apps.cpython-310.pyc deleted file mode 100644 index 11b794a..0000000 Binary files a/gestion_projet/__pycache__/apps.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/apps.cpython-313.pyc b/gestion_projet/__pycache__/apps.cpython-313.pyc deleted file mode 100644 index e5fe762..0000000 Binary files a/gestion_projet/__pycache__/apps.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/apps.cpython-314.pyc b/gestion_projet/__pycache__/apps.cpython-314.pyc deleted file mode 100644 index b9a762f..0000000 Binary files a/gestion_projet/__pycache__/apps.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/forms.cpython-310.pyc b/gestion_projet/__pycache__/forms.cpython-310.pyc deleted file mode 100644 index 851629a..0000000 Binary files a/gestion_projet/__pycache__/forms.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/forms.cpython-312.pyc b/gestion_projet/__pycache__/forms.cpython-312.pyc deleted file mode 100644 index f59f146..0000000 Binary files a/gestion_projet/__pycache__/forms.cpython-312.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/forms.cpython-313.pyc b/gestion_projet/__pycache__/forms.cpython-313.pyc deleted file mode 100644 index 26adeae..0000000 Binary files a/gestion_projet/__pycache__/forms.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/forms.cpython-314.pyc b/gestion_projet/__pycache__/forms.cpython-314.pyc deleted file mode 100644 index ee43e1d..0000000 Binary files a/gestion_projet/__pycache__/forms.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/models.cpython-310.pyc b/gestion_projet/__pycache__/models.cpython-310.pyc deleted file mode 100644 index 2eb446c..0000000 Binary files a/gestion_projet/__pycache__/models.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/models.cpython-312.pyc b/gestion_projet/__pycache__/models.cpython-312.pyc deleted file mode 100644 index 234597d..0000000 Binary files a/gestion_projet/__pycache__/models.cpython-312.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/models.cpython-313.pyc b/gestion_projet/__pycache__/models.cpython-313.pyc deleted file mode 100644 index 495a805..0000000 Binary files a/gestion_projet/__pycache__/models.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/models.cpython-314.pyc b/gestion_projet/__pycache__/models.cpython-314.pyc deleted file mode 100644 index 09c9670..0000000 Binary files a/gestion_projet/__pycache__/models.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/urls.cpython-310.pyc b/gestion_projet/__pycache__/urls.cpython-310.pyc deleted file mode 100644 index e10f409..0000000 Binary files a/gestion_projet/__pycache__/urls.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/urls.cpython-312.pyc b/gestion_projet/__pycache__/urls.cpython-312.pyc deleted file mode 100644 index b941eb2..0000000 Binary files a/gestion_projet/__pycache__/urls.cpython-312.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/urls.cpython-313.pyc b/gestion_projet/__pycache__/urls.cpython-313.pyc deleted file mode 100644 index 5836f28..0000000 Binary files a/gestion_projet/__pycache__/urls.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/urls.cpython-314.pyc b/gestion_projet/__pycache__/urls.cpython-314.pyc deleted file mode 100644 index a8efb99..0000000 Binary files a/gestion_projet/__pycache__/urls.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/views.cpython-310.pyc b/gestion_projet/__pycache__/views.cpython-310.pyc deleted file mode 100644 index 17b2d31..0000000 Binary files a/gestion_projet/__pycache__/views.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/views.cpython-312.pyc b/gestion_projet/__pycache__/views.cpython-312.pyc deleted file mode 100644 index 4bc400f..0000000 Binary files a/gestion_projet/__pycache__/views.cpython-312.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/views.cpython-313.pyc b/gestion_projet/__pycache__/views.cpython-313.pyc deleted file mode 100644 index 4b5562b..0000000 Binary files a/gestion_projet/__pycache__/views.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/__pycache__/views.cpython-314.pyc b/gestion_projet/__pycache__/views.cpython-314.pyc deleted file mode 100644 index 012a9c3..0000000 Binary files a/gestion_projet/__pycache__/views.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0001_initial.cpython-310.pyc b/gestion_projet/migrations/__pycache__/0001_initial.cpython-310.pyc deleted file mode 100644 index 7db5fc2..0000000 Binary files a/gestion_projet/migrations/__pycache__/0001_initial.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0001_initial.cpython-312.pyc b/gestion_projet/migrations/__pycache__/0001_initial.cpython-312.pyc deleted file mode 100644 index 7f3b259..0000000 Binary files a/gestion_projet/migrations/__pycache__/0001_initial.cpython-312.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0001_initial.cpython-313.pyc b/gestion_projet/migrations/__pycache__/0001_initial.cpython-313.pyc deleted file mode 100644 index c3a8ad9..0000000 Binary files a/gestion_projet/migrations/__pycache__/0001_initial.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0001_initial.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0001_initial.cpython-314.pyc deleted file mode 100644 index 47ee6a3..0000000 Binary files a/gestion_projet/migrations/__pycache__/0001_initial.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0002_alter_domainederecherche_options.cpython-310.pyc b/gestion_projet/migrations/__pycache__/0002_alter_domainederecherche_options.cpython-310.pyc deleted file mode 100644 index 53ae779..0000000 Binary files a/gestion_projet/migrations/__pycache__/0002_alter_domainederecherche_options.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0002_alter_domainederecherche_options.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0002_alter_domainederecherche_options.cpython-314.pyc deleted file mode 100644 index 2dc0098..0000000 Binary files a/gestion_projet/migrations/__pycache__/0002_alter_domainederecherche_options.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0002_alter_projet_budget_alter_projet_budget_rh.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0002_alter_projet_budget_alter_projet_budget_rh.cpython-314.pyc deleted file mode 100644 index cfd5cf5..0000000 Binary files a/gestion_projet/migrations/__pycache__/0002_alter_projet_budget_alter_projet_budget_rh.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0002_documentprojet_dernier_alerte_mail.cpython-310.pyc b/gestion_projet/migrations/__pycache__/0002_documentprojet_dernier_alerte_mail.cpython-310.pyc deleted file mode 100644 index e61e26f..0000000 Binary files a/gestion_projet/migrations/__pycache__/0002_documentprojet_dernier_alerte_mail.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0002_documentprojet_dernier_alerte_mail.cpython-313.pyc b/gestion_projet/migrations/__pycache__/0002_documentprojet_dernier_alerte_mail.cpython-313.pyc deleted file mode 100644 index 5844683..0000000 Binary files a/gestion_projet/migrations/__pycache__/0002_documentprojet_dernier_alerte_mail.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0002_domainederecherche_remove_projet_domaine_recherche_and_more.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0002_domainederecherche_remove_projet_domaine_recherche_and_more.cpython-314.pyc deleted file mode 100644 index a87a34d..0000000 Binary files a/gestion_projet/migrations/__pycache__/0002_domainederecherche_remove_projet_domaine_recherche_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0002_projet_volets.cpython-313.pyc b/gestion_projet/migrations/__pycache__/0002_projet_volets.cpython-313.pyc deleted file mode 100644 index f9e500b..0000000 Binary files a/gestion_projet/migrations/__pycache__/0002_projet_volets.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0002_remove_activiteprojet_livrables_and_more.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0002_remove_activiteprojet_livrables_and_more.cpython-314.pyc deleted file mode 100644 index a430fe5..0000000 Binary files a/gestion_projet/migrations/__pycache__/0002_remove_activiteprojet_livrables_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0003_alter_domainederecherche_nom.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0003_alter_domainederecherche_nom.cpython-314.pyc deleted file mode 100644 index 23891b6..0000000 Binary files a/gestion_projet/migrations/__pycache__/0003_alter_domainederecherche_nom.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0003_remove_documentprojet_dernier_alerte_mail_and_more.cpython-310.pyc b/gestion_projet/migrations/__pycache__/0003_remove_documentprojet_dernier_alerte_mail_and_more.cpython-310.pyc deleted file mode 100644 index 0127eb1..0000000 Binary files a/gestion_projet/migrations/__pycache__/0003_remove_documentprojet_dernier_alerte_mail_and_more.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0003_remove_documentprojet_dernier_alerte_mail_and_more.cpython-313.pyc b/gestion_projet/migrations/__pycache__/0003_remove_documentprojet_dernier_alerte_mail_and_more.cpython-313.pyc deleted file mode 100644 index fc771dc..0000000 Binary files a/gestion_projet/migrations/__pycache__/0003_remove_documentprojet_dernier_alerte_mail_and_more.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0003_remove_documentprojet_dernier_alerte_mail_and_more.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0003_remove_documentprojet_dernier_alerte_mail_and_more.cpython-314.pyc deleted file mode 100644 index 33326ca..0000000 Binary files a/gestion_projet/migrations/__pycache__/0003_remove_documentprojet_dernier_alerte_mail_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0004_delete_plan.cpython-310.pyc b/gestion_projet/migrations/__pycache__/0004_delete_plan.cpython-310.pyc deleted file mode 100644 index dc6ab2a..0000000 Binary files a/gestion_projet/migrations/__pycache__/0004_delete_plan.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0004_delete_plan.cpython-313.pyc b/gestion_projet/migrations/__pycache__/0004_delete_plan.cpython-313.pyc deleted file mode 100644 index 4cb2d12..0000000 Binary files a/gestion_projet/migrations/__pycache__/0004_delete_plan.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0004_remove_activiteprojet_livrables.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0004_remove_activiteprojet_livrables.cpython-314.pyc deleted file mode 100644 index ca7e542..0000000 Binary files a/gestion_projet/migrations/__pycache__/0004_remove_activiteprojet_livrables.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0005_alter_livrableslivres_nom_delete_livrableattendu.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0005_alter_livrableslivres_nom_delete_livrableattendu.cpython-314.pyc deleted file mode 100644 index d1a11ac..0000000 Binary files a/gestion_projet/migrations/__pycache__/0005_alter_livrableslivres_nom_delete_livrableattendu.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0006_activiteprojet_motif_changement_budget.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0006_activiteprojet_motif_changement_budget.cpython-314.pyc deleted file mode 100644 index 3f26612..0000000 Binary files a/gestion_projet/migrations/__pycache__/0006_activiteprojet_motif_changement_budget.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0007_alter_domainederecherche_nom.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0007_alter_domainederecherche_nom.cpython-314.pyc deleted file mode 100644 index 9558ba9..0000000 Binary files a/gestion_projet/migrations/__pycache__/0007_alter_domainederecherche_nom.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/0008_remove_domainederecherche_id_and_more.cpython-314.pyc b/gestion_projet/migrations/__pycache__/0008_remove_domainederecherche_id_and_more.cpython-314.pyc deleted file mode 100644 index 7835b14..0000000 Binary files a/gestion_projet/migrations/__pycache__/0008_remove_domainederecherche_id_and_more.cpython-314.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/__init__.cpython-310.pyc b/gestion_projet/migrations/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index f1b89ae..0000000 Binary files a/gestion_projet/migrations/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/__init__.cpython-312.pyc b/gestion_projet/migrations/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index cfb6f8c..0000000 Binary files a/gestion_projet/migrations/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/__init__.cpython-313.pyc b/gestion_projet/migrations/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 56a1444..0000000 Binary files a/gestion_projet/migrations/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/gestion_projet/migrations/__pycache__/__init__.cpython-314.pyc b/gestion_projet/migrations/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index a1c65e9..0000000 Binary files a/gestion_projet/migrations/__pycache__/__init__.cpython-314.pyc and /dev/null 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 @@
- - + + +
+
+ +
@@ -48,24 +52,19 @@
-
- - -
{% if appartient_au_departement_informatique %} {% endif %} {% if appartient_direction and reservation.statut == "en_attente" %} - {% endif %} - - {% if appartient_direction %} {% endif %} + +
-
\ No newline at end of file +
\ No newline at end of file diff --git a/gestion_salle/views.py b/gestion_salle/views.py index de589cf..6ccc645 100644 --- a/gestion_salle/views.py +++ b/gestion_salle/views.py @@ -8,63 +8,93 @@ from django.forms import model_to_dict from gestion_employe.models import Employe from gestion_salle.forms import ReservationForm from .models import Reservation +from datetime import timedelta +from django.contrib.auth.models import User + @login_required -def index(request:HttpRequest): - """Vue de gestion de la reservation de la salle""" +def index(request: HttpRequest): + try: employe = Employe.objects.get(user=request.user) except Employe.DoesNotExist: - 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.") + messages.error(request, "Profil employé introuvable.") return redirect('gestion_conges:conge') - + + + if request.method == "POST": form = ReservationForm(request.POST) - if form.is_valid(): - date_debut = form.cleaned_data.get('date_debut') - date_fin = form.cleaned_data.get('date_fin') - salle = form.cleaned_data.get('salle') - heure_debut = form.cleaned_data.get('heure_debut') - heure_fin = form.cleaned_data.get('heure_fin') - motif_reservation = form.cleaned_data.get('motif_reservation') - besoin_zoom = form.cleaned_data.get('besoin_zoom') - besoin_ordi = form.cleaned_data.get('besoin_ordi') - - while date_debut <= date_fin : - reservation = Reservation( - employe = employe, - date_debut = date_debut, - date_fin = date_debut, - salle = salle, - heure_debut = heure_debut, - heure_fin = heure_fin, - besoin_zoom = besoin_zoom, - besoin_ordi = besoin_ordi, - motif_reservation=motif_reservation, - ) - reservation.save() - date_debut = date_debut + timedelta(days=1) - messages.success(request, "Réservation(s) créées avec succès.") + if form.is_valid(): + + date_debut = form.cleaned_data['date_debut'] + date_fin = form.cleaned_data['date_fin'] + salle = form.cleaned_data['salle'] + heure_debut = form.cleaned_data['heure_debut'] + heure_fin = form.cleaned_data['heure_fin'] + motif = form.cleaned_data['motif_reservation'] + besoin_zoom = form.cleaned_data['besoin_zoom'] + besoin_ordi = form.cleaned_data['besoin_ordi'] + + if date_fin < date_debut: + messages.error(request, "Date fin invalide.") + return redirect('gestion_salle:reservation-salle') + + if heure_fin <= heure_debut: + messages.error(request, "Heure invalide.") + return redirect('gestion_salle:reservation-salle') + + if not request.user.first_name.strip() or not request.user.last_name.strip(): + messages.error( + request, + "Veuillez renseigner votre nom et prénom pour pouvoir faire une réservation." + ) + return redirect('gestion_salle:reservation-salle') + + created = [] + current_date = date_debut + + while current_date <= date_fin: + + reservation = Reservation.objects.create( + employe=employe, + date_debut=current_date, + date_fin=current_date, + salle=salle, + heure_debut=heure_debut, + heure_fin=heure_fin, + besoin_zoom=besoin_zoom, + besoin_ordi=besoin_ordi, + motif_reservation=motif, + statut="en_attente" + ) + + created.append(reservation) + current_date += timedelta(days=1) + + messages.success(request, "Réservation(s) créée(s) avec succès.") return redirect('gestion_salle:reservation-salle') formulaire_reservation = ReservationForm() - departement = Employe.objects.get(user__username=request.user).departement - appartient_direction = 'direction' in request.user.groups.values_list('name', flat=True) - liste_demande_reservation = [ - reservation.id for reservation in - Reservation.objects.filter(employe=employe, statut='en_attente') - ] - + departement = employe.departement + + appartient_direction = request.user.groups.filter(name='direction').exists() + + liste_demande_reservation = Reservation.objects.filter( + employe=employe, + statut='en_attente' + ).values_list('id', flat=True) + context = { 'formulaire_reservation': formulaire_reservation, 'nb_reservation_attente': Reservation.objects.filter(statut='en_attente').count(), - 'appartient_au_departement_informatique': 'Informatique' == departement.nom if departement else False, + 'appartient_au_departement_informatique': departement and departement.nom == "Systeme informatique", 'appartient_direction': appartient_direction, - 'liste_demande_reservation': liste_demande_reservation + 'liste_demande_reservation': list(liste_demande_reservation), } - return render(request, "gestion_salle/index.html", context) + return render(request, "gestion_salle/index.html", context) def liste_reservation(request:HttpRequest): """Vue d'affichage des creneaux disponibles""" reservations = Reservation.objects.filter(statut = "validee") @@ -86,7 +116,6 @@ def liste_reservation(request:HttpRequest): "end": reservation.heure_fin, "color": color, }) - return JsonResponse(liste_reservation, safe=False) @login_required @@ -103,23 +132,25 @@ def liste_reservation_attente(request): return JsonResponse(liste_reservation, safe=False) def detail_reservation(request:HttpRequest, reservation_id:int): + reservation = Reservation.objects.get(id=reservation_id) employe = reservation.employe.user + reservation_json = { + 'id_reservation': reservation_id, 'employe': f"{employe.first_name} {employe.last_name}", 'salle': reservation.salle, 'statut': reservation.statut, - 'date_evenement': reservation.date_debut.strftime('%Y-%m-%d'), + 'date_debut': reservation.date_debut.strftime('%Y-%m-%d'), + 'date_fin': reservation.date_fin.strftime('%Y-%m-%d'), 'heure_debut': reservation.heure_debut.strftime('%H:%M'), 'heure_fin': reservation.heure_fin.strftime('%H:%M'), 'motif_reservation': reservation.motif_reservation, '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) @login_required @@ -165,31 +196,35 @@ def annuler_reservation(request:HttpRequest): return redirect('gestion_salle:reservation-salle') @login_required -def valider_reservation(request:HttpRequest): - """Vue de gestion de l'annulation de la reservation""" +def valider_reservation(request: HttpRequest): + """Validation d'une réservation""" if request.method == 'POST': - reservation_id= request.POST['id_reservation'] + reservation_id = request.POST.get('id_reservation') + try: - reservation = Reservation.objects.get(id=reservation_id) - except reservation.DoesNotExist: - messages.error(request, "La resevertion selectionné n'existe pas.") + reservation = Reservation.objects.get(id=reservation_id) + except Reservation.DoesNotExist: + messages.error(request, "La réservation sélectionnée n'existe pas.") return redirect("salle") - + reservation.statut = 'validee' reservation.save() - messages.success(request, f"Réservation de {reservation.employe.get_full_name()} validée avec succès.") + return redirect('gestion_salle:reservation-salle') @login_required -def refuser_reservation(request:HttpRequest): - """Vue de gestion de refus de la reservation""" - data = json.loads(request.body) - reservation_id = data.get("id_reservation") - try: - reservation = Reservation.objects.get(id=reservation_id) - except Reservation.DoesNotExist and ValueError: - return JsonResponse({"message": "La resevertion selectionné n'existe pas."}) - else: - reservation.statut = "refusee" +def refuser_reservation(request: HttpRequest): + """Refuser une réservation""" + if request.method == 'POST': + reservation_id = request.POST.get('id_reservation') + + try: + reservation = Reservation.objects.get(id=reservation_id) + except Reservation.DoesNotExist: + messages.error(request, "La réservation n'existe pas.") + return redirect("salle") + + reservation.statut = 'refusee' reservation.save() - return JsonResponse({"message": "Réservation refusée avec succès."}) \ No newline at end of file + + return redirect('gestion_salle:reservation-salle') \ No newline at end of file diff --git a/media/photos/unnamed_-_Copie.png b/media/photos/unnamed_-_Copie.png new file mode 100644 index 0000000..1d7cf9f Binary files /dev/null and b/media/photos/unnamed_-_Copie.png differ