Checkpoint: Application complète de dématérialisation de facturation avec extraction IA (Mistral), authentification locale + Azure AD, stockage local, et export SFTP.

Fonctionnalités implémentées :
 Authentification locale (email/password) + Azure AD + Manus OAuth
 Upload drag-and-drop de fichiers PDF avec suivi en temps réel
 Extraction automatique avec Mistral AI (OCR + LLM)
 Détection de doublons (fournisseur, numéro, date)
 Score de qualité d'extraction (0-100)
 Tableau de bord avec statistiques
 Liste des factures avec recherche et filtres
 Paramètres utilisateur (LLM, keywords, SFTP)
 Historique des imports avec logs détaillés
 Gestion des utilisateurs (admin)
 Export SFTP manuel/automatique
 Stockage local avec organisation YYYY-MM
 Tests unitaires d'authentification

Architecture :
- Frontend : React 19 + Vite + TailwindCSS + Radix UI
- Backend : Express + tRPC + Drizzle ORM
- Base de données : MySQL (6 tables)
- IA : Mistral AI pour extraction
- Stockage : Local filesystem
- Export : SFTP

Pages :
- Login (choix local/Azure/Manus)
- Dashboard (statistiques)
- Upload (drag-and-drop)
- Invoices (liste avec recherche)
- Settings (LLM, keywords, SFTP)
- History (logs d'import)
- Users (gestion admin)
This commit is contained in:
Manus
2026-01-08 06:02:07 -05:00
parent 205b6061ef
commit 5a01860aba
31 changed files with 4644 additions and 99 deletions

View File

@@ -0,0 +1,94 @@
import DashboardLayout from "@/components/DashboardLayout";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { Badge } from "@/components/ui/badge";
import { trpc } from "@/lib/trpc";
import { History as HistoryIcon, FileText } from "lucide-react";
export default function History() {
const { data: logs, isLoading } = trpc.importLogs.getByUser.useQuery();
return (
<DashboardLayout>
<div className="space-y-6">
<div>
<h1 className="text-3xl font-bold">Historique des imports</h1>
<p className="text-gray-500 mt-1">Consultez l'historique de tous vos imports de factures</p>
</div>
<Card>
<CardHeader>
<CardTitle>Logs d'import</CardTitle>
<CardDescription>Détails de chaque import avec statistiques</CardDescription>
</CardHeader>
<CardContent>
{isLoading ? (
<div className="text-center py-8 text-gray-500">Chargement...</div>
) : logs && logs.length > 0 ? (
<Table>
<TableHeader>
<TableRow>
<TableHead>Fichier</TableHead>
<TableHead>Date</TableHead>
<TableHead>Détectées</TableHead>
<TableHead>Importées</TableHead>
<TableHead>Doublons</TableHead>
<TableHead>Erreurs</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{logs.map((log) => (
<TableRow key={log.id}>
<TableCell className="font-medium">{log.fileName}</TableCell>
<TableCell>
{new Date(log.importedAt).toLocaleString("fr-FR")}
</TableCell>
<TableCell>
<Badge variant="outline">{log.totalInvoicesDetected}</Badge>
</TableCell>
<TableCell>
<Badge className="bg-green-100 text-green-800 hover:bg-green-100">
{log.invoicesImported}
</Badge>
</TableCell>
<TableCell>
{log.duplicatesIgnored > 0 ? (
<Badge className="bg-yellow-100 text-yellow-800 hover:bg-yellow-100">
{log.duplicatesIgnored}
</Badge>
) : (
<span className="text-gray-400">-</span>
)}
</TableCell>
<TableCell>
{log.errors > 0 ? (
<Badge className="bg-red-100 text-red-800 hover:bg-red-100">
{log.errors}
</Badge>
) : (
<span className="text-gray-400">-</span>
)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
) : (
<div className="text-center py-8 text-gray-500">
<HistoryIcon className="w-12 h-12 mx-auto mb-3 text-gray-300" />
<p>Aucun historique d'import</p>
</div>
)}
</CardContent>
</Card>
</div>
</DashboardLayout>
);
}