diff --git a/client/src/components/NewSaleForm.tsx b/client/src/components/NewSaleForm.tsx index 1ef9b9e..0d8bdbf 100644 --- a/client/src/components/NewSaleForm.tsx +++ b/client/src/components/NewSaleForm.tsx @@ -281,7 +281,7 @@ export default function NewSaleForm({ onSaveSale }: NewSaleFormProps) { Quantité * - + diff --git a/client/src/lib/validation.ts b/client/src/lib/validation.ts index 1f30c2d..47041d5 100644 --- a/client/src/lib/validation.ts +++ b/client/src/lib/validation.ts @@ -30,7 +30,15 @@ export function validateRequiredFields(formData: any): string[] { ]; return requiredFields - .filter(field => !formData[field.key] || formData[field.key].toString().trim() === '') + .filter(field => { + const value = formData[field.key]; + // Pour la quantité, accepter 0 comme valeur valide + if (field.key === 'quantite') { + return value === '' || value === null || value === undefined; + } + // Pour les autres champs, vérifier si vide ou juste des espaces + return !value || value.toString().trim() === ''; + }) .map(field => field.label); }