This commit is contained in:
tiago.kayaya
2021-07-13 12:05:17 +01:00
parent 40de613773
commit ae090ad82d
7 changed files with 99 additions and 70 deletions
@@ -1,5 +1,5 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { ActivatedRoute, NavigationEnd, NavigationExtras, Router } from '@angular/router';
import { CalendarComponent } from 'ionic2-calendar';
import { DailyWorkTask, tasksList } from '../../../models/dailyworktask.model';
@@ -24,7 +24,7 @@ export class PedidosPage implements OnInit {
taskslist:DailyWorkTask[];
parecerList:any[];
fulltask:any;
parecerListResult:tasksList[] = [];
deferimentoListResult:tasksList[] = [];
@@ -36,29 +36,30 @@ export class PedidosPage implements OnInit {
@Output() openExpedientDetail:EventEmitter<any> = new EventEmitter<any>();
constructor(
private router: Router,
private router: Router,
private processes:ProcessesService,
private modalController: ModalController,
private alertService: AlertService,
private activatedRoute: ActivatedRoute,
) {
}
ngOnInit() {
//Inicializar segment
) {
//Inicializar segment
this.segment = 'parecer';
this.activatedRoute.queryParams.subscribe(params => {
if(params['deferimento'] == 'true') {
this.segment = 'deferimento';
} else if (params['parecer'] == 'true') {
this.segment = 'parecer';
}
this.LoadList();
});
this.LoadList();
}
ngOnInit() {
const pathname = window.location.pathname;
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.refreshing();
}
});
}
goBack() {
@@ -123,15 +124,15 @@ export class PedidosPage implements OnInit {
}
this.parecerList.push(task);
});
}
else if(this.segment == 'deferimento') {
this.taskType = "Pedido de Deferimento";
this.processes.GetTasksList("Pedido de Deferimento", false).subscribe(result => {
this.taskslist = result;
console.log(result);
this.deferimentoList = new Array();
let res = result.reverse();
res.forEach(element => {
@@ -153,11 +154,17 @@ export class PedidosPage implements OnInit {
}
this.deferimentoList.push(task);
});
});
}
}
refreshing() {
setTimeout(() => {
this.LoadList();
}, 1500);
}
doRefresh(event) {
this.LoadList();
setTimeout(() => {
@@ -167,4 +174,3 @@ export class PedidosPage implements OnInit {
}