Première groose modification
This commit is contained in:
BIN
gestion_salle/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
gestion_salle/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
gestion_salle/__pycache__/admin.cpython-312.pyc
Normal file
BIN
gestion_salle/__pycache__/admin.cpython-312.pyc
Normal file
Binary file not shown.
BIN
gestion_salle/__pycache__/apps.cpython-312.pyc
Normal file
BIN
gestion_salle/__pycache__/apps.cpython-312.pyc
Normal file
Binary file not shown.
BIN
gestion_salle/__pycache__/forms.cpython-312.pyc
Normal file
BIN
gestion_salle/__pycache__/forms.cpython-312.pyc
Normal file
Binary file not shown.
BIN
gestion_salle/__pycache__/models.cpython-312.pyc
Normal file
BIN
gestion_salle/__pycache__/models.cpython-312.pyc
Normal file
Binary file not shown.
BIN
gestion_salle/__pycache__/urls.cpython-312.pyc
Normal file
BIN
gestion_salle/__pycache__/urls.cpython-312.pyc
Normal file
Binary file not shown.
BIN
gestion_salle/__pycache__/views.cpython-312.pyc
Normal file
BIN
gestion_salle/__pycache__/views.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
gestion_salle/migrations/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
gestion_salle/migrations/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
@@ -20,4 +20,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -21,8 +21,12 @@
|
||||
<input class="form-control" id="salle" readonly>
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Date de l'évènement :</label>
|
||||
<input type='date' class="form-control" id="date_evenement" readonly >
|
||||
<label>Date de debut :</label>
|
||||
<input type='date' class="form-control" id="date_debut" readonly >
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Date de fin :</label>
|
||||
<input type='date' class="form-control" id="date_fin" readonly >
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Heure de début :</label>
|
||||
@@ -48,10 +52,6 @@
|
||||
<label label="form-check-label">Besoin d'un ordinateur</label>
|
||||
<input type="checkbox" class="form-check-input" id="besoin_ordinateur" readonly >
|
||||
</div>
|
||||
<div class="form-group mb-2" id='motif_refus_container'>
|
||||
<label>Motif de refus de la reservation :</label>
|
||||
<textarea class="form-control" id="motif_refus" readonly></textarea>
|
||||
</div>
|
||||
<div class='d-flex justify-content-around mt-2'>
|
||||
{% if appartient_au_departement_informatique %}
|
||||
<button class="btn btn-primary" id="ajoutZoom">Ajout du lien zoom</button>
|
||||
@@ -59,8 +59,9 @@
|
||||
{% if appartient_direction and reservation.statut == "en_attente" %}
|
||||
<button class="btn btn-danger" id="refuserReservation" data-lienrefus="{% url 'gestion_salle:refuser-reservation' %}">Refuser</button>
|
||||
{% endif %}
|
||||
<span id="current-user-id" data-user-id="{{ request.user.id }}"></span>
|
||||
<button class="btn btn-danger" id="bouton-annuler">Annuler</button>
|
||||
{% if appartient_direction %}
|
||||
{% if appartient_direction and reservation.statut == "en_attente" %}
|
||||
<button class="btn btn-success" id="bouton-valider">Valider</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -68,4 +69,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -16,8 +16,7 @@ def index(request:HttpRequest):
|
||||
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.")
|
||||
return redirect('gestion_conges:conge')
|
||||
|
||||
return redirect('gestion_conges:conge')
|
||||
if request.method == "POST":
|
||||
form = ReservationForm(request.POST)
|
||||
if form.is_valid():
|
||||
@@ -29,7 +28,7 @@ def index(request:HttpRequest):
|
||||
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,
|
||||
@@ -42,12 +41,24 @@ def index(request:HttpRequest):
|
||||
besoin_ordi = besoin_ordi,
|
||||
motif_reservation=motif_reservation,
|
||||
)
|
||||
reservation.save()
|
||||
date_debut = date_debut + timedelta(days=1)
|
||||
|
||||
if heure_fin <= heure_debut:
|
||||
messages.error(
|
||||
request,
|
||||
"Erreur : l'heure de fin ne peut pas être inférieure ou égale à l'heure de début."
|
||||
)
|
||||
return redirect('gestion_salle:reservation-salle')
|
||||
first_name = (employe.user.first_name or "").strip()
|
||||
last_name = (employe.user.last_name or "").strip()
|
||||
if not first_name or not last_name:
|
||||
messages.error(
|
||||
request,
|
||||
"Vous devez renseigner un nom et prénom valides avant de faire une réservation."
|
||||
)
|
||||
return redirect('gestion_salle:reservation-salle')
|
||||
reservation.save()
|
||||
date_debut = date_debut + timedelta(days=1)
|
||||
messages.success(request, "Réservation(s) créées 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)
|
||||
@@ -86,7 +97,6 @@ def liste_reservation(request:HttpRequest):
|
||||
"end": reservation.heure_fin,
|
||||
"color": color,
|
||||
})
|
||||
|
||||
return JsonResponse(liste_reservation, safe=False)
|
||||
|
||||
@login_required
|
||||
@@ -105,21 +115,22 @@ def liste_reservation_attente(request):
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user