SGL avec une premiere implementation de SSO
This commit is contained in:
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.
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.
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.
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.
@@ -8,7 +8,7 @@
|
||||
<div class="row p-2">
|
||||
<div class="col d-flex justify-content-between">
|
||||
<h3>PARC AUTOMOBILE</h3>
|
||||
{% if user|has_group:"Logisticien" %}
|
||||
{% if user|has_group:"logistique" %}
|
||||
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#enregistrerVehiculeModal">Ajouter un véhicule</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="card-body">
|
||||
<h5 class="card-title text-center">{{ vehicule.immatriculation }}</h5>
|
||||
|
||||
{% if user|has_group:"Logisticien" %}
|
||||
{% if user|has_group:"logistique" %}
|
||||
<a href="{% url 'gestion_vehicule:detail-voiture' vehicule.id %}" class="d-block m-auto btn btn-primary d-block voir-demande">Voir</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -38,13 +38,13 @@
|
||||
<div class="row d-flex mt-3">
|
||||
<div class="col d-flex justify-content-between">
|
||||
<h4>LISTE DES DEMANDES</h4>
|
||||
{% if user|has_group:"Employe" %}
|
||||
{% comment %} {% if user|has_group:"Employe" %} {% endcomment %}
|
||||
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#enregistrerDemandeModal">Faire une demande</button>
|
||||
{% endif %}
|
||||
{% comment %} {% endif %} {% endcomment %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if user|has_group:"Employe" %}
|
||||
{% comment %} {% if user|has_group:"Employe" %} {% endcomment %}
|
||||
<div class="row d-flex mt-2 mb-2">
|
||||
<!-- <div class="col">
|
||||
<label>Filtrer par date et heure de depart</label>
|
||||
@@ -62,7 +62,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% comment %} {% endif %} {% endcomment %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -70,131 +70,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ---------------------------------------- MODAL ENREGISTREMENT VEHICULE ----------------------------------- -->
|
||||
|
||||
<div class="modal fade" id="enregistrerVehiculeModal" tabindex="-1" aria-labelledby="enregistrerVehiculeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="enregistrerVehiculeModalLabel">Enregistrer un véhicule</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{% url 'gestion_vehicule:enregistrer-voiture' %}" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ formulaire_enregistrer_vehicule.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>
|
||||
|
||||
<!-- ------------------------------------ MODAL ENREGISTREMENT DEMANDE ------------------------------------ -->
|
||||
<div class="modal fade" id="enregistrerDemandeModal" tabindex="-1" aria-labelledby="enregistrerDemandeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="enregistrerDemandeModalLabel">Enregistrer une demande</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="messageZone"></div>
|
||||
<form data-url ="{% url 'gestion_vehicule:enregistrer-demande' %}" id="enregistrer-demande-form" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ formulaire_demande_vehicule.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>
|
||||
|
||||
<!-- ---------------------------------------- Modal confirmer sortie de la voiture ----------------------- -->
|
||||
<div class="modal fade" id="confirmerDemandeModal" tabindex="-1" aria-labelledby="confirmerDemandeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="confirmerDemandeModalLabel">Détail de la demande</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{% url 'gestion_vehicule:statut_demande' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<h5 class="text-center">Décision du logisticien</h5>
|
||||
<div class="d-flex justify-content-around">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="radioValider" id="radioValider" value="Valider">
|
||||
<label class="form-check-label" for="radioValider">
|
||||
Valider la demande
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="radioValider" id="radioRefuser" value="Refuser">
|
||||
<label class="form-check-label" for="radioRefuser">
|
||||
Refuser la demande
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="affichage-formulaire">
|
||||
<h5 class="text-center mt-3">Détail de la demande</h5>
|
||||
<input type="hidden" name="id-demande" id="id-demande">
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Nom du passager :</label>
|
||||
<input type="text" class="form-control" id="nom-passager" readonly>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Lieu de départ</label>
|
||||
<input type="text" class="form-control" id="lieu-depart" readonly>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Lieu d'arrivé :</label>
|
||||
<input type="text" class="form-control" id="lieu-arrivee" readonly>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Date et heure de départ :</label>
|
||||
<input type="text" class="form-control" id="date-heure-depart" readonly>
|
||||
</div>
|
||||
<h5 class="text-center mt-3">Attribution</h5>
|
||||
<div class="form-group">
|
||||
<label for="">Véhicule : </label>
|
||||
<select name="vehicule" id="vehicule" class="form-select"></select>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Chauffeur :</label>
|
||||
<select name="chauffeur" id="chauffeur" class="form-select"></select>
|
||||
</div>
|
||||
<!-- <h5 class="text-center mt-3">Fin de course</h5>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" name="course_termine" type="checkbox" role="switch" id="courseTermine">
|
||||
<label class="form-check-label" for="courseTermine">Course terminée</label>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Date et heure de retour :</label>
|
||||
<input type="datetime-local" name="date_heure_retour" id="date_heure_retour" class="form-control">
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="form-group mt-2" id="refus">
|
||||
<label for="">Motifs du refus :</label>
|
||||
<textarea class="form-control" name="motif" id="motif-refus"></textarea>
|
||||
</div>
|
||||
<div class="modal-footer" id="validation-sortie-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
|
||||
<button type="submit" class="btn btn-primary" id="demanderValiderEnregistrer">Enregistrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "gestion_vehicule/parts/modal_enregistrement_vehicule.html" %}
|
||||
{% include "gestion_vehicule/parts/modal_enregistrement_demande.html" %}
|
||||
{% include "gestion_vehicule/parts/modal_confirmer_sortie_voiture.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block "js" %}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,77 @@
|
||||
<!-- ---------------------------------------- Modal confirmer sortie de la voiture ----------------------- -->
|
||||
<div class="modal fade" id="confirmerDemandeModal" tabindex="-1" aria-labelledby="confirmerDemandeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="confirmerDemandeModalLabel">Détail de la demande</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{% url 'gestion_vehicule:statut_demande' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<h5 class="text-center">Décision du logistique</h5>
|
||||
<div class="d-flex justify-content-around">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="radioValider" id="radioValider" value="Valider">
|
||||
<label class="form-check-label" for="radioValider">
|
||||
Valider la demande
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="radioValider" id="radioRefuser" value="Refuser">
|
||||
<label class="form-check-label" for="radioRefuser">
|
||||
Refuser la demande
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="affichage-formulaire">
|
||||
<h5 class="text-center mt-3">Détail de la demande</h5>
|
||||
<input type="hidden" name="id-demande" id="id-demande">
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Nom du passager :</label>
|
||||
<input type="text" class="form-control" id="nom-passager" readonly>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Lieu de départ</label>
|
||||
<input type="text" class="form-control" id="lieu-depart" readonly>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Lieu d'arrivé :</label>
|
||||
<input type="text" class="form-control" id="lieu-arrivee" readonly>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Date et heure de départ :</label>
|
||||
<input type="text" class="form-control" id="date-heure-depart" readonly>
|
||||
</div>
|
||||
<h5 class="text-center mt-3">Attribution</h5>
|
||||
<div class="form-group">
|
||||
<label for="">Véhicule : </label>
|
||||
<select name="vehicule" id="vehicule" class="form-select"></select>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Chauffeur :</label>
|
||||
<select name="chauffeur" id="chauffeur" class="form-select"></select>
|
||||
</div>
|
||||
<!-- <h5 class="text-center mt-3">Fin de course</h5>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" name="course_termine" type="checkbox" role="switch" id="courseTermine">
|
||||
<label class="form-check-label" for="courseTermine">Course terminée</label>
|
||||
</div>
|
||||
<div class="form-group mt-2">
|
||||
<label for="">Date et heure de retour :</label>
|
||||
<input type="datetime-local" name="date_heure_retour" id="date_heure_retour" class="form-control">
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="form-group mt-2" id="refus">
|
||||
<label for="">Motifs du refus :</label>
|
||||
<textarea class="form-control" name="motif" id="motif-refus"></textarea>
|
||||
</div>
|
||||
<div class="modal-footer" id="validation-sortie-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
|
||||
<button type="submit" class="btn btn-primary" id="demanderValiderEnregistrer">Enregistrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,22 @@
|
||||
<!-- ------------------------------------ MODAL ENREGISTREMENT DEMANDE ------------------------------------ -->
|
||||
<div class="modal fade" id="enregistrerDemandeModal" tabindex="-1" aria-labelledby="enregistrerDemandeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="enregistrerDemandeModalLabel">Enregistrer une demande</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="messageZone"></div>
|
||||
<form data-url ="{% url 'gestion_vehicule:enregistrer-demande' %}" id="enregistrer-demande-form" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ formulaire_demande_vehicule.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>
|
||||
@@ -0,0 +1,22 @@
|
||||
<!-- ---------------------------------------- MODAL ENREGISTREMENT VEHICULE ----------------------------------- -->
|
||||
|
||||
<div class="modal fade" id="enregistrerVehiculeModal" tabindex="-1" aria-labelledby="enregistrerVehiculeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="enregistrerVehiculeModalLabel">Enregistrer un véhicule</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{% url 'gestion_vehicule:enregistrer-voiture' %}" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ formulaire_enregistrer_vehicule.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>
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,12 +1,12 @@
|
||||
"""Views pour la gestion des véhicules."""
|
||||
|
||||
from pyexpat.errors import messages
|
||||
from django.shortcuts import render, redirect
|
||||
from django.http import JsonResponse
|
||||
|
||||
from authentification.models import Profile
|
||||
from django.contrib.auth.models import Group
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib import messages
|
||||
from . import forms
|
||||
from . import models
|
||||
|
||||
@@ -132,7 +132,7 @@ def liste_demande(request):
|
||||
"""
|
||||
liste_demande_vehicule = []
|
||||
|
||||
if request.user.groups.filter(name="Chauffeur").exists():
|
||||
if request.user.groups.filter(name="chauffeur").exists():
|
||||
liste_demande_vehicule = models.DemandeVehicule.objects.filter(
|
||||
chauffeur__user_id=request.user.id
|
||||
)
|
||||
@@ -144,16 +144,20 @@ def liste_demande(request):
|
||||
{"id": vehicule.id, "immatriculation": vehicule.immatriculation}
|
||||
for vehicule in models.Vehicule.objects.filter(disponible=True)
|
||||
]
|
||||
chauffeur_group = Group.objects.get(name="Chauffeur")
|
||||
chauffeurs = [
|
||||
{
|
||||
"chauffeur_id": chauffeur.user.id,
|
||||
"chauffeur_name": (
|
||||
f"{chauffeur.user.first_name} {chauffeur.user.last_name}"
|
||||
),
|
||||
}
|
||||
for chauffeur in Profile.objects.filter(user__groups=chauffeur_group)
|
||||
]
|
||||
|
||||
try:
|
||||
chauffeur_group = Group.objects.get(name="chauffeur")
|
||||
chauffeurs = [
|
||||
{
|
||||
"chauffeur_id": chauffeur.user.id,
|
||||
"chauffeur_name": (
|
||||
f"{chauffeur.user.first_name} {chauffeur.user.last_name}"
|
||||
),
|
||||
}
|
||||
for chauffeur in Profile.objects.filter(user__groups=chauffeur_group)
|
||||
]
|
||||
except Group.DoesNotExist:
|
||||
chauffeurs = []
|
||||
|
||||
demandes_en_cours = [
|
||||
{
|
||||
@@ -182,6 +186,8 @@ def liste_demande(request):
|
||||
for demande in liste_demande_vehicule
|
||||
]
|
||||
|
||||
|
||||
|
||||
return JsonResponse(demandes_en_cours, safe=False)
|
||||
|
||||
@login_required(login_url="login")
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user