Fixe home page

This commit is contained in:
2021-02-08 16:55:31 +01:00
parent 1033c3e657
commit d9cdbcdd80
+26 -21
View File
@@ -21,6 +21,9 @@ const { PushNotifications, LocalNotifications, LocalNotificationAction } = Plugi
styleUrls: ['./home.page.scss'],
})
export class HomePage implements OnInit {
today = new Date();
todayEnd = new Date();
eventsList: Event[];
prEventList: Event[];
mdEventList: Event[];
@@ -35,13 +38,13 @@ export class HomePage implements OnInit {
//Initialize profile as mdgpr
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(this.today.toLocaleString(), this.todayEnd.toLocaleString()).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(this.today.toLocaleString(), this.todayEnd.toLocaleString()).subscribe(res => {
this.eventsList = res;
this.totalEvent = this.eventsList.length;
});
@@ -50,6 +53,10 @@ export class HomePage implements OnInit {
this.processesbackend.GetTasksList("Expediente", true).subscribe(result => {
this.totalExpediente = result;
});
}
}
/*
(PushNotifications as any).requestPermission().then(result => {
PushNotifications.register();
@@ -66,11 +73,11 @@ export class HomePage implements OnInit {
console.log(this.storageService.get(this.username)) */
PushNotifications.addListener('registrationError', (error: any) => {
alert('Error on registration: ' + JSON.stringify(error));
});
/* 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;
@@ -91,10 +98,10 @@ export class HomePage implements OnInit {
}]
});
//}
});
}); */
PushNotifications.addListener(
/* PushNotifications.addListener(
'pushNotificationActionPerformed',
(notification: PushNotificationActionPerformed) => {
let service = notification.notification.data.service;
@@ -126,7 +133,7 @@ export class HomePage implements OnInit {
service = "agenda" ? this.router.navigate(['/home/', service, idObject, 'home']) : */
if (service === "agenda") {
/* if (service === "agenda") {
this.router.navigate(['/home/', service, idObject, 'home']);
} else if (service === "gabinete-digital" && object != "expediente") {
this.router.navigate(['/home/', service]);
@@ -137,7 +144,7 @@ export class HomePage implements OnInit {
} else if (service === "accoes" && object === "publicacao") {
this.viewPublicationDetail(idObject)
}
*/
@@ -170,11 +177,11 @@ export class HomePage implements OnInit {
},
);
/* },
);
}
async localNotificationPresent(notification) {
*/
/* async localNotificationPresent(notification) {
LocalNotificationAction.
@@ -193,9 +200,9 @@ export class HomePage implements OnInit {
}
]
});
}
} */
async viewExpedientDetail(serialNumber:any) {
/* async viewExpedientDetail(serialNumber:any) {
console.log(this.profile);
const modal = await this.modalController.create({
@@ -237,14 +244,12 @@ export class HomePage implements OnInit {
component: ViewPublicationsPage,
/* enterAnimation,
leaveAnimation, */
componentProps: {
item: folderId,
/* componentProps: { */
/* item: folderId,
},
cssClass: 'new-action',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
}
}
} */