Relecture du code v1
This commit is contained in:
BIN
SGL/__init__.py:Zone.Identifier
Normal file
BIN
SGL/__init__.py:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/__pycache__/__init__.cpython-310.pyc:Zone.Identifier
Normal file
BIN
SGL/__pycache__/__init__.cpython-310.pyc:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/__pycache__/__init__.cpython-313.pyc:Zone.Identifier
Normal file
BIN
SGL/__pycache__/__init__.cpython-313.pyc:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/__pycache__/settings.cpython-310.pyc:Zone.Identifier
Normal file
BIN
SGL/__pycache__/settings.cpython-310.pyc:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/__pycache__/settings.cpython-313.pyc:Zone.Identifier
Normal file
BIN
SGL/__pycache__/settings.cpython-313.pyc:Zone.Identifier
Normal file
Binary file not shown.
Binary file not shown.
BIN
SGL/__pycache__/urls.cpython-310.pyc:Zone.Identifier
Normal file
BIN
SGL/__pycache__/urls.cpython-310.pyc:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/__pycache__/urls.cpython-313.pyc:Zone.Identifier
Normal file
BIN
SGL/__pycache__/urls.cpython-313.pyc:Zone.Identifier
Normal file
Binary file not shown.
Binary file not shown.
BIN
SGL/__pycache__/views.cpython-310.pyc:Zone.Identifier
Normal file
BIN
SGL/__pycache__/views.cpython-310.pyc:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/__pycache__/views.cpython-313.pyc:Zone.Identifier
Normal file
BIN
SGL/__pycache__/views.cpython-313.pyc:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/__pycache__/wsgi.cpython-310.pyc:Zone.Identifier
Normal file
BIN
SGL/__pycache__/wsgi.cpython-310.pyc:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/__pycache__/wsgi.cpython-313.pyc:Zone.Identifier
Normal file
BIN
SGL/__pycache__/wsgi.cpython-313.pyc:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/asgi.py:Zone.Identifier
Normal file
BIN
SGL/asgi.py:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/settings.py:Zone.Identifier
Normal file
BIN
SGL/settings.py:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/templates/BASE.html:Zone.Identifier
Normal file
BIN
SGL/templates/BASE.html:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/templates/emails/email_template.html:Zone.Identifier
Normal file
BIN
SGL/templates/emails/email_template.html:Zone.Identifier
Normal file
Binary file not shown.
@@ -124,6 +124,7 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
<label for="produit" class="form-label">Produit</label>
|
||||
<input type="text" class="form-control" id="produitCommande" readonly>
|
||||
|
||||
BIN
SGL/templates/index.html:Zone.Identifier
Normal file
BIN
SGL/templates/index.html:Zone.Identifier
Normal file
Binary file not shown.
26
SGL/urls.py
26
SGL/urls.py
@@ -26,11 +26,27 @@ from django.conf.urls.static import static
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
path("gestion-produit/", include("gestion_produit.urls")),
|
||||
path("gestion-fournisseur/", include("gestion_fournisseur.urls")),
|
||||
path("gestion-vehicule/", include("gestion_vehicule.urls")),
|
||||
path("authentification/", include("authentification.urls")),
|
||||
path(
|
||||
"",
|
||||
views.index,
|
||||
name="index"
|
||||
),
|
||||
path(
|
||||
"gestion-produit/",
|
||||
include("gestion_produit.urls")
|
||||
),
|
||||
path(
|
||||
"gestion-fournisseur/",
|
||||
include("gestion_fournisseur.urls")
|
||||
),
|
||||
path(
|
||||
"gestion-vehicule/",
|
||||
include("gestion_vehicule.urls")
|
||||
),
|
||||
path(
|
||||
"authentification/",
|
||||
include("authentification.urls")
|
||||
),
|
||||
path(
|
||||
"liste-commande-en-cours/",
|
||||
views.liste_produit_commander,
|
||||
|
||||
BIN
SGL/urls.py:Zone.Identifier
Normal file
BIN
SGL/urls.py:Zone.Identifier
Normal file
Binary file not shown.
31
SGL/views.py
31
SGL/views.py
@@ -9,7 +9,7 @@ Principales fonctionnalités couvertes :
|
||||
from django.shortcuts import render, redirect
|
||||
from django.http import JsonResponse
|
||||
from gestion_produit.models import Commander, Demander, Produit
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
# from django.views.decorators.csrf import csrf_exempt
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
import json
|
||||
@@ -29,10 +29,6 @@ def dashboard_quantite_produit():
|
||||
"""
|
||||
tous_les_produits = Produit.objects.all()
|
||||
|
||||
nombre_rupture = 0
|
||||
nombre_pre_rupture = 0
|
||||
nombre_normal = 0
|
||||
|
||||
produit_rupture = []
|
||||
produit_pre_rupture = []
|
||||
produit_normal = []
|
||||
@@ -41,19 +37,16 @@ def dashboard_quantite_produit():
|
||||
stock_actuel = calcul_stock_produit(produit)
|
||||
stock_actuel.pop("image")
|
||||
if stock_actuel["stockActuel"] == 0:
|
||||
nombre_rupture += 1
|
||||
produit_rupture.append(stock_actuel)
|
||||
elif stock_actuel["stockActuel"] < produit.seuil_pre_rupture:
|
||||
nombre_pre_rupture += 1
|
||||
produit_pre_rupture.append(stock_actuel)
|
||||
else:
|
||||
nombre_normal += 1
|
||||
produit_normal.append(stock_actuel)
|
||||
|
||||
return {
|
||||
"nombre_rupture": nombre_rupture,
|
||||
"nombre_pre_rupture": nombre_pre_rupture,
|
||||
"nombre_normal": nombre_normal,
|
||||
"nombre_rupture": len(produit_rupture),
|
||||
"nombre_pre_rupture": len(produit_pre_rupture),
|
||||
"nombre_normal": len(produit_normal),
|
||||
"produit_rupture": produit_rupture,
|
||||
"produit_pre_rupture": produit_pre_rupture,
|
||||
"produit_normale": produit_normal,
|
||||
@@ -62,7 +55,7 @@ def dashboard_quantite_produit():
|
||||
|
||||
@login_required(login_url="authentification:login")
|
||||
def index(request):
|
||||
"""Vue pour la page d'accueil du dashboard.
|
||||
"""Retournez la page d'accueil du dashboard.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -104,10 +97,9 @@ def index(request):
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@login_required(login_url="login")
|
||||
def produit_a_rendre(request): #noqa: ARG001
|
||||
"""Vue pour obtenir la liste des équipements à rendre.
|
||||
def produit_a_rendre(_request):
|
||||
"""Retournez la liste des équipements à rendre.
|
||||
|
||||
Cette vue est appelée via une requête AJAX et renvoie une liste
|
||||
d'équipements qui doivent être rendus.
|
||||
@@ -141,9 +133,8 @@ def produit_a_rendre(request): #noqa: ARG001
|
||||
return JsonResponse(liste_equipement, safe=False)
|
||||
|
||||
@login_required(login_url="login")
|
||||
@csrf_exempt
|
||||
def produit_a_rendre_update(request):
|
||||
"""Vue pour mettre à jour le statut des équipements à rendre.
|
||||
"""Mettez à jour le statut des équipements à rendre.
|
||||
|
||||
Lorsqu'une requête POST est reçue, cette vue met à jour le statut
|
||||
des équipements à rendre en fonction des données fournies dans la
|
||||
@@ -248,7 +239,6 @@ def liste_produit_commander(request):
|
||||
|
||||
|
||||
@login_required(login_url="login")
|
||||
@csrf_exempt
|
||||
def enregistrer_livraison_produit(request):
|
||||
"""Enregistrez la livraison d'un produit commandé.
|
||||
|
||||
@@ -322,7 +312,10 @@ def liste_demandes(request):
|
||||
"produit": demande.produit.libelle,
|
||||
"quantite": demande.quantite,
|
||||
"motifs": demande.motifs,
|
||||
"date_de_mise_a_dispo_souhaite": demande.date_de_mise_a_dispo_souhaite.strftime("%Y-%m-%d"),
|
||||
"date_de_mise_a_dispo_souhaite": (
|
||||
demande.date_de_mise_a_dispo_souhaite
|
||||
.strftime("%Y-%m-%d")
|
||||
),
|
||||
"a_rendre": demande.a_rendre,
|
||||
"valider_par_chef": demande.valider_par_chef,
|
||||
"valider_par_logisticien": demande.valider_par_logisticien,
|
||||
|
||||
BIN
SGL/views.py:Zone.Identifier
Normal file
BIN
SGL/views.py:Zone.Identifier
Normal file
Binary file not shown.
BIN
SGL/wsgi.py:Zone.Identifier
Normal file
BIN
SGL/wsgi.py:Zone.Identifier
Normal file
Binary file not shown.
Reference in New Issue
Block a user