mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
133 lines
3.3 KiB
TypeScript
133 lines
3.3 KiB
TypeScript
import { Component, Input, OnInit } from '@angular/core';
|
|
import { NavigationEnd, 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 { ThemeService } from 'src/app/services/theme.service'
|
|
import { DeplomasStore } from 'src/app/store/deplomas.service';
|
|
import { TaskService } from 'src/app/services/task.service'
|
|
import { RouteService } from 'src/app/services/route.service';
|
|
import { PermissionService } from 'src/app/services/permission.service';
|
|
|
|
@Component({
|
|
selector: 'app-diplomas-assinar',
|
|
templateUrl: './diplomas-assinar.page.html',
|
|
styleUrls: ['./diplomas-assinar.page.scss'],
|
|
})
|
|
export class DiplomasAssinarPage implements OnInit {
|
|
//profile:string;
|
|
diplomasList:DailyWorkTask[] = [];
|
|
showLoader: boolean;
|
|
totalDocs:any;
|
|
serialNumber:string;
|
|
|
|
@Input() profile:string;
|
|
@Input() segment:string;
|
|
|
|
customTaskPipe = new CustomTaskPipe()
|
|
skeletonLoader = true
|
|
deplomasStore = DeplomasStore
|
|
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
|
|
showSearch = false
|
|
searchSubject = ''
|
|
list = []
|
|
ordinance: string = 'recent'
|
|
|
|
constructor(
|
|
private processes:ProcessesService,
|
|
private router: Router,
|
|
public ThemeService: ThemeService,
|
|
public TaskService: TaskService,
|
|
private RouteService: RouteService,
|
|
public p: PermissionService,) {
|
|
}
|
|
|
|
ngOnInit() {
|
|
const location = window.location
|
|
const pathname = location.pathname + location.search
|
|
|
|
this.LoadList()
|
|
|
|
this.router.events.forEach((event) => {
|
|
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
|
|
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
|
this.refreshing()
|
|
} else {
|
|
this.LoadList()
|
|
}
|
|
}
|
|
});
|
|
this.dynamicSearch()
|
|
}
|
|
|
|
reorderList(orderBy: string) {
|
|
|
|
this.ordinance = orderBy;
|
|
|
|
this.dynamicSearch();
|
|
}
|
|
|
|
|
|
async dynamicSearch() {
|
|
|
|
if(this.showSearch && this.searchSubject) {
|
|
|
|
const list = this.TaskService.despachoStore.list.filter((task) => {
|
|
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
|
|
subject = subject.toLowerCase();
|
|
return subject.includes(this.searchSubject.toLowerCase())
|
|
})
|
|
|
|
this.list = this.TaskService.reorderList(this.ordinance, list)
|
|
} else {
|
|
const list = this.TaskService.AllProcess
|
|
this.list = this.TaskService.reorderList(this.ordinance, list)
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
goToDiploma(serialNumber:any){
|
|
this.router.navigate(['/home/gabinete-digital/diplomas-assinar',serialNumber,'gabinete-digital']);
|
|
}
|
|
|
|
async refreshing() {
|
|
setTimeout(() => {
|
|
this.LoadList();
|
|
}, 1000);
|
|
}
|
|
|
|
doRefresh(event) {
|
|
|
|
setTimeout(() => {
|
|
this.LoadList();
|
|
}, 1000);
|
|
}
|
|
|
|
async LoadList() {
|
|
|
|
this.skeletonLoader = true
|
|
|
|
try {
|
|
await this.TaskService.loadDiplomas()
|
|
this.dynamicSearch()
|
|
|
|
} catch(error) {
|
|
|
|
}
|
|
|
|
|
|
this.skeletonLoader = false
|
|
this.showLoader = false;
|
|
|
|
}
|
|
|
|
goBack() {
|
|
// this.router.navigate(['/home/gabinete-digital']);
|
|
// window.history.back()
|
|
this.RouteService.goBack();
|
|
}
|
|
|
|
}
|