Files
doneit-web/src/app/services/task.service.ts
T

503 lines
16 KiB
TypeScript
Raw Normal View History

2023-04-12 09:01:03 +01:00
import { Injectable } from '@angular/core';
import { momentG } from 'src/plugin/momentG';
2023-04-17 16:00:30 +01:00
import { ProcessesService } from 'src/app/services/processes.service';
2023-04-17 14:11:30 +01:00
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
import { DeplomasStore } from 'src/app/store/deplomas.service';
import { PendentesStore } from 'src/app/store/pendestes-store.service';
import { DespachoStore } from 'src/app/store/despacho-store.service';
import { TotalDocumentStore } from 'src/app/store/total-document.service';
import { DespachosprStore } from 'src/app/store/despachospr-store.service';
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
import { PedidosStore } from 'src/app/store/pedidos-store.service';
2023-04-17 16:00:30 +01:00
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { DespachoService } from 'src/app/Rules/despacho.service';
import { CustomTaskPipe } from '../pipes/custom-task.pipe';
import { SessionStore } from 'src/app/store/session.service';
import { EventsService } from './events.service';
2023-04-20 13:36:59 +01:00
import { customTask } from '../models/dailyworktask.model';
2023-06-10 14:17:41 +01:00
import { Router } from '@angular/router';
2023-06-11 20:17:10 +01:00
import { v4 as uuidv4 } from 'uuid'
2023-08-18 17:37:11 +01:00
import { ChangeProfileService } from './change-profile.service';
2023-08-21 17:36:32 +01:00
import { PermissionService } from './permission.service';
2024-05-31 12:49:49 +01:00
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { SortService } from './functions/sort.service';
2024-06-17 10:33:35 +01:00
import { TracingType, XTracerAsync } from './monitoring/opentelemetry/tracer';
import { EEventFilterStatus } from './Repositorys/Agenda/model/enums';
2023-04-12 09:01:03 +01:00
@Injectable({
providedIn: 'root'
})
export class TaskService {
2023-04-17 14:11:30 +01:00
read = 0
unread = 0
deadline = 0
new = 0
overdueTasks = 0
expedientegbstore = ExpedienteGdStore;
pendentesstore = PendentesStore;
despachoStore = DespachoStore;
eventoaprovacaostore = EventoAprovacaoStore;
pedidosstore = PedidosStore;
despachoprstore = DespachosprStore;
totalDocumentStore = TotalDocumentStore
deplomasStore = DeplomasStore
2023-04-17 16:00:30 +01:00
SessionStore = SessionStore
2023-09-19 10:21:23 +01:00
2023-04-17 14:11:30 +01:00
AllProcess = []
2023-04-17 16:00:30 +01:00
showLoader: boolean = false
2023-08-14 12:15:18 +01:00
showLoaderNum: number = 0
2023-04-17 16:00:30 +01:00
loadCount = false
loadNum = 0
2023-04-17 14:11:30 +01:00
2023-04-17 16:00:30 +01:00
expedienteTaskPipe = new ExpedienteTaskPipe();
customTaskPipe = new CustomTaskPipe()
2023-04-20 11:45:46 +01:00
callbacks: {
[key: string]: {
funx: Function
id: string
}
2023-09-19 10:21:23 +01:00
} = {}
2023-04-20 11:45:46 +01:00
2023-04-17 16:00:30 +01:00
constructor(
private processesbackend: ProcessesService,
private despachoRule: DespachoService,
public eventService: EventsService,
2023-06-10 14:17:41 +01:00
private router: Router,
2023-08-18 17:37:11 +01:00
private changeProfileService: ChangeProfileService,
2023-08-21 17:36:32 +01:00
public p: PermissionService,
2024-05-31 12:49:49 +01:00
public AgendaDataRepositoryService: AgendaDataRepositoryService,
private sortService: SortService,
2023-04-17 16:00:30 +01:00
) {
2023-08-18 17:37:11 +01:00
this.changeProfileService.registerCallback(() => {
this.updateCount()
this.runCallback();
})
2023-04-17 16:00:30 +01:00
window['all-process-gabinete'] = () => {
2023-05-18 17:40:52 +01:00
this.updateAllProcess();
this.updateCount();
this.runCallback();
2023-04-17 16:00:30 +01:00
}
2023-04-20 13:36:59 +01:00
2023-05-18 17:40:52 +01:00
this.updateAllProcess();
2023-04-20 13:36:59 +01:00
this.updateCount()
2023-05-18 17:40:52 +01:00
this.runCallback();
2023-06-11 20:17:10 +01:00
2023-08-08 16:32:57 +01:00
document.addEventListener('resume', () => {
if(window['all-process-gabinete']) {
window['all-process-gabinete']()
}
2023-06-11 20:17:10 +01:00
});
2023-04-17 16:00:30 +01:00
}
2023-04-12 09:01:03 +01:00
2023-06-11 20:17:10 +01:00
registerCallback({funx, id = uuidv4()}) {
2023-04-20 11:45:46 +01:00
this.callbacks[id] = { funx, id}
2023-09-19 10:21:23 +01:00
2023-06-11 20:17:10 +01:00
return {
delete: ()=> {
delete this.callbacks[id]
}
}
2023-04-20 11:45:46 +01:00
}
runCallback() {
for (const [key, value] of Object.entries(this.callbacks)) {
value.funx()
}
}
2023-04-12 09:01:03 +01:00
deadlineIsToday(isoDateString:string) {
2023-04-13 12:51:38 +01:00
if(!isoDateString) {
return false
}
2023-08-11 16:38:23 +01:00
2023-04-12 09:01:03 +01:00
return momentG(new Date(), 'dd MMMM yyyy') == momentG(new Date(isoDateString), 'dd MMMM yyyy')
}
2023-04-17 14:11:30 +01:00
overdueTask(isoDateString:string) {
2023-06-11 22:51:21 +01:00
if(!isoDateString) {
return false
}
2023-04-17 17:23:26 +01:00
return (new Date()).getTime() > (new Date(isoDateString)).getTime()
2023-04-17 14:11:30 +01:00
}
2023-04-12 09:01:03 +01:00
lessThen24Hours(isoDateString:string) {
2023-04-13 12:51:38 +01:00
if(!isoDateString) {
2023-04-19 09:18:25 +01:00
return false
2023-04-13 12:51:38 +01:00
}
2023-09-19 10:21:23 +01:00
2023-04-12 09:01:03 +01:00
const creationDate = new Date(isoDateString)
2023-04-21 16:26:13 +01:00
return momentG(new Date(), 'dd MMMM yyyy') == momentG(new Date(creationDate), 'dd MMMM yyyy')
2023-04-12 09:01:03 +01:00
}
2023-04-12 14:39:26 +01:00
filter(item, attribute) {
if(attribute == 'Para hoje') {
2023-04-18 16:50:25 +01:00
return this.deadlineIsToday(item.Deadline || item.deadline)
2023-04-12 14:39:26 +01:00
} else if (attribute == 'Novos') {
2023-04-18 09:37:41 +01:00
return this.lessThen24Hours(item.TaskReceiveDate || item.taskReceiveDate)
2023-04-12 14:39:26 +01:00
} else if (attribute == 'Lidos') {
2023-04-13 16:15:46 +01:00
return item.TaskStatus == 'Open' || item.taskStatus == 'Open'
2023-04-12 14:39:26 +01:00
} else if (attribute == 'Não lidos') {
2023-04-14 22:53:29 +01:00
return !(item.TaskStatus == 'Open' || item.taskStatus == 'Open')
2023-04-17 14:11:30 +01:00
} else if (attribute == 'OverdueTasks') {
2023-06-11 22:51:21 +01:00
2023-04-17 14:11:30 +01:00
return this.overdueTask(item.Deadline || item.deadline)
2023-09-19 10:21:23 +01:00
2023-04-12 14:39:26 +01:00
}
return true
}
2023-04-13 16:15:46 +01:00
seen(item) {
return item.TaskStatus == 'Open' || item.taskStatus == 'Open'
}
2023-04-17 14:11:30 +01:00
updateAllProcess = () => {
2023-04-28 12:56:45 +01:00
this.AllProcess = this.sortArrayISODate(this.despachoprstore.list.concat(this.deplomasStore.diplomasAssinadoList as any).concat(this.deplomasStore.diplomasParaAssinarList as any).concat(this.deplomasStore.DiplomaGerarList as any).concat(this.deplomasStore.diplomasReviewList)
2023-04-17 14:11:30 +01:00
.concat(this.eventoaprovacaostore.contactList as any).concat(this.expedientegbstore.list as any).concat(this.despachoStore.list as any).concat(this.pedidosstore.listparecer as any).concat(this.pedidosstore.listdeferimento as any)
2023-05-23 11:56:12 +01:00
.concat(this.pendentesstore.list as any))
2023-04-20 11:45:46 +01:00
2023-04-17 14:11:30 +01:00
}
sortArrayISODate(myArray: any): any[] {
2023-09-19 10:21:23 +01:00
return myArray.sort((a,b) =>
Date.parse(b.CreateDate || b.taskStartDate || b.TaskStartDate || b.TaskReceiveDate || b.taskReceiveDate )
-
2023-07-16 21:38:37 +01:00
Date.parse(a.CreateDate || b.taskStartDate || b.TaskStartDate || a.TaskReceiveDate || a.taskReceiveDate ))
2023-05-23 11:56:12 +01:00
}
reorderList(orderBy: string, list) {
if(orderBy == 'recent') {
return this.sortArrayISODate(list).reverse();
} else {
return this.sortArrayISODate(list)
}
2023-04-17 14:11:30 +01:00
}
2023-04-17 16:00:30 +01:00
updateCount = () => {
2023-04-17 14:11:30 +01:00
this.read = this.AllProcess.filter((item) => this.filter(item,'Lidos')).length
this.unread = this.AllProcess.filter((item) => this.filter(item,'Não lidos')).length
this.deadline = this.AllProcess.filter((task) => this.deadlineIsToday(task.Deadline || task.deadline)).length
2023-04-18 16:50:25 +01:00
this.new = this.AllProcess.filter((task) => this.lessThen24Hours(task.TaskReceiveDate || task.taskReceiveDate)).length
2023-04-17 14:11:30 +01:00
this.overdueTasks = this.AllProcess.filter((task) => this.overdueTask(task.Deadline || task.deadline)).length
}
2023-04-17 16:00:30 +01:00
async LoadTask() {
this.showLoader = true
try {
2023-04-20 13:36:59 +01:00
await this.loadExpedientes()
2023-04-17 16:00:30 +01:00
this.loadCount = true;
2023-05-29 11:51:08 +01:00
2023-04-17 16:00:30 +01:00
} catch(error) {
this.loadCount = true;
}
this.loadNum++;
2023-04-20 13:36:59 +01:00
await this.loadDespachos();
await this.loadPedidos()
await this.loadPendestes()
await this.loadDiplomas()
2023-09-19 10:21:23 +01:00
2023-04-20 13:36:59 +01:00
await this.loadEventosParaAprovacao()
this.loadCount = true
2023-05-29 11:51:08 +01:00
this.showLoader = false;
2023-04-20 13:36:59 +01:00
}
async loadDespachos() {
2023-08-10 16:46:55 +01:00
this.showLoaderNum++
2023-04-20 13:36:59 +01:00
let despachos = await this.despachoRule.getList({ updateStore: true })
if (despachos) {
this.despachoStore.reset(despachos)
}
2023-08-10 16:46:55 +01:00
this.showLoaderNum--
2023-04-20 13:36:59 +01:00
}
async loadExpedientes() {
2023-08-10 16:46:55 +01:00
this.showLoaderNum++
2023-04-25 10:04:32 +01:00
try {
let expedientes;
expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise()
2023-09-19 10:21:23 +01:00
2023-04-25 10:04:32 +01:00
expedientes = (expedientes || [] ).filter(data => data.workflowInstanceDataFields.Status == "" || data.workflowInstanceDataFields.Status == "Active")
2023-09-19 10:21:23 +01:00
2023-04-25 10:04:32 +01:00
expedientes = expedientes.filter((item) => {
return item.activityInstanceName != 'Retificar Expediente'
});
2023-09-19 10:21:23 +01:00
2023-04-25 10:04:32 +01:00
expedientes = expedientes.map((element) => this.expedienteTaskPipe.transform(element));
2023-05-23 11:56:12 +01:00
expedientes = this.sortArrayISODate(expedientes).reverse()
2023-09-19 10:21:23 +01:00
2023-04-25 10:04:32 +01:00
this.expedientegbstore.reset(expedientes);
} catch (error) {
}
2023-04-17 16:00:30 +01:00
2023-08-10 16:46:55 +01:00
this.showLoaderNum--
2023-04-17 16:00:30 +01:00
2023-04-20 13:36:59 +01:00
}
2023-04-17 16:00:30 +01:00
2023-04-20 13:36:59 +01:00
async loadPedidos() {
2023-08-10 16:46:55 +01:00
this.showLoader = true
this.showLoaderNum++
2023-04-17 16:00:30 +01:00
2023-04-25 10:04:32 +01:00
try {
let pareceres = await this.processesbackend.GetTasksList("Pedido de Parecer", false).toPromise();
let pareceresPr = await this.processesbackend.GetTasksList("Pedido de Parecer do Presidente", false).toPromise();
2023-09-19 10:21:23 +01:00
2023-04-25 10:04:32 +01:00
let allParecer = pareceres.concat(pareceresPr);
2023-09-19 10:21:23 +01:00
2023-04-25 10:04:32 +01:00
this.pedidosstore.countparecer = Object.keys(allParecer.filter(data => data.workflowInstanceDataFields.Status == "Active")).length;
2023-09-19 10:21:23 +01:00
2023-04-25 10:04:32 +01:00
this.pedidosstore.resetparecer(allParecer.filter(data => data.workflowInstanceDataFields.Status == "Active").map((element) => {
return this.customTaskPipe.transform(element)
2023-09-19 10:21:23 +01:00
}));
2023-04-25 10:04:32 +01:00
let deferimentos = await this.processesbackend.GetTasksList("Pedido de Deferimento", false).toPromise();
this.pedidosstore.countdeferimento = Object.keys(deferimentos.filter(data => data.workflowInstanceDataFields.Status == "Active")).length
this.pedidosstore.resetdeferimento(deferimentos.filter(data => data.workflowInstanceDataFields.Status == "Active").map((element) => {
return this.customTaskPipe.transform(element)
}));
2023-06-09 12:02:11 +01:00
} catch (error) {}
2023-04-17 16:00:30 +01:00
2023-08-10 16:46:55 +01:00
this.showLoaderNum--
2023-04-20 13:36:59 +01:00
}
2023-04-17 16:00:30 +01:00
2023-04-20 13:36:59 +01:00
async loadPendestes() {
2023-08-10 16:46:55 +01:00
this.showLoaderNum++
2023-04-25 10:04:32 +01:00
try {
2023-09-19 10:21:23 +01:00
2023-04-25 10:04:32 +01:00
let pendentes = await this.processesbackend.GetPendingTasks(false).toPromise();
this.pendentesstore.count = Object.keys(pendentes).length;
2023-04-17 16:00:30 +01:00
2023-04-25 10:04:32 +01:00
pendentes = pendentes.map((element)=> this.customTaskPipe.transform(element))
2023-04-17 16:00:30 +01:00
2023-04-25 10:04:32 +01:00
this.pendentesstore.reset(pendentes);
} catch (error) {
}
2023-08-10 16:46:55 +01:00
this.showLoaderNum--
2023-09-19 10:21:23 +01:00
2023-04-20 13:36:59 +01:00
}
@XTracerAsync({name:'taskService/loadEventParaAprovacao', bugPrint: true})
2024-06-17 10:33:35 +01:00
async loadEventosParaAprovacao(tracing?: TracingType) {
2023-08-10 16:46:55 +01:00
this.showLoaderNum++
console.log('PR')
2023-05-23 11:56:12 +01:00
// PR dont have event to approve
/* if(this.SessionStore.user.Profile != 'PR') { */
2023-09-19 10:21:23 +01:00
try {
2024-06-21 23:33:29 +01:00
const list = await this.AgendaDataRepositoryService.geCalendars()
2024-05-31 12:49:49 +01:00
2024-06-21 23:33:29 +01:00
for(let calendar of list) {
2023-09-19 10:21:23 +01:00
2024-06-17 10:33:35 +01:00
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
2024-06-21 23:33:29 +01:00
userId: calendar.wxUserId,
2024-06-17 10:33:35 +01:00
status: EEventFilterStatus.Pending
2024-06-18 09:14:22 +01:00
}, tracing)
2024-06-17 10:33:35 +01:00
2024-05-31 12:49:49 +01:00
if(allEvents.isOk()) {
2024-06-17 10:33:35 +01:00
tracing.setAttribute('outcome', 'success')
2024-05-31 12:49:49 +01:00
let eventsList = []
if(allEvents.value.length >= 1) {
eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
2024-06-21 23:33:29 +01:00
this.eventoaprovacaostore.save(calendar.wxUserId as any, eventsList)
2024-05-31 12:49:49 +01:00
} else {
2024-06-21 23:33:29 +01:00
this.eventoaprovacaostore.save(calendar.wxUserId as any, [])
2024-05-31 12:49:49 +01:00
}
2024-06-17 10:33:35 +01:00
} else {
tracing.setAttribute('outcome', 'failed')
2023-04-25 10:04:32 +01:00
}
2023-04-20 13:36:59 +01:00
}
2023-05-23 11:56:12 +01:00
} catch (error) {
2023-09-19 10:21:23 +01:00
2023-04-20 13:36:59 +01:00
}
/* } */
2023-04-25 10:04:32 +01:00
2023-08-10 16:46:55 +01:00
this.showLoaderNum--
2023-04-20 13:36:59 +01:00
}
2023-04-17 16:00:30 +01:00
2023-04-20 13:36:59 +01:00
async loadDiplomas() {
2023-08-21 17:36:32 +01:00
if(this.p.userPermission([this.p.permissionList.Gabinete.md_tasks]) || this.p.userPermission([this.p.permissionList.Gabinete.pr_tasks])) {
this.showLoaderNum++
2023-04-17 16:00:30 +01:00
2023-08-21 17:36:32 +01:00
try {
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
let depachoAPI = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise();
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
if(SessionStore.user.Profile != 'PR') {
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
let depacho: any = depachoAPI.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
depacho = depacho.filter(data => data.workflowInstanceDataFields.Status == "Active");
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
depacho = depacho.map((e)=> this.customTaskPipe.transform(e))
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
this.despachoprstore.reset(depacho)
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
} else if(SessionStore.user.Profile == 'PR') {
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
let depacho: any = depachoAPI.filter(data => data.activityInstanceName == "Concluir Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active")
depacho = depacho.map((e)=> this.customTaskPipe.transform(e))
this.despachoprstore.reset(depacho)
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
}
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
let gerarDiploma = depachoAPI.reverse().filter(data => data.activityInstanceName == "Gerar Diploma" || data.activityInstanceName == "Retificar Diploma");
let diplomasList = []
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
gerarDiploma.forEach(element => {
let task: customTask = this.customTaskPipe.transform(element);
diplomasList.push(task);
});
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
diplomasList = diplomasList
this.deplomasStore.resetDiplomaGerar(diplomasList);
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
let diplomasValidar = depachoAPI.filter(data => data.activityInstanceName == "Revisar Diploma");
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
diplomasValidar = diplomasValidar.filter(data => data.activityInstanceName != "Tarefa de Despacho");
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
this.deplomasStore.resetDiplomasReview(diplomasValidar.map((element)=> {
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
return this.customTaskPipe.transform(element)
}))
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
let diplomasAssinar: any = depachoAPI.filter(data => data.activityInstanceName == "Assinar Diploma");
diplomasAssinar = diplomasAssinar.map((element) => this.expedienteTaskPipe.transform(element))
this.deplomasStore.resetDiplomasParaAssinar(diplomasAssinar)
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
let diplomasAssinados: any = depachoAPI.filter(data => data.activityInstanceName == "Diploma Assinado");
diplomasAssinados = diplomasAssinados.map((element) => this.expedienteTaskPipe.transform(element))
this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados)
} catch (error) {}
2023-09-19 10:21:23 +01:00
2023-08-21 17:36:32 +01:00
this.showLoaderNum--
}
2023-04-20 11:45:46 +01:00
2023-04-17 16:00:30 +01:00
}
2023-06-10 14:17:41 +01:00
goToProcess(serialNumber: string, workflowName: string, activityName: string) {
2023-08-10 16:46:55 +01:00
console.log({workflowName, serialNumber, activityName})
2023-06-10 14:17:41 +01:00
if (workflowName == 'Despacho') {
2023-08-10 16:46:55 +01:00
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho' || activityName == 'Reexecutar Despacho') {
2023-06-10 14:17:41 +01:00
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']);
}
2023-07-26 13:06:42 +01:00
else if (activityName == 'Revisar Diploma' || activityName == 'Diploma Assinado') {
2023-06-10 14:17:41 +01:00
this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
2023-07-26 13:06:42 +01:00
} else if ( activityName == 'Assinar Diploma') {
2023-06-10 14:17:41 +01:00
this.router.navigate(['/home/gabinete-digital/diplomas-assinar', serialNumber, 'gabinete-digital']);
} else {
2023-07-26 13:06:42 +01:00
throw('Bug!');
2023-06-10 14:17:41 +01:00
}
}
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' && SessionStore.user.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 == "Expediente") {
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`)
}
}
2023-06-12 11:56:23 +01:00
dynamicSearch({searchSubject, ordinance, list}) {
if(searchSubject) {
2023-09-19 10:21:23 +01:00
2023-06-12 11:56:23 +01:00
const AllProcess = list.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(searchSubject.toLowerCase())
})
this.AllProcess = list.reorderList(ordinance, AllProcess)
} else {
const AllProcess = list
this.AllProcess = list.reorderList(ordinance, AllProcess)
}
}
2023-08-31 12:00:52 +01:00
attachmentAppName(e) {
const ApplicationId = e.ApplicationId || e.ApplicationType
if( ApplicationId =='8' || ApplicationId ==8) {
return 'Correspondencia'
} else if (ApplicationId =='361' || ApplicationId ==361) {
return 'ArquivoDespachoElect'
}
}
2023-04-12 09:01:03 +01:00
}