mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Route notification fixed
This commit is contained in:
+1
-1
@@ -134,7 +134,7 @@
|
||||
</mfp:windows10>
|
||||
<mfp:appChecksum>0</mfp:appChecksum>
|
||||
</mfp:windows>
|
||||
<mfp:platformVersion>8.0.0.00-20210214-154410</mfp:platformVersion>
|
||||
<mfp:platformVersion>8.0.0.00-20210308-063916</mfp:platformVersion>
|
||||
<mfp:clientCustomInit enabled="false" />
|
||||
<mfp:server runtime="mfp" url="http://gpr-dev-10.gabinetedigital.local:9080" />
|
||||
<mfp:serverUri url="" />
|
||||
|
||||
Generated
+5
@@ -2341,6 +2341,11 @@
|
||||
"@types/cordova": "^0.0.34"
|
||||
}
|
||||
},
|
||||
"@ionic-native/local-notifications": {
|
||||
"version": "4.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@ionic-native/local-notifications/-/local-notifications-4.20.0.tgz",
|
||||
"integrity": "sha512-Ht/0zau8/2+G/bH/okXXhhWB6YrkCNL2QxVJHQ2dophXFGxQPOZAN3CKWhuQSjfbr76fa2nvQXF6jsXLpIR/ng=="
|
||||
},
|
||||
"@ionic-native/splash-screen": {
|
||||
"version": "5.31.1",
|
||||
"resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-5.31.1.tgz",
|
||||
|
||||
+2
-1
@@ -35,6 +35,7 @@
|
||||
"@ionic-native/http": "^5.31.1",
|
||||
"@ionic-native/in-app-browser": "^5.28.0",
|
||||
"@ionic-native/ionic-webview": "^5.30.0",
|
||||
"@ionic-native/local-notifications": "^4.20.0",
|
||||
"@ionic-native/splash-screen": "^5.31.1",
|
||||
"@ionic-native/sqlite": "^5.31.1",
|
||||
"@ionic-native/sqlite-porter": "^5.31.1",
|
||||
@@ -148,4 +149,4 @@
|
||||
"url": "git+https://Kayaya@bitbucket.org/equilibriumito/gabinete-digital.git"
|
||||
},
|
||||
"license": "ISC"
|
||||
}
|
||||
}
|
||||
+37
-175
@@ -8,7 +8,7 @@ import { NotificationsService } from '../services/notifications.service';
|
||||
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
|
||||
//import { AlertController } from 'ionic-angular';
|
||||
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core'; */
|
||||
import { Router } from '@angular/router';
|
||||
import { NavigationExtras,Router } from '@angular/router';
|
||||
|
||||
// import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
||||
import { ViewEventPage } from '../pages/agenda/view-event/view-event.page';
|
||||
@@ -87,7 +87,7 @@ export class HomePage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async count(){
|
||||
async count() {
|
||||
|
||||
let date = new Date();
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
@@ -172,33 +172,17 @@ export class HomePage implements OnInit {
|
||||
console.log("Successfully failue: " + failureResponse);
|
||||
}
|
||||
);
|
||||
async function notificationReceived(message) {
|
||||
alert(message.alert);
|
||||
console.log(message)
|
||||
|
||||
var notificationReceived = (message) => {
|
||||
console.log(message);
|
||||
var data = JSON.parse(message.payload);
|
||||
console.log(data.Service);
|
||||
console.log(data.IdObject);
|
||||
console.log(data.Object);
|
||||
|
||||
if (data.Service === "agenda") {
|
||||
//this.router.navigate(['/home/', service, IdObject, 'home']);
|
||||
this.viewEventDetail(data.IdObject)
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "expediente") {
|
||||
console.log('expediante 1')
|
||||
this.viewExpedientDetail(data.IdObject)
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "event-list") {
|
||||
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', IdObject])})
|
||||
this.openApproveModal(data.IdObject);
|
||||
}
|
||||
else if (data.Service === "accoes" && data.Object === "accao") {
|
||||
this.viewPublications(data.IdObject)
|
||||
alert(data.IdObject)
|
||||
}
|
||||
else if (data.Service === "accoes" && data.Object === "publicacao") {
|
||||
this.viewPublicationDetail(data.IdObject)
|
||||
if(message.actionName){
|
||||
this.notificatinsRoutes(data);
|
||||
} else {
|
||||
this.toastService.successMessage(message.alert);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -210,167 +194,45 @@ export class HomePage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async successMessage(message?: any, callback?) {
|
||||
|
||||
const enterAnimation = (baseEl: any) => {
|
||||
const backdropAnimation = this.animationController.create()
|
||||
.addElement(baseEl.querySelector('ion-backdrop')!)
|
||||
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
|
||||
|
||||
const wrapperAnimation = this.animationController.create()
|
||||
.addElement(baseEl.querySelector('.modal-wrapper')!)
|
||||
.keyframes([
|
||||
{ offset: 0, opacity: '1', right: '-100%' },
|
||||
{ offset: 1, opacity: '1', right: '0px' }
|
||||
]);
|
||||
|
||||
return this.animationController.create()
|
||||
.addElement(baseEl)
|
||||
.easing('ease-out')
|
||||
.duration(500)
|
||||
.addAnimation([backdropAnimation, wrapperAnimation]);
|
||||
notificatinsRoutes(data) {
|
||||
if (data.Service === "agenda") {
|
||||
//this.router.navigate(['/home/', service, IdObject, 'home']);
|
||||
//this.router.navigate(['/home/agenda', data.IdObject, 'agenda']);
|
||||
this.zone.run(() => this.viewEventDetail(data.IdObject));
|
||||
}
|
||||
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "expediente") {
|
||||
console.log('expediante 1')
|
||||
this.viewExpedientDetail(data.IdObject)
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "event-list") {
|
||||
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', IdObject])})
|
||||
this.zone.run(() =>this.openApproveModal(data.IdObject));
|
||||
}
|
||||
else if (data.Service === "accoes" && data.Object === "accao") {
|
||||
this.viewPublications(data.IdObject)
|
||||
alert(data.IdObject)
|
||||
}
|
||||
else if (data.Service === "accoes" && data.Object === "publicacao") {
|
||||
this.viewPublicationDetail(data.IdObject)
|
||||
}
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
enterAnimation,
|
||||
leaveAnimation,
|
||||
component: SuccessMessagePage,
|
||||
componentProps: {
|
||||
message: message || 'Processo efetuado',
|
||||
},
|
||||
cssClass: 'notification-modal'
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
setTimeout(() => {
|
||||
if (callback) {
|
||||
callback()
|
||||
}
|
||||
modal.dismiss()
|
||||
}, 7000)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// pushCordova() {
|
||||
|
||||
// if(this.platform.is('desktop')) {
|
||||
// console.log('Notifications not supported')
|
||||
// } else {
|
||||
|
||||
// this.fcm.onNotification().subscribe(data => {
|
||||
// this.viewEventDetail(data.IdObject)
|
||||
// if (data.wasTapped === true) {
|
||||
// console.log("Received in background: ", data);
|
||||
|
||||
// if (data.Service === "agenda") {
|
||||
// //this.router.navigate(['/home/', service, IdObject, 'home']);
|
||||
// this.viewEventDetail(data.IdObject)
|
||||
// }
|
||||
// else if (data.Service === "gabinete-digital" && data.Object === "expediente") {
|
||||
// console.log('expediante 1')
|
||||
// this.viewExpedientDetail(data.IdObject)
|
||||
// }
|
||||
// else if (data.Service === "gabinete-digital" && data.Object === "event-list") {
|
||||
// // this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', IdObject])})
|
||||
// this.openApproveModal(data.IdObject);
|
||||
// }
|
||||
// else if (data.Service === "accoes" && data.Object === "accao") {
|
||||
// this.viewPublications(data.IdObject)
|
||||
// alert(data.IdObject)
|
||||
// }
|
||||
// else if (data.Service === "accoes" && data.Object === "publicacao") {
|
||||
// this.viewPublicationDetail(data.IdObject)
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// console.log("Received in foreground: ", data);
|
||||
|
||||
// console.log(data.Service)
|
||||
// console.log(data.Object)
|
||||
// console.log(data.IdObject)
|
||||
|
||||
// };
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
async viewEventDetail(eventId: any) {
|
||||
console.log(this.profile);
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewEventPage,
|
||||
componentProps: {
|
||||
eventId: eventId,
|
||||
adding: this.adding
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res) => {
|
||||
if (res) {
|
||||
//this.viewEventDetailDismiss(res);
|
||||
}
|
||||
});
|
||||
console.log('home noti '+ eventId);
|
||||
this.router.navigate(['/home/agenda', eventId, 'agenda']);
|
||||
}
|
||||
|
||||
async openApproveModal(eventSerialNumber) {
|
||||
let classs;
|
||||
if (window.innerWidth <= 1024) {
|
||||
classs = 'cal-modal modal modal-desktop'
|
||||
} else {
|
||||
classs = 'gabinete-digital-mobile-modal-to-Desktop'
|
||||
}
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ApproveEventModalPage,
|
||||
componentProps: {
|
||||
serialNumber: eventSerialNumber,
|
||||
},
|
||||
cssClass: 'event-list',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss();
|
||||
let navigationExtras: NavigationExtras = {
|
||||
queryParams: {
|
||||
"serialNumber": eventSerialNumber,
|
||||
}
|
||||
};
|
||||
this.router.navigate(['/home/gabinete-digital/event-list/approve-event'], navigationExtras)
|
||||
}
|
||||
|
||||
async viewExpedientDetail(serialNumber: any) {
|
||||
let classs;
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
console.log(this.profile);
|
||||
console.log(serialNumber);
|
||||
console.log('expediante 2')
|
||||
const modal = await this.modalController.create({
|
||||
component: ExpedienteDetailPage,
|
||||
componentProps: {
|
||||
serialNumber: serialNumber,
|
||||
profile: "MDGPR",
|
||||
},
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res) => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
async viewExpedientDetail(serialNumber:any) {
|
||||
this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
|
||||
}
|
||||
|
||||
async viewPublicationDetail(publicationId: string) {
|
||||
|
||||
@@ -1176,6 +1176,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
// open component
|
||||
async viewEventDetail(eventId:any) {
|
||||
console.log('View event '+eventId)
|
||||
this.router.navigate(['/home/agenda', eventId, 'agenda']);
|
||||
/* console.log(this.profile);
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export class ViewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
/* console.log(this.eventId); */
|
||||
console.log('Notifi teste '+this.eventId);
|
||||
this.loadEvent();
|
||||
this.getAttachments();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user