Update how user data is displayed and searched for

Modify the Avoir interface to make invoiceReference and amount optional. Adjust the filtering logic in Avoirs.tsx to safely handle potentially undefined invoiceReference values.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/QDWg25A
This commit is contained in:
michaelschal committed 2025-09-08 14:55:45 +00:00
1 parent 929ac01a71
commit d189d9c232
1 file changed
+3 -3
+3 -3
View File
@@ -24,8 +24,8 @@ interface Avoir {
id: number;
supplierId: number;
groupId: number;
invoiceReference: string;
amount: number;
invoiceReference?: string;
amount?: number;
comment?: string;
commercialProcessed: boolean;
status: 'En attente de demande' | 'Demandé' | 'Reçu';
@@ -161,7 +161,7 @@ export default function Avoirs() {
// Filter avoirs based on search term
const filteredAvoirs = avoirs.filter(avoir =>
avoir.invoiceReference.toLowerCase().includes(searchTerm.toLowerCase()) ||
avoir.invoiceReference?.toLowerCase().includes(searchTerm.toLowerCase()) ||
avoir.supplier.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
avoir.comment?.toLowerCase().includes(searchTerm.toLowerCase()) ||
(avoir.creator.firstName && avoir.creator.lastName