mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Improve handling of optional amount fields in transaction forms
Update the `avoirSchema` in `Avoirs.tsx` to correctly preprocess empty string values for the `amount` field, ensuring it's treated as undefined. 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/KZQgDPI
This commit is contained in:
1 parent
6dea6e383f
commit
3c8ce736cc
2 files changed
+1
-1
No files matched your search
@@ -71,7 +71,7 @@ const avoirSchema = z.object({
|
||||
supplierId: z.coerce.number().min(1, "Veuillez sélectionner un fournisseur"),
|
||||
groupId: z.coerce.number().min(1, "Veuillez sélectionner un magasin"),
|
||||
invoiceReference: z.string().optional(),
|
||||
amount: z.coerce.number().positive().optional(),
|
||||
amount: z.preprocess((val) => val === "" ? undefined : val, z.coerce.number().positive().optional()),
|
||||
comment: z.string().optional(),
|
||||
commercialProcessed: z.boolean().optional(),
|
||||
status: z.enum(["En attente de demande", "Demandé", "Reçu"]).optional(),
|
||||
|
||||
Reference in new issue
Block a user