mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
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:
1 parent
6b2c5af4f1
commit
b946e28818
2 files changed
+16
-33
No files matched your search
@@ -77,19 +77,9 @@ export default function ReconciliationModal({
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
// Validation basique
|
||||
if (!formData.blNumber.trim()) {
|
||||
toast({
|
||||
title: "Erreur",
|
||||
description: "Le numéro de BL est requis",
|
||||
variant: "destructive",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
updateDeliveryMutation.mutate({
|
||||
blNumber: formData.blNumber.trim(),
|
||||
blNumber: formData.blNumber.trim() || null,
|
||||
blAmount: formData.blAmount ? formData.blAmount.toString() : null,
|
||||
invoiceReference: formData.invoiceReference.trim() || null,
|
||||
invoiceAmount: formData.invoiceAmount ? formData.invoiceAmount.toString() : null,
|
||||
@@ -97,17 +87,8 @@ export default function ReconciliationModal({
|
||||
};
|
||||
|
||||
const handleValidateReconciliation = () => {
|
||||
if (!formData.blNumber.trim()) {
|
||||
toast({
|
||||
title: "Erreur",
|
||||
description: "Veuillez d'abord renseigner le numéro de BL",
|
||||
variant: "destructive",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
updateDeliveryMutation.mutate({
|
||||
blNumber: formData.blNumber.trim(),
|
||||
blNumber: formData.blNumber.trim() || null,
|
||||
blAmount: formData.blAmount ? formData.blAmount.toString() : null,
|
||||
invoiceReference: formData.invoiceReference.trim() || null,
|
||||
invoiceAmount: formData.invoiceAmount ? formData.invoiceAmount.toString() : null,
|
||||
@@ -117,7 +98,7 @@ export default function ReconciliationModal({
|
||||
};
|
||||
|
||||
const isAutomaticMode = delivery?.supplier?.automaticReconciliation;
|
||||
const canValidate = formData.blNumber.trim().length > 0;
|
||||
const canValidate = true; // Plus de restriction sur le numéro BL
|
||||
|
||||
return (
|
||||
<Dialog open={isOpen} onOpenChange={onClose}>
|
||||
@@ -176,13 +157,12 @@ export default function ReconciliationModal({
|
||||
<h4 className="font-medium text-gray-900">Bon de Livraison (BL)</h4>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="blNumber">N° BL *</Label>
|
||||
<Label htmlFor="blNumber">N° BL</Label>
|
||||
<Input
|
||||
id="blNumber"
|
||||
value={formData.blNumber}
|
||||
onChange={(e) => setFormData(prev => ({ ...prev, blNumber: e.target.value }))}
|
||||
placeholder="Ex: BL-2025-001"
|
||||
required
|
||||
placeholder="Ex: BL-2025-001 (optionnel)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -263,8 +243,8 @@ export default function ReconciliationModal({
|
||||
|
||||
{/* Note d'aide */}
|
||||
<div className="text-xs text-gray-500 bg-blue-50 p-3 rounded">
|
||||
<strong>Note :</strong> Le numéro de BL est obligatoire pour valider un rapprochement.
|
||||
Les montants sont optionnels mais recommandés pour un suivi précis.
|
||||
<strong>Note :</strong> Tous les champs sont optionnels.
|
||||
Les données BL et facture sont recommandées pour un suivi précis mais pas obligatoires.
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user