centralize service

This commit is contained in:
Peter Maquiran
2023-04-17 16:00:30 +01:00
parent 9c835cde28
commit 955640e42e
8 changed files with 269 additions and 306 deletions
@@ -1,5 +1,5 @@
<ion-header class="ion-no-border">
<!-- <ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar> -->
<!-- <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar> -->
<div class="title">
<div class="thetitle"><ion-label >Todas as tarefas</ion-label></div>
@@ -55,13 +55,13 @@
<div class="overflow-y-auto height-100 width-100">
<div *ngIf="AllProcess.length >= 0">
<div *ngIf="TaskService.AllProcess.length >= 0">
<ion-item-sliding class="overflow-y-auto height-100">
<div class="listview">
<ion-list *ngIf="AllProcess">
<ion-list *ngIf="TaskService.AllProcess">
<div
class="item-hover ion-no-padding cursor-pointer"
*ngFor = "let task of AllProcess"
*ngFor = "let task of TaskService.AllProcess"
(click)="goToProcess(task.SerialNumber || task.serialNumber, task.WorkflowName || task.workflowName|| task.workflowDisplayName , task.activityInstanceName)">
<div class="item-wrapper" *ngIf="TaskService.filter(task, filterName)">
<div class="item width-100 " >
@@ -120,13 +120,13 @@
</div>
<div
*ngIf="!skeletonLoader && getAllProcessCount == 0"
*ngIf="!TaskService.showLoader && TaskService.AllProcess.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
</div>
<div *ngIf="skeletonLoader && getAllProcessCount == 0">
<div *ngIf="TaskService.showLoader && TaskService.AllProcess.length == 0">
<ion-list>
<ion-item>
@@ -34,7 +34,6 @@ export class AllProcessesPage implements OnInit {
totalDocumentStore = TotalDocumentStore
deplomasStore = DeplomasStore
AllProcess = []
filterName: 'Para hoje' | 'Novos'| 'Lidos'| 'Não lidos'| 'OverdueTasks' | 'Todos' = 'Todos'
constructor(
@@ -43,16 +42,10 @@ export class AllProcessesPage implements OnInit {
public TaskService: TaskService
) {
this.loggeduser = SessionStore.user;
window['all-process'] = () => {
if(window.location.href.includes('?processes=true')) {
this.updateAllProcess()
}
}
}
ngOnInit() {
this.updateAllProcess()
// this.updateAllProcess()
this.checkFilter();
this.router.events.forEach((event) => {
@@ -95,44 +88,18 @@ export class AllProcessesPage implements OnInit {
}, 2000);
}
setTimeout(() => {
this.updateAllProcess();
// this.updateAllProcess();
}, 1000);
}
refreshing() {
setTimeout(() => {
this.updateAllProcess();
// this.updateAllProcess();
}, 1000);
}
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()
clearTimeout(this.functionTimer);
this.functionTimer = setTimeout(() => {
this.TaskService.updateCount()
}, 1000); // time is in milliseconds
}
get getAllProcessCount() {
return this.AllProcess.length
}
sortArrayISODate(myArray: any): any[] {
// return myArray.sort(function (a, b) {
// return (a.CreateDate || a.taskStartDate < b.CreateDate || b.taskStartDate) ? -1 : ((a.CreateDate || a.taskStartDate > b.CreateDate || b.taskStartDate) ? 1 : 0);
// });
return myArray.sort((a,b) => Date.parse(b.CreateDate || b.taskStartDate || b.TaskStartDate) - Date.parse(a.CreateDate || a.taskStartDate || a.TaskStartDate))
}
setFormatDate(start: any, end: any, allday: boolean) {
let customDate;