mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
centralize service
This commit is contained in:
@@ -47,7 +47,6 @@ export class GabineteDigitalPage implements OnInit {
|
||||
|
||||
segment: string;
|
||||
segmentVista: string;
|
||||
showLoader: boolean = false
|
||||
public profile: string;
|
||||
|
||||
allProcessesList: any = new Array();
|
||||
@@ -84,16 +83,6 @@ export class GabineteDigitalPage implements OnInit {
|
||||
|
||||
hideRefreshBtn = true;
|
||||
hideInMobile = true;
|
||||
|
||||
expedientegbstore = ExpedienteGdStore;
|
||||
pendentesstore = PendentesStore;
|
||||
despachoStore = DespachoStore;
|
||||
eventoaprovacaostore = EventoAprovacaoStore;
|
||||
pedidosstore = PedidosStore;
|
||||
despachoprstore = DespachosprStore;
|
||||
totalDocumentStore = TotalDocumentStore
|
||||
deplomasStore = DeplomasStore
|
||||
|
||||
showDiplomasGerar = false
|
||||
//
|
||||
// pipe
|
||||
@@ -101,7 +90,6 @@ export class GabineteDigitalPage implements OnInit {
|
||||
SessionStore = SessionStore
|
||||
expedienteTaskPipe = new ExpedienteTaskPipe();
|
||||
|
||||
loadCount = false
|
||||
|
||||
customTaskPipe = new CustomTaskPipe()
|
||||
|
||||
@@ -109,8 +97,6 @@ export class GabineteDigitalPage implements OnInit {
|
||||
Agenda: 530
|
||||
}
|
||||
|
||||
AllProcess = []
|
||||
|
||||
// workerList : Worker
|
||||
environment = environment
|
||||
@ViewChild(ExpedientsPage) expedientesPage: ExpedientsPage;
|
||||
@@ -158,8 +144,6 @@ export class GabineteDigitalPage implements OnInit {
|
||||
|
||||
this.checkRoutes();
|
||||
|
||||
window['all-process-gabinete'] = this.updateAllProcess
|
||||
|
||||
}
|
||||
closeAllDesktopComponent() {
|
||||
this.desktopComponent = {
|
||||
@@ -179,7 +163,6 @@ export class GabineteDigitalPage implements OnInit {
|
||||
}
|
||||
|
||||
this.LoadCounts();
|
||||
this.updateAllProcess()
|
||||
this.checkFilter();
|
||||
|
||||
const pathname = window.location.pathname
|
||||
@@ -536,195 +519,15 @@ export class GabineteDigitalPage implements OnInit {
|
||||
|
||||
functionTimer = null
|
||||
|
||||
updateAllProcess = () => {
|
||||
|
||||
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.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)
|
||||
.concat(this.pendentesstore.list as any)).reverse()
|
||||
|
||||
|
||||
// try{
|
||||
// this.workerList.postMessage([
|
||||
// this.expedientegbstore.list,this.pedidosstore.listparecer,this.pedidosstore.listdeferimento,
|
||||
// this.despachoprstore.list, this.eventoaprovacaostore.listmd, this.eventoaprovacaostore.listpr, this.despachoStore.list,
|
||||
// this.deplomasStore.diplomasParaAssinarList, this.deplomasStore.diplomasAssinadoList, this.deplomasStore.DiplomaGerarList
|
||||
// ])
|
||||
// } catch (e) {
|
||||
// this.AllProcess = this.expedientegbstore.list.concat(this.pedidosstore.listparecer).concat(this.pedidosstore.listdeferimento)
|
||||
// .concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.listmd).concat(this.eventoaprovacaostore.listpr).concat(this.despachoStore.list)
|
||||
// .concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList)
|
||||
// }
|
||||
|
||||
|
||||
clearTimeout(this.functionTimer);
|
||||
this.functionTimer = setTimeout(() => {
|
||||
|
||||
if(window['all-process']) {
|
||||
window['all-process']()
|
||||
} else {
|
||||
this.TaskService.updateCount()
|
||||
}
|
||||
}, 1000); // time is in milliseconds
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
get getAllProcessCount() {
|
||||
return this.AllProcess.length
|
||||
}
|
||||
|
||||
loadProcess = {}
|
||||
|
||||
get getloadKeys() {
|
||||
return Object.keys(this.loadProcess)
|
||||
}
|
||||
|
||||
loadNum = 0
|
||||
async LoadCounts() {
|
||||
this.updateAllProcess()
|
||||
|
||||
let expedientes;
|
||||
this.showLoader = true
|
||||
|
||||
try {
|
||||
expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise()
|
||||
this.loadCount = true;
|
||||
this.showLoader = false;
|
||||
} catch(error) {
|
||||
this.showLoader = false
|
||||
this.loadCount = true;
|
||||
}
|
||||
|
||||
this.loadNum++;
|
||||
|
||||
expedientes = (expedientes || [] ).filter(data => data.workflowInstanceDataFields.Status == "" || data.workflowInstanceDataFields.Status == "Active")
|
||||
|
||||
expedientes = expedientes.filter((item) => {
|
||||
return item.activityInstanceName != 'Retificar Expediente'
|
||||
});
|
||||
|
||||
expedientes = expedientes.map((element) => this.expedienteTaskPipe.transform(element));
|
||||
|
||||
this.expedientegbstore.reset(expedientes);
|
||||
|
||||
|
||||
let despachos = await this.despachoRule.getList({ updateStore: true })
|
||||
if (despachos) {
|
||||
this.despachoStore.reset(despachos)
|
||||
}
|
||||
|
||||
let pareceres = await this.processesbackend.GetTasksList("Pedido de Parecer", false).toPromise();
|
||||
let pareceresPr = await this.processesbackend.GetTasksList("Pedido de Parecer do Presidente", false).toPromise();
|
||||
|
||||
let allParecer = pareceres.concat(pareceresPr);
|
||||
|
||||
this.pedidosstore.countparecer = Object.keys(allParecer.filter(data => data.workflowInstanceDataFields.Status == "Active")).length;
|
||||
|
||||
this.pedidosstore.resetparecer(allParecer.filter(data => data.workflowInstanceDataFields.Status == "Active").map((element) => {
|
||||
return this.customTaskPipe.transform(element)
|
||||
}));
|
||||
|
||||
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)
|
||||
}));
|
||||
|
||||
|
||||
let pendentes = await this.processesbackend.GetPendingTasks(false).toPromise();
|
||||
this.pendentesstore.count = Object.keys(pendentes).length;
|
||||
|
||||
pendentes = pendentes.map((element)=> this.customTaskPipe.transform(element))
|
||||
|
||||
this.pendentesstore.reset(pendentes);
|
||||
|
||||
let depachoAPI = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
||||
|
||||
|
||||
if(SessionStore.user.Profile != 'PR') {
|
||||
|
||||
let depacho: any = depachoAPI.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
|
||||
depacho = depacho.filter(data => data.workflowInstanceDataFields.Status == "Active");
|
||||
|
||||
depacho = depacho.map((e)=> this.customTaskPipe.transform(e))
|
||||
|
||||
this.despachoprstore.reset(depacho)
|
||||
|
||||
} else if(SessionStore.user.Profile == 'PR') {
|
||||
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
let diplomasValidar = depachoAPI.filter(data => data.activityInstanceName == "Revisar Diploma");
|
||||
|
||||
diplomasValidar = diplomasValidar.filter(data => data.activityInstanceName != "Tarefa de Despacho");
|
||||
|
||||
|
||||
this.deplomasStore.resetDiplomasReview(diplomasValidar.map((element)=> {
|
||||
|
||||
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();
|
||||
|
||||
return this.customTaskPipe.transform(element)
|
||||
}))
|
||||
|
||||
|
||||
let diplomasAssinar: any = depachoAPI.filter(data => data.activityInstanceName == "Assinar Diploma");
|
||||
diplomasAssinar = diplomasAssinar.map((element) => this.expedienteTaskPipe.transform(element))
|
||||
this.deplomasStore.resetDiplomasParaAssinar(diplomasAssinar)
|
||||
|
||||
let diplomasAssinados: any = depachoAPI.filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
diplomasAssinados = diplomasAssinados.map((element) => this.expedienteTaskPipe.transform(element))
|
||||
this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados)
|
||||
|
||||
for(let calendar of this.eventService.calendarNamesAry) {
|
||||
if(calendar == 'Meu calendario') {
|
||||
// color
|
||||
let genericEvents = await this.processesbackend.GetTasksList('Agendar Evento', false).toPromise();
|
||||
let eventsList
|
||||
try {
|
||||
eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
|
||||
} catch (error) {
|
||||
eventsList = [];
|
||||
}
|
||||
|
||||
this.eventoaprovacaostore.save(calendar, eventsList)
|
||||
|
||||
} else {
|
||||
let allEvents = await this.processesbackend.eventsToApprove(calendar.OwnerUserId, 'againete page').toPromise()
|
||||
let eventsList
|
||||
try {
|
||||
eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
|
||||
} catch(error) {
|
||||
eventsList = []
|
||||
}
|
||||
|
||||
this.eventoaprovacaostore.save(calendar.OwnerUserId, eventsList)
|
||||
}
|
||||
}
|
||||
// let mdEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise();
|
||||
// let eventsMDGPRList = mdEventsOficial
|
||||
|
||||
// eventsMDGPRList = eventsMDGPRList.filter((item) => item.activityInstanceName != 'Editar Evento')
|
||||
|
||||
// this.eventoaprovacaostore.countMd = eventsMDGPRList.length
|
||||
// this.eventoaprovacaostore.resetmd(eventsMDGPRList);
|
||||
// this.updateAllProcess()
|
||||
|
||||
// let prEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
|
||||
// let eventsPRList = prEventsOficial
|
||||
// eventsPRList = eventsPRList.filter((item) => item.activityInstanceName != 'Editar Evento')
|
||||
|
||||
// this.eventoaprovacaostore.countPr = eventsPRList.length
|
||||
// this.eventoaprovacaostore.resetpr(eventsPRList);
|
||||
|
||||
|
||||
this.loadCount = true
|
||||
await this.TaskService.LoadTask()
|
||||
}
|
||||
|
||||
doRefresh(event) {
|
||||
|
||||
Reference in New Issue
Block a user