mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
order by date
This commit is contained in:
@@ -7,6 +7,7 @@ import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
|
||||
import { SqliteService } from '../../../services/sqlite.service';
|
||||
import { synchro } from '../../../services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-all-processes',
|
||||
@@ -26,7 +27,8 @@ export class AllProcessesPage implements OnInit {
|
||||
private router: Router,
|
||||
private authService: AuthService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
private platform: Platform,
|
||||
private sortService: SortService,
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
}
|
||||
@@ -93,7 +95,8 @@ export class AllProcessesPage implements OnInit {
|
||||
}
|
||||
this.allProcessesList.push(task);
|
||||
this.allProcessesList = removeDuplicate(this.allProcessesList)
|
||||
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
|
||||
//this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
|
||||
this.allProcessesList = this.sortService.sortArrayISODate(this.allProcessesList).reverse();
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { NavigationStart, Router } from '@angular/router';
|
||||
import { DespachosprStore } from 'src/app/store/despachospr-store.service';
|
||||
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despachos-pr',
|
||||
@@ -24,6 +25,7 @@ constructor (
|
||||
private processes:ProcessesService,
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private sortService: SortService,
|
||||
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
@@ -32,7 +34,7 @@ constructor (
|
||||
ngOnInit() {
|
||||
|
||||
this.LoadList()
|
||||
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart &&
|
||||
event.url.startsWith('/home/gabinete-digital?despachospr=true')) {
|
||||
@@ -72,17 +74,12 @@ constructor (
|
||||
despachoList.push(task);
|
||||
});
|
||||
|
||||
despachoList = this.sortArrayISODate(despachoList).reverse()
|
||||
despachoList = this.sortService.sortArrayByDate(despachoList).reverse()
|
||||
this.despachosprstore.reset(despachoList);
|
||||
this.skeletonLoader = false;
|
||||
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any){
|
||||
return myArray.sort(function(a, b) {
|
||||
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
||||
});
|
||||
}
|
||||
|
||||
refreshing(){
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -6,6 +6,7 @@ import { ModalController } from '@ionic/angular';
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
import { DeplomasStore } from 'src/app/store/deplomas.service';
|
||||
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-diplomas-assinar',
|
||||
@@ -26,12 +27,13 @@ export class DiplomasAssinarPage implements OnInit {
|
||||
private modalController: ModalController,
|
||||
private alertService: AlertService,
|
||||
private router: Router,
|
||||
private sortService: SortService,
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.LoadList()
|
||||
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && '/home/gabinete-digital?diplomasassinar=true'.startsWith(event.url)) {
|
||||
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
@@ -68,13 +70,13 @@ export class DiplomasAssinarPage implements OnInit {
|
||||
console.log(diplomasAssinar);
|
||||
|
||||
diplomasAssinar.forEach(element => {
|
||||
|
||||
|
||||
let task: customTask = this.customTaskPipe.transform(element)
|
||||
this.diplomasList.push(task);
|
||||
this.deplomasStore.resetDiplomasList(this.diplomasList)
|
||||
this.deplomasStore.resetDiplomasList(this.sortService.sortArrayByDate(this.diplomasList));
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { NavigationStart, Router } from '@angular/router';
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-events-to-approve',
|
||||
@@ -31,6 +32,7 @@ export class EventsToApprovePage implements OnInit {
|
||||
private modalController: ModalController,
|
||||
private router: Router,
|
||||
private userAuth: AuthService,
|
||||
private sortService: SortService,
|
||||
)
|
||||
{
|
||||
this.loggeduser = userAuth.ValidatedUser;
|
||||
@@ -41,9 +43,9 @@ export class EventsToApprovePage implements OnInit {
|
||||
this.LoadToApproveEvents();
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart &&
|
||||
if (event instanceof NavigationStart &&
|
||||
'/home/gabinete-digital?eventos=true'.startsWith(event.url)) {
|
||||
|
||||
|
||||
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.doRefresh()
|
||||
} else {
|
||||
@@ -65,13 +67,15 @@ export class EventsToApprovePage implements OnInit {
|
||||
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
|
||||
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
|
||||
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
|
||||
this.eventaprovacaostore.resetmd(this.eventsMDGPRList);
|
||||
console.log(this.sortService.sortArrayByDate(this.eventsMDGPRList));
|
||||
|
||||
this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse());
|
||||
}
|
||||
else if(this.segment == 'PR'){
|
||||
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
|
||||
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
|
||||
this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
|
||||
this.eventaprovacaostore.resetpr(this.eventsPRList);
|
||||
this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse());
|
||||
}
|
||||
this.showLoader = false;
|
||||
}
|
||||
@@ -123,7 +127,7 @@ export class EventsToApprovePage implements OnInit {
|
||||
setTimeout(()=>{
|
||||
this.LoadToApproveEvents();
|
||||
}, 1000)
|
||||
|
||||
|
||||
}
|
||||
close(){
|
||||
this.modalController.dismiss(null);
|
||||
|
||||
@@ -9,6 +9,7 @@ import { AlertService } from 'src/app/services/alert.service';
|
||||
import { PedidoPage } from 'src/app/pages/gabinete-digital/pedidos/pedido/pedido.page';
|
||||
import { PedidosStore } from 'src/app/store/pedidos-store.service';
|
||||
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
@Component({
|
||||
selector: 'app-pedidos',
|
||||
templateUrl: './pedidos.page.html',
|
||||
@@ -43,6 +44,7 @@ export class PedidosPage implements OnInit {
|
||||
private processes:ProcessesService,
|
||||
private modalController: ModalController,
|
||||
private alertService: AlertService,
|
||||
private sortService: SortService,
|
||||
) {
|
||||
this.profile = 'mdgpr';
|
||||
}
|
||||
@@ -70,7 +72,7 @@ export class PedidosPage implements OnInit {
|
||||
segmentChanged(ev: any) {
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
|
||||
async LoadList() {
|
||||
|
||||
this.skeletonLoader = true;
|
||||
@@ -92,7 +94,7 @@ export class PedidosPage implements OnInit {
|
||||
let task: customTask = this.customTaskPipe.transform(element);
|
||||
this.parecerList.push(task);
|
||||
});
|
||||
this.pedidosstore.resetparecer(this.parecerList);
|
||||
this.pedidosstore.resetparecer(this.sortService.sortArrayByDate(this.parecerList));
|
||||
|
||||
}
|
||||
else if(this.segment == 'deferimento') {
|
||||
@@ -108,7 +110,7 @@ export class PedidosPage implements OnInit {
|
||||
let task: customTask = this.customTaskPipe.transform(element);
|
||||
this.deferimentoList.push(task);
|
||||
});
|
||||
this.pedidosstore.resetdeferimento(this.deferimentoList);
|
||||
this.pedidosstore.resetdeferimento(this.sortService.sortArrayByDate(this.deferimentoList));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { AuthService } from 'src/app/services/auth.service';
|
||||
import { PendentesStore } from 'src/app/store/pendestes-store.service';
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pendentes',
|
||||
@@ -28,6 +29,7 @@ export class PendentesPage implements OnInit {
|
||||
private processes:ProcessesService,
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private sortService: SortService,
|
||||
) {
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
}
|
||||
@@ -60,18 +62,12 @@ export class PendentesPage implements OnInit {
|
||||
});
|
||||
|
||||
pendentesList = removeDuplicate( pendentesList)
|
||||
pendentesList = this.sortArrayISODate(pendentesList);
|
||||
pendentesList = this.sortService.sortArrayByDate(pendentesList);
|
||||
|
||||
this.pendentesstore.reset(pendentesList);
|
||||
this.skeletonLoader = false;
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any){
|
||||
return myArray.sort(function(a, b) {
|
||||
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
||||
});
|
||||
}
|
||||
|
||||
doRefresh() {
|
||||
setTimeout(()=>{
|
||||
this.LoadList();
|
||||
|
||||
Reference in New Issue
Block a user