fix filter change

This commit is contained in:
Peter Maquiran
2023-04-17 17:23:26 +01:00
parent bd13431c6a
commit b4bc286557
5 changed files with 29 additions and 39 deletions
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { NavigationStart, Router } from '@angular/router';
import { ActivatedRoute, NavigationEnd, NavigationStart, Router } from '@angular/router';
import { LoginUserRespose } from 'src/app/models/user.model';
import { ThemeService } from 'src/app/services/theme.service'
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
@@ -39,7 +39,8 @@ export class AllProcessesPage implements OnInit {
constructor(
private router: Router,
public ThemeService: ThemeService,
public TaskService: TaskService
public TaskService: TaskService,
private route: ActivatedRoute
) {
this.loggeduser = SessionStore.user;
}
@@ -49,36 +50,32 @@ export class AllProcessesPage implements OnInit {
this.checkFilter();
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital')) {
if (window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing();
this.checkFilter();
}
if (event instanceof NavigationEnd && event.url.includes('/home/gabinete-digital')) {
this.refreshing();
this.checkFilter();
}
});
}
checkFilter() {
const params: any = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams: any, prop: any) => searchParams.get(prop),
});
const filter = params.filter
if(filter == 'ForToDay') {
console.log(this.router.url)
if(this.router.url.includes('ForToDay')) {
this.filterName = 'Para hoje'
} else if (filter == 'OverdueTasks') {
} else if (this.router.url.includes('OverdueTasks')) {
this.filterName = 'OverdueTasks'
} else if (filter == 'New') {
} else if (this.router.url.includes('New')) {
this.filterName = 'Novos'
} else if (filter == 'unread') {
} else if (this.router.url.includes('unread')) {
this.filterName = 'Não lidos'
} else {
console.log('filter', filter)
console.log('else uiuuiu')
}
}
doRefresh(event) {
if (event) {
setTimeout(() => {