2021-07-08 14:07:33 +01:00
|
|
|
/* eslint-disable */
|
2021-07-08 14:45:38 +01:00
|
|
|
/* tslint:disable */
|
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-07-08 10:43:40 +01:00
|
|
|
import { Component, OnInit, NgZone, Inject } 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-07-07 15:28:29 +01:00
|
|
|
import { NavigationExtras,Router,ActivatedRoute } 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,
|
2021-07-20 19:22:56 +01:00
|
|
|
private router: Router,
|
2021-06-16 08:37:31 +01:00
|
|
|
public modalCtrl: AlertController,
|
2021-04-12 15:39:44 +01:00
|
|
|
private notificatinsservice: NotificationsService,
|
2021-07-07 15:28:29 +01:00
|
|
|
private platform: Platform,
|
|
|
|
|
private activeroute: ActivatedRoute) {
|
2021-04-08 22:54:15 +01:00
|
|
|
|
2021-07-08 10:43:40 +01:00
|
|
|
this.router.events.subscribe((val) => {
|
|
|
|
|
document.querySelectorAll('ion-modal').forEach((e: any) => 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-07-07 15:28:29 +01:00
|
|
|
console.log('Active route ',this.router.url)
|
2021-06-25 14:37:52 +01:00
|
|
|
if(this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
|
|
|
|
console.log('Notifications not supported')
|
|
|
|
|
} else {
|
2021-06-25 10:04:41 +01:00
|
|
|
this.mobilefirstConnect();
|
2021-06-25 09:35:50 +01:00
|
|
|
this.notificatinsservice.onReceviNotification();
|
2021-06-25 14:37:52 +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
|
|
|
|
2021-07-13 09:57:38 +01:00
|
|
|
// let date = new Date();
|
|
|
|
|
// date.setMonth(date.getMonth() + 1);
|
|
|
|
|
// 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";
|
|
|
|
|
|
|
|
|
|
// this.profile = "mdgpr";
|
|
|
|
|
// if (this.profile == "mdgpr") {
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
|
|
// }
|
2021-04-15 15:16:14 +01:00
|
|
|
|
2021-02-01 09:58:15 +01:00
|
|
|
}
|
|
|
|
|
|
2021-06-25 10:04:41 +01:00
|
|
|
mobilefirstConnect() {
|
2021-07-08 10:43:40 +01:00
|
|
|
window['WLAuthorizationManager'].obtainAccessToken("").then(
|
2021-06-25 10:04:41 +01:00
|
|
|
(token) => {
|
|
|
|
|
console.log('MobileFirst Server connect: Success ' + token);
|
|
|
|
|
|
|
|
|
|
var resourceRequest = new WLResourceRequest("/adapters/javaAdapter/resource/greet/",
|
|
|
|
|
WLResourceRequest.GET
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
resourceRequest.setQueryParameter("name", "world");
|
|
|
|
|
resourceRequest.send().then(
|
|
|
|
|
(response) => {
|
|
|
|
|
// Will display "Hello world" in an alert dialog.
|
|
|
|
|
console.log("Connect with JavaAdapter Success: " + response.responseText);
|
|
|
|
|
//this.MFPushNotification();
|
|
|
|
|
},
|
|
|
|
|
(error) => {
|
|
|
|
|
alert("Connect with JavaAdapter Failure: " + JSON.stringify(error));
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}, (error) => {
|
|
|
|
|
console.log('MobileFirst Server connect: failure ' + error.responseText);
|
|
|
|
|
console.log(JSON.stringify(error))
|
|
|
|
|
/* this.zone.run(() => {
|
|
|
|
|
alert("Bummer...");
|
|
|
|
|
alert("Failed to connect to MobileFirst Server");
|
|
|
|
|
}); */
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-05 15:39:16 +01:00
|
|
|
}
|