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
@@ -66,13 +66,15 @@ export class DespachosPrPage implements OnInit {
//Inicializar segment
this.segment = "despachos";
const pathname = window.location.pathname
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(ev: any) {
@@ -59,12 +59,16 @@ export class DespachosPage implements OnInit {
ngOnInit() {
//Inicializar segment
this.segment = "despachos";
const pathname = window.location.pathname;
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();
}
});
}
async refreshing() {
@@ -32,14 +32,16 @@ export class DiplomasAssinarPage implements OnInit {
) {
}
ngOnInit() {
const pathname = window.location.pathname;
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.refreshing();
}
});
}
ngOnInit() {
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();
}
});
}
goToDiploma(serialNumber:any){
let navigationExtras: NavigationExtras = {
@@ -42,13 +42,15 @@ constructor(
}
});
const pathname = window.location.pathname
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();
}
});
}
/* async loadDiplomas(){
@@ -36,13 +36,16 @@ export class EventListPage implements OnInit {
this.refreshing();
const pathname = window.location.pathname
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();
}
});
window.onresize = (event) => {
// if not mobile remove all component
if( window.innerWidth <= 800){
@@ -29,12 +29,16 @@ export class ExpedientePage implements OnInit {
}
ngOnInit() {
const pathname = window.location.pathname
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();
}
});
}
LoadList(){
@@ -38,17 +38,19 @@ export class ExpedientesPrPage implements OnInit {
private router: Router,
) {
this.loggeduser = authService.ValidatedUser;
this.LoadList();
}
ngOnInit() {
const pathname = window.location.pathname;
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();
}
});
}
LoadList(){
@@ -147,18 +147,18 @@
<!-- Aside right -->
<div class="aside-content d-none flex-column height-100">
<app-empty-container [texto]="emptyTextDescription" *ngIf="showEmptyContainer" class="d-flex height-100 flex-column"></app-empty-container>
<app-events-to-approve [profile]="'MDGPR'" *ngIf="showEventsToApprove" class="d-flex height-100 flex-column"></app-events-to-approve>
<app-empty-container [texto]="emptyTextDescription" [style.display]="showEmptyContainer ? 'flex' : 'none'" class="height-100 flex-column"></app-empty-container>
<app-events-to-approve [profile]="'MDGPR'" [style.display]="showEventsToApprove ? 'flex' : 'none'" class=" height-100 flex-column"></app-events-to-approve>
<app-expedients [profile]="profile" class="d-flex height-100 flex-column" *ngIf="showExpedients"></app-expedients>
<app-pedidos [profile]="profile" [segment]="segment" [serialNumber]="serialNumber" class="d-flex height-100 flex-column" *ngIf="showPedidos"></app-pedidos>
<app-despachos [profile]="profile" class="d-flex height-100 flex-column" *ngIf="showDespachos"></app-despachos>
<app-despachos-pr [profile]="profile" class="d-flex height-100 flex-column" *ngIf="showDespachosPr"></app-despachos-pr>
<app-pendentes [profile]="profile" class="d-flex height-100 flex-column" *ngIf="showPendentes"></app-pendentes>
<app-diplomas (openExpedientDetail)="openExpedientesPrPage($event)" [profile]="profile" [segment]="segment" class="d-flex height-100 flex-column" *ngIf="showDiplomas"></app-diplomas>
<app-diplomas-assinar class="d-flex height-100 flex-column" *ngIf="showDiplomasAssinar"></app-diplomas-assinar>
<app-expedientes-pr [profile]="profile" class="d-flex height-100 flex-column" *ngIf="showExpedientesPr"></app-expedientes-pr>
<app-signed-diploma [profile]="profile" class="d-flex height-100 flex-column" *ngIf="showSignedDiploma"></app-signed-diploma>
<app-expedients [profile]="profile" class=" height-100 flex-column" [style.display]="showExpedients ? 'flex' : 'none'" ></app-expedients>
<app-pedidos [profile]="profile" [segment]="segment" [serialNumber]="serialNumber" class=" height-100 flex-column" [style.display]="showPedidos ? 'flex' : 'none'"></app-pedidos>
<app-despachos [profile]="profile" class="height-100 flex-column" [style.display]="showDespachos ? 'flex' : 'none'" ></app-despachos>
<app-despachos-pr [profile]="profile" class=" height-100 flex-column" [style.display]="showDespachosPr ? 'flex' : 'none'" ></app-despachos-pr>
<app-pendentes [profile]="profile" class=" height-100 flex-column" [style.display]="showPendentes ? 'flex' : 'none'" ></app-pendentes>
<app-diplomas (openExpedientDetail)="openExpedientesPrPage($event)" [profile]="profile" [segment]="segment" class=" height-100 flex-column" [style.display]="showDiplomas ? 'flex' : 'none'"></app-diplomas>
<app-diplomas-assinar class=" height-100 flex-column" [style.display]="showDiplomasAssinar ? 'flex' : 'none'"></app-diplomas-assinar>
<app-expedientes-pr [profile]="profile" class=" height-100 flex-column" [style.display]="showExpedientesPr ? 'flex' : 'none'" ></app-expedientes-pr>
<app-signed-diploma [profile]="profile" class=" height-100 flex-column" [style.display]="showSignedDiploma ? 'flex' : 'none'" ></app-signed-diploma>
</div>
</div>
</ion-content>
@@ -55,10 +55,12 @@ export class PedidosPage implements OnInit {
}
ngOnInit() {
const pathname = window.location.pathname;
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();
}
});
}
@@ -40,12 +40,15 @@ export class PendentesPage implements OnInit {
//Inicializar segment
this.segment = "despachos";
const pathname = window.location.pathname
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();
}
});
}
segmentChanged(ev: any) {
@@ -63,9 +66,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);