Make delivery reconciliation and validation optional for BL numbers

Remove the mandatory requirement for the delivery note (BL) number in both the reconciliation and delivery validation forms, allowing these fields to be optional.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a3de0820-9397-41b2-b000-7931ee9c29de
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a3de0820-9397-41b2-b000-7931ee9c29de/vqNg9rh
This commit is contained in:
michaelschal committed 2025-08-15 22:21:57 +00:00
1 parent 6b2c5af4f1
commit b946e28818
2 files changed
+16 -33

No files matched your search

@@ -13,7 +13,7 @@ import { isUnauthorizedError } from "@/lib/authUtils";
import { Check, X } from "lucide-react";
const validateDeliverySchema = z.object({
blNumber: z.string().min(1, "Le numéro de BL est obligatoire"),
blNumber: z.string().optional(),
blAmount: z.string().optional(),
});
@@ -45,9 +45,12 @@ export default function ValidateDeliveryModal({
const validateDeliveryMutation = useMutation({
mutationFn: async (data: ValidateDeliveryForm) => {
const payload: any = {
blNumber: data.blNumber,
};
const payload: any = {};
// Ajouter blNumber seulement s'il est fourni
if (data.blNumber && data.blNumber.trim() !== '') {
payload.blNumber = data.blNumber.trim();
}
if (data.blAmount && data.blAmount.trim() !== '') {
payload.blAmount = parseFloat(data.blAmount);
@@ -134,10 +137,10 @@ export default function ValidateDeliveryModal({
name="blNumber"
render={({ field }) => (
<FormItem>
<FormLabel>N° Bon de Livraison *</FormLabel>
<FormLabel>N° Bon de Livraison</FormLabel>
<FormControl>
<Input
placeholder="Ex: BL-2024-001"
placeholder="Ex: BL-2024-001 (optionnel)"
{...field}
/>
</FormControl>