diff --git a/src/front/Components/LayoutTemplates/DefaultCustomerDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultCustomerDashboard/index.tsx index b56f9238..1c8a8f2d 100644 --- a/src/front/Components/LayoutTemplates/DefaultCustomerDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultCustomerDashboard/index.tsx @@ -51,7 +51,11 @@ export default function DefaultCustomerDashboard(props: IProps) { if (props.isReady) { FolderService.getFolders().then((processes: any[]) => { if (processes.length > 0) { - const folders: any[] = processes.map((process: any) => process.processData); + let folders: any[] = processes.map((process: any) => process.processData); + + // Filter By customer.uid + folders = folders.filter((folder: any) => folder.customers.some((customer: any) => customer.uid === profileUid)); + setFolders(folders); } }); diff --git a/src/front/Components/Layouts/ClientDashboard/ReceivedDocuments/index.tsx b/src/front/Components/Layouts/ClientDashboard/ReceivedDocuments/index.tsx index 4d6d7882..75071c0a 100644 --- a/src/front/Components/Layouts/ClientDashboard/ReceivedDocuments/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/ReceivedDocuments/index.tsx @@ -115,7 +115,7 @@ export default function ReceivedDocuments() { let documents: any[] = processes.map((process: any) => process.processData); // FilterBy folder.uid & customer.uid - documents = documents.filter((document: any) => document.folder.uid === folderUid && document.customer && document.customer.uid === customerUid); + documents = documents.filter((document: any) => document.folder.uid === folderUid && document.customer /*&& document.customer.uid === customerUid*/); for (const document of documents) { if (document.files && document.files.length > 0) { diff --git a/src/front/Components/Layouts/ClientDashboard/index.tsx b/src/front/Components/Layouts/ClientDashboard/index.tsx index 5c94d6f8..61acd009 100644 --- a/src/front/Components/Layouts/ClientDashboard/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/index.tsx @@ -139,6 +139,7 @@ export default function ClientDashboard(props: IProps) { const fetchDocuments = useCallback( async (customerUid: string | undefined) => { + setDocuments([]); LoaderService.getInstance().show(); return new Promise((resolve: () => void) => { DocumentService.getDocuments().then(async (processes: any[]) => { @@ -179,9 +180,9 @@ export default function ClientDashboard(props: IProps) { */ useEffect(() => { + setDocumentsNotary([]); const customerUid = customer?.uid; if (!folderUid || !customerUid) return; - LoaderService.getInstance().show(); DocumentService.getDocuments().then(async (processes: any[]) => { if (processes.length > 0) {