Fixe home page

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