mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { customTask } from '../../../models/dailyworktask.model';
|
|
import { NavigationStart, Router } from '@angular/router';
|
|
import { DespachoStore } from 'src/app/store/despacho-store.service';
|
|
import { DespachoService } from 'src/app/Rules/despacho.service';
|
|
|
|
@Component({
|
|
selector: 'app-despachos',
|
|
templateUrl: './despachos.page.html',
|
|
styleUrls: ['./despachos.page.scss'],
|
|
})
|
|
export class DespachosPage implements OnInit {
|
|
|
|
despachoStore = DespachoStore;
|
|
skeletonLoader = true;
|
|
|
|
constructor (
|
|
private router: Router,
|
|
private despachoRule: DespachoService
|
|
) {}
|
|
|
|
ngOnInit() {
|
|
|
|
this.LoadList();
|
|
|
|
this.router.events.forEach((event) => {
|
|
if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital?despachos=true')) {
|
|
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
|
this.doRefresh()
|
|
} else {
|
|
this.LoadList()
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
goToDespacho({ SerialNumber } : customTask) {
|
|
this.router.navigate(['/home/gabinete-digital/despachos',SerialNumber,'gabinete-digital']);
|
|
}
|
|
|
|
async LoadList() {
|
|
|
|
this.skeletonLoader = true;
|
|
|
|
await this.despachoRule.getList({updateStore: true})
|
|
this.skeletonLoader = false;
|
|
}
|
|
|
|
doRefresh() {
|
|
setTimeout(() => {
|
|
this.LoadList();
|
|
}, 1000);
|
|
}
|
|
|
|
refreshing() {
|
|
setTimeout(() => {
|
|
this.LoadList();
|
|
}, 1000);
|
|
}
|
|
|
|
}
|