From a6bd2dad7b189ffd13802793dee0bf76e6122be3 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 25 Jul 2024 10:46:19 +0200 Subject: [PATCH] :sparkles: Sort customers that have warnings --- .../FolderInformation/ClientView/index.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/index.tsx index 264db94d..3ff52286 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/index.tsx @@ -39,14 +39,17 @@ export default function ClientView(props: IProps) { const tabs = useMemo( () => - customers.map((customer) => ({ - label: `${customer.contact?.first_name} ${customer.contact?.last_name}`, - key: customer.uid, - value: customer, - hasWarning: - customer.documents && - customer.documents.filter((document) => document.document_status === EDocumentStatus.DEPOSITED).length > 0, - })), + customers + .map((customer) => ({ + label: `${customer.contact?.first_name} ${customer.contact?.last_name}`, + key: customer.uid, + value: customer, + hasWarning: + customer.documents && + customer.documents.filter((document) => document.document_status === EDocumentStatus.DEPOSITED).length > 0, + })) + // put every tabs that has warning first + .sort((a, b) => (a.hasWarning ? -1 : 1)), [customers], );