From f299b49da377fd4bd675a1658799e8e5014b6eac Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Thu, 14 Aug 2025 13:59:36 +0000 Subject: [PATCH] Improve SAV ticket creation and display for better tracking Update SavTickets page to correctly assign default values for groupId, set initial ticket status to "nouveau", and ensure createdBy is handled. Refactor ticket display to consistently show problem type, priority, status, and supplier information. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 31f9bd88-0285-4787-81b3-31ceeea5a08b Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/31f9bd88-0285-4787-81b3-31ceeea5a08b/Hy4QGSM --- client/src/pages/SavTickets.tsx | 128 ++++++++------------------------ 1 file changed, 33 insertions(+), 95 deletions(-) diff --git a/client/src/pages/SavTickets.tsx b/client/src/pages/SavTickets.tsx index 540eb53..a52e53a 100644 --- a/client/src/pages/SavTickets.tsx +++ b/client/src/pages/SavTickets.tsx @@ -255,13 +255,15 @@ export default function SavTickets() { const ticketData: InsertSavTicket = { supplierId: parseInt(formData.supplierId), - groupId: selectedGroupId || undefined, + groupId: selectedGroupId || 1, // Default group if none available productGencode: formData.productGencode, productReference: formData.productReference || undefined, productDesignation: formData.productDesignation, problemType: formData.problemType as "defectueux" | "pieces_manquantes" | "non_conforme" | "autre", problemDescription: formData.problemDescription, priority: formData.priority as "faible" | "normale" | "haute" | "critique", + status: "nouveau" as const, + createdBy: 1, // Will be set by the backend from session clientName: formData.clientName || undefined, clientPhone: formData.clientPhone || undefined, }; @@ -843,16 +845,16 @@ export default function SavTickets() {

Problème

-
- Type: -

{selectedTicket.problemType}

-
-
- Priorité: - - {priorityConfig[selectedTicket.priority as keyof typeof priorityConfig]?.label} - -
+
+ Type: +

{selectedTicket.problemType}

+
+
+ Priorité: + + {priorityConfig[selectedTicket.priority as keyof typeof priorityConfig]?.label} + +
Description:

{selectedTicket.problemDescription}

@@ -881,23 +883,24 @@ export default function SavTickets() {

Informations ticket

-
- Statut: - - {statusConfig[selectedTicket.status as keyof typeof statusConfig]?.label} - -
-
- Fournisseur: -

{selectedTicket.supplier?.name}

-
-
- Magasin: -

{selectedTicket.group?.name}

-
-
- Créé le: -

{safeFormat(selectedTicket.createdAt, 'dd/MM/yyyy HH:mm')}

+
+ Statut: + + {statusConfig[selectedTicket.status as keyof typeof statusConfig]?.label} + +
+
+ Fournisseur: +

{selectedTicket.supplier?.name}

+
+
+ Magasin: +

{selectedTicket.group?.name}

+
+
+ Créé le: +

{safeFormat(selectedTicket.createdAt, 'dd/MM/yyyy HH:mm')}

+
@@ -959,74 +962,9 @@ export default function SavTickets() {

Historique et commentaires

{/* Affichage de l'historique existant */} - {ticketDetails?.history && ticketDetails.history.length > 0 ? ( + {(ticketDetails as any)?.history && (ticketDetails as any).history.length > 0 ? (
- {ticketDetails.history.map((entry: any, index: number) => ( -
-
- - {entry.action === 'comment' ? 'Commentaire' : entry.action} - - - {safeFormat(entry.createdAt, 'dd/MM/yyyy HH:mm')} - -
-

{entry.description}

- {entry.creator && ( -

Par: {entry.creator.username}

- )} -
- ))} -
- ) : ( -
- Aucun commentaire pour le moment -
- )} - - {/* Champ d'ajout de commentaire */} - {canModify && ( -
- -