This commit is contained in:
Peter Maquiran
2021-07-17 14:02:05 +01:00
parent 133e3ad122
commit b1c165bf87
23 changed files with 240 additions and 142 deletions
@@ -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){
@@ -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
@@ -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(){
@@ -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() {
@@ -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);
@@ -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) {
@@ -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){
@@ -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()
}
}
});
@@ -24,7 +24,7 @@
<ion-item
class="expediente ion-no-padding cursor-pointer"
*ngFor = "let task of pendentesList"
(click)="viewTaskDetails(task.SerialNumber, task.WorkflowName)"
(click)="viewTaskDetails(task.SerialNumber, task.WorkflowName, task)"
>
<!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" -->
<div class="item width-100">
@@ -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)
}
}