From b1c165bf87f3832850b5a332f4440756ee5f0a6b Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Sat, 17 Jul 2021 14:02:05 +0100 Subject: [PATCH] Fix --- .../despachos-pr/despachos-pr.page.html | 4 +- .../despachos-pr/despachos-pr.page.ts | 22 +++++--- .../despachos/despachos.page.ts | 15 ++++-- .../diplomas-assinar/diplomas-assinar.page.ts | 27 ++++++---- .../diplomas/diplomas.page.ts | 21 ++++---- .../event-list/event-list.page.html | 2 +- .../event-list/event-list.page.ts | 26 ++++++---- .../expediente/expediente.page.ts | 18 ++++--- .../expedientes-pr/expedientes-pr.page.ts | 16 ++++-- .../pedidos/pedido/pedido.page.html | 1 - .../pedidos/pedido/pedido.page.ts | 10 ++-- .../gabinete-digital/pedidos/pedidos.page.ts | 8 ++- .../pendentes/pendentes.page.ts | 6 ++- .../despachos-pr/despachos-pr.page.ts | 52 +++++++++++-------- .../despachos/despachos.page.ts | 17 +++--- .../diplomas-assinar/diplomas-assinar.page.ts | 27 +++++----- .../diplomas/diplomas.page.ts | 25 ++++----- .../events-to-approve.page.ts | 19 +++++-- .../expedientes-pr/expedientes-pr.page.ts | 16 ++++-- .../expedients/expedients.page.ts | 16 ++++-- .../gabinete-digital/pedidos/pedidos.page.ts | 8 ++- .../pendentes/pendentes.page.html | 2 +- .../pendentes/pendentes.page.ts | 24 +++++++-- 23 files changed, 240 insertions(+), 142 deletions(-) diff --git a/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.html b/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.html index 87945ed56..0d581e3f4 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.html +++ b/src/app/pages/gabinete-digital/despachos-pr/despachos-pr.page.html @@ -10,7 +10,7 @@ Despachos
-
@@ -18,7 +18,7 @@

Presidente da República

- + { - if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { - this.LoadList(); + if (event instanceof NavigationStart && event.url.startsWith(pathname)) { + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.doRefresh() + } else { + this.LoadList() + } } }); @@ -154,9 +159,12 @@ export class DespachosPrPage implements OnInit { }); } - doRefresh(event) { - this.LoadList(); - event.target.complete(); + doRefresh() { + + setTimeout(()=>{ + this.LoadList(); + }, 1000) + } async viewExpedientDetail(serialNumber:any) { diff --git a/src/app/pages/gabinete-digital/despachos/despachos.page.ts b/src/app/pages/gabinete-digital/despachos/despachos.page.ts index c934a99ab..e4d2ec835 100644 --- a/src/app/pages/gabinete-digital/despachos/despachos.page.ts +++ b/src/app/pages/gabinete-digital/despachos/despachos.page.ts @@ -14,7 +14,7 @@ import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discar import { AuthService } from 'src/app/services/auth.service'; import { DespachoPage } from 'src/app/pages/gabinete-digital/despachos/despacho/despacho.page'; -import { NavigationEnd, NavigationExtras, Router } from '@angular/router'; +import { NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angular/router'; @Component({ selector: 'app-despachos', @@ -62,10 +62,15 @@ export class DespachosPage implements OnInit { const location = window.location const pathname = location.pathname + location.search - + this.LoadList(); + this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { - this.LoadList(); + if (event instanceof NavigationStart && event.url.startsWith(pathname)) { + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.refreshing() + } else { + this.LoadList() + } } }); @@ -74,7 +79,7 @@ export class DespachosPage implements OnInit { async refreshing() { setTimeout(() => { this.LoadList(); - }, 1500); + }, 1000); } segmentChanged(ev: any) { diff --git a/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts b/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts index d2f7d0eeb..26ad18d01 100644 --- a/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts +++ b/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts @@ -35,10 +35,15 @@ export class DiplomasAssinarPage implements OnInit { ngOnInit() { const location = window.location const pathname = location.pathname + location.search + this.LoadList(); this.router.events.forEach((event) => { if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { - this.LoadList(); + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.refreshing() + } else { + this.LoadList() + } } }); } @@ -53,17 +58,17 @@ export class DiplomasAssinarPage implements OnInit { } async refreshing() { - setTimeout(() => { - this.LoadList(); - }, 1500); -} + setTimeout(() => { + this.LoadList(); + }, 1000); + } - doRefresh(event) { - this.LoadList(); - setTimeout(() => { - event.target.complete(); - }, 2000); - } + doRefresh(event) { + + setTimeout(() => { + this.LoadList(); + }, 1000); + } async LoadList(){ diff --git a/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts b/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts index 95efdd096..acc2e1480 100644 --- a/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts +++ b/src/app/pages/gabinete-digital/diplomas/diplomas.page.ts @@ -44,10 +44,15 @@ constructor( const location = window.location const pathname = location.pathname + location.search - + this.LoadList(); + this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { - this.LoadList(); + if (event instanceof NavigationStart && event.url.startsWith(pathname)) { + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.refreshing() + } else { + this.LoadList() + } } }); @@ -232,18 +237,14 @@ constructor( async refreshing() { setTimeout(() => { this.LoadList(); - }, 1500); + }, 1000); } async doRefresh(event) { - console.log('refresh'); - - //this.loadDiplomas(); - this.LoadList(); setTimeout(() => { - event.target.complete(); - }, 2000); + this.LoadList(); + }, 1000); } goBack() { diff --git a/src/app/pages/gabinete-digital/event-list/event-list.page.html b/src/app/pages/gabinete-digital/event-list/event-list.page.html index b9dfcd516..5bf075902 100644 --- a/src/app/pages/gabinete-digital/event-list/event-list.page.html +++ b/src/app/pages/gabinete-digital/event-list/event-list.page.html @@ -2,7 +2,7 @@ - + diff --git a/src/app/pages/gabinete-digital/event-list/event-list.page.ts b/src/app/pages/gabinete-digital/event-list/event-list.page.ts index c75217db7..c60033c7c 100644 --- a/src/app/pages/gabinete-digital/event-list/event-list.page.ts +++ b/src/app/pages/gabinete-digital/event-list/event-list.page.ts @@ -4,7 +4,7 @@ import { EventPerson } from 'src/app/models/eventperson.model'; import { ProcessesService } from 'src/app/services/processes.service'; import { ModalController } from '@ionic/angular'; import { ApproveEventModalPage } from './approve-event-modal/approve-event-modal.page'; -import { NavigationEnd, Router } from '@angular/router'; +import { NavigationEnd, NavigationStart, Router } from '@angular/router'; @Component({ selector: 'app-event-list', @@ -36,14 +36,17 @@ export class EventListPage implements OnInit { ngOnInit() { this.segment = 'MDGPR'; - this.refreshing(); - const location = window.location const pathname = location.pathname + location.search - + this.LoadToApproveEvents(); + this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { - this.LoadToApproveEvents(); + if (event instanceof NavigationStart && event.url.startsWith(pathname)) { + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.doRefresh() + } else { + this.LoadToApproveEvents() + } } }); @@ -114,15 +117,16 @@ export class EventListPage implements OnInit { refreshing() { setTimeout(() => { this.LoadToApproveEvents(); - }, 1500); + }, 1000); } - doRefresh(event) { - this.LoadToApproveEvents(); + doRefresh() { + setTimeout(() => { - event.target.complete(); - }, 2000); + this.LoadToApproveEvents(); + }, 1000); } + close(){ this.modalController.dismiss(null); } diff --git a/src/app/pages/gabinete-digital/expediente/expediente.page.ts b/src/app/pages/gabinete-digital/expediente/expediente.page.ts index 2a798576f..02884b850 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente.page.ts @@ -1,5 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; -import { NavigationEnd, Router } from '@angular/router'; +import { NavigationEnd, NavigationStart, Router } from '@angular/router'; import { DailyWorkTask } from '../../../models/dailyworktask.model'; import { ProcessesService } from 'src/app/services/processes.service'; import { ModalController } from '@ionic/angular'; @@ -32,10 +32,16 @@ export class ExpedientePage implements OnInit { const location = window.location const pathname = location.pathname + location.search - + + this.LoadList(); + this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { - this.LoadList(); + if (event instanceof NavigationStart && event.url.startsWith(pathname)) { + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.refreshing() + } else { + this.LoadList() + } } }); @@ -74,14 +80,14 @@ export class ExpedientePage implements OnInit { async refreshing() { setTimeout(() => { this.LoadList(); - }, 1500); + }, 1000); } doRefresh(event) { this.LoadList(); setTimeout(() => { event.target.complete(); - }, 2000); + }, 1000); } goBack() { diff --git a/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts b/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts index 1bf575a6d..b0b23b5a1 100644 --- a/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts +++ b/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; -import { NavigationEnd, NavigationExtras, Router } from '@angular/router'; +import { NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angular/router'; import { CalendarComponent } from 'ionic2-calendar'; import { DailyWorkTask } from '../../../models/dailyworktask.model'; @@ -42,10 +42,16 @@ export class ExpedientesPrPage implements OnInit { const location = window.location const pathname = location.pathname + location.search - + + this.LoadList(); + this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { - this.LoadList(); + if (event instanceof NavigationStart && event.url.startsWith(pathname)) { + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.refreshing() + } else { + this.LoadList() + } } }); @@ -121,7 +127,7 @@ export class ExpedientesPrPage implements OnInit { refreshing() { setTimeout(() => { this.LoadList(); - }, 1500); + }, 1000); } doRefresh(event) { diff --git a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html index ee8078d22..234927796 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html +++ b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html @@ -71,7 +71,6 @@ -
diff --git a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts index 0c63662be..d1e07e6d6 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts +++ b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts @@ -476,9 +476,9 @@ export class PedidoPage implements OnInit { let navigationExtras: NavigationExtras; - if (this.task.WorkflowName == 'Pedido de Deferimento') { + if (this.task.activityInstanceName == 'Concluir Deferimento') { navigationExtras= { queryParams: {"deferimento": true,}}; - } else if (this.task.WorkflowName == 'Pedido de Parecer') { + } else if (this.task.activityInstanceName == 'Tarefa de Parecer' ) { navigationExtras = { queryParams: {"parecer": true,}}; } @@ -493,12 +493,12 @@ export class PedidoPage implements OnInit { let navigationExtras: NavigationExtras; - if (this.task.WorkflowName == 'Pedido de Deferimento') { + if (this.task.activityInstanceName == 'Concluir Deferimento') { navigationExtras= { queryParams: {"deferimento": true,}}; - } else if (this.task.WorkflowName == 'Pedido de Parecer') { + } else if (this.task.activityInstanceName == 'Tarefa de Parecer' ) { + navigationExtras = { queryParams: {"parecer": true,}}; } - this.router.navigate(['/home/gabinete-digital'], navigationExtras); } } diff --git a/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts b/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts index 75dded269..fad691ce2 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts +++ b/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts @@ -57,8 +57,12 @@ export class PedidosPage implements OnInit { if(event instanceof NavigationStart && '/home/gabinete-digital/pedidos?parecer=true'.startsWith(event.url) || event instanceof NavigationStart && '/home/gabinete-digital/pedidos?deferimento=true'.startsWith(event.url) ) { - alert('resfresh') - this.refreshing() + + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.refreshing() + } else { + this.LoadList() + } } }); } diff --git a/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts b/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts index 7d2b86aac..7a97a305c 100644 --- a/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts +++ b/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts @@ -44,7 +44,11 @@ export class PendentesPage implements OnInit { this.router.events.forEach((event) => { if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { - this.LoadList(); + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.refreshing() + } else { + this.LoadList() + } } }); diff --git a/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts b/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts index fc6dc66d9..5ac230ae6 100644 --- a/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts +++ b/src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.ts @@ -13,7 +13,7 @@ import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discar import { AuthService } from 'src/app/services/auth.service'; import { DespachoPrPage } from 'src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page'; import { User } from 'src/app/models/user.model'; -import { NavigationEnd, NavigationExtras, Router } from '@angular/router'; +import { NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angular/router'; @Component({ selector: 'app-despachos-pr', @@ -58,36 +58,41 @@ constructor ( this.loggeduser = authService.ValidatedUser; } -ngOnInit() { - //Inicializar segment - this.segment = "despachos"; + ngOnInit() { + //Inicializar segment + this.segment = "despachos"; - setTimeout(()=>{ // update list const location = window.location const pathname = location.pathname + location.search + this.LoadList(); + this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && + if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital?despachospr=true')) { - this.LoadList(); + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.refreshing() + } else { + this.LoadList() + } } }); - }, 10) -} -segmentChanged(ev: any) { - this.LoadList(); -} + } -goToDespachoPr(serialNumber:any){ - let navigationExtras: NavigationExtras = { - queryParams: { - "serialNumber": serialNumber, - } - }; - this.router.navigate(['/home/gabinete-digital/despachos-pr/despacho-pr'], navigationExtras); -} + segmentChanged(ev: any) { + this.LoadList(); + } + + goToDespachoPr(serialNumber:any){ + let navigationExtras: NavigationExtras = { + queryParams: { + "serialNumber": serialNumber, + } + }; + this.router.navigate(['/home/gabinete-digital/despachos-pr/despacho-pr'], navigationExtras); + } notImplemented(){ this.alertService.presentAlert('Funcionalidade em desenvolvimento'); @@ -157,15 +162,16 @@ goToDespachoPr(serialNumber:any){ refreshing(){ setTimeout(() => { this.LoadList(); - }, 2000); + }, 1000); } doRefresh() { - this.LoadList(); + setTimeout(() => { + this.LoadList(); //event.target.complete(); - }, 2000); + }, 1000); } goToDespacho(serialNumber:any){ diff --git a/src/app/shared/gabinete-digital/despachos/despachos.page.ts b/src/app/shared/gabinete-digital/despachos/despachos.page.ts index f872ec0e3..df047fae1 100644 --- a/src/app/shared/gabinete-digital/despachos/despachos.page.ts +++ b/src/app/shared/gabinete-digital/despachos/despachos.page.ts @@ -14,7 +14,7 @@ import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discar import { AuthService } from 'src/app/services/auth.service'; import { DespachoPage } from 'src/app/pages/gabinete-digital/despachos/despacho/despacho.page'; -import { ActivatedRoute, NavigationEnd, NavigationExtras, Router } from '@angular/router'; +import { ActivatedRoute, NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angular/router'; @Component({ selector: 'app-despachos', @@ -67,11 +67,16 @@ export class DespachosPage implements OnInit { ngOnInit() { //Inicializar segment this.segment = "despachos"; + this.LoadList(); this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && + if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital?despachos=true')) { - this.LoadList(); + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.doRefresh() + } else { + this.LoadList() + } } }); @@ -138,11 +143,11 @@ export class DespachosPage implements OnInit { } doRefresh() { - this.LoadList(); + setTimeout(() => { - //event.target.complete(); - }, 2000); + this.LoadList(); + }, 1000); } // old diff --git a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts index 056968f4a..a405b3ec1 100644 --- a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts +++ b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; -import { NavigationEnd, NavigationExtras, Router } from '@angular/router'; +import { NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angular/router'; import { DailyWorkTask, tasksList } from '../../../models/dailyworktask.model'; import { ProcessesService } from 'src/app/services/processes.service'; import { formatDate } from '@angular/common'; @@ -33,18 +33,18 @@ skeletonLoader = true ngOnInit() { // update list - setTimeout(()=>{ - // update list - const location = window.location - const pathname = location.pathname + location.search + this.LoadList(); - this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && event.url.startsWith('/home/gabinete-digital?diplomasassinar=true')) { - this.LoadList(); + this.router.events.forEach((event) => { + if (event instanceof NavigationStart && '/home/gabinete-digital?diplomasassinar=true'.startsWith(event.url)) { + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.doRefresh() + } else { + this.LoadList() } - }); - }, 10) - + } + }); + } goToDiploma(serialNumber:any){ @@ -57,10 +57,11 @@ skeletonLoader = true } doRefresh() { - this.LoadList(); + setTimeout(() => { + this.LoadList(); //event.target.complete(); - }, 2000); + }, 1000); } async LoadList(){ diff --git a/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts b/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts index 2fcef0abf..dcd1ad946 100644 --- a/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts +++ b/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; -import { ActivatedRoute, NavigationEnd, NavigationExtras, Router } from '@angular/router'; +import { ActivatedRoute, NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angular/router'; import { DailyWorkTask, tasksList } from '../../../models/dailyworktask.model'; import { ProcessesService } from 'src/app/services/processes.service'; import { ModalController, NavParams } from '@ionic/angular'; @@ -32,21 +32,22 @@ constructor( } ngOnInit() { + // update list + this.LoadList(); // update list const location = window.location const pathname = location.pathname + location.search - setTimeout(()=>{ - // update list - const location = window.location - const pathname = location.pathname + location.search - - this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { - this.LoadList(); + this.router.events.forEach((event) => { + if (event instanceof NavigationStart && '/home/gabinete-digital?diplomas=true'.startsWith(event.url)) { + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.refreshing() + } else { + this.LoadList() } - }); - }, 10) + } + }); + } @@ -150,7 +151,7 @@ constructor( async refreshing() { setTimeout(() => { this.LoadList(); - }, 1500); + }, 1000); } doRefresh() { diff --git a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts index 030119e75..e4fe68e78 100644 --- a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts +++ b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts @@ -3,7 +3,7 @@ import { EventBody } from 'src/app/models/eventbody.model'; import { EventPerson } from 'src/app/models/eventperson.model'; import { ProcessesService } from 'src/app/services/processes.service'; import { ModalController } from '@ionic/angular'; -import { NavigationEnd, NavigationExtras, Router } from '@angular/router'; +import { NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angular/router'; import { User } from 'src/app/models/user.model'; import { AuthService } from 'src/app/services/auth.service'; @@ -36,11 +36,17 @@ export class EventsToApprovePage implements OnInit { ngOnInit() { this.segment = this.loggeduser.Profile; + this.LoadToApproveEvents(); this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && - event.url.startsWith('/home/gabinete-digital?eventos=true')) { - this.LoadToApproveEvents(); + if (event instanceof NavigationStart && + '/home/gabinete-digital?eventos=true'.startsWith(event.url)) { + + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.doRefresh() + } else { + this.LoadToApproveEvents() + } } }); @@ -105,7 +111,10 @@ export class EventsToApprovePage implements OnInit { doRefresh() { console.log('Refresh Events'); - this.LoadToApproveEvents(); + setTimeout(()=>{ + this.LoadToApproveEvents(); + }, 1000) + } close(){ this.modalController.dismiss(null); diff --git a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts index 6dcbb0958..cfdca272c 100644 --- a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts +++ b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; -import { NavigationEnd, NavigationExtras, Router } from '@angular/router'; +import { NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angular/router'; import { CalendarComponent } from 'ionic2-calendar'; import { DailyWorkTask } from '../../../models/dailyworktask.model'; @@ -39,13 +39,19 @@ export class ExpedientesPrPage implements OnInit { ngOnInit() { + this.LoadList(); + this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && + if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital?expedientespr=true') || - event instanceof NavigationEnd && + event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital?expedientes-pr=true')) { - this.LoadList(); + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.refreshing() + } else { + this.LoadList() + } } }); @@ -122,7 +128,7 @@ export class ExpedientesPrPage implements OnInit { refreshing() { setTimeout(() => { this.LoadList(); - }, 1500); + }, 1000); } doRefresh(event) { diff --git a/src/app/shared/gabinete-digital/expedients/expedients.page.ts b/src/app/shared/gabinete-digital/expedients/expedients.page.ts index 95ffdbce0..7e497a6d0 100644 --- a/src/app/shared/gabinete-digital/expedients/expedients.page.ts +++ b/src/app/shared/gabinete-digital/expedients/expedients.page.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; -import { ActivatedRoute, NavigationEnd, NavigationExtras, Router } from '@angular/router'; +import { ActivatedRoute, NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angular/router'; import { CalendarComponent } from 'ionic2-calendar'; import { DailyWorkTask } from '../../../models/dailyworktask.model'; @@ -41,11 +41,16 @@ export class ExpedientsPage implements OnInit { ngOnInit() { //Inicializar segment this.segment = "expedientes"; + this.LoadList(); this.router.events.forEach((event) => { - if (event instanceof NavigationEnd && + if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital?expedientes=true')) { - this.LoadList(); + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.doRefresh() + } else { + this.LoadList() + } } }); @@ -90,7 +95,10 @@ export class ExpedientsPage implements OnInit { } doRefresh() { - this.LoadList(); + setTimeout(()=>{ + this.LoadList(); + }, 1000) + } goToExpediente(serialNumber:any){ diff --git a/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts b/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts index 0194fe446..b62fc6596 100644 --- a/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts +++ b/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts @@ -57,7 +57,13 @@ export class PedidosPage implements OnInit { event instanceof NavigationStart && '/home/gabinete-digital?deferimento=true'.startsWith(event.url) || event instanceof NavigationStart && '/home/gabinete-digital?pedidos=true'.startsWith(event.url) ) { - this.doRefresh() + + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.doRefresh() + } else { + this.LoadList() + } + } }); diff --git a/src/app/shared/gabinete-digital/pendentes/pendentes.page.html b/src/app/shared/gabinete-digital/pendentes/pendentes.page.html index ca7e20e71..dfef8fe86 100644 --- a/src/app/shared/gabinete-digital/pendentes/pendentes.page.html +++ b/src/app/shared/gabinete-digital/pendentes/pendentes.page.html @@ -24,7 +24,7 @@
diff --git a/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts b/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts index e207e5ffb..ed252445b 100644 --- a/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts +++ b/src/app/shared/gabinete-digital/pendentes/pendentes.page.ts @@ -41,10 +41,16 @@ export class PendentesPage implements OnInit { //Inicializar segment this.segment = "despachos"; // update list + this.LoadList(); + this.router.events.forEach((event) => { if (event instanceof NavigationEnd && event.url.startsWith('/home/gabinete-digital?pendentes=true')) { - this.LoadList(); + if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { + this.doRefresh() + } else { + this.LoadList() + } } }); @@ -98,10 +104,14 @@ export class PendentesPage implements OnInit { doRefresh() { - this.LoadList(); + + setTimeout(()=>{ + this.LoadList(); + }, 1000) + } - async viewTaskDetails(serialNumber:string, workflowName:string) { + async viewTaskDetails(serialNumber:string, workflowName:string , task) { console.log(this.profile); if(workflowName == 'Despacho') { this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']); @@ -111,9 +121,13 @@ export class PendentesPage implements OnInit { } else if(workflowName == 'Expediente') { this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']); + } else if (task.activityInstanceName == "Tarefa de Parecer") { + this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']); + } else if(task.activityInstanceName == "Tarefa de Despacho") { + this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']); } else { - console.log('cant find page for this task', workflowName) - } + console.log('cant find page for this task', task) + } }