mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
91 lines
2.8 KiB
TypeScript
91 lines
2.8 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { ProcessesService } from '../services/processes.service';
|
|
import { SessionStore } from '../store/session.service';
|
|
import { ProcessDocumentService } from './process-document.service';
|
|
import { LoaderService } from 'src/app/store/loader.service'
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class DeplomasServiceService {
|
|
|
|
loader = this.LoaderService.initialize(this.constructor.name)
|
|
|
|
constructor(
|
|
private processes: ProcessesService,
|
|
private processDocumentService: ProcessDocumentService,
|
|
public LoaderService: LoaderService,
|
|
) { }
|
|
|
|
|
|
async getListReview(depachoAPI) {
|
|
|
|
this.loader.push()
|
|
|
|
if(!depachoAPI) {
|
|
try {
|
|
depachoAPI = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
|
} catch (error) {
|
|
this.loader.pop()
|
|
return []
|
|
}
|
|
|
|
}
|
|
|
|
this.loader.pop()
|
|
|
|
if(SessionStore.user.Profile == 'PR') {
|
|
let diplomasValidar = depachoAPI.filter(data => data.activityInstanceName == "Revisar Diploma");
|
|
diplomasValidar = diplomasValidar.filter(data => data.activityInstanceName != "Tarefa de Despacho");
|
|
|
|
return 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,
|
|
}
|
|
})
|
|
}
|
|
|
|
return []
|
|
|
|
}
|
|
|
|
async getListAssinar(depachoAPI) {
|
|
if(!depachoAPI) {
|
|
depachoAPI = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
|
}
|
|
|
|
if(SessionStore.user.Profile == 'PR') {
|
|
return depachoAPI.filter(data => data.activityInstanceName == "Assinar Diploma");
|
|
}
|
|
|
|
return []
|
|
}
|
|
|
|
async getListAssinados(depachoAPI) {
|
|
if(!depachoAPI) {
|
|
depachoAPI = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
|
}
|
|
|
|
if(SessionStore.user.Profile == 'PR') {
|
|
return depachoAPI.filter(data => data.activityInstanceName == "Diploma Assinado");
|
|
}
|
|
|
|
return []
|
|
}
|
|
}
|