mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
160 lines
4.9 KiB
TypeScript
160 lines
4.9 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
|
import { LoginUserRespose } from 'src/app/models/user.model';
|
|
import { ThemeService } from 'src/app/services/theme.service'
|
|
import { SessionStore } from 'src/app/store/session.service';
|
|
import { TaskService } from 'src/app/services/task.service'
|
|
/* import MiniSearch from 'minisearch' */
|
|
|
|
@Component({
|
|
selector: 'app-all-processes',
|
|
templateUrl: './all-processes.page.html',
|
|
styleUrls: ['./all-processes.page.scss'],
|
|
})
|
|
export class AllProcessesPage implements OnInit {
|
|
|
|
skeletonLoader = false;
|
|
loggeduser: LoginUserRespose;
|
|
hideSearchBtn: boolean = false;
|
|
showSearch = false;
|
|
searchSubject: string = '';
|
|
|
|
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
|
|
|
|
/* miniSearch = new MiniSearch({
|
|
fields: ['Folio', 'Senders'], // fields to index for full-text search
|
|
idField: 'DocId'
|
|
}) */
|
|
|
|
AllProcess = []
|
|
ordinance: string = 'old'
|
|
|
|
listSubscription : {
|
|
delete(): void;
|
|
}
|
|
|
|
|
|
constructor(
|
|
private router: Router,
|
|
public ThemeService: ThemeService,
|
|
public TaskService: TaskService,
|
|
) {}
|
|
|
|
ngOnInit() {
|
|
// this.updateAllProcess()
|
|
this.checkFilter();
|
|
}
|
|
|
|
ngAfterViewInit(): void {
|
|
|
|
this.listSubscription = this.TaskService.registerCallback({
|
|
id: import.meta.url,
|
|
funx:() => {
|
|
|
|
this.dynamicSearch()
|
|
|
|
}
|
|
})
|
|
|
|
this.dynamicSearch();
|
|
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
this.listSubscription.delete()
|
|
}
|
|
|
|
|
|
openSearch() {
|
|
// this.dynamicSearch()
|
|
}
|
|
async closeSearch() {
|
|
this.searchSubject = ''
|
|
// this.dynamicSearch()
|
|
}
|
|
|
|
async basicSearch() {
|
|
// this.dynamicSearch()
|
|
}
|
|
|
|
|
|
reorderList(orderBy: string) {
|
|
|
|
this.ordinance = orderBy;
|
|
|
|
this.dynamicSearch();
|
|
}
|
|
|
|
async dynamicSearch() {
|
|
|
|
if(this.showSearch && this.searchSubject) {
|
|
|
|
const AllProcess = this.TaskService.AllProcess.filter((task) => {
|
|
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
|
|
subject = subject.toLowerCase();
|
|
return subject.includes(this.searchSubject.toLowerCase())
|
|
})
|
|
|
|
this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess)
|
|
} else {
|
|
const AllProcess = this.TaskService.AllProcess
|
|
this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess)
|
|
}
|
|
}
|
|
|
|
checkFilter() {
|
|
if(this.router.url.includes('ForToDay')) {
|
|
this.filterName = 'Para hoje'
|
|
} else if (this.router.url.includes('OverdueTasks')) {
|
|
this.filterName = 'OverdueTasks'
|
|
} else if (this.router.url.includes('New')) {
|
|
this.filterName = 'Novos'
|
|
} else if (this.router.url.includes('unread')) {
|
|
this.filterName = 'Não lidos'
|
|
}
|
|
}
|
|
|
|
|
|
goToProcess(serialNumber: string, workflowName: string, activityName: string) {
|
|
|
|
|
|
if (workflowName == 'Despacho') {
|
|
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho') {
|
|
this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']);
|
|
}
|
|
}
|
|
else if (workflowName == 'Despacho do Presidente da República') {
|
|
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho') {
|
|
this.router.navigate(['/home/gabinete-digital/despachos-pr', serialNumber, 'gabinete-digital']);
|
|
}
|
|
else if (activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma') {
|
|
this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
|
|
}
|
|
else if (activityName == 'Diploma Assinado') {
|
|
this.router.navigate(['/home/gabinete-digital/diplomas-assinar', serialNumber, 'gabinete-digital']);
|
|
} else {
|
|
throw('Bug!');
|
|
}
|
|
}
|
|
else if (workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
|
|
this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
|
|
}
|
|
else if (workflowName == 'Expediente') {
|
|
this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
|
|
}
|
|
else if (workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
|
|
this.router.navigate(['/home/gabinete-digital/expedientes-pr', serialNumber, 'gabinete-digital']);
|
|
}
|
|
else if (workflowName == "Pedido de Parecer do Presidente") {
|
|
this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
|
|
}
|
|
else if (workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR' || activityName == "Aprovar Evento" || workflowName == "Agendar Evento") {
|
|
this.router.navigate(['/home/gabinete-digital/event-list/approve-event', serialNumber, 'gabinete-digital']);
|
|
}
|
|
else {
|
|
throw(`${workflowName} && ${activityName} no route`)
|
|
}
|
|
}
|
|
|
|
}
|