mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
195 lines
6.7 KiB
TypeScript
195 lines
6.7 KiB
TypeScript
///<reference path="../../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
|
|
///<reference path="../../../../plugins/cordova-plugin-mfp-jsonstore/typings/jsonstore.d.ts" />
|
|
import { Component, OnInit,NgZone } from '@angular/core';
|
|
import { Router,NavigationExtras } from '@angular/router';
|
|
import { AnimationController, ModalController } from '@ionic/angular';
|
|
import { User } from 'src/app/models/user.model';
|
|
import { AuthService } from 'src/app/services/auth.service';
|
|
import { ToastService } from 'src/app/services/toast.service';
|
|
import { FingerprintPage } from 'src/app/shared/fingerprint/fingerprint.page';
|
|
import { PinPage } from 'src/app/shared/pin/pin.page';
|
|
import { LocalstoreService } from 'src/app/store/localstore.service';
|
|
import { EditProfilePage } from './edit-profile/edit-profile.page';
|
|
import { JsonStore } from '../../services/jsonStore.service';
|
|
import { StorageService } from '../../services/storage.service';
|
|
|
|
@Component({
|
|
selector: 'app-profile',
|
|
templateUrl: './profile.page.html',
|
|
styleUrls: ['./profile.page.scss'],
|
|
})
|
|
export class ProfilePage implements OnInit {
|
|
|
|
loggeduser: User;
|
|
userLoginPreference = ''
|
|
notificationdata: any[];
|
|
DataArray: Array<Object> = [];
|
|
|
|
constructor(private modalController: ModalController,
|
|
private authService: AuthService,
|
|
private animationController: AnimationController,
|
|
private router: Router,
|
|
private localstoreService: LocalstoreService,
|
|
private jsonstore: JsonStore,
|
|
private storageservice: StorageService,
|
|
private zone: NgZone,
|
|
) {
|
|
|
|
this.loggeduser = authService.ValidatedUser;
|
|
|
|
console.log(this.loggeduser.RoleDescription)
|
|
|
|
this.checkState()
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.storageservice.get("Notifications").then((value) => {
|
|
|
|
var data = JSON.parse(value);
|
|
data.forEach(element => {
|
|
console.log("ARaaAA", element)
|
|
var payload = JSON.parse(element.payload)
|
|
let notificationObject = {
|
|
alert: element.alert,
|
|
Service: payload.Service,
|
|
Object: payload.Object,
|
|
IdObject: payload.IdObject,
|
|
FolderId: payload.FolderId,
|
|
desc: payload.desc,
|
|
dateInit: payload.dateInit,
|
|
dateEnd: payload.dateEnd,
|
|
Location: payload.Location,
|
|
TypeAgenda: payload.TypeAgenda,
|
|
Status: payload.Status
|
|
}
|
|
|
|
this.DataArray.push(notificationObject)
|
|
});
|
|
this.notificationdata = this.DataArray
|
|
console.log("Notificaaa", this.notificationdata)
|
|
})
|
|
console.log("Notificaaa", this.notificationdata)
|
|
|
|
}
|
|
|
|
close() {
|
|
this.modalController.dismiss();
|
|
}
|
|
|
|
notImplemented() { }
|
|
|
|
notificatinsRoutes = (Service,Object,IdObject,FolderId) => {
|
|
if (Service === "agenda") {
|
|
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
|
|
}
|
|
else if (Service === "gabinete-digital" && Object === "expediente") {
|
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente',IdObject,'gabinete-digital']));
|
|
}
|
|
else if (Service === "gabinete-digital" && Object === "event-list") {
|
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'gabinete-digital']));
|
|
}else if (Service === "gabinete-digital" && Object === "despachos") {
|
|
|
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos',IdObject,'gabinete-digital'],{replaceUrl: true}));
|
|
}
|
|
else if (Service === "gabinete-digital" && Object === "parecer") {
|
|
|
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos',IdObject,'gabinete-digital']));
|
|
}
|
|
else if (Service === "gabinete-digital" && Object === "deferimento") {
|
|
|
|
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos',IdObject,'gabinete-digital']));
|
|
}
|
|
else if (Service === "gabinete-digital" && Object === "despachos-pr") {
|
|
|
|
let navigationExtras: NavigationExtras = {
|
|
queryParams: {
|
|
"serialNumber": IdObject,
|
|
}
|
|
};
|
|
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/despachos-pr/despacho-pr'], 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") {
|
|
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/expedientes-pr',IdObject,'gabinete-digital']));
|
|
}
|
|
}
|
|
|
|
logout() {
|
|
//const loader = this.toastService.loading();
|
|
// clear local storage
|
|
window.localStorage.clear();
|
|
|
|
setTimeout(() => {
|
|
window.location.pathname = '/'
|
|
location.reload();
|
|
}, 1000)
|
|
|
|
}
|
|
|
|
checkState() {
|
|
|
|
let userData = this.localstoreService.get('UserData', {})
|
|
|
|
if (userData.hasOwnProperty('loginPreference')) {
|
|
this.userLoginPreference = userData.loginPreference
|
|
} else {
|
|
this.userLoginPreference = ''
|
|
}
|
|
|
|
}
|
|
|
|
async editProfile() {
|
|
|
|
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]);
|
|
}
|
|
|
|
const leaveAnimation = (baseEl: any) => {
|
|
return enterAnimation(baseEl).direction('reverse');
|
|
}
|
|
|
|
|
|
const modal = await this.modalController.create({
|
|
enterAnimation,
|
|
leaveAnimation,
|
|
component: EditProfilePage,
|
|
cssClass: 'model profile-modal',
|
|
componentProps: {
|
|
}
|
|
});
|
|
return await modal.present();
|
|
}
|
|
|
|
}
|