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);
@@ -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);