ajanin #5
@ -51,7 +51,11 @@ export default function DefaultCustomerDashboard(props: IProps) {
|
|||||||
if (props.isReady) {
|
if (props.isReady) {
|
||||||
FolderService.getFolders().then((processes: any[]) => {
|
FolderService.getFolders().then((processes: any[]) => {
|
||||||
if (processes.length > 0) {
|
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);
|
setFolders(folders);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -115,7 +115,7 @@ export default function ReceivedDocuments() {
|
|||||||
let documents: any[] = processes.map((process: any) => process.processData);
|
let documents: any[] = processes.map((process: any) => process.processData);
|
||||||
|
|
||||||
// FilterBy folder.uid & customer.uid
|
// 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) {
|
for (const document of documents) {
|
||||||
if (document.files && document.files.length > 0) {
|
if (document.files && document.files.length > 0) {
|
||||||
|
@ -139,6 +139,7 @@ export default function ClientDashboard(props: IProps) {
|
|||||||
|
|
||||||
const fetchDocuments = useCallback(
|
const fetchDocuments = useCallback(
|
||||||
async (customerUid: string | undefined) => {
|
async (customerUid: string | undefined) => {
|
||||||
|
setDocuments([]);
|
||||||
LoaderService.getInstance().show();
|
LoaderService.getInstance().show();
|
||||||
return new Promise<void>((resolve: () => void) => {
|
return new Promise<void>((resolve: () => void) => {
|
||||||
DocumentService.getDocuments().then(async (processes: any[]) => {
|
DocumentService.getDocuments().then(async (processes: any[]) => {
|
||||||
@ -179,9 +180,9 @@ export default function ClientDashboard(props: IProps) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setDocumentsNotary([]);
|
||||||
const customerUid = customer?.uid;
|
const customerUid = customer?.uid;
|
||||||
if (!folderUid || !customerUid) return;
|
if (!folderUid || !customerUid) return;
|
||||||
|
|
||||||
LoaderService.getInstance().show();
|
LoaderService.getInstance().show();
|
||||||
DocumentService.getDocuments().then(async (processes: any[]) => {
|
DocumentService.getDocuments().then(async (processes: any[]) => {
|
||||||
if (processes.length > 0) {
|
if (processes.length > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user