✨ Sort customers that have warnings
This commit is contained in:
parent
5efd8b3713
commit
a6bd2dad7b
@ -39,14 +39,17 @@ export default function ClientView(props: IProps) {
|
||||
|
||||
const tabs = useMemo(
|
||||
() =>
|
||||
customers.map((customer) => ({
|
||||
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],
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user