Merge pull request #311 from R0m1k3/1.1

1.1
This commit is contained in:
LogiFlow authored and GitHub committed 2025-09-01 22:55:14 +02:00
commit 886c4a6f59
1 file changed
+3 -29
@@ -14,7 +14,6 @@ import { Check, X } from "lucide-react";
const validateDeliverySchema = z.object({
blNumber: z.string().min(1, "Le numéro de bon de livraison est obligatoire"),
blAmount: z.string().optional(),
});
type ValidateDeliveryForm = z.infer<typeof validateDeliverySchema>;
@@ -39,20 +38,14 @@ export default function ValidateDeliveryModal({
resolver: zodResolver(validateDeliverySchema),
defaultValues: {
blNumber: "",
blAmount: "",
},
});
const validateDeliveryMutation = useMutation({
mutationFn: async (data: ValidateDeliveryForm) => {
const payload: any = {};
// Le blNumber est maintenant obligatoire
payload.blNumber = data.blNumber.trim();
if (data.blAmount && data.blAmount.trim() !== '') {
payload.blAmount = parseFloat(data.blAmount);
}
const payload = {
blNumber: data.blNumber.trim()
};
await apiRequest(`/api/deliveries/${delivery.id}/validate`, "POST", payload);
},
@@ -147,25 +140,6 @@ export default function ValidateDeliveryModal({
)}
/>
{/* Montant BL */}
<FormField
control={form.control}
name="blAmount"
render={({ field }) => (
<FormItem>
<FormLabel>Montant BL (€) - Optionnel</FormLabel>
<FormControl>
<Input
type="number"
step="0.01"
placeholder="Ex: 1200.00 (à remplir plus tard si nécessaire)"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{/* Actions */}
<div className="flex justify-end space-x-3 pt-4">