Merge with developer-c

This commit is contained in:
Eudes Inácio
2021-02-24 11:04:11 +01:00
374 changed files with 5470 additions and 204982 deletions
+56 -145
View File
@@ -11,11 +11,11 @@ import { ExpedienteDetailPage } from '../../app/pages/gabinete-digital/expedient
import { ViewEventPage } from '../../app/pages/agenda/view-event/view-event.page'
import { ApproveEventModalPage } from '../../app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page';
import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core';
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core'; */
import { Router } from '@angular/router';
import { MethodCall } from '@angular/compiler';
const { PushNotifications, LocalNotifications, LocalNotificationAction } = Plugins;
/* const { PushNotifications, LocalNotifications, LocalNotificationAction } = Plugins; */
@Component({
selector: 'app-home',
@@ -31,19 +31,25 @@ export class HomePage implements OnInit {
totalExpediente = 0;
profile: string;
constructor(private zone: NgZone, private eventService: EventsService, private processesbackend: ProcessesService, private router: Router, private modalController: ModalController,) { }
constructor(private ngZone: NgZone,private eventService: EventsService, private processesbackend: ProcessesService, private router: Router, private modalController: ModalController,) { }
ngOnInit() {
//Initialize profile as mdgpr
/* //Initialize profile as mdgpr
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") {
this.eventService.getAllMdEvents(formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss', 'pt'), formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
this.eventService.getAllMdEvents(start, end).subscribe(res => {
this.eventsList = res;
this.totalEvent = this.eventsList.length;
});
}
else {
this.eventService.getAllPrEvents(formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss', 'pt'), formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
this.eventService.getAllPrEvents(start, end).subscribe(res => {
this.eventsList = res;
this.totalEvent = this.eventsList.length;
});
@@ -53,55 +59,22 @@ export class HomePage implements OnInit {
this.totalExpediente = result;
});
//Mobile first
/* WLAuthorizationManager.obtainAccessToken("").then(
(token) => {
console.log('--> pingMFP(): Success ', token);
this.zone.run(() => {
//this.title = "Yay!";
//this.status = "Connected to MobileFirst Server";
});
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.
alert("Success: " + response.responseText);
},
(error) => {
alert("Failure: " + JSON.stringify(error));
}
);
}, (error) => {
console.log('--> pingMFP(): failure ', error.responseText);
this.zone.run(() => {
//this.title = "Bummer...";
//this.status = "Failed to connect to MobileFirst Server";
});
}
); */
PushNotifications.addListener('registrationError', (error: any) => {
alert('Error on registration: ' + JSON.stringify(error));
});
PushNotifications.addListener('pushNotificationReceived', notification => {
PushNotifications.addListener('pushNotificationReceived', notification => {
//const isPushNotification = !!notification.title || !!notification.body;
// if this is a push notification received when the app is in the foreground on Android
//if (isAndroid && isPushNotification) {
// We schedule a LocalNotification 1 second later since Capacitor for Android doesn't show anything in this case
console.log('Recived: ', notification)
// We schedule a LocalNotification 1 second later since Capacitor for Android doesn't show anything in this case
console.log('Recived: ', notification)
//}
});
});
PushNotifications.addListener(
'pushNotificationActionPerformed',
@@ -110,110 +83,38 @@ export class HomePage implements OnInit {
let object = notification.notification.data.Object;
let idObject = notification.notification.data.IdObject;
console.log('Complete Object: ', notification.notification)
console.log('Complete Object: ', notification.notification )
console.log('Service: ', service);
console.log('Object: ', object);
console.log('idObject: ', idObject);
/* if (service === "events") {
this.router.navigate(['/home/', service, idObject, 'home']);
} else if (service === "agenda") {
this.router.navigate(['/home/', service, idObject, 'home']);
} else if (service === "gabinete-digital" && object != "expediente") {*/
// this.router.navigate(['/home/', service]);
// }
//if (service != null) {
/*const routeValue = {
"agenda": this.router.navigate(['/home/', service, idObject, 'home']),
"gabinete-digital": this.router.navigate(['/home/', service]),
"accoes": this.viewExpedientDetail(idObject),
}
const route = routeValue[service] && object ;
service = "agenda" ? this.router.navigate(['/home/', service, idObject, 'home']) : */
if (service === "agenda") {
//this.router.navigate(['/home/', service, idObject, 'home']);
this.viewEventDetail(idObject)
} /*else if (service === "gabinete-digital" && object != "expediente" || object != "event-list") {
this.router.navigate(['/home/gabinete-digital']);
} */else if (service === "gabinete-digital" && object === "expediente") {
this.viewExpedientDetail(idObject)
} else if (service === "gabinete-digital" && object === "event-list") {
/* this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])}) */
this.openApproveModal(idObject);
} else if (service === "accoes" && object === "accao") {
this.viewPublications(idObject)
} else if (service === "accoes" && object === "publicacao") {
this.viewPublicationDetail(idObject)
}
/*switch (service) {
case "events":
this.router.navigate(['/home/', service, idObject, 'home']);
break;
case "agenda":
this.router.navigate(['/home/', service, idObject, 'home']);
break;
case "gabinete-digital":
this.router.navigate(['/home/', service]);
break;
case "gabinete-digital-expediente":
this.router.navigate(['/home/gabinete-digital/', object, idObject, 'home']);
break;
case "": {
if(publicationId && processId != null) {
this.viewPublicationDetail(publicationId,processId)
}
if (folder.ProcessId != null) {
this.viewPublications(folder)
}
if (service === "agenda") {
//this.router.navigate(['/home/', service, idObject, 'home']);
this.viewEventDetail(idObject)
}
else if (service === "gabinete-digital" && object === "expediente") {
this.viewExpedientDetail(idObject)
}
else if (service === "gabinete-digital" && object === "event-list") {
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])})
this.openApproveModal(idObject);
}
else if (service === "accoes" && object === "accao") {
this.viewPublications(idObject)
}
else if (service === "accoes" && object === "publicacao") {
this.viewPublicationDetail(idObject)
}
default:
this.router.navigate(['/home/']);
}*/
},
);
); */
}
async localNotificationPresent(notification) {
LocalNotificationAction.
LocalNotifications.schedule({
notifications: [
{
title: notification.title,
body: notification.body,
id: 1,
schedule: { at: new Date(Date.now() + 1000) },
sound: null,
attachments: null,
actionTypeId: "",
extra: null,
foreground: true,
}
]
});
}
async openApproveModal(eventSerialNumber) {
async openApproveModal(eventSerialNumber){
const modal = await this.modalController.create({
component: ApproveEventModalPage,
componentProps: {
componentProps:{
serialNumber: eventSerialNumber,
},
cssClass: 'cal-modal',
@@ -221,11 +122,25 @@ export class HomePage implements OnInit {
});
await modal.present();
modal.onDidDismiss();
}
async viewEventDetail(eventId:any) {
console.log(this.profile);
const modal = await this.modalController.create({
component: ViewEventPage,
componentProps:{
eventId: eventId,
},
cssClass: 'modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
}
async viewEventDetail(eventId: any) {
/* async viewExpedientDetail(serialNumber:any) {
console.log(this.profile);
const modal = await this.modalController.create({
@@ -259,12 +174,8 @@ export class HomePage implements OnInit {
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((res) => {
if (res) {
console.log(res);
}
});
}
modal.onDidDismiss();
} */