From a2ab38a412c2dff1b90549e30925fa987cc0fa5d Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Tue, 30 Sep 2025 08:22:02 +0000 Subject: [PATCH] Add quality control process for supplier deliveries Introduce a new 'requires_control' flag for suppliers, enabling a quality control workflow for deliveries. This includes UI updates, database schema changes, and API endpoints to manage and track control validation. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/e7P7sOc --- .replit | 4 +++ .../modals/ValidateDeliveryModal.tsx | 17 +++++++++- client/src/pages/Suppliers.tsx | 23 ++++++++++++- init.sql | 7 +++- server/routes.ts | 34 +++++++++++++++++++ server/storage.ts | 9 +++++ shared/schema.ts | 9 +++-- 7 files changed, 97 insertions(+), 6 deletions(-) diff --git a/.replit b/.replit index c7abdf5..796ed8b 100644 --- a/.replit +++ b/.replit @@ -39,6 +39,10 @@ externalPort = 5000 localPort = 41343 externalPort = 3001 +[[ports]] +localPort = 42551 +externalPort = 8000 + [[ports]] localPort = 43315 externalPort = 6000 diff --git a/client/src/components/modals/ValidateDeliveryModal.tsx b/client/src/components/modals/ValidateDeliveryModal.tsx index 5024aef..e2906cf 100644 --- a/client/src/components/modals/ValidateDeliveryModal.tsx +++ b/client/src/components/modals/ValidateDeliveryModal.tsx @@ -10,7 +10,7 @@ import { Input } from "@/components/ui/input"; import { useToast } from "@/hooks/use-toast"; import { apiRequest } from "@/lib/queryClient"; import { isUnauthorizedError } from "@/lib/authUtils"; -import { Check, X } from "lucide-react"; +import { Check, X, AlertTriangle } from "lucide-react"; const validateDeliverySchema = z.object({ blNumber: z.string().min(1, "Le numéro de bon de livraison est obligatoire"), @@ -110,6 +110,21 @@ export default function ValidateDeliveryModal({

+ {/* Alerte si le fournisseur nécessite un contrôle */} + {delivery.supplier?.requiresControl && ( +
+ +
+

+ ⚠️ Contrôle à effectuer sur cette livraison +

+

+ Ce fournisseur nécessite un contrôle qualité lors de la réception de la livraison. +

+
+
+ )} +
{/* Informations de la livraison */} diff --git a/client/src/pages/Suppliers.tsx b/client/src/pages/Suppliers.tsx index 3a826fe..5e2b093 100644 --- a/client/src/pages/Suppliers.tsx +++ b/client/src/pages/Suppliers.tsx @@ -38,6 +38,7 @@ export default function Suppliers() { phone: "", hasDlc: false, automaticReconciliation: false, + requiresControl: false, }); const { data: suppliers = [], isLoading } = useQuery({ @@ -191,6 +192,7 @@ export default function Suppliers() { phone: "", hasDlc: false, automaticReconciliation: false, + requiresControl: false, }); }; @@ -227,6 +229,7 @@ export default function Suppliers() { phone: supplier.phone || "", hasDlc: supplier.hasDlc || false, automaticReconciliation: supplier.automaticReconciliation || false, + requiresControl: supplier.requiresControl || false, }); setShowEditModal(true); }; @@ -410,10 +413,16 @@ export default function Suppliers() { Auto-rapprochement )} + {supplier.requiresControl && ( +
+ + Contrôle requis +
+ )} - {!supplier.hasDlc && !supplier.automaticReconciliation && ( + {!supplier.hasDlc && !supplier.automaticReconciliation && !supplier.requiresControl && (
Aucune option activée
@@ -524,6 +533,18 @@ export default function Suppliers() { +
+ handleChange('requiresControl', checked === true)} + data-testid="checkbox-requires-control" + /> + +
+