mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
Improve local storage and fix expediente task strature
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { customTask, DailyWorkTask, fullTask } from '../../../models/dailyworktask.model';
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { customTask } from '../../../models/dailyworktask.model';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { NavigationStart, Router } from '@angular/router';
|
||||
import { DespachoStore } from 'src/app/store/despacho-store.service';
|
||||
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
||||
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { DespachoService } from 'src/app/Rules/despacho.service'
|
||||
@Component({
|
||||
selector: 'app-despachos',
|
||||
templateUrl: './despachos.page.html',
|
||||
@@ -15,13 +16,14 @@ export class DespachosPage implements OnInit {
|
||||
segment:string;
|
||||
@Output() openExpedientDetail:EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
skeletonLoader = true
|
||||
despachoStore = DespachoStore;
|
||||
customTaskPipe = new CustomTaskPipe()
|
||||
|
||||
constructor (
|
||||
private processes:ProcessesService,
|
||||
private router: Router,
|
||||
private notificationsService: NotificationsService,
|
||||
private despachoRule: DespachoService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -45,32 +47,16 @@ export class DespachosPage implements OnInit {
|
||||
|
||||
async LoadList() {
|
||||
|
||||
this.skeletonLoader = true
|
||||
|
||||
let result: fullTask[] = await this.processes.GetTasksList("Despacho", false).toPromise();
|
||||
result = result.filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
|
||||
let despachoList = new Array();
|
||||
|
||||
result.forEach((element, index) => {
|
||||
|
||||
let task = this.customTaskPipe.transform(element);
|
||||
despachoList.push(task);
|
||||
|
||||
});
|
||||
|
||||
despachoList = this.sortArrayISODate(despachoList).reverse();
|
||||
this.despachoStore.reset(despachoList);
|
||||
this.skeletonLoader = false
|
||||
|
||||
await this.despachoRule.getList({updateStore: true})
|
||||
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any) {
|
||||
return myArray.sort(function(a, b) {
|
||||
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
||||
});
|
||||
|
||||
get skeletonLoader(): boolean {
|
||||
return this.despachoRule.LoaderService.loading
|
||||
}
|
||||
|
||||
|
||||
doRefresh() {
|
||||
setTimeout(() => {
|
||||
this.LoadList();
|
||||
|
||||
Reference in New Issue
Block a user