From 83b50d6ba2abaccbc6333616440352e47dd30992 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 8 Sep 2025 13:56:23 +0000 Subject: [PATCH] Update the credits section to make reference and amount optional Modify the client-side schema and UI for the "Avoirs" page to make "invoiceReference" and "amount" fields optional, and reposition the "Avoirs" link in the sidebar. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/0C3uBiZ --- client/src/components/Sidebar.tsx | 12 ++++++------ client/src/pages/Avoirs.tsx | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/src/components/Sidebar.tsx b/client/src/components/Sidebar.tsx index eb20bfc..c3d61c1 100644 --- a/client/src/components/Sidebar.tsx +++ b/client/src/components/Sidebar.tsx @@ -255,6 +255,12 @@ export default function Sidebar() { icon: FileText, roles: ["admin", "directeur"] }, + { + path: "/avoirs", + label: "Avoirs", + icon: Receipt, + roles: ["admin", "directeur", "manager"] + }, { path: "/publicities", label: "Publicités", @@ -285,12 +291,6 @@ export default function Sidebar() { icon: Wrench, roles: ["admin", "directeur", "manager", "employee"] }, - { - path: "/avoirs", - label: "Avoirs", - icon: Receipt, - roles: ["admin", "directeur", "manager"] - }, ]; const adminItems = [ diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index 17d3718..21e8772 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -69,8 +69,8 @@ interface Group { const avoirSchema = z.object({ supplierId: z.number().min(1, "Veuillez sélectionner un fournisseur"), groupId: z.number().min(1, "Veuillez sélectionner un magasin"), - invoiceReference: z.string().min(1, "La référence facture est requise"), - amount: z.number().min(0.01, "Le montant doit être supérieur à 0"), + invoiceReference: z.string().optional(), + amount: z.number().optional(), comment: z.string().optional(), commercialProcessed: z.boolean().optional(), }); @@ -148,7 +148,7 @@ export default function Avoirs() { supplierId: 0, groupId: 0, invoiceReference: "", - amount: 0, + amount: undefined, comment: "", commercialProcessed: false, }, @@ -296,7 +296,7 @@ export default function Avoirs() { name="invoiceReference" render={({ field }) => ( - Référence facture + Référence facture (optionnel) @@ -310,14 +310,14 @@ export default function Avoirs() { name="amount" render={({ field }) => ( - Montant (€) + Montant (€) (optionnel) field.onChange(parseFloat(e.target.value) || 0)} + onChange={(e) => field.onChange(e.target.value ? parseFloat(e.target.value) : undefined)} />