mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-22 06:28:19 +02:00
Automatically verify invoices upon page load for improved efficiency
Introduces automatic invoice verification on page load using useEffect hook, refactors invoice verification service to fetch active NocoDB configuration, and updates routes to accept invoice reference and group ID. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/CltQiuj
This commit is contained in:
1 parent
88d2c4a4c8
commit
4cf7a5c602
5 files changed
+126
-119
No files matched your search
+16
-15
@@ -860,35 +860,36 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
}
|
||||
}
|
||||
|
||||
const { invoiceReference, blNumber } = req.body;
|
||||
const { invoiceReference } = req.body;
|
||||
|
||||
if (!delivery.supplier || !delivery.group) {
|
||||
console.log('❌ Livraison manque informations:', {
|
||||
deliveryId,
|
||||
hasSupplier: !!delivery.supplier,
|
||||
hasGroup: !!delivery.group,
|
||||
delivery: delivery
|
||||
hasGroup: !!delivery.group
|
||||
});
|
||||
return res.status(400).json({ message: "Delivery missing supplier or group information" });
|
||||
}
|
||||
|
||||
console.log('🔍 Tentative de vérification facture:', {
|
||||
if (!invoiceReference || !invoiceReference.trim()) {
|
||||
return res.status(400).json({ message: "Référence de facture requise" });
|
||||
}
|
||||
|
||||
console.log('🔍 Vérification facture:', {
|
||||
deliveryId,
|
||||
invoiceReference: invoiceReference || delivery.invoiceReference,
|
||||
blNumber: blNumber || delivery.blNumber,
|
||||
supplierName: delivery.supplier.name,
|
||||
groupId: delivery.groupId,
|
||||
groupData: delivery.group
|
||||
invoiceReference,
|
||||
supplier: delivery.supplier?.name,
|
||||
group: delivery.group?.name,
|
||||
groupId: delivery.groupId
|
||||
});
|
||||
|
||||
const result = await invoiceVerificationService.verifyInvoiceReference(
|
||||
invoiceReference || delivery.invoiceReference || '',
|
||||
blNumber || delivery.blNumber || '',
|
||||
delivery.supplier.name,
|
||||
delivery.groupId,
|
||||
delivery.group
|
||||
// Appeler le service de vérification
|
||||
const result = await invoiceVerificationService.verifyInvoice(
|
||||
invoiceReference,
|
||||
delivery.groupId
|
||||
);
|
||||
|
||||
console.log('✅ Résultat vérification:', result);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
console.error("Error verifying invoice:", error);
|
||||
|
||||
Reference in new issue
Block a user