✨ Filter now include clients
This commit is contained in:
parent
6e89190b82
commit
f5729af068
@ -1,9 +1,10 @@
|
||||
import React from "react";
|
||||
import classes from "./classes.module.scss";
|
||||
import LoopIcon from "@Assets/Icons/loop.svg";
|
||||
import Image from "next/image";
|
||||
import Typography, { ITypo } from "../Typography";
|
||||
import { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
||||
import Image from "next/image";
|
||||
import React from "react";
|
||||
|
||||
import Typography, { ITypo } from "../Typography";
|
||||
import classes from "./classes.module.scss";
|
||||
|
||||
type IProps = {
|
||||
folders: IDashBoardFolder[];
|
||||
@ -57,6 +58,20 @@ export default class SearchBar extends React.Component<IProps, IState> {
|
||||
const name = folder.name.toLowerCase();
|
||||
const number = folder.folder_number.toLowerCase();
|
||||
const value = event.target.value.toLowerCase();
|
||||
|
||||
if (folder.office_folder_has_customers) {
|
||||
const customersNames = folder.office_folder_has_customers?.reduce((acc: string[], customer) => {
|
||||
return acc.concat(
|
||||
`${customer.customer.contact.first_name.toLowerCase()} ${customer.customer.contact.last_name.toLowerCase()}`,
|
||||
);
|
||||
}, []);
|
||||
let namesIncludesValue = false;
|
||||
customersNames.forEach((name) => {
|
||||
if (name.includes(value)) namesIncludesValue = true;
|
||||
});
|
||||
return name.includes(value) || number.includes(value) || namesIncludesValue;
|
||||
}
|
||||
|
||||
return name.includes(value) || number.includes(value);
|
||||
});
|
||||
return filteredFolders;
|
||||
|
Loading…
x
Reference in New Issue
Block a user