Fonctionnalite : Ajout de la liste des contrats
This commit is contained in:
0
gestion_salle/__init__.py
Normal file
0
gestion_salle/__init__.py
Normal file
3
gestion_salle/admin.py
Normal file
3
gestion_salle/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
5
gestion_salle/apps.py
Normal file
5
gestion_salle/apps.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class GestionSalleConfig(AppConfig):
|
||||
name = 'gestion_salle'
|
||||
32
gestion_salle/forms.py
Normal file
32
gestion_salle/forms.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from django import forms
|
||||
from .models import Reservation
|
||||
|
||||
class ReservationForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Reservation
|
||||
fields = ['salle', 'date_debut', 'date_fin', 'heure_debut', 'heure_fin', 'motif_reservation', 'besoin_zoom', 'besoin_ordi']
|
||||
widgets = {
|
||||
'date_debut': forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}),
|
||||
'date_fin': forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}),
|
||||
'heure_debut': forms.TimeInput(attrs={'type': 'time', 'class': 'form-control'}),
|
||||
'heure_fin': forms.TimeInput(attrs={'type': 'time', 'class': 'form-control'}),
|
||||
'motif_reservation': forms.Textarea(attrs={'rows': 3, 'cols': 40, 'style':'resize:none;', 'class': 'form-control'}),
|
||||
'salle': forms.Select(attrs={'class': 'form-select'}),
|
||||
}
|
||||
besoin_zoom = forms.BooleanField(
|
||||
required=False,
|
||||
label="Besoin d'un lien Zoom ?",
|
||||
widget=forms.CheckboxInput(attrs={'class': 'form-check-input', 'id': 'id_besoin_zoom'})
|
||||
)
|
||||
besoin_ordi = forms.BooleanField(
|
||||
required=False,
|
||||
label="Besoin d'ordinateur ?",
|
||||
widget=forms.CheckboxInput(attrs={'class': 'form-check-input', 'id': 'id_besoin_ordi'})
|
||||
)
|
||||
|
||||
class RefusReservationForm(forms.Form):
|
||||
motif_refus = forms.CharField(
|
||||
label= "Motif du refus",
|
||||
widget=forms.Textarea(attrs={'rows': 3, 'cols': 40, 'style': 'resize:none;'}),
|
||||
required=True
|
||||
)
|
||||
34
gestion_salle/migrations/0001_initial.py
Normal file
34
gestion_salle/migrations/0001_initial.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Generated by Django 5.2.13 on 2026-04-17 12:03
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('gestion_employe', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Reservation',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('salle', models.CharField(choices=[('formation', 'Salle de formation'), ('reunion', 'Salle de réunion'), ('lien_zoom', 'Lien Zoom')], max_length=100)),
|
||||
('date_demande', models.DateTimeField(auto_now_add=True)),
|
||||
('date_debut', models.DateField()),
|
||||
('date_fin', models.DateField(blank=True, null=True)),
|
||||
('heure_debut', models.TimeField()),
|
||||
('heure_fin', models.TimeField()),
|
||||
('besoin_zoom', models.BooleanField(default=False, verbose_name="Besoin d'un lien Zoom ?")),
|
||||
('besoin_ordi', models.BooleanField(default=False, verbose_name="Besoin d'un ordinateur ?")),
|
||||
('lien_zoom', models.URLField(blank=True, null=True, verbose_name='Lien Zoom')),
|
||||
('motif_reservation', models.TextField()),
|
||||
('statut', models.CharField(choices=[('en_attente', 'En attente'), ('validee', 'Validée'), ('refusee', 'Refusée'), ('annulee', 'Annulée')], default='en_attente', max_length=25)),
|
||||
('employe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gestion_employe.employe')),
|
||||
],
|
||||
),
|
||||
]
|
||||
0
gestion_salle/migrations/__init__.py
Normal file
0
gestion_salle/migrations/__init__.py
Normal file
@@ -15,6 +15,10 @@ const calendrier = Schedule(document.getElementById('planning-reservation'), {
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
currentReservationId = data.id_reservation;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
console.log(data);
|
||||
>>>>>>> c28b14f (clean: remove pycache from tracking)
|
||||
$("id_reservation_detail").value = data.id_reservation;
|
||||
$("id_reservation_refus").value = data.id_reservation;
|
||||
$("id_reservation_zoom").value = data.id_reservation;
|
||||
@@ -29,10 +33,13 @@ const calendrier = Schedule(document.getElementById('planning-reservation'), {
|
||||
$("besoin_ordinateur").checked=data.besoin_ordinateur;
|
||||
$("lien_zoom").value=data.lien_zoom;
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (data.besoin_zoom === false){
|
||||
$("lien_zoom_container").className = "d-none";
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> c28b14f (clean: remove pycache from tracking)
|
||||
if(data.statut !== "annulee"){
|
||||
$("motif_refus_container").className = "d-none";
|
||||
}else{
|
||||
@@ -170,9 +177,15 @@ tableau_reservation_attente.on("rowClick", (row, rowData) => {
|
||||
$("lien_zoom_container").className = 'd-none';
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// if(data.statut !== "refusee"){
|
||||
// $("motif_refus_container").className = 'd-none';
|
||||
// }
|
||||
=======
|
||||
if(data.statut !== "refusee"){
|
||||
$("motif_refus_container").className = 'd-none';
|
||||
}
|
||||
>>>>>>> c28b14f (clean: remove pycache from tracking)
|
||||
|
||||
$("id_reservation_detail").value = data.id;
|
||||
$("id_reservation_refus").value = data.id;
|
||||
@@ -181,15 +194,23 @@ tableau_reservation_attente.on("rowClick", (row, rowData) => {
|
||||
$("employe").value=data.employe;
|
||||
$("salle").value=data.salle;
|
||||
$("statut-reservation").innerHTML=data.statut;
|
||||
<<<<<<< HEAD
|
||||
$("date_debut").value = data.date_debut;
|
||||
$("date_fin").value = data.date_fin;
|
||||
=======
|
||||
$("date_evenement").value=data.date_debut;
|
||||
>>>>>>> c28b14f (clean: remove pycache from tracking)
|
||||
$("heure_debut").value=data.heure_debut;
|
||||
$("heure_fin").value=data.heure_fin;
|
||||
$("motif_reservation").value=data.motif_reservation;
|
||||
$("besoin_zoom").checked=data.besoin_zoom;
|
||||
$("besoin_ordinateur").checked=data.besoin_ordi;
|
||||
$("lien_zoom").value=data.lien_zoom;
|
||||
<<<<<<< HEAD
|
||||
// $("motif_refus").value=data.motif_refus;
|
||||
=======
|
||||
$("motif_refus").value=data.motif_refus;
|
||||
>>>>>>> c28b14f (clean: remove pycache from tracking)
|
||||
|
||||
const modal = new bootstrap.Modal($("modalDetailReservation"));
|
||||
bootstrap.Modal.getOrCreateInstance($("modalReservationAttente")).hide();
|
||||
|
||||
59
gestion_salle/templates/gestion_salle/index.html
Normal file
59
gestion_salle/templates/gestion_salle/index.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{% extends "BASE.html" %}
|
||||
{% load static %}
|
||||
{% block 'titre_page' %} Gestion des projets {% endblock %}
|
||||
{% block 'css' %}
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@calendarjs/ce/dist/style.min.css" />
|
||||
{% endblock %}
|
||||
{% block 'contenu' %}
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div class="alert alert-{% if message.tags == "error" %}danger{% else %}success{% endif %} alert-dismissible fade show" role="alert">
|
||||
{{ message }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<div class="col py-2 px-4">
|
||||
<h1 class="text-center">Reservation de salle</h1>
|
||||
<hr>
|
||||
<div class="row d-flex justify-content-around">
|
||||
<div class="form-group col-5 me-2">
|
||||
<label>Selectionner le jour concerné :</label>
|
||||
<input type="date" class="form-control" id="semaineDate" />
|
||||
</div>
|
||||
<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>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col d-flex justify-content-center">
|
||||
<button class="btn btn-lg btn-primary me-2" data-bs-toggle="modal" data-bs-target="#modalReservation">Nouvelle reservation</button>
|
||||
<button type="button" class="btn btn-warning" data-bs-toggle="modal" data-bs-target="#modalReservationAttente">
|
||||
Validation en attente <span class="badge badge-light">{{ nb_reservation_attente }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div data-url="{% url 'gestion_salle:liste-reservation' %}" id="planning-reservation"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block 'modal' %}
|
||||
{% include 'gestion_salle/parts/modalCreationReservation.html' %}
|
||||
{% include 'gestion_salle/parts/ModaleAjoutLienZoom.html' %}
|
||||
{% include 'gestion_salle/parts/ModalRefusReservation.html' %}
|
||||
{% include 'gestion_salle/parts/modalDetailResevation.html' %}
|
||||
{% include 'gestion_salle/parts/modalListeValidation.html' %}
|
||||
{% endblock %}
|
||||
{% block 'js' %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/lemonadejs/dist/lemonade.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@calendarjs/ce/dist/index.min.js"></script>
|
||||
<script src="{% static 'gestion_salle/js/index.js' %}"></script>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,22 @@
|
||||
<div class="modal fade" id="refusModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header ">
|
||||
<h5 class="modal-title">Motif du refus</h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="POST" id="refusForm" action="{% url 'gestion_salle:refuser-reservation' %}">
|
||||
{% csrf_token %}
|
||||
<input type='' class="form-control" id="id_reservation_refus" name='id_reservation' value="">
|
||||
<textarea class="form-control" name="motif_refus" rows="3" required></textarea>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-danger">Refuser</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annuler</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
<!-- Modal Ajouter/Modifier lien Zoom -->
|
||||
<div class="modal fade" id="modalZoom" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header ">
|
||||
<h5 class="modal-title">Ajouter/Modifier le lien Zoom</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" id="formZoom" action="{% url 'gestion_salle:ajouter-lien_zoom' %}">
|
||||
{% csrf_token %}
|
||||
<input type='hidden' class="form-control" id="id_reservation_zoom" name='id_reservation'>
|
||||
<div class="mb-3">
|
||||
<label for="lienZoom" class="form-label">Lien Zoom</label>
|
||||
<input type="url" class="form-control" name="lien_zoom" id="lienZoom"
|
||||
value="" required>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-success">Enregistrer</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annuler</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,23 @@
|
||||
<!-- Modal de création d'une nouvelle reservation -->
|
||||
<div class="modal fade" id="modalReservation" tabindex="-1" aria-labelledby="modalReservationLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="modalReservationLabel">
|
||||
Nouvelle reservation
|
||||
</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="POST" action="{% url 'gestion_salle:reservation-salle' %}">
|
||||
{% csrf_token %}
|
||||
{{ formulaire_reservation.as_p }}
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
|
||||
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -67,4 +67,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<!-- Modal d'affichage des détails d'une reservation -->
|
||||
<div class="modal fade" id="modalReservationAttente" tabindex="-1" aria-labelledby="modalReservationAttenteLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="modalReservationAttenteLabel">
|
||||
Liste des reservation en attente de validation
|
||||
</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="tableau-reservation-attente" data-reservationattentes = "{% url 'gestion_salle:liste-reservation-attente' %}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
3
gestion_salle/tests.py
Normal file
3
gestion_salle/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
48
gestion_salle/urls.py
Normal file
48
gestion_salle/urls.py
Normal file
@@ -0,0 +1,48 @@
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
app_name = "gestion_salle"
|
||||
|
||||
urlpatterns = [
|
||||
path(
|
||||
'revervation/',
|
||||
views.index,
|
||||
name='reservation-salle'
|
||||
),
|
||||
path(
|
||||
'revervation/details/<int:reservation_id>',
|
||||
views.detail_reservation,
|
||||
name='detail-reservation'
|
||||
),
|
||||
|
||||
path(
|
||||
'reservation/annuler',
|
||||
views.annuler_reservation,
|
||||
name='annuler-reservation'
|
||||
),
|
||||
path(
|
||||
'reservation/valider',
|
||||
views.valider_reservation,
|
||||
name='valider-reservation'
|
||||
),
|
||||
path(
|
||||
'reservation/refuser',
|
||||
views.refuser_reservation,
|
||||
name='refuser-reservation'
|
||||
),
|
||||
path(
|
||||
'reservation/ajout-de-lien-zoom',
|
||||
views.ajouter_lien_zoom,
|
||||
name='ajouter-lien_zoom'
|
||||
),
|
||||
path(
|
||||
'liste-reservation',
|
||||
views.liste_reservation,
|
||||
name='liste-reservation'
|
||||
),
|
||||
path(
|
||||
'liste-reservation-attente',
|
||||
views.liste_reservation_attente,
|
||||
name="liste-reservation-attente"
|
||||
)
|
||||
]
|
||||
Reference in New Issue
Block a user