Compare commits
7 Commits
267994044c
...
modificati
| Author | SHA1 | Date | |
|---|---|---|---|
| a28b177eba | |||
| 415860f233 | |||
| 8503689aa4 | |||
| b03a4214c0 | |||
| d4f4b7d954 | |||
| 489eeb439f | |||
| 5277b7f355 |
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@@ -39,6 +39,8 @@ pipeline
|
||||
|
||||
python manage.py makemigrations
|
||||
python manage.py migrate
|
||||
echo $SUDO_PASSWORD | sudo -S rm -r staticfiles
|
||||
python manage.py collectstatic --noinput
|
||||
|
||||
echo $SUDO_PASSWORD | sudo -S chown -R www-data:www-data /var/www/sirh
|
||||
echo "Deploiement reussi"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -24,7 +24,6 @@ enregistrerProfil.addEventListener("click", (e) => {
|
||||
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);
|
||||
@@ -32,6 +31,10 @@ enregistrerProfil.addEventListener("click", (e) => {
|
||||
formData.append("adresse", $("adresse").value);
|
||||
formData.append("sexe", $("sexe").value);
|
||||
formData.append("date_naissance", $("date_naissance").value);
|
||||
const photoInput = $("photo");
|
||||
if (photoInput.files.length > 0) {
|
||||
formData.append("photo", photoInput.files[0]);
|
||||
}
|
||||
|
||||
fetch(url, {
|
||||
method: "POST",
|
||||
|
||||
Binary file not shown.
@@ -191,7 +191,7 @@ def modifier_employer(request):
|
||||
except Employe.DoesNotExist:
|
||||
return JsonResponse({"message": "Employé non trouvé."})
|
||||
if request.method == "POST":
|
||||
data = json.loads(request.body)
|
||||
data = request.POST
|
||||
user = User.objects.get(username=request.user)
|
||||
user.last_name = data['nom']
|
||||
user.first_name = data['prenom']
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,7 +2,6 @@ from datetime import date
|
||||
from decimal import Decimal, InvalidOperation
|
||||
from django.http import JsonResponse
|
||||
from django.shortcuts import redirect, render
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -33,11 +33,6 @@ const calendrier = Schedule(document.getElementById('planning-reservation'), {
|
||||
$("lien_zoom_container").className = "d-none";
|
||||
}
|
||||
|
||||
if(data.statut !== "annulee"){
|
||||
$("motif_refus_container").className = "d-none";
|
||||
}else{
|
||||
$("motif_refus").value=data.motif_refus;
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
@@ -83,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,
|
||||
{
|
||||
@@ -133,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: {
|
||||
@@ -164,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;
|
||||
@@ -189,7 +187,10 @@ tableau_reservation_attente.on("rowClick", (row, rowData) => {
|
||||
$("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();
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
<div class="form-group col-5 me-2">
|
||||
<label>Selectionner une salle :</label>
|
||||
<select class = "form-select" id="liste-salle">
|
||||
<option value='formation'>Salle de formation</option>
|
||||
<option value='reunion'>Salle de réunion</option>
|
||||
<option value='lien_zoom'>Lien Zoom</option>
|
||||
<option value='Salle de formation'>Salle de formation</option>
|
||||
<option value='Salle de réunion'>Salle de réunion</option>
|
||||
<option value='Lien Zoom'>Lien Zoom</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<!-- Modal d'affichage des détails d'une reservation -->
|
||||
{% load tags_personnaliser %}
|
||||
<div class="modal fade" id="modalDetailReservation" tabindex="-1" aria-labelledby="modalDetailReservationLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
@@ -56,11 +57,11 @@
|
||||
{% if appartient_au_departement_informatique %}
|
||||
<button class="btn btn-primary" id="ajoutZoom">Ajout du lien zoom</button>
|
||||
{% endif %}
|
||||
{% if appartient_direction and reservation.statut == "en_attente" %}
|
||||
{% if user|has_group:'direction' %}
|
||||
<button class="btn btn-danger" id="refuserReservation" data-lienrefus="{% url 'gestion_salle:refuser-reservation' %}">Refuser</button>
|
||||
<button class="btn btn-success" id="bouton-valider">Valider</button>
|
||||
{% endif %}
|
||||
<span id="current-user-id" data-user-id="{{ request.user.id }}"></span>
|
||||
<span id="current-user-id" data-userid="{{ request.user.id }}"></span>
|
||||
<button class="btn btn-danger" id="bouton-annuler">Annuler</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from datetime import timedelta
|
||||
import json
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import redirect, render
|
||||
@@ -19,8 +20,6 @@ def index(request: HttpRequest):
|
||||
messages.error(request, "Profil employé introuvable.")
|
||||
return redirect('gestion_conges:conge')
|
||||
|
||||
|
||||
|
||||
if request.method == "POST":
|
||||
form = ReservationForm(request.POST)
|
||||
|
||||
@@ -71,13 +70,14 @@ def index(request: HttpRequest):
|
||||
current_date += timedelta(days=1)
|
||||
|
||||
messages.success(request, "Réservation(s) créée(s) avec succès.")
|
||||
|
||||
if fonctions_utilitaire.EMAIL_ASSISTANTE_DE_DIRECTION:
|
||||
fonctions_utilitaire.envoyer_mail(
|
||||
sujet = "Reservation de salle",
|
||||
message = f"""
|
||||
Une nouvelle demande de réservation de la {dict(Reservation.TYPE_CHOICES).get(salle)} a été effectuée par {employe.user.first_name} {employe.user.last_name} du {form.cleaned_data.get('date_debut').strftime('%d/%m/%Y')} au {form.cleaned_data.get('date_fin').strftime('%d/%m/%Y')} pour motif "{motif}".
|
||||
Veuillez vous connecter à la plateforme pour plus de détails.""",
|
||||
destinataires = list(fonctions_utilitaire.EMAIL_ASSISTANTE_DE_DIRECTION)
|
||||
destinataires = fonctions_utilitaire.EMAIL_ASSISTANTE_DE_DIRECTION
|
||||
)
|
||||
return redirect('gestion_salle:reservation-salle')
|
||||
|
||||
@@ -100,10 +100,12 @@ Veuillez vous connecter à la plateforme pour plus de détails.""",
|
||||
}
|
||||
|
||||
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")
|
||||
liste_reservation = []
|
||||
|
||||
for reservation in reservations:
|
||||
color = None
|
||||
if reservation.statut == "en_attente":
|
||||
@@ -113,6 +115,8 @@ def liste_reservation(request:HttpRequest):
|
||||
else:
|
||||
color = "#dc3545"
|
||||
|
||||
print(dict(Reservation.TYPE_CHOICES).get(reservation.salle))
|
||||
|
||||
liste_reservation.append({
|
||||
"guid": reservation.pk,
|
||||
"title": dict(Reservation.TYPE_CHOICES).get(reservation.salle),
|
||||
@@ -130,7 +134,9 @@ def liste_reservation_attente(request):
|
||||
{
|
||||
**model_to_dict(reservation),
|
||||
"employe": f"{reservation.employe.user.first_name} {reservation.employe.user.last_name}",
|
||||
"salle": dict(Reservation.TYPE_CHOICES).get(reservation.salle)
|
||||
"employe_id": reservation.employe.user.id,
|
||||
"salle": dict(Reservation.TYPE_CHOICES).get(reservation.salle),
|
||||
'statut': dict(Reservation.STATUT).get(reservation.statut),
|
||||
} for reservation in reservations
|
||||
]
|
||||
|
||||
@@ -155,6 +161,7 @@ def detail_reservation(request:HttpRequest, reservation_id:int):
|
||||
'besoin_ordinateur': reservation.besoin_ordi,
|
||||
'lien_zoom': reservation.lien_zoom or '',
|
||||
}
|
||||
|
||||
return JsonResponse(reservation_json, safe=True)
|
||||
|
||||
@login_required
|
||||
@@ -213,32 +220,31 @@ def valider_reservation(request: HttpRequest):
|
||||
|
||||
reservation.statut = 'validee'
|
||||
reservation.save()
|
||||
if fonctions_utilitaire.EMAIL_ASSISTANTE_DE_DIRECTION:
|
||||
|
||||
fonctions_utilitaire.envoyer_mail(
|
||||
sujet = "Reservation de salle",
|
||||
message = f"""Bonjour {request.user.first_name} {request.user.last_name}, votre reservation de la salle {dict(Reservation.TYPE_CHOICES).get(reservation.salle)} du {reservation.date_debut.strftime('%d/%m/%Y')} au {reservation.date_fin.strftime('%d/%m/%Y')} pour motif "{reservation.motif_reservation}" a été validée. Veuillez vous connecter à la plateforme pour plus de détails.""",
|
||||
destinataires = [reservation.employe.user.email]
|
||||
)
|
||||
|
||||
messages.success(request, f"Réservation de {reservation.employe.get_full_name()} validée avec succès.")
|
||||
messages.success(request, f"La réservation de {request.user.first_name} {request.user.last_name} validée avec succès.")
|
||||
return redirect('gestion_salle:reservation-salle')
|
||||
|
||||
@login_required
|
||||
def refuser_reservation(request: HttpRequest):
|
||||
"""Refuser une réservation"""
|
||||
if request.method == 'POST':
|
||||
reservation_id = request.POST.get('id_reservation')
|
||||
reservation_id = json.loads(request.body).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")
|
||||
return JsonResponse({"message": "Une erreur s'est produite lors de l'annulation de la reservation."})
|
||||
|
||||
reservation.statut = 'refusee'
|
||||
reservation.save()
|
||||
|
||||
if fonctions_utilitaire.EMAIL_ASSISTANTE_DE_DIRECTION:
|
||||
fonctions_utilitaire.envoyer_mail(
|
||||
sujet = "Reservation de salle",
|
||||
message = f"""Bonjour {request.user.first_name} {request.user.last_name}, votre reservation de la salle {dict(Reservation.TYPE_CHOICES).get(reservation.salle)} du {reservation.date_debut.strftime('%d/%m/%Y')} au {reservation.date_fin.strftime('%d/%m/%Y')} pour motif "{reservation.motif_reservation}" a été refusée. Veuillez vous connecter à l'Assistante de Direction pour plus de détails.""",
|
||||
|
||||
Reference in New Issue
Block a user