2021-06-11 17:27:31 +01:00
|
|
|
///<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
|
|
|
|
|
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
|
2021-02-09 20:20:36 +01:00
|
|
|
import { Component, OnInit, NgZone } from '@angular/core';
|
2020-09-08 11:17:07 +01:00
|
|
|
import { EventsService } from '../services/events.service';
|
|
|
|
|
import { Event } from '../models/event.model';
|
2020-09-08 11:25:00 +01:00
|
|
|
import { ProcessesService } from '../services/processes.service';
|
2021-04-12 08:34:17 +01:00
|
|
|
import { NotificationsService } from '../services/notifications.service';
|
2021-04-12 15:39:44 +01:00
|
|
|
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
|
2021-06-18 11:08:55 +01:00
|
|
|
import { NavigationExtras,Router } from '@angular/router';
|
2021-06-15 16:01:31 +01:00
|
|
|
import { ToastService } from '../services/toast.service';
|
2021-01-20 17:00:56 +01:00
|
|
|
|
2020-08-05 15:39:16 +01:00
|
|
|
@Component({
|
|
|
|
|
selector: 'app-home',
|
|
|
|
|
templateUrl: './home.page.html',
|
|
|
|
|
styleUrls: ['./home.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class HomePage implements OnInit {
|
2020-09-08 11:17:07 +01:00
|
|
|
eventsList: Event[];
|
2020-11-20 13:36:35 +01:00
|
|
|
prEventList: Event[];
|
|
|
|
|
mdEventList: Event[];
|
|
|
|
|
|
2021-01-26 17:00:41 +01:00
|
|
|
totalEvent = 0;
|
|
|
|
|
totalExpediente = 0;
|
|
|
|
|
profile: string;
|
2020-08-05 15:39:16 +01:00
|
|
|
|
2021-04-08 22:54:15 +01:00
|
|
|
adding: "intervenient" | "CC" = "intervenient";
|
|
|
|
|
mobileComponent = {
|
|
|
|
|
showAddNewEvent: false,
|
|
|
|
|
showEditEvent: false,
|
|
|
|
|
showEventDetails: false,
|
|
|
|
|
showEventList: false,
|
|
|
|
|
transparentEventList: false,
|
|
|
|
|
transparentEventToApprove: false,
|
|
|
|
|
showEventToApprove: false,
|
|
|
|
|
showAttendees: false,
|
|
|
|
|
showAttendeeModal: false
|
|
|
|
|
}
|
|
|
|
|
eventToaprove: any = {
|
|
|
|
|
back: false,
|
|
|
|
|
serialNumber: "",
|
|
|
|
|
saveData: {}
|
|
|
|
|
}
|
|
|
|
|
selectedEvent: Event;
|
|
|
|
|
postEvent: any;
|
|
|
|
|
folderId: string;
|
|
|
|
|
|
2021-06-16 08:37:31 +01:00
|
|
|
constructor(private zone: NgZone,
|
|
|
|
|
private eventService: EventsService,
|
|
|
|
|
private processesbackend: ProcessesService,
|
|
|
|
|
private router: Router,
|
|
|
|
|
private modalController: ModalController,
|
|
|
|
|
public modalCtrl: AlertController,
|
2021-06-15 16:01:31 +01:00
|
|
|
private toastService: ToastService,
|
2021-04-12 08:34:17 +01:00
|
|
|
private animationController: AnimationController,
|
2021-04-12 15:39:44 +01:00
|
|
|
private notificatinsservice: NotificationsService,
|
|
|
|
|
private platform: Platform) {
|
2021-04-08 22:54:15 +01:00
|
|
|
|
2021-03-04 16:07:09 +01:00
|
|
|
router.events.subscribe((val) => {
|
2021-06-21 14:29:49 +01:00
|
|
|
document.querySelectorAll('ion-modal').forEach((e) => e.remove())
|
2021-03-04 16:07:09 +01:00
|
|
|
});
|
2021-04-08 22:54:15 +01:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
//this.folderId = this.navParams.get('folderId');
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-04 16:07:09 +01:00
|
|
|
}
|
2020-08-05 15:39:16 +01:00
|
|
|
|
|
|
|
|
ngOnInit() {
|
2021-06-23 11:23:22 +01:00
|
|
|
if(!this.platform.is('desktop')) {
|
2021-06-25 09:35:50 +01:00
|
|
|
this.notificatinsservice.onReceviNotification();
|
2021-06-23 11:23:22 +01:00
|
|
|
}
|
2021-06-15 17:42:51 +01:00
|
|
|
this.count();
|
2021-04-09 00:10:07 +01:00
|
|
|
|
2021-06-15 17:42:51 +01:00
|
|
|
}
|
|
|
|
|
|
2021-06-18 11:08:55 +01:00
|
|
|
async count() {
|
2021-02-10 13:51:39 +01:00
|
|
|
|
|
|
|
|
let date = new Date();
|
|
|
|
|
date.setMonth(date.getMonth() + 1);
|
2021-06-16 08:37:31 +01:00
|
|
|
let start = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
|
|
|
|
let end = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " 23:59:59";
|
2021-02-10 13:51:39 +01:00
|
|
|
|
2020-11-26 09:04:22 +01:00
|
|
|
this.profile = "mdgpr";
|
2021-01-26 17:00:41 +01:00
|
|
|
if (this.profile == "mdgpr") {
|
2021-06-15 17:42:51 +01:00
|
|
|
|
|
|
|
|
let mdOficialEvents = await this.eventService.getAllPrOficialEvents(start, end).toPromise();
|
|
|
|
|
let mdPessoalEvents = await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
|
|
|
|
|
this.eventsList = mdOficialEvents.concat(mdPessoalEvents)
|
|
|
|
|
this.totalEvent = this.eventsList.length;
|
|
|
|
|
|
2020-11-20 13:36:35 +01:00
|
|
|
}
|
2021-01-26 17:00:41 +01:00
|
|
|
else {
|
2021-06-15 17:42:51 +01:00
|
|
|
let prOficialEvents = await this.eventService.getAllPrOficialEvents(start, end).toPromise();
|
|
|
|
|
let prPessoalEvents = await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
|
|
|
|
|
this.eventsList = prOficialEvents.concat(prPessoalEvents)
|
|
|
|
|
this.totalEvent = this.eventsList.length;
|
2020-11-20 13:36:35 +01:00
|
|
|
|
|
|
|
|
}
|
2021-04-15 15:16:14 +01:00
|
|
|
|
2021-02-01 09:58:15 +01:00
|
|
|
}
|
|
|
|
|
|
2020-08-05 15:39:16 +01:00
|
|
|
}
|