mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Delete notifications bug fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { Router, NavigationExtras } from '@angular/router';
|
||||
import { AnimationController, ModalController,Platform } from '@ionic/angular';
|
||||
import { AnimationController, ModalController, Platform } from '@ionic/angular';
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { LocalstoreService } from 'src/app/store/localstore.service';
|
||||
@@ -28,7 +28,7 @@ export class ProfilePage implements OnInit {
|
||||
typeagenda2: "pessoal";
|
||||
pr: "100000014";
|
||||
md: "100000011";
|
||||
date:"60:20";
|
||||
date: "60:20";
|
||||
location: "Gabinete";
|
||||
|
||||
constructor(private modalController: ModalController,
|
||||
@@ -77,16 +77,18 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
notImplemented() { }
|
||||
|
||||
asyncNotification(){}
|
||||
asyncNotification() { }
|
||||
|
||||
async getNotificationData() {
|
||||
this.storageservice.get("Notifications").then((value) => {
|
||||
console.log("Init get store", value)
|
||||
|
||||
this.DataArray = []
|
||||
value.forEach((element,i) => {
|
||||
value.forEach((element, i) => {
|
||||
let notificationObject;
|
||||
if (element.data) {
|
||||
console.log("ARaaAA", element)
|
||||
let notificationObject = {
|
||||
notificationObject = {
|
||||
index: i,
|
||||
title: element.title,
|
||||
Service: element.data.Service,
|
||||
@@ -101,41 +103,23 @@ export class ProfilePage implements OnInit {
|
||||
Role: element.data.Role,
|
||||
Status: element.data.Status
|
||||
}
|
||||
/* if(element.payload){
|
||||
var payload = JSON.parse(element.payload)
|
||||
notificationObject = {
|
||||
//index: i,
|
||||
//alert: element.alert,
|
||||
Service: payload.Service,
|
||||
Object: payload.Object,
|
||||
IdObject: payload.IdObject,
|
||||
//FolderId: payload.FolderId,
|
||||
//desc: payload.desc,
|
||||
//dateInit: this.getFormatedTime(payload.dateInit),
|
||||
//dateEnd: this.getFormatedTime(payload.dateEnd),
|
||||
//Location: payload.Location,
|
||||
//TypeAgenda: payload.TypeAgenda,
|
||||
//Role: payload.Role,
|
||||
//Status: payload.Status
|
||||
}
|
||||
} else {
|
||||
notificationObject = {
|
||||
index: i,
|
||||
alert: element.alert,
|
||||
Service: element.Service,
|
||||
Object: element.Object,
|
||||
IdObject: element.IdObject,
|
||||
FolderId: element.FolderId,
|
||||
desc: element.desc,
|
||||
dateInit: element.dateInit,
|
||||
dateEnd: element.dateEnd,
|
||||
IdObject: element.IdObject,
|
||||
Location: element.Location,
|
||||
TypeAgenda: element.TypeAgenda,
|
||||
Object: element.Object,
|
||||
Role: element.Role,
|
||||
Status: element.Status
|
||||
Service: element.Service,
|
||||
Status: element.Status,
|
||||
TypeAgenda: element.TypeAgenda,
|
||||
body: element.body,
|
||||
dateEnd: element.dateEnd,
|
||||
dateInit: element.dateInit,
|
||||
index: element.index,
|
||||
title: element.title
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
this.DataArray.push(notificationObject)
|
||||
});
|
||||
@@ -149,20 +133,20 @@ export class ProfilePage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
getFormatedTime(dateString){
|
||||
getFormatedTime(dateString) {
|
||||
var date = new Date(dateString);
|
||||
var hours = date.getHours() > 12 ? date.getHours() - 12 : date.getHours();
|
||||
var am_pm = date.getHours() >= 12 ? "pm" : "am";
|
||||
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
||||
let time = hours + ":" + minutes /* + " " + am_pm */;
|
||||
console.log('Formate',time)
|
||||
console.log('Formate', time)
|
||||
return time;
|
||||
}
|
||||
|
||||
notificatinsRoutes = (index, Service, Object, IdObject, FolderId) => {
|
||||
|
||||
if (Service === "agenda" && IdObject.length > 10) {
|
||||
console.log("Id Lenght",IdObject.length)
|
||||
console.log("Id Lenght", IdObject.length)
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
|
||||
}
|
||||
else if (Service === "gabinete-digital" && Object === "expediente") {
|
||||
@@ -170,7 +154,7 @@ export class ProfilePage implements OnInit {
|
||||
}
|
||||
else if (Service === "agenda" && Object === "event-list") {
|
||||
//this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda']));
|
||||
this.zone.run(() =>this.router.navigate(['/home/agenda/event-list/approve-event',IdObject, 'agenda']));
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda']));
|
||||
|
||||
} else if (Service === "gabinete-digital" && Object === "despachos") {
|
||||
|
||||
@@ -186,7 +170,7 @@ export class ProfilePage implements OnInit {
|
||||
}
|
||||
else if (Service === "gabinete-digital" && Object === "despachos-pr") {
|
||||
|
||||
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/despachos-pr',IdObject,'gabinete-digital']));
|
||||
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]));
|
||||
@@ -199,7 +183,7 @@ export class ProfilePage implements OnInit {
|
||||
}
|
||||
else if (Service === "gabinete-digital" && Object === "diplomas-assinar") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar',IdObject,'gabinete-digital']));
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (Service === "gabinete-digital" && Object === "expedientes-pr") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
|
||||
@@ -215,13 +199,13 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
deleteNotification(index){
|
||||
deleteNotification(index) {
|
||||
console.log("Delete notification first stata", this.notificationdata)
|
||||
this.notificationdata = this.notificationdata.filter(item=>item.index !=index );
|
||||
this.notificationdata = this.notificationdata.filter(item => item.index != index);
|
||||
|
||||
this.storageservice.store("Notifications",JSON.stringify(this.notificationdata)).then(() =>{
|
||||
this.storageservice.get("Notifications").then((value) =>{
|
||||
console.log("notfication state", value, )
|
||||
this.storageservice.store("Notifications", JSON.stringify(this.notificationdata)).then(() => {
|
||||
this.storageservice.get("Notifications").then((value) => {
|
||||
console.log("notfication state", value,)
|
||||
});
|
||||
});
|
||||
console.log("Delete notification last stata", this.notificationdata)
|
||||
|
||||
Reference in New Issue
Block a user