mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
994 lines
35 KiB
TypeScript
994 lines
35 KiB
TypeScript
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
import { ProcessesService } from 'src/app/services/processes.service';
|
|
import { ModalController } from '@ionic/angular';
|
|
import {NavigationEnd, NavigationExtras, Router } from '@angular/router';
|
|
|
|
import { LoginUserRespose } from 'src/app/models/user.model';
|
|
import { ExpedientsPage } from 'src/app/shared/gabinete-digital/expedients/expedients.page';
|
|
import { PendentesPage } from 'src/app/shared/gabinete-digital/pendentes/pendentes.page';
|
|
import { EventsToApprovePage } from 'src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page';
|
|
import { DespachoStore } from 'src/app/store/despacho-store.service';
|
|
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
|
|
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
|
import { PendentesStore } from 'src/app/store/pendestes-store.service';
|
|
import { PedidosStore } from 'src/app/store/pedidos-store.service';
|
|
import { DespachosprStore } from 'src/app/store/despachospr-store.service';
|
|
|
|
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
|
|
import { WaitForDomService } from 'src/app/services/dom/wait-for-dom.service';
|
|
import { TotalDocumentStore } from 'src/app/store/total-document.service';
|
|
import { DeplomasStore } from 'src/app/store/deplomas.service';
|
|
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
|
|
|
import { DespachoService } from 'src/app/Rules/despacho.service';
|
|
import { PermissionService } from 'src/app/services/permission.service';
|
|
import { ThemeService } from 'src/app/services/theme.service';
|
|
|
|
import { SqliteService } from '../../services/sqlite.service';
|
|
import { Platform } from '@ionic/angular';
|
|
import { BackgroundService } from 'src/app/services/background.service';
|
|
import { SortService } from 'src/app/services/functions/sort.service';
|
|
import { Storage } from '@ionic/storage';
|
|
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
|
import { SessionStore } from 'src/app/store/session.service';
|
|
import { NotificationsService } from 'src/app/services/notifications.service'
|
|
import { environment } from 'src/environments/environment';
|
|
@Component({
|
|
selector: 'app-gabinete-digital',
|
|
templateUrl: './gabinete-digital.page.html',
|
|
styleUrls: ['./gabinete-digital.page.scss'],
|
|
})
|
|
|
|
export class GabineteDigitalPage implements OnInit {
|
|
|
|
segment: string;
|
|
segmentVista: string;
|
|
showLoader: boolean = false
|
|
public profile: string;
|
|
|
|
allProcessesList: any = new Array();
|
|
skeletonLoader: boolean;
|
|
|
|
|
|
selectedElement = "";
|
|
|
|
desktopComponent: any = {
|
|
showEventList: false,
|
|
showExpediente: false,
|
|
}
|
|
|
|
showAllProcesses = false;
|
|
showEventsToApprove = false;
|
|
showEmptyContainer = false;
|
|
showExpedients = false;
|
|
showExpedientesPr = false;
|
|
showPedidos = false;
|
|
showDespachos = false;
|
|
showDespachosPr = false;
|
|
showPendentes = false;
|
|
showDiplomas = false;
|
|
showDiplomasAssinar = false;
|
|
showExpedientDetail = false;
|
|
showSignedDiploma = false;
|
|
emptyTextDescription = 'Sem opção selecionada';
|
|
|
|
serialNumber: string;
|
|
|
|
loggeduser: LoginUserRespose;
|
|
mdgpr = "MDGPR";
|
|
pr = "PR";
|
|
|
|
hideRefreshBtn = true;
|
|
hideInMobile = true;
|
|
|
|
expedientegbstore = ExpedienteGdStore;
|
|
pendentesstore = PendentesStore;
|
|
despachoStore = DespachoStore;
|
|
eventoaprovacaostore = EventoAprovacaoStore;
|
|
pedidosstore = PedidosStore;
|
|
despachoprstore = DespachosprStore;
|
|
totalDocumentStore = TotalDocumentStore
|
|
deplomasStore = DeplomasStore
|
|
|
|
showDiplomasGerar = false
|
|
//
|
|
// pipe
|
|
|
|
SessionStore = SessionStore
|
|
expedienteTaskPipe = new ExpedienteTaskPipe();
|
|
|
|
loadCount = false
|
|
|
|
customTaskPipe = new CustomTaskPipe()
|
|
|
|
permissions = {
|
|
Agenda: 530
|
|
}
|
|
|
|
AllProcess = []
|
|
|
|
// workerList : Worker
|
|
environment = environment
|
|
@ViewChild(ExpedientsPage) expedientesPage: ExpedientsPage;
|
|
@ViewChild(PendentesPage) pendentesListPage: PendentesPage;
|
|
@ViewChild(EventsToApprovePage) eventsToApprove: EventsToApprovePage;
|
|
|
|
constructor(
|
|
private processesbackend: ProcessesService,
|
|
private modalController: ModalController,
|
|
private router: Router,
|
|
public waitForDomService: WaitForDomService,
|
|
private despachoRule: DespachoService,
|
|
private sqliteservice: SqliteService,
|
|
private platform: Platform,
|
|
private backgroundservice: BackgroundService,
|
|
public ThemeService: ThemeService,
|
|
private sortService: SortService,
|
|
private storage: Storage,
|
|
public p: PermissionService,
|
|
public NotificationsService: NotificationsService
|
|
) {
|
|
|
|
// this.workerList = new Worker(new URL('./list.worker.js', import.meta.url));
|
|
|
|
// this.workerList.onmessage = (oEvent) => {
|
|
// this.AllProcess = oEvent.data
|
|
// }
|
|
|
|
window.onresize = (event) => {
|
|
// if not mobile remove all component
|
|
if (window.innerWidth < 701) {
|
|
this.modalController.dismiss();
|
|
this.segmentVista = "listview";
|
|
}
|
|
else {
|
|
this.segmentVista = "boxview";
|
|
}
|
|
}
|
|
|
|
this.checkRoutes();
|
|
}
|
|
closeAllDesktopComponent() {
|
|
this.desktopComponent = {
|
|
showEventList: false,
|
|
showExpediente: false
|
|
}
|
|
}
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
if (window.innerWidth < 701) {
|
|
this.segmentVista = "listview";
|
|
}
|
|
else {
|
|
this.segmentVista = "boxview"
|
|
}
|
|
|
|
this.LoadCounts();
|
|
this.updateAllProcess()
|
|
|
|
const pathname = window.location.pathname
|
|
this.router.events.forEach((event) => {
|
|
if (event instanceof NavigationEnd && event.url == pathname) {
|
|
this.waitForDomService.selector({
|
|
selector: 'app-gabinete-digital ion-content .aside-wrapper',
|
|
callback: () => {
|
|
if(this.NotificationsService.active === false) {
|
|
this.checkRoutes();
|
|
this.LoadCounts();
|
|
this.updateAllProcess()
|
|
} else {
|
|
this.checkRoutes();
|
|
this.LoadCounts();
|
|
this.updateAllProcess()
|
|
}
|
|
}
|
|
})
|
|
}
|
|
});
|
|
|
|
|
|
this.hideRefreshButton();
|
|
|
|
// this.waitForDomService.selector({
|
|
// selector: 'app-gabinete-digital ion-content .aside-wrapper',
|
|
// callback: () => {
|
|
// // console.log('SECOND CALL')
|
|
// this.loadAllProcesses();
|
|
// }
|
|
// })
|
|
|
|
setTimeout(() => {
|
|
|
|
this.backgroundservice.registerBackService('Online', () => {
|
|
// this.loadAllProcesses();
|
|
});
|
|
|
|
// this.NotificationsService.registerCallback({
|
|
// type:'despachos',
|
|
// funx:() => {
|
|
// // this.loadCount();
|
|
// console.log('refresh with notification')
|
|
// }
|
|
// })
|
|
|
|
// this.NotificationsService.registerCallback({
|
|
// type:'*',
|
|
// funx:() => {
|
|
// // this.LoadCounts();
|
|
// console.log('refresh with notification *')
|
|
// }
|
|
// })
|
|
|
|
// this.NotificationsService.registerCallback({
|
|
// type:'despachos-pr',
|
|
// funx:() => {
|
|
// // this.LoadCounts();
|
|
// console.log('refresh with notification')
|
|
// }
|
|
// })
|
|
// this.NotificationsService.registerCallback({
|
|
// type:'expediente',
|
|
// funx: () => {
|
|
// this.LoadCounts();
|
|
// console.log('refresh with notification')
|
|
// }
|
|
// })
|
|
// this.NotificationsService.registerCallback({
|
|
// type:'gabinete-digital',
|
|
// funx:() => {
|
|
// this.LoadCounts();
|
|
// console.log('refresh with notification')
|
|
// }
|
|
// })
|
|
// this.NotificationsService.registerCallback({
|
|
// type:'parecer',
|
|
// funx: () => {
|
|
// this.LoadCounts();
|
|
// console.log('refresh with notification')
|
|
// }
|
|
// })
|
|
// this.NotificationsService.registerCallback({
|
|
// type: 'deferimento',
|
|
// funx: () => {
|
|
// this.LoadCounts();
|
|
// console.log('refresh with notification')
|
|
// }
|
|
// })
|
|
// this.NotificationsService.registerCallback({
|
|
// type: 'diplomas-assinar',
|
|
// funx: () => {
|
|
// this.LoadCounts();
|
|
// console.log('refresh with notification')
|
|
// }
|
|
// })
|
|
// this.NotificationsService.registerCallback({
|
|
// type: 'diplomas',
|
|
// funx: () => {
|
|
// this.LoadCounts();
|
|
// console.log('refresh with notification')
|
|
// }
|
|
// })
|
|
// this.NotificationsService.registerCallback({
|
|
// type: 'expedientes-pr',
|
|
// funx: () => {
|
|
// this.LoadCounts();
|
|
// console.log('refresh with notification')
|
|
// }
|
|
// })
|
|
|
|
}, 100);
|
|
|
|
}
|
|
|
|
async loadAllProcesses() {
|
|
this.LoadCounts();
|
|
}
|
|
|
|
addProcessToDB(data) {
|
|
this.platform.ready().then(() => {
|
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
|
this.storage.set('GabineteProcess', data).then(() => {
|
|
|
|
})
|
|
} else {
|
|
data.forEach(element => {
|
|
|
|
let process = {
|
|
"serialNumber": element.serialNumber,
|
|
"workflowInstanceFolio": element.workflowInstanceFolio,
|
|
"Documents": element.Documents,
|
|
"actions": element.actions,
|
|
"activityInstanceName": element.activityInstanceName,
|
|
"formURL": element.formURL,
|
|
"originator": element.originator,
|
|
"taskStartDate": element.taskStartDate,
|
|
"totalDocuments": element.totalDocuments,
|
|
"workflowDisplayName": element.workflowDisplayName,
|
|
"workflowID": element.workflowID,
|
|
"workflowInstanceDataFields": element.workflowInstanceDataFields,
|
|
"workflowInstanceID": element.workflowInstanceID,
|
|
"workflowName": element.workflowName
|
|
}
|
|
|
|
this.sqliteservice.addProcess(process);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
getAllProcessFromDB() {
|
|
|
|
this.hideRefreshButton();
|
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
|
this.storage.get('GabineteProcess').then((allprocess: any[]) => {
|
|
|
|
allprocess.forEach(element => {
|
|
let date = new Date(element.taskStartDate);
|
|
date.setMonth(date.getMonth() + 1);
|
|
|
|
let task = {
|
|
"SerialNumber": element.serialNumber,
|
|
"Folio": element.workflowInstanceDataFields.Subject,
|
|
"Senders": element.workflowInstanceDataFields.Sender,
|
|
//"CreateDate": taskDate,
|
|
"CreateDate": new Date(element.taskStartDate),
|
|
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
|
"Remetente": element.workflowInstanceDataFields.Remetente,
|
|
"DocumentsQty": element.totalDocuments,
|
|
"DocId": element.workflowInstanceDataFields.DispatchDocId,
|
|
"FolderID": element.workflowInstanceDataFields.FolderID,
|
|
"WorkflowName": element.workflowDisplayName,
|
|
"activityInstanceName": element.activityInstanceName,
|
|
"Status": element.workflowInstanceDataFields.Status,
|
|
"Agenda": element.workflowInstanceDataFields.Agenda,
|
|
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
|
|
}
|
|
|
|
this.allProcessesList.push(task);
|
|
this.allProcessesList = removeDuplicate(this.allProcessesList);
|
|
this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate')
|
|
|
|
});
|
|
})
|
|
} else {
|
|
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
|
|
allprocess.forEach(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();
|
|
|
|
var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
|
|
|
|
let task = {
|
|
"SerialNumber": element.serialNumber,
|
|
"Folio": workflowInstanceDataFields.Subject,
|
|
"Senders": workflowInstanceDataFields.Sender,
|
|
"CreateDate": taskDate,
|
|
"DocumentURL": workflowInstanceDataFields.ViewerRequest,
|
|
"Remetente": workflowInstanceDataFields.Remetente,
|
|
"DocumentsQty": element.totalDocuments,
|
|
"DocId": workflowInstanceDataFields.DispatchDocId,
|
|
"FolderID": workflowInstanceDataFields.FolderID,
|
|
"WorkflowName": element.workflowDisplayName,
|
|
"activityInstanceName": element.activityInstanceName,
|
|
"Status": workflowInstanceDataFields.Status,
|
|
"Agenda": workflowInstanceDataFields.Agenda,
|
|
"customDate": this.setFormatDate(new Date(workflowInstanceDataFields.StartDate), new Date(workflowInstanceDataFields.EndDate), workflowInstanceDataFields.IsAllDayEvent),
|
|
}
|
|
|
|
this.allProcessesList.push(task);
|
|
this.allProcessesList = removeDuplicate(this.allProcessesList)
|
|
this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate')
|
|
|
|
});
|
|
|
|
})
|
|
}
|
|
|
|
}
|
|
|
|
dataTranform(data) {
|
|
|
|
}
|
|
|
|
sortArrayISODate(myArray: any) {
|
|
return myArray.sort(function (a, b) {
|
|
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
|
});
|
|
}
|
|
|
|
setFormatDate(start: any, end: any, allday: boolean) {
|
|
let customDate;
|
|
|
|
const totalSeconds = Math.floor((end - (start)) / 1000);;
|
|
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
const totalHours = Math.floor(totalMinutes / 60);
|
|
const totalDays = Math.floor(totalHours / 24);
|
|
|
|
if (totalDays == 0) {
|
|
if (allday) {
|
|
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " (todo dia)";
|
|
|
|
return customDate;
|
|
}
|
|
else {
|
|
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " | " + this.getCustomHours(end);
|
|
return customDate;
|
|
}
|
|
}
|
|
else {
|
|
customDate = this.getCustomDate(start) + "," + this.getCustomHours(start) +
|
|
" (termina:" + this.getCustomDate(end) + "," + this.getCustomHours(end) + ")";
|
|
return customDate;
|
|
}
|
|
}
|
|
|
|
getCustomDate(thedate: Date) {
|
|
return thedate.getDate() + "/" +
|
|
(thedate.getMonth() + 1) + "/" +
|
|
thedate.getFullYear();
|
|
}
|
|
|
|
getCustomHours(thedate: Date) {
|
|
return thedate.getHours() + ":" +
|
|
thedate.getMinutes();
|
|
}
|
|
goto(url) {
|
|
this.router.navigate([url])
|
|
}
|
|
|
|
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 {
|
|
console.log('no route!')
|
|
}
|
|
}
|
|
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') {
|
|
this.router.navigate(['/home/gabinete-digital/event-list/approve-event', serialNumber, 'gabinete-digital']);
|
|
}
|
|
else {
|
|
|
|
}
|
|
}
|
|
|
|
onSegmentVistaChange() {
|
|
|
|
}
|
|
|
|
checkUser() {
|
|
this.selectedElement = 'allProcessesTag';
|
|
this.showAllProcesses = true;
|
|
}
|
|
|
|
hideRefreshButton() {
|
|
window.onresize = (event) => {
|
|
if (window.innerWidth < 701) {
|
|
this.hideRefreshBtn = false;
|
|
this.hideInMobile = false;
|
|
this.segmentVista = "listview";
|
|
}
|
|
else {
|
|
this.hideRefreshBtn = true;
|
|
this.hideInMobile = true;
|
|
this.segmentVista = "boxview";
|
|
}
|
|
}
|
|
if (window.innerWidth < 701) {
|
|
this.hideRefreshBtn = false;
|
|
this.hideInMobile = false;
|
|
this.segmentVista = "listview";
|
|
}
|
|
else {
|
|
this.hideRefreshBtn = true;
|
|
this.hideInMobile = true;
|
|
this.segmentVista = "boxview";
|
|
}
|
|
}
|
|
|
|
checkRoutes() {
|
|
this.closeAllDesktopComponents();
|
|
if (this.router.url == '/home/gabinete-digital?processes=true') {
|
|
this.openAllProcessesPage();
|
|
this.selectedElement = 'allProcessesTag';
|
|
}
|
|
if (this.router.url == '/home/gabinete-digital?eventos=true') {
|
|
this.openEventsToApprovePage();
|
|
this.selectedElement = 'approval';
|
|
}
|
|
else if (this.router.url == '/home/gabinete-digital?expedientes=true') {
|
|
this.openExpedientListPage();
|
|
if (SessionStore.user.Profile == 'MDGPR') {
|
|
this.selectedElement = 'Correspondence';
|
|
}
|
|
else {
|
|
this.selectedElement = 'Expediente Presidente'
|
|
}
|
|
}
|
|
else if (this.router.url == '/home/gabinete-digital?pendentes=true') {
|
|
this.openPendentesPage('');
|
|
this.selectedElement = 'Pending';
|
|
}
|
|
else if (this.router.url == '/home/gabinete-digital?despachos=true') {
|
|
this.openDespachosPage('');
|
|
this.selectedElement = 'Dispatches';
|
|
}
|
|
else if (this.router.url == '/home/gabinete-digital?pedidos=true') {
|
|
this.openPedidosPage('parecer');
|
|
this.selectedElement = 'RequestsForOpinion';
|
|
}
|
|
else if (this.router.url == '/home/gabinete-digital?expedientespr=true') {
|
|
this.openExpedientesPrPage();
|
|
this.selectedElement = 'Expediente Presidente'
|
|
}
|
|
else if (this.router.url == '/home/gabinete-digital?despachospr=true') {
|
|
this.openDespachosPrPage('');
|
|
this.selectedElement = 'DispatchesPr'
|
|
}
|
|
else if (this.router.url == '/home/gabinete-digital?diplomas=true') {
|
|
this.openDiplomasPage('validar');
|
|
this.selectedElement = 'DiplomasPorValidar';
|
|
}
|
|
else if (this.router.url == '/home/gabinete-digital?diplomasassinar=true') {
|
|
this.openDiplomasAssinarPage();
|
|
this.selectedElement = 'DiplomasAssinar';
|
|
}
|
|
else if (this.router.url == '/home/gabinete-digital?parecer=true') {
|
|
this.openPedidosPage('parecer')
|
|
}
|
|
else if (this.router.url == '/home/gabinete-digital?deferimento=true') {
|
|
this.openPedidosPage('deferimento')
|
|
}
|
|
else {
|
|
this.checkUser();
|
|
}
|
|
}
|
|
|
|
closeAllDesktopComponents() {
|
|
this.showEmptyContainer = false;
|
|
this.showAllProcesses = false;
|
|
this.showEventsToApprove = false;
|
|
this.showExpedients = false;
|
|
this.showPedidos = false;
|
|
this.showDespachos = false;
|
|
this.showDespachosPr = false;
|
|
this.showPendentes = false;
|
|
this.showDiplomas = false;
|
|
this.showDiplomasAssinar = false;
|
|
this.showExpedientesPr = false;
|
|
this.showExpedientDetail = false;
|
|
this.showSignedDiploma = false
|
|
this.showDiplomasGerar = false
|
|
}
|
|
|
|
updateAllProcess() {
|
|
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).concat(this.pendentesstore.list)
|
|
|
|
// 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)
|
|
// }
|
|
}
|
|
|
|
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);
|
|
this.updateAllProcess()
|
|
|
|
|
|
let despachos = await this.despachoRule.getList({ updateStore: true })
|
|
this.updateAllProcess()
|
|
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 {
|
|
"SerialNumber": element.serialNumber,
|
|
"Folio": element.workflowInstanceDataFields.Subject,
|
|
"Senders": element.workflowInstanceDataFields.Sender,
|
|
"CreateDate": new Date(element.taskStartDate),
|
|
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
|
"Remetente": element.workflowInstanceDataFields.Remetente,
|
|
"DocumentsQty": element.totalDocuments,
|
|
"DocId": element.workflowInstanceDataFields.DocIdDiferimento,
|
|
"WorkflowName": element.workflowDisplayName,
|
|
"activityInstanceName": element.activityInstanceName,
|
|
}
|
|
}));
|
|
|
|
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 {
|
|
"SerialNumber": element.serialNumber,
|
|
"Folio": element.workflowInstanceDataFields.Subject,
|
|
"Senders": element.workflowInstanceDataFields.Sender,
|
|
"CreateDate": new Date(element.taskStartDate),
|
|
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
|
"Remetente": element.workflowInstanceDataFields.Remetente,
|
|
"DocumentsQty": element.totalDocuments,
|
|
"DocId": element.workflowInstanceDataFields.DocIdDiferimento,
|
|
"WorkflowName": element.workflowDisplayName,
|
|
"activityInstanceName": element.activityInstanceName,
|
|
}
|
|
}));
|
|
|
|
|
|
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);
|
|
this.updateAllProcess()
|
|
|
|
let depachoAPI: any = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
|
|
|
|
|
if(SessionStore.user.Profile != 'PR') {
|
|
|
|
let depacho = 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)
|
|
this.updateAllProcess()
|
|
} else if(SessionStore.user.Profile == 'PR') {
|
|
|
|
let depacho = 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)
|
|
this.updateAllProcess()
|
|
}
|
|
|
|
let mdEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
|
|
let mdEventsPessoal = await this.processesbackend.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
|
|
let eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
|
|
|
|
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', false).toPromise();
|
|
let prEventsPessoal = await this.processesbackend.GetTasksList('Agenda Pessoal PR', false).toPromise();
|
|
let eventsPRList = prEventsOficial.concat(prEventsPessoal);
|
|
eventsPRList = eventsPRList.filter((item) => item.activityInstanceName != 'Editar Evento')
|
|
|
|
this.eventoaprovacaostore.countPr = eventsPRList.length
|
|
this.eventoaprovacaostore.resetpr(eventsPRList);
|
|
this.updateAllProcess()
|
|
|
|
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 {
|
|
"SerialNumber": element.serialNumber,
|
|
"Folio": element.workflowInstanceDataFields.Subject,
|
|
"Senders": element.workflowInstanceDataFields.Sender,
|
|
"CreateDate": taskDate,
|
|
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
|
"Remetente": element.workflowInstanceDataFields.Remetente,
|
|
"DocumentsQty": element.totalDocuments,
|
|
"DocId": element.workflowInstanceDataFields.DocIdDiferimento,
|
|
"WorkflowName": element.workflowDisplayName,
|
|
"activityInstanceName": element.activityInstanceName,
|
|
"Status": element.workflowInstanceDataFields.Status,
|
|
}
|
|
}))
|
|
|
|
|
|
let diplomasAssinar = depachoAPI.filter(data => data.activityInstanceName == "Assinar Diploma");
|
|
|
|
this.deplomasStore.resetDiplomasParaAssinar(diplomasAssinar)
|
|
|
|
let diplomasAssinados = depachoAPI.filter(data => data.activityInstanceName == "Diploma Assinado");
|
|
this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados)
|
|
|
|
this.updateAllProcess()
|
|
this.loadCount = true
|
|
}
|
|
|
|
doRefresh(event) {
|
|
|
|
|
|
this.LoadCounts();
|
|
|
|
if (event) {
|
|
setTimeout(() => {
|
|
event?.target?.complete();
|
|
}, 2000);
|
|
}
|
|
else {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
selectedElementF(element: string) {
|
|
if (window.innerWidth > 701) {
|
|
return element == this.selectedElement
|
|
}
|
|
return false;
|
|
}
|
|
|
|
openAllProcessesPage() {
|
|
this.closeAllDesktopComponents();
|
|
let navigationExtras: NavigationExtras = { queryParams: { "processes": true, } };
|
|
if (window.innerWidth < 701) {
|
|
this.router.navigate(['/home/gabinete-digital']);
|
|
}
|
|
else {
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showAllProcesses = true;
|
|
this.selectedElement = "allProcessesTag";
|
|
}
|
|
}
|
|
|
|
openEventsToApprovePage() {
|
|
this.closeAllDesktopComponents();
|
|
let navigationExtras: NavigationExtras = { queryParams: { "eventos": true, } };
|
|
if (window.innerWidth < 701) {
|
|
this.router.navigate(['/home/gabinete-digital/event-list']);
|
|
}
|
|
else {
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showEventsToApprove = true;
|
|
}
|
|
}
|
|
|
|
openExpedientListPage() {
|
|
this.closeAllDesktopComponents();
|
|
|
|
|
|
if(SessionStore.user.Profile != 'PR') {
|
|
if (window.innerWidth < 701) {
|
|
//this.openExpedientList();
|
|
this.router.navigate(['/home/gabinete-digital/expediente']);
|
|
}
|
|
else {
|
|
this.selectedElement = 'Correspondence'
|
|
let navigationExtras: NavigationExtras = { queryParams: { "expedientes": true, } };
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showExpedients = true;
|
|
}
|
|
} else if(SessionStore.user.Profile == 'PR') {
|
|
if (window.innerWidth < 701) {
|
|
this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
|
|
}
|
|
else {
|
|
this.selectedElement = 'ExpedientesPr'
|
|
let navigationExtras: NavigationExtras = { queryParams: { "expedientes": true, } };
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showExpedientesPr = true;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
openPedidosPage(segment: string) {
|
|
this.closeAllDesktopComponents();
|
|
|
|
let navigationExtras: NavigationExtras;
|
|
|
|
if (segment == 'deferimento') {
|
|
navigationExtras = { queryParams: { "deferimento": true, } };
|
|
this.segment = 'deferimento'
|
|
} else if (segment == 'parecer') {
|
|
navigationExtras = { queryParams: { "parecer": true, } };
|
|
this.segment = 'parecer'
|
|
}
|
|
|
|
if (window.innerWidth < 701) {
|
|
this.router.navigate(['/home/gabinete-digital/pedidos'], navigationExtras);
|
|
}
|
|
else {
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showPedidos = true;
|
|
this.selectedElement = 'RequestForApproval'
|
|
if (segment == 'deferimento') {
|
|
this.selectedElement = 'RequestForApproval'
|
|
} else if (segment == 'parecer') {
|
|
this.selectedElement = 'RequestsForOpinion'
|
|
}
|
|
}
|
|
}
|
|
|
|
openDespachosPage(segment?: string) {
|
|
this.closeAllDesktopComponents();
|
|
if (window.innerWidth < 701) {
|
|
this.router.navigate(['/home/gabinete-digital/despachos']);
|
|
}
|
|
else {
|
|
let navigationExtras: NavigationExtras = { queryParams: { "despachos": true, } };
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showDespachos = true;
|
|
}
|
|
}
|
|
|
|
openDespachosPrPage(segment?: string) {
|
|
this.closeAllDesktopComponents();
|
|
if (window.innerWidth < 701) {
|
|
this.router.navigate(['/home/gabinete-digital/despachos-pr']);
|
|
}
|
|
else {
|
|
let navigationExtras: NavigationExtras = { queryParams: { "despachospr": true, } };
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showDespachosPr = true;
|
|
}
|
|
}
|
|
|
|
openPendentesPage(segment?: string) {
|
|
this.closeAllDesktopComponents();
|
|
if (window.innerWidth < 701) {
|
|
this.router.navigate(['/home/gabinete-digital/pendentes']);
|
|
}
|
|
else {
|
|
let navigationExtras: NavigationExtras = { queryParams: { "pendentes": true, } };
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showPendentes = true;
|
|
}
|
|
}
|
|
|
|
openExpedientesPrPage(segment?: string) {
|
|
this.closeAllDesktopComponents();
|
|
if (window.innerWidth < 701) {
|
|
this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
|
|
}
|
|
else {
|
|
this.selectedElement = 'ExpedientesPr'
|
|
let navigationExtras: NavigationExtras = { queryParams: { "expedientespr": true, } };
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showExpedientesPr = true;
|
|
}
|
|
}
|
|
|
|
openDiplomasPage(segment: string) {
|
|
let navigationExtras: NavigationExtras;
|
|
|
|
if (segment == 'validar') {
|
|
navigationExtras = { queryParams: { "validar": true, } };
|
|
} else if (segment == 'assinados') {
|
|
navigationExtras = { queryParams: { "assinados": true, } };
|
|
}
|
|
|
|
this.segment = segment;
|
|
|
|
if (window.innerWidth < 701) {
|
|
this.router.navigate(['/home/gabinete-digital/diplomas'], navigationExtras);
|
|
}
|
|
else {
|
|
this.closeAllDesktopComponents();
|
|
this.segment = segment;
|
|
let navigationExtras: NavigationExtras = { queryParams: { "diplomas": true, } };
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showDiplomas = true;
|
|
}
|
|
}
|
|
|
|
openDiplomaPorElaborar(segment: string) {
|
|
|
|
this.segment = segment;
|
|
|
|
if (window.innerWidth < 701) {
|
|
|
|
let navigationExtras: NavigationExtras = { queryParams: { "gerarDiplomas": true }}
|
|
this.router.navigate(['/home/gabinete-digital/diplomas-gerar'], navigationExtras);
|
|
|
|
}
|
|
else {
|
|
this.closeAllDesktopComponents();
|
|
this.segment = segment;
|
|
let navigationExtras: NavigationExtras = { queryParams: { "gerarDiplomas": true, } };
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showDiplomasGerar = true
|
|
}
|
|
}
|
|
|
|
openDiplomasAssinarPage() {
|
|
this.closeAllDesktopComponents();
|
|
if (window.innerWidth < 701) {
|
|
this.router.navigate(['/home/gabinete-digital/diplomas-assinar']);
|
|
}
|
|
else {
|
|
let navigationExtras: NavigationExtras = { queryParams: { "diplomasassinar": true, } };
|
|
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
|
this.showDiplomasAssinar = true;
|
|
}
|
|
}
|
|
|
|
}
|