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:
@@ -34,7 +34,7 @@
|
|||||||
<ion-list>
|
<ion-list>
|
||||||
<div class="item cursor-pointer ion-no-padding ion-no-margin" lines="none"
|
<div class="item cursor-pointer ion-no-padding ion-no-margin" lines="none"
|
||||||
*ngFor = "let item of notificationdata; let i = index"
|
*ngFor = "let item of notificationdata; let i = index"
|
||||||
(click)="notificatinsRoutes(item.Service,item.Object,item.IdObject,item.FolderId)"
|
(click)="notificatinsRoutes(item.index,item.Service,item.Object,item.IdObject,item.FolderId)"
|
||||||
>
|
>
|
||||||
<div class="item-content width-100">
|
<div class="item-content width-100">
|
||||||
<div class="notification-item">
|
<div class="notification-item">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
///<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-jsonstore/typings/jsonstore.d.ts" />
|
///<reference path="../../../../plugins/cordova-plugin-mfp-jsonstore/typings/jsonstore.d.ts" />
|
||||||
import { Component, OnInit,NgZone } from '@angular/core';
|
import { Component, OnInit, NgZone } from '@angular/core';
|
||||||
import { Router,NavigationExtras } from '@angular/router';
|
import { Router, NavigationExtras } from '@angular/router';
|
||||||
import { AnimationController, ModalController } from '@ionic/angular';
|
import { AnimationController, ModalController } from '@ionic/angular';
|
||||||
import { User } from 'src/app/models/user.model';
|
import { User } from 'src/app/models/user.model';
|
||||||
import { AuthService } from 'src/app/services/auth.service';
|
import { AuthService } from 'src/app/services/auth.service';
|
||||||
@@ -9,6 +9,7 @@ import { LocalstoreService } from 'src/app/store/localstore.service';
|
|||||||
import { EditProfilePage } from './edit-profile/edit-profile.page';
|
import { EditProfilePage } from './edit-profile/edit-profile.page';
|
||||||
import { JsonStore } from '../../services/jsonStore.service';
|
import { JsonStore } from '../../services/jsonStore.service';
|
||||||
import { StorageService } from '../../services/storage.service';
|
import { StorageService } from '../../services/storage.service';
|
||||||
|
import { NotificationsService } from '../../services/notifications.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-profile',
|
selector: 'app-profile',
|
||||||
@@ -30,6 +31,7 @@ export class ProfilePage implements OnInit {
|
|||||||
private jsonstore: JsonStore,
|
private jsonstore: JsonStore,
|
||||||
private storageservice: StorageService,
|
private storageservice: StorageService,
|
||||||
private zone: NgZone,
|
private zone: NgZone,
|
||||||
|
private notificationservice: NotificationsService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.loggeduser = authService.ValidatedUser;
|
this.loggeduser = authService.ValidatedUser;
|
||||||
@@ -43,10 +45,11 @@ export class ProfilePage implements OnInit {
|
|||||||
this.storageservice.get("Notifications").then((value) => {
|
this.storageservice.get("Notifications").then((value) => {
|
||||||
|
|
||||||
var data = JSON.parse(value);
|
var data = JSON.parse(value);
|
||||||
data.forEach(element => {
|
data.forEach((element, i) => {
|
||||||
console.log("ARaaAA", element)
|
console.log("ARaaAA", element)
|
||||||
var payload = JSON.parse(element.payload)
|
var payload = JSON.parse(element.payload)
|
||||||
let notificationObject = {
|
let notificationObject = {
|
||||||
|
index: i,
|
||||||
alert: element.alert,
|
alert: element.alert,
|
||||||
Service: payload.Service,
|
Service: payload.Service,
|
||||||
Object: payload.Object,
|
Object: payload.Object,
|
||||||
@@ -75,64 +78,71 @@ export class ProfilePage implements OnInit {
|
|||||||
|
|
||||||
notImplemented() { }
|
notImplemented() { }
|
||||||
|
|
||||||
notificatinsRoutes = (Service,Object,IdObject,FolderId) => {
|
notificatinsRoutes = (index, Service, Object, IdObject, FolderId) => {
|
||||||
if (Service === "agenda") {
|
if (Service === "agenda") {
|
||||||
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
|
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
|
||||||
}
|
}
|
||||||
else if (Service === "gabinete-digital" && Object === "expediente") {
|
else if (Service === "gabinete-digital" && Object === "expediente") {
|
||||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente',IdObject,'gabinete-digital']));
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', IdObject, 'gabinete-digital']));
|
||||||
}
|
}
|
||||||
else if (Service === "gabinete-digital" && Object === "event-list") {
|
else if (Service === "gabinete-digital" && Object === "event-list") {
|
||||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'gabinete-digital']));
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event', IdObject, 'gabinete-digital']));
|
||||||
}else if (Service === "gabinete-digital" && Object === "despachos") {
|
} else if (Service === "gabinete-digital" && Object === "despachos") {
|
||||||
|
|
||||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos',IdObject,'gabinete-digital'],{replaceUrl: true}));
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', IdObject, 'gabinete-digital'], { replaceUrl: true }));
|
||||||
}
|
}
|
||||||
else if (Service === "gabinete-digital" && Object === "parecer") {
|
else if (Service === "gabinete-digital" && Object === "parecer") {
|
||||||
|
|
||||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos',IdObject,'gabinete-digital']));
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', IdObject, 'gabinete-digital']));
|
||||||
}
|
}
|
||||||
else if (Service === "gabinete-digital" && Object === "deferimento") {
|
else if (Service === "gabinete-digital" && Object === "deferimento") {
|
||||||
|
|
||||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos',IdObject,'gabinete-digital']));
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', IdObject, 'gabinete-digital']));
|
||||||
}
|
}
|
||||||
else if (Service === "gabinete-digital" && Object === "despachos-pr") {
|
else if (Service === "gabinete-digital" && Object === "despachos-pr") {
|
||||||
|
|
||||||
|
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/despachos-pr',IdObject,'gabinete-digital']));
|
||||||
|
}
|
||||||
|
else if (Service === "accoes" && Object === "accao") {
|
||||||
|
this.zone.run(() => this.router.navigate(['/home/publications', IdObject]));
|
||||||
|
}
|
||||||
|
else if (Service === "accoes" && Object === "publicacao") {
|
||||||
|
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', FolderId, IdObject]));
|
||||||
|
}
|
||||||
|
else if (Service === "gabinete-digital" && Object === "diplomas") {
|
||||||
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', IdObject, 'gabinete-digital']));
|
||||||
|
}
|
||||||
|
else if (Service === "gabinete-digital" && Object === "diplomas-assinar") {
|
||||||
let navigationExtras: NavigationExtras = {
|
let navigationExtras: NavigationExtras = {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
"serialNumber": IdObject,
|
"serialNumber": IdObject,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/despachos-pr/despacho-pr'], navigationExtras));
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar/diploma-assinar'], navigationExtras));
|
||||||
}
|
|
||||||
else if (Service === "accoes" && Object === "accao") {
|
|
||||||
this.zone.run(() => this.router.navigate(['/home/publications',IdObject]));
|
|
||||||
}
|
|
||||||
else if (Service === "accoes" && Object === "publicacao") {
|
|
||||||
this.zone.run(() => this.router.navigate(['/home/publications/view-publications',FolderId,IdObject]));
|
|
||||||
}
|
|
||||||
else if (Service === "gabinete-digital" && Object === "diplomas") {
|
|
||||||
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/diplomas', IdObject, 'gabinete-digital']));
|
|
||||||
}
|
|
||||||
else if (Service === "gabinete-digital" && Object === "diplomas-assinar") {
|
|
||||||
let navigationExtras: NavigationExtras = {
|
|
||||||
queryParams: {
|
|
||||||
"serialNumber": IdObject,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/diplomas-assinar/diploma-assinar'], navigationExtras));
|
|
||||||
}
|
}
|
||||||
else if (Service === "gabinete-digital" && Object === "expedientes-pr") {
|
else if (Service === "gabinete-digital" && Object === "expedientes-pr") {
|
||||||
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/expedientes-pr',IdObject,'gabinete-digital']));
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const indexx = this.notificationdata.indexOf(index, 0);
|
||||||
|
if (indexx > -1) {
|
||||||
|
this.notificationdata.splice(index, 1);
|
||||||
|
console.log('This notificatio', this.notificationdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.notificationservice.removeDepartment(index);
|
||||||
|
console.log('This notificatio 2', this.notificationdata);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
window.localStorage.clear();
|
window.localStorage.clear();
|
||||||
|
|
||||||
setTimeout(()=> {
|
setTimeout(() => {
|
||||||
this.router.navigateByUrl('/', { replaceUrl: true });
|
this.router.navigateByUrl('/', { replaceUrl: true });
|
||||||
},100)
|
}, 100)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,16 @@ export class NotificationsService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeDepartment(index): void {
|
||||||
|
/* this.DataArray[this.DataArray.findIndex(item => item.index == index)];
|
||||||
|
this.DataArray.splice( this.DataArray.findIndex(item => item.indexOf(index.to) === 'William'),1); */
|
||||||
|
const indexx = this.DataArray.indexOf(index, 0);
|
||||||
|
if (indexx > -1) {
|
||||||
|
this.DataArray.splice(index, 1);
|
||||||
|
console.log('This notificatio', this.DataArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async onReceviNotification() {
|
async onReceviNotification() {
|
||||||
|
|
||||||
if(window['WLAuthorizationManager']) {
|
if(window['WLAuthorizationManager']) {
|
||||||
@@ -185,6 +195,7 @@ export class NotificationsService {
|
|||||||
var notificationReceived = (message) => {
|
var notificationReceived = (message) => {
|
||||||
//this.jsonstore.createCollection('Notifications',message);
|
//this.jsonstore.createCollection('Notifications',message);
|
||||||
this.DataArray.push(message)
|
this.DataArray.push(message)
|
||||||
|
console.log("On ReceiveNotification", message)
|
||||||
this.storageService.store("Notifications",JSON.stringify(this.DataArray))
|
this.storageService.store("Notifications",JSON.stringify(this.DataArray))
|
||||||
|
|
||||||
console.log(message);
|
console.log(message);
|
||||||
@@ -196,7 +207,9 @@ export class NotificationsService {
|
|||||||
if(message.actionName){
|
if(message.actionName){
|
||||||
this.notificatinsRoutes(data);
|
this.notificatinsRoutes(data);
|
||||||
} else {
|
} else {
|
||||||
this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
|
/* this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data); */
|
||||||
|
//this.notificatinsRoutes(data);
|
||||||
|
console.log(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -234,12 +247,7 @@ export class NotificationsService {
|
|||||||
}
|
}
|
||||||
else if (data.Service === "gabinete-digital" && data.Object === "despachos-pr") {
|
else if (data.Service === "gabinete-digital" && data.Object === "despachos-pr") {
|
||||||
|
|
||||||
let navigationExtras: NavigationExtras = {
|
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/despachos-pr',data.IdObject,'gabinete-digital']));
|
||||||
queryParams: {
|
|
||||||
"serialNumber": data.IdObject,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/despachos-pr/despacho-pr'], navigationExtras));
|
|
||||||
}
|
}
|
||||||
else if (data.Service === "accoes" && data.Object === "accao") {
|
else if (data.Service === "accoes" && data.Object === "accao") {
|
||||||
this.zone.run(() => this.router.navigate(['/home/publications',data.IdObject]));
|
this.zone.run(() => this.router.navigate(['/home/publications',data.IdObject]));
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ const { Storage } = Plugins; */
|
|||||||
const ret = await this.storage.get(key).then((val) => { return val; });
|
const ret = await this.storage.get(key).then((val) => { return val; });
|
||||||
return JSON.parse(unescape(atob(ret)));
|
return JSON.parse(unescape(atob(ret)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async remove(key: string){
|
||||||
|
await this.storage.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Get the value
|
// Get the value
|
||||||
async get(storageKey: string) {
|
async get(storageKey: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user