mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Ensure BL amount is always present in reconciliation but optional for delivery validation
Update ReconciliationModal to include and display the BL amount. Modify ValidateDeliveryModal to make the BL amount field optional in its schema and remove it from the payload sent to the API. Replit-Commit-Author: Agent Replit-Commit-Session-Id: db1bcb73-80c1-4bff-8236-4ced2c07f75f Replit-Commit-Checkpoint-Type: full_checkpoint
This commit is contained in:
1 parent
73a3d36ce8
commit
cc13f32b1b
2 files changed
+17
-29
No files matched your search
@@ -29,6 +29,7 @@ export default function ReconciliationModal({
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
blNumber: "",
|
||||
blAmount: "",
|
||||
invoiceReference: "",
|
||||
invoiceAmount: "",
|
||||
reconciled: false,
|
||||
@@ -39,6 +40,7 @@ export default function ReconciliationModal({
|
||||
if (delivery) {
|
||||
setFormData({
|
||||
blNumber: delivery.blNumber || "",
|
||||
blAmount: delivery.blAmount || "",
|
||||
invoiceReference: delivery.invoiceReference || "",
|
||||
invoiceAmount: delivery.invoiceAmount || "",
|
||||
reconciled: delivery.reconciled || false,
|
||||
@@ -78,6 +80,7 @@ export default function ReconciliationModal({
|
||||
|
||||
updateDeliveryMutation.mutate({
|
||||
blNumber: formData.blNumber.trim() || null,
|
||||
blAmount: formData.blAmount ? formData.blAmount.toString() : null,
|
||||
invoiceReference: formData.invoiceReference.trim() || null,
|
||||
invoiceAmount: formData.invoiceAmount ? formData.invoiceAmount.toString() : null,
|
||||
});
|
||||
@@ -152,6 +155,17 @@ export default function ReconciliationModal({
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="blAmount">Montant BL (€)</Label>
|
||||
<Input
|
||||
id="blAmount"
|
||||
type="number"
|
||||
step="0.01"
|
||||
value={formData.blAmount}
|
||||
onChange={(e) => setFormData(prev => ({ ...prev, blAmount: e.target.value }))}
|
||||
placeholder="0.00"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Données Facture */}
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in new issue
Block a user