mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer
This commit is contained in:
+44
-195
@@ -1,22 +1,13 @@
|
||||
//<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
|
||||
///<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
|
||||
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
|
||||
import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { EventsService } from '../services/events.service';
|
||||
import { Event } from '../models/event.model';
|
||||
import { ProcessesService } from '../services/processes.service';
|
||||
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 { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
||||
import { ViewEventPage } from '../pages/agenda/view-event/view-event.page';
|
||||
import { ExpedienteDetailPage } from '../pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page';
|
||||
import { ViewPublicationsPage } from '../pages/publications/view-publications/view-publications.page';
|
||||
import { ApproveEventModalPage } from '../pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page';
|
||||
import { PublicationDetailPage } from '../pages/publications/view-publications/publication-detail/publication-detail.page';
|
||||
|
||||
/* const { PushNotifications, LocalNotifications, LocalNotificationAction } = Plugins; */
|
||||
import { NavigationExtras,Router } from '@angular/router';
|
||||
import { ToastService } from '../services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@@ -53,13 +44,13 @@ export class HomePage implements OnInit {
|
||||
postEvent: any;
|
||||
folderId: string;
|
||||
|
||||
constructor(private zone: NgZone,
|
||||
private eventService: EventsService,
|
||||
private processesbackend: ProcessesService,
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
public modalCtrl: AlertController,
|
||||
// private fcm: FCM,
|
||||
constructor(private zone: NgZone,
|
||||
private eventService: EventsService,
|
||||
private processesbackend: ProcessesService,
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
public modalCtrl: AlertController,
|
||||
private toastService: ToastService,
|
||||
private animationController: AnimationController,
|
||||
private notificatinsservice: NotificationsService,
|
||||
private platform: Platform) {
|
||||
@@ -75,16 +66,20 @@ export class HomePage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(!this.platform.is('desktop')) {
|
||||
this.mobilefirstConnect();
|
||||
this.notificatinsservice.onReceviNotification();
|
||||
}
|
||||
this.count();
|
||||
|
||||
}
|
||||
|
||||
async count(){
|
||||
async count() {
|
||||
|
||||
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";
|
||||
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") {
|
||||
@@ -105,181 +100,35 @@ export class HomePage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
mobilefirstConnect() {
|
||||
WLAuthorizationManager.obtainAccessToken("").then(
|
||||
(token) => {
|
||||
console.log('MobileFirst Server connect: Success ' + token);
|
||||
|
||||
// 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);
|
||||
var resourceRequest = new WLResourceRequest("/adapters/javaAdapter/resource/greet/",
|
||||
WLResourceRequest.GET
|
||||
);
|
||||
|
||||
// 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);
|
||||
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");
|
||||
}); */
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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 viewPublicationDetail(publicationId: string) {
|
||||
const modal = await this.modalController.create({
|
||||
component: PublicationDetailPage,
|
||||
componentProps: {
|
||||
publicationId: publicationId,
|
||||
folderId: this.folderId,
|
||||
},
|
||||
cssClass: 'publication-detail modal modal-desktop',
|
||||
//backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(() => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async viewPublications(folderId) {
|
||||
|
||||
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: '0', transform: 'scale(0)' },
|
||||
{ offset: 1, opacity: '0.99', transform: 'scale(1)' }
|
||||
]);
|
||||
|
||||
return this.animationController.create()
|
||||
.addElement(baseEl)
|
||||
.easing('ease-out')
|
||||
.duration(500)
|
||||
.addAnimation([backdropAnimation, wrapperAnimation]);
|
||||
}
|
||||
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewPublicationsPage,
|
||||
enterAnimation,
|
||||
leaveAnimation,
|
||||
componentProps: {
|
||||
folderId: folderId,
|
||||
},
|
||||
cssClass: 'new-action',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1135,6 +1135,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();
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ export class LoginPage implements OnInit {
|
||||
} */
|
||||
|
||||
getToken() {
|
||||
// this.notificatinsservice.getAndpostToken(this.username);
|
||||
this.notificatinsservice.getAndpostToken(this.username);
|
||||
}
|
||||
|
||||
async Login() {
|
||||
@@ -133,7 +133,7 @@ export class LoginPage implements OnInit {
|
||||
if (attempt) {
|
||||
//this.loginRocketChat();
|
||||
this.authService.loginChat(this.userattempt);
|
||||
//this.getToken();
|
||||
this.getToken();
|
||||
|
||||
if(!this.pin) {
|
||||
this.setPint = true
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
|
||||
import { Injectable, NgZone } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
import { AuthConnstants } from 'src/app/config/auth-constants';
|
||||
import { Token } from '../models/token.model';
|
||||
// import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
||||
/* import { AgendaPage } from '../pages/agenda/agenda.page'
|
||||
import { ExpedientePage } from '../pages/gabinete-digital/expediente/expediente.page'
|
||||
import { EventListPage } from '../pages/gabinete-digital/event-list/event-list.page';
|
||||
import { PublicationsPage } from '../pages/publications/publications.page'
|
||||
import { ViewPublicationsPage } from '../pages/publications/view-publications/view-publications.page' */
|
||||
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
|
||||
import { ViewEventPage } from '../pages/agenda/view-event/view-event.page';
|
||||
import { ExpedienteDetailPage } from '../pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page';
|
||||
import { PublicationDetailPage } from '../pages/publications/publication-detail/publication-detail.page';
|
||||
import { ViewPublicationsPage } from '../pages/publications/view-publications/view-publications.page';
|
||||
import { ApproveEventModalPage } from '../pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page';
|
||||
import { NavigationExtras,Router } from '@angular/router';
|
||||
import { ToastService } from '../services/toast.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -27,17 +19,14 @@ export class NotificationsService {
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
// private fcm: FCM,
|
||||
private storageService: StorageService,
|
||||
private modalController: ModalController,
|
||||
public modalCtrl: AlertController,
|
||||
private animationController: AnimationController,
|
||||
private platform: Platform/* ,
|
||||
public agenda: AgendaPage,
|
||||
public expediante: ExpedientePage,
|
||||
public eventList: EventListPage,
|
||||
public publication: PublicationsPage,
|
||||
public viewPublication: ViewPublicationsPage */) { }
|
||||
private platform: Platform,
|
||||
private router: Router,
|
||||
private toastService: ToastService,
|
||||
private zone: NgZone) { }
|
||||
|
||||
getTokenByUserIdAndId(user, userID) {
|
||||
const geturl = environment.apiURL + 'notifications/user/' + userID;
|
||||
@@ -45,199 +34,137 @@ export class NotificationsService {
|
||||
return this.http.get<Token[]>(`${geturl}`);
|
||||
}
|
||||
|
||||
// getAndpostToken(username) {
|
||||
// if(this.platform.is('desktop')) {
|
||||
// console.log('Notifications not supported')
|
||||
// } else {
|
||||
|
||||
// const geturl = environment.apiURL + 'notifications/token';
|
||||
getAndpostToken(username) {
|
||||
if (this.platform.is('desktop')) {
|
||||
console.log('Notifications not supported')
|
||||
} else {
|
||||
|
||||
// return this.fcm.getToken().then(token => {
|
||||
// console.log('token: ', token)
|
||||
// this.storageService.store(username, token);
|
||||
// this.storageService.get(username).then(value => {
|
||||
// console.log('STORAGE TOKEN', value)
|
||||
// this.storageService.get(AuthConnstants.USER).then(res => {
|
||||
// console.log('USERID', res);
|
||||
// const headers = { 'Authorization': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
|
||||
// const body = {
|
||||
// UserId: res.UserId,
|
||||
// TokenId: token,
|
||||
// Status: 1,
|
||||
// Service: 1
|
||||
// };
|
||||
const geturl = environment.apiURL + 'notifications/token';
|
||||
|
||||
// this.http.post<Token>(`${geturl}`, body, { headers }).subscribe(data => {
|
||||
// console.log('TOKEN USER MIDLE', data);
|
||||
// })
|
||||
// });
|
||||
WLAuthorizationManager.obtainAccessToken("push.mobileclient").then(
|
||||
(token) => {
|
||||
console.log('Push Notification: Success ' + token);
|
||||
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
// }
|
||||
MFPPush.initialize(
|
||||
function (successResponse) {
|
||||
console.log("Push notification Successfully Service intialized: " + successResponse);
|
||||
},
|
||||
function (failureResponse) {
|
||||
console.log("Push notification failure Service intialized: " + failureResponse);
|
||||
}
|
||||
);
|
||||
|
||||
async onReceviNotification(viewEventDetail, viewExpedientDetail, openApproveModal, viewPublications, viewPublicationDetail) {
|
||||
// this.fcm.onNotification().subscribe(data => {
|
||||
// if (data.click_action) {
|
||||
// console.log("Received in background: ", data);
|
||||
MFPPush.registerDevice(null, (successResponse) => {
|
||||
console.log("Successfully registered: " + JSON.stringify(successResponse));
|
||||
console.log('token: ', successResponse.deviceId)
|
||||
this.storageService.store(username, successResponse.deviceId);
|
||||
this.storageService.get(username).then(value => {
|
||||
console.log('STORAGE TOKEN', value)
|
||||
this.storageService.get(AuthConnstants.USER).then(res => {
|
||||
console.log('USERID', res);
|
||||
const headers = { 'Authorization': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
|
||||
const body = {
|
||||
UserId: res.UserId,
|
||||
TokenId: successResponse.deviceId,
|
||||
Status: 1,
|
||||
Service: 1
|
||||
};
|
||||
this.http.post<Token>(`${geturl}`, body, { headers }).subscribe(data => {
|
||||
console.log('TOKEN USER MIDLE', data);
|
||||
})
|
||||
});
|
||||
|
||||
// if (data.Service === "agenda") {
|
||||
// viewEventDetail(data.IdObject)
|
||||
// }
|
||||
// else if (data.Service === "gabinete-digital" && data.Object === "expediente") {
|
||||
// console.log('expediante 1')
|
||||
// viewExpedientDetail(data.IdObject)
|
||||
// }
|
||||
// else if (data.Service === "gabinete-digital" && data.Object === "event-list") {
|
||||
// openApproveModal(data.IdObject);
|
||||
// }
|
||||
// else if (data.Service === "accoes" && data.Object === "accao") {
|
||||
// viewPublications(data.IdObject)
|
||||
// }
|
||||
// else if (data.Service === "accoes" && data.Object === "publicacao") {
|
||||
// viewPublicationDetail(data.IdObject)
|
||||
// }
|
||||
});
|
||||
},
|
||||
function (failureResponse) {
|
||||
console.log("Successfully failue: " + JSON.stringify(failureResponse));
|
||||
}
|
||||
);
|
||||
}, (error) => {
|
||||
console.log('Push notification recived: failure ' + error.responseText);
|
||||
console.log(JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// } /* else {
|
||||
// console.log("Received in foreground: ", data);
|
||||
}
|
||||
|
||||
// console.log(data.Service)
|
||||
// console.log(data.Object)
|
||||
// console.log(data.IdObject)
|
||||
// this.openApproveModal(data.IdObject);
|
||||
|
||||
// }; */
|
||||
// });
|
||||
async onReceviNotification() {
|
||||
WLAuthorizationManager.obtainAccessToken("push.mobileclient").then(
|
||||
(token) => {
|
||||
console.log('Push Notification: Success ' + token);
|
||||
|
||||
MFPPush.initialize(
|
||||
function (successResponse) {
|
||||
console.log("Push notification Successfully intialized: " + successResponse);
|
||||
MFPPush.registerNotificationsCallback(notificationReceived);
|
||||
},
|
||||
function (failureResponse) {
|
||||
console.log("Push notification failure intialized: " + failureResponse);
|
||||
}
|
||||
);
|
||||
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(message.actionName){
|
||||
this.notificatinsRoutes(data);
|
||||
} else {
|
||||
this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
|
||||
}
|
||||
|
||||
}
|
||||
}, (error) => {
|
||||
console.log('Push notification recived: failure ' + error.responseText);
|
||||
console.log(JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
notificatinsRoutes = (data) => {
|
||||
if (data.Service === "agenda") {
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', data.IdObject, 'agenda']));
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "expediente") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente',data.IdObject,'gabinete-digital']));
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "event-list") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "parecer") {
|
||||
let navigationExtras: NavigationExtras = {
|
||||
queryParams: {
|
||||
enterAnimation: "",
|
||||
serialNumber: data.IdObject,
|
||||
}
|
||||
};
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras));
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "deferimento") {
|
||||
let navigationExtras: NavigationExtras = {
|
||||
queryParams: {
|
||||
enterAnimation: "",
|
||||
serialNumber: data.IdObject,
|
||||
}
|
||||
};
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras));
|
||||
}
|
||||
else if (data.Service === "accoes" && data.Object === "accao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications',data.IdObject]));
|
||||
}
|
||||
else if (data.Service === "accoes" && data.Object === "publicacao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications/view-publications',data.FolderId,data.IdObject]));
|
||||
}
|
||||
}
|
||||
|
||||
platformVerify() {
|
||||
|
||||
|
||||
if (this.platform.is('cordova')) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
async viewEventDetail(eventId: any) {
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
async viewExpedientDetail(serialNumber: any) {
|
||||
let classs;
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
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 viewPublicationDetail(publicationId: string) {
|
||||
const modal = await this.modalController.create({
|
||||
component: PublicationDetailPage,
|
||||
componentProps: {
|
||||
publicationId: publicationId,
|
||||
folderId: this.folderId,
|
||||
},
|
||||
cssClass: 'publication-detail',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(() => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async viewPublications(folderId) {
|
||||
|
||||
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: '0', transform: 'scale(0)' },
|
||||
{ offset: 1, opacity: '0.99', transform: 'scale(1)' }
|
||||
]);
|
||||
|
||||
return this.animationController.create()
|
||||
.addElement(baseEl)
|
||||
.easing('ease-out')
|
||||
.duration(500)
|
||||
.addAnimation([backdropAnimation, wrapperAnimation]);
|
||||
}
|
||||
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewPublicationsPage,
|
||||
enterAnimation,
|
||||
leaveAnimation,
|
||||
componentProps: {
|
||||
folderId: folderId,
|
||||
},
|
||||
cssClass: 'new-action',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,4 +88,41 @@ export class ToastService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
async notificationMessage(message?: any, callback?: any,data?: any) {
|
||||
|
||||
let notification = document.createElement('div')
|
||||
notification.className = 'notificationPush'
|
||||
notification.innerHTML = `
|
||||
|
||||
<div class="main-content width-100 pa-20">
|
||||
<p class="message d-flex align-left">
|
||||
<p class="text">{{ message }}</p>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
`
|
||||
|
||||
let funcx = ()=>{
|
||||
callback(data);
|
||||
document.body.removeEventListener('click', funcx);
|
||||
notification.remove();
|
||||
}
|
||||
|
||||
document.body.append(notification)
|
||||
document.body.addEventListener('click', funcx);
|
||||
|
||||
notification.querySelector('.text').innerHTML = message || 'Processo efetuado'
|
||||
setTimeout(()=>{
|
||||
|
||||
notification.style.top = "-100%"
|
||||
|
||||
setTimeout(()=>{
|
||||
notification.remove()
|
||||
},1000)
|
||||
|
||||
},6000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* eslint-disable no-undef */
|
||||
/* eslint-disable no-restricted-globals */
|
||||
|
||||
const regex = /{{\s*([^}]+)\s*}}/g;
|
||||
var _pushVaribales = "";
|
||||
|
||||
function interpolate(messageData) {
|
||||
return function interpolate(o) {
|
||||
return messageData.replace(regex, function (a, b) {
|
||||
var r = o[b];
|
||||
return typeof r === 'string' || typeof r === 'number' ? r : a;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function createTemplateMessage(messageData) {
|
||||
if (Object.keys(_pushVaribales).length > 0 ) {
|
||||
var message = interpolate(messageData)(_pushVaribales);
|
||||
return message;
|
||||
} else {
|
||||
return messageData;
|
||||
}
|
||||
}
|
||||
|
||||
function displayNotification(event) {
|
||||
var messageJson = event.data.text();
|
||||
messageJson = JSON.parse(messageJson);
|
||||
var title = messageJson.title ? messageJson.title : "New message";
|
||||
var imageUrl = messageJson.iconUrl ? messageJson.iconUrl : "images/icon.png";
|
||||
// var tagJson = messageJson.payload;
|
||||
// var tag = tagJson.tag ? tagJson.tag : "";
|
||||
var bodyAlert = messageJson.alert ? messageJson.alert : "Example message"
|
||||
var payloadData = messageJson.payload ? messageJson.payload : "Example message"
|
||||
let messageTemp;
|
||||
if ((messageTemp = regex.exec(bodyAlert)) !== null) {
|
||||
bodyAlert = createTemplateMessage(bodyAlert);
|
||||
}
|
||||
self.registration.showNotification(title, {
|
||||
body: bodyAlert,
|
||||
icon: imageUrl,
|
||||
data: payloadData,
|
||||
// tag: tag
|
||||
});
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
function triggerSeenEvent(strMsg) {
|
||||
send_message_to_all_clients("msgEventSeen:" + strMsg);
|
||||
}
|
||||
|
||||
function triggerOpenEvent(strMsg) {
|
||||
send_message_to_all_clients("msgEventOpen:" + strMsg);
|
||||
}
|
||||
|
||||
function onPushNotificationReceived(event) {
|
||||
console.log('Push notification received : ', event);
|
||||
if (event.data) {
|
||||
console.log('Event data is : ', event.data.text());
|
||||
}
|
||||
event.waitUntil(displayNotification(event).then(() => triggerSeenEvent(event.data.text())));
|
||||
};
|
||||
|
||||
self.addEventListener('push', onPushNotificationReceived);
|
||||
|
||||
function send_message_to_client(client, msg) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var msg_chan = new MessageChannel();
|
||||
|
||||
msg_chan.port1.onmessage = function (event) {
|
||||
if (event.data.error) {
|
||||
reject(event.data.error);
|
||||
} else {
|
||||
resolve(event.data);
|
||||
}
|
||||
};
|
||||
|
||||
client.postMessage(msg, [msg_chan.port2]);
|
||||
});
|
||||
}
|
||||
|
||||
function send_message_to_all_clients(msg) {
|
||||
clients.matchAll().then(clients => {
|
||||
clients.forEach(client => {
|
||||
send_message_to_client(client, msg);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
self.addEventListener('install', function (event) {
|
||||
self.skipWaiting();
|
||||
console.log('Installed Service Worker : ', event);
|
||||
//event.postMessage("SW Says 'Hello back!'");
|
||||
});
|
||||
|
||||
self.addEventListener('message', function (event) {
|
||||
replyPort = event.ports[0];
|
||||
_pushVaribales = event.data;
|
||||
});
|
||||
|
||||
self.addEventListener('activate', function (event) {
|
||||
console.log('Activated Service Worker : ', event);
|
||||
event.waitUntil(self.clients.claim());
|
||||
});
|
||||
|
||||
self.addEventListener('notificationclick', function (event) {
|
||||
console.log('Notification clicked with tag' + event.notification.tag + " and data " + event.notification.data);
|
||||
let nidjson = event.notification.data;
|
||||
event.notification.close();
|
||||
event.waitUntil(triggerOpenEvent(nidjson));
|
||||
});
|
||||
|
||||
self.addEventListener('pushsubscriptionchange', function () {
|
||||
console.log('Push Subscription change');
|
||||
send_message_to_all_clients("updateRegistration:");
|
||||
});
|
||||
+26
-14
@@ -1,21 +1,33 @@
|
||||
function wlCommonInit() {
|
||||
|
||||
WLAuthorizationManager.obtainAccessToken()
|
||||
WLAuthorizationManager.obtainAccessToken("").then(
|
||||
(token) => {
|
||||
console.log('MobileFirst Server connect: Success ' + token);
|
||||
|
||||
.then(
|
||||
var resourceRequest = new WLResourceRequest("/adapters/javaAdapter/resource/greet/",
|
||||
WLResourceRequest.GET
|
||||
);
|
||||
|
||||
function (accessToken) {
|
||||
alert('Index sucsse: ', accessToken)
|
||||
|
||||
},
|
||||
|
||||
function (error) {
|
||||
alert('Index error: ', error)
|
||||
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
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");
|
||||
}); */
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ function wlCommonInit(){
|
||||
// Override the default Direct Update interface.
|
||||
|
||||
//uncomment below function to get custom DU
|
||||
wl_directUpdateChallengeHandler.handleDirectUpdate = function(directUpdateData, directUpdateContext) {
|
||||
wl_directUpdateChallengeHandler.handleDirectUpdate = function(directUpdateData, directUpdateContext) {
|
||||
// Create a dialog.
|
||||
navigator.notification.confirm(
|
||||
'Actualização Disponivel',
|
||||
@@ -14,9 +14,9 @@ function wlCommonInit(){
|
||||
wl_directUpdateChallengeHandler.submitFailure();
|
||||
}
|
||||
},
|
||||
'ctualização Disponivel',
|
||||
'Actualização Disponivel',
|
||||
['Actualizar']
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "com.gpr.gabinetedigital",
|
||||
"gcm_sender_id": "800733765231"
|
||||
}
|
||||
@@ -874,12 +874,56 @@ background: rgb(92, 92, 92);
|
||||
}
|
||||
}
|
||||
|
||||
.notificationPush{
|
||||
position: absolute;
|
||||
top: 23px;
|
||||
right: 0px;
|
||||
height: 87px;
|
||||
max-width: 400px;
|
||||
border-radius: 9px;
|
||||
-webkit-border-radius: 9px;
|
||||
-moz-border-radius: 9px;
|
||||
-ms-border-radius: 9px;
|
||||
-o-border-radius: 9px;
|
||||
background-color: white;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
background-image: url("/assets/background/background-circle-negative.svg");
|
||||
background-size: 686px 674px;
|
||||
background-position: center;
|
||||
background-position-y: 0px;
|
||||
background-repeat: no-repeat;
|
||||
min-width: 340px;
|
||||
box-shadow: 0px 2px 10px #0000003d;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
animation-name: notification-top;
|
||||
animation-duration: 1s;
|
||||
animation-timing-function: ease-in;
|
||||
transition: 1s;
|
||||
|
||||
.main-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.message {
|
||||
font-size: 12pt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@keyframes notification {
|
||||
from {right: -100%;}
|
||||
to {right: 0px;}
|
||||
}
|
||||
|
||||
@keyframes notification-top {
|
||||
from {top: -100%;}
|
||||
to {top: 23px;}
|
||||
}
|
||||
|
||||
|
||||
.calendar-component .monthview-container table.table tbody {
|
||||
tr:nth-child(n+6) {
|
||||
|
||||
+31
-1
@@ -7,8 +7,37 @@
|
||||
|
||||
<base href="/" />
|
||||
|
||||
<script src="assets/js/index.js"></script>
|
||||
<!-- <script src="assets/js/index.js"></script> -->
|
||||
<script src="assets/js/wldirectudpate.js"></script>
|
||||
<script>
|
||||
if (navigator.serviceWorker) {
|
||||
navigator.serviceWorker.register("assets/js/MFPPushServiceWorker.js").then(function(reg) {
|
||||
window.pushReg = reg;
|
||||
if (reg.installing) {
|
||||
console.info('Service worker installing');
|
||||
} else if (reg.waiting) {
|
||||
console.info('Service worker installed');
|
||||
} else if (reg.active) {
|
||||
console.info('Service worker active');
|
||||
}
|
||||
if (!(reg.showNotification)) {
|
||||
console.info('Notifications aren\'t supported on service workers.');
|
||||
}
|
||||
// Check if push messaging is supported
|
||||
if (!('PushManager' in window)) {
|
||||
console.info("Push messaging isn't supported.");
|
||||
}
|
||||
|
||||
if (Notification.permission === 'denied') {
|
||||
console.info('The user has blocked notifications.');
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error(JSON.stringify(err));
|
||||
});
|
||||
} else {
|
||||
console.info("Service workers aren't supported in this browser.");
|
||||
}
|
||||
</script>
|
||||
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<meta name="viewport" content="viewport-fit=cover, width=device-width, height=device-hight, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
@@ -19,6 +48,7 @@
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="assets/icon/favicon.png" />
|
||||
<link rel="manifest" href="assets/json/manifest.json">
|
||||
|
||||
<!-- add to homescreen for ios -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
|
||||
Reference in New Issue
Block a user