mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
save
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CustomTaskPipe } from '../pipes/custom-task.pipe';
|
||||
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 DespachoPRService {
|
||||
|
||||
customTaskPipe = new CustomTaskPipe()
|
||||
loader = this.LoaderService.initialize(this.constructor.name)
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
private processDocumentService: ProcessDocumentService,
|
||||
public LoaderService: LoaderService,
|
||||
) { }
|
||||
|
||||
async getList(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 depacho = depachoAPI.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
|
||||
depacho = depacho.filter(data => data.workflowInstanceDataFields.Status == "Active");
|
||||
return depacho.map((e)=> this.customTaskPipe.transform(e))
|
||||
|
||||
} else if(SessionStore.user.Profile == 'PR') {
|
||||
let depacho = depachoAPI.filter(data => data.activityInstanceName == "Concluir Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
return depacho.map((e)=> this.customTaskPipe.transform(e))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user