Add refresh and improve performance

This commit is contained in:
Peter Maquiran
2021-07-16 12:59:43 +01:00
parent 7b93dbf1e2
commit 9f28fc1b03
21 changed files with 186 additions and 123 deletions
@@ -28,7 +28,7 @@ export class DespachosPrPage implements OnInit {
@ViewChild(CalendarComponent) myCal: CalendarComponent;
taskslist:DailyWorkTask[];
taskslist:DailyWorkTask[] = [];
despachoList:any[]=[];
deferimentoList:DailyWorkTask[] = [];
@@ -64,14 +64,17 @@ constructor (
ngOnInit() {
//Inicializar segment
this.segment = "despachos";
this.refreshing();
const pathname = window.location.pathname
// update list
const location = window.location
const pathname = location.pathname + location.search
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.doRefresh();
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
this.LoadList();
}
});
}
segmentChanged(ev: any) {
this.LoadList();
@@ -55,7 +55,7 @@
</ion-item>
</ion-list>
</div>
<div *ngIf="skeletonLoader && despachoList.length == 0">
<div *ngIf="skeletonLoader">
<ion-list>
<ion-item>
@@ -22,30 +22,30 @@ import { ActivatedRoute, NavigationEnd, NavigationExtras, Router } from '@angula
styleUrls: ['./despachos.page.scss'],
})
export class DespachosPage implements OnInit {
//profile:string;
//profile:string;
@ViewChild(CalendarComponent) myCal: CalendarComponent;
@ViewChild(CalendarComponent) myCal: CalendarComponent;
taskslist:DailyWorkTask[];
despachoList:any[] = [];
deferimentoList:DailyWorkTask[] = [];
taskslist:DailyWorkTask[] = [];
despachoList:any[] = [];
deferimentoList:DailyWorkTask[] = [];
taskList:tasksList[] = [];
taskList:tasksList[] = [];
taskType: string;
serialNumber:string;
totalDocs:any;
taskType: string;
serialNumber:string;
totalDocs:any;
@Input() profile:string;
segment:string;
@Output() openExpedientDetail:EventEmitter<any> = new EventEmitter<any>();
@Input() profile:string;
segment:string;
@Output() openExpedientDetail:EventEmitter<any> = new EventEmitter<any>();
loadedAttachments:any;
dicIndex = 0;
inicial = false
skeletonLoader = true
loadedAttachments:any;
dicIndex = 0;
inicial = false
skeletonLoader = true
constructor (
constructor (
private processes:ProcessesService,
private modalController: ModalController,
private alertService: AlertService,
@@ -60,44 +60,50 @@ export class DespachosPage implements OnInit {
console.log(params["serialNumber"]);
}
});
}
ngOnInit() {
}
ngOnInit() {
//Inicializar segment
this.segment = "despachos";
this.LoadList();
const pathname = window.location.pathname
// update list
const location = window.location
const pathname = location.pathname + location.search
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.doRefresh();
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
console.log('update', pathname)
this.LoadList();
}
});
}
segmentChanged(ev: any) {
this.LoadList();
}
segmentChanged(ev: any) {
this.LoadList();
}
goToDespacho(serialNumber:any){
goToDespacho(serialNumber:any){
this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']);
}
notImplemented(){
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
}
notImplemented(){
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
}
openExpedientDetailPage(data){
this.openExpedientDetail.emit(data);
}
openExpedientDetailPage(data){
this.openExpedientDetail.emit(data);
}
async LoadList(){
async LoadList() {
console.log('update ================================')
this.skeletonLoader = true
let result = await this.processes.GetTasksList("Despacho", false).toPromise();
//let despachos = result.reverse().filter(data => data.activityInstanceName == "Despacho (Paralelo)");
this.despachoList = new Array();
await result.forEach( (element, index) => {
@@ -136,13 +142,13 @@ export class DespachosPage implements OnInit {
});
}
doRefresh() {
this.LoadList();
doRefresh() {
this.LoadList();
setTimeout(() => {
//event.target.complete();
}, 2000);
}
setTimeout(() => {
//event.target.complete();
}, 2000);
}
// old
async openExpedientActionsModal(taskAction: any, task: any) {
@@ -32,14 +32,16 @@ skeletonLoader = true
}
ngOnInit() {
this.LoadList();
// update list
const location = window.location
const pathname = location.pathname + location.search
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.doRefresh();
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
this.LoadList();
}
});
}
goToDiploma(serialNumber:any){
@@ -32,7 +32,15 @@ constructor(
}
ngOnInit() {
this.refreshing();
// 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();
}
});
}
segmentChanged(ev: any) {
@@ -32,18 +32,19 @@ export class EventsToApprovePage implements OnInit {
)
{
this.loggeduser = userAuth.ValidatedUser;
}
}
ngOnInit() {
this.segment = this.loggeduser.Profile;
console.log(this.segment);
this.LoadToApproveEvents();
const pathname = window.location.pathname
// update list
const location = window.location
const pathname = location.pathname + location.search
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
this.LoadToApproveEvents();
}
});
@@ -20,7 +20,7 @@ import { AuthService } from 'src/app/services/auth.service';
export class ExpedientesPrPage implements OnInit {
@ViewChild(CalendarComponent) myCal: CalendarComponent;
taskslist:DailyWorkTask[];
taskslist:DailyWorkTask[] = [];
serialNumber:string;
skeletonLoader:boolean;
@@ -35,18 +35,20 @@ export class ExpedientesPrPage implements OnInit {
private router: Router,
) {
this.loggeduser = authService.ValidatedUser;
this.LoadList();
}
ngOnInit() {
const pathname = window.location.pathname
// update list
const location = window.location
const pathname = location.pathname + location.search
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.refreshing();
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
this.LoadList();
}
});
}
openExpedientDetailPage(data){
@@ -41,14 +41,17 @@ export class ExpedientsPage implements OnInit {
ngOnInit() {
//Inicializar segment
this.segment = "expedientes";
this.LoadList();
const pathname = window.location.pathname
// update list
const location = window.location
const pathname = location.pathname + location.search
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
this.LoadList();
}
});
}
segmentChanged(){
@@ -51,10 +51,13 @@ export class PedidosPage implements OnInit {
ngOnInit() {
this.LoadList();
const pathname = window.location.pathname
// update list
const location = window.location
const pathname = location.pathname + location.search
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.doRefresh();
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
this.LoadList();
}
});
}
@@ -41,15 +41,16 @@ export class PendentesPage implements OnInit {
ngOnInit() {
//Inicializar segment
this.segment = "despachos";
this.LoadList();
// update list
const location = window.location
const pathname = location.pathname + location.search
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.LoadList();
}
});
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
this.LoadList();
}
});
}
segmentChanged(ev: any) {
@@ -63,9 +64,10 @@ export class PendentesPage implements OnInit {
async LoadList(){
this.skeletonLoader = true;
this.pendentesList = new Array();
let pendentes = await this.processes.GetPendingTasks(false).toPromise();
this.pendentesList = new Array();
pendentes.forEach(element => {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);