mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
94 lines
2.4 KiB
TypeScript
94 lines
2.4 KiB
TypeScript
import { Component, Input, OnInit } from '@angular/core';
|
|
import { NavigationStart, Router } from '@angular/router';
|
|
import { DailyWorkTask } from '../../../models/dailyworktask.model';
|
|
import { ProcessesService } from 'src/app/services/processes.service';
|
|
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
|
import { DeplomasStore } from 'src/app/store/deplomas.service';
|
|
import { ThemeService } from 'src/app/services/theme.service'
|
|
import { SortService } from 'src/app/services/functions/sort.service';
|
|
import { PermissionService } from 'src/app/services/permission.service';
|
|
import { TaskService } from 'src/app/services/task.service'
|
|
|
|
@Component({
|
|
selector: 'app-diplomas',
|
|
templateUrl: './diplomas.page.html',
|
|
styleUrls: ['./diplomas.page.scss'],
|
|
})
|
|
export class DiplomasPage implements OnInit {
|
|
|
|
diplomasList:DailyWorkTask[] = [];
|
|
diplomasAssinadoList:DailyWorkTask[] = [];
|
|
showLoader: boolean;
|
|
serialNumber:string;
|
|
skeletonLoader = false
|
|
|
|
@Input() segment:string;
|
|
|
|
|
|
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
|
|
deplomasStore = DeplomasStore
|
|
customTaskPipe = new CustomTaskPipe()
|
|
|
|
constructor(
|
|
private processes:ProcessesService,
|
|
private router: Router,
|
|
public ThemeService: ThemeService,
|
|
private sortService: SortService,
|
|
public p: PermissionService,
|
|
public TaskService: TaskService
|
|
) {}
|
|
|
|
ngOnInit() {
|
|
// update list
|
|
this.LoadList()
|
|
|
|
this.router.events.forEach((event) => {
|
|
if (event instanceof NavigationStart && '/home/gabinete-digital?diplomas=true'.startsWith(event.url)) {
|
|
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
|
this.LoadList()
|
|
} else {
|
|
this.LoadList()
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
segmentChanged(ev: any) {
|
|
this.LoadList();
|
|
}
|
|
|
|
goToDiploma(serialNumber:any){
|
|
this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
|
|
}
|
|
|
|
async LoadList() {
|
|
this.skeletonLoader = true;
|
|
|
|
await this.TaskService.loadDiplomas()
|
|
|
|
this.showLoader = false;
|
|
this.skeletonLoader = false
|
|
}
|
|
|
|
async refreshing() {
|
|
setTimeout(() => {
|
|
this.LoadList();
|
|
}, 1000);
|
|
}
|
|
|
|
doRefresh(event) {
|
|
if (event) {
|
|
setTimeout(() => {
|
|
try {
|
|
event?.target?.complete();
|
|
} catch(error) {}
|
|
}, 2000);
|
|
}
|
|
|
|
this.LoadList();
|
|
}
|
|
|
|
}
|