mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix notification
This commit is contained in:
@@ -94,55 +94,59 @@
|
||||
<div class="notifications-content height-100">
|
||||
|
||||
<ion-list *ngIf="(notificationList$ | async) as notificationList">
|
||||
<div class="item cursor-pointer ion-no-padding ion-no-margin" lines="none"
|
||||
<div class=" cursor-pointer ion-no-padding ion-no-margin" lines="none"
|
||||
*ngFor="let item of notificationList; let i = index">
|
||||
|
||||
<div *ngIf="item.status==false && objectRead[item.notificationId] != true" class="item-conten1 item-conten-{{item.service}}-{{item.typeAgenda}}-{{item.role}}" (click)="notificatinsRoutes(item.index, item)">
|
||||
<div *ngIf="item.status==false " class="item">
|
||||
<div *ngIf="objectRead[item.notificationId] != true" class="item-conten1 item-conten-{{item.service}}-{{item.typeAgenda}}-{{item.role}}" (click)="notificatinsRoutes(item.index, item)">
|
||||
|
||||
<div class="notification-item">
|
||||
<img class="notification-icon" slot="end" *ngIf = "item.service == 'agenda'" src="assets/images/icons-default-agenda.svg" >
|
||||
<img class="notification-icon" slot="end" *ngIf = "item.service == 'gabinete-digital'" src="assets/images/icons-correspondencias.svg" >
|
||||
<img class="notification-icon" slot="end" *ngIf = "item.service == 'accoes'" src="assets/images/icons-nav-accoes-active.svg" >
|
||||
<img class="notification-icon" slot="end" *ngIf = "item.service == 'chat'" src="assets/images/icons-nav-agenda-active.svg" >
|
||||
<div class="notification-item">
|
||||
<img class="notification-icon" slot="end" *ngIf = "item.service == 'agenda'" src="assets/images/icons-default-agenda.svg" >
|
||||
<img class="notification-icon" slot="end" *ngIf = "item.service == 'gabinete-digital'" src="assets/images/icons-correspondencias.svg" >
|
||||
<img class="notification-icon" slot="end" *ngIf = "item.service == 'accoes'" src="assets/images/icons-nav-accoes-active.svg" >
|
||||
<img class="notification-icon" slot="end" *ngIf = "item.service == 'chat'" src="assets/images/icons-nav-agenda-active.svg" >
|
||||
</div>
|
||||
<div class="approve-event-time" *ngIf = "item.service == 'agenda'">
|
||||
<div *ngIf="isValidDate(item.dateInit)">
|
||||
<p *ngIf="toDateString(item.dateInit) == toDateString(item.dateEnd)">{{item.dateInit | date: 'HH:mm'}} </p>
|
||||
<p *ngIf="toDateString(item.dateInit) == toDateString(item.dateEnd)">{{item.dateEnd | date: 'HH:mm'}}</p>
|
||||
|
||||
<p *ngIf="toDateString(item.dateInit) != toDateString(item.dateEnd)">{{item.dateInit | date: 'd/M/yy' }}</p>
|
||||
<p *ngIf="toDateString(item.dateInit) != toDateString(item.dateEnd)">{{ item.dateEnd | date: 'dd/M/yy'}} </p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="approve-event-detail">
|
||||
<h3 id="profile-title">{{item.title}}</h3>
|
||||
<p *ngIf = "item.service == 'agenda'">{{item.location}}</p>
|
||||
<p id="profile-title" *ngIf = "item.service != 'agenda'">{{item.body}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="approve-event-time" *ngIf = "item.service == 'agenda'">
|
||||
<div *ngIf="isValidDate(item.dateInit)">
|
||||
<p *ngIf="toDateString(item.dateInit) == toDateString(item.dateEnd)">{{item.dateInit | date: 'HH:mm'}} </p>
|
||||
<p *ngIf="toDateString(item.dateInit) == toDateString(item.dateEnd)">{{item.dateEnd | date: 'HH:mm'}}</p>
|
||||
|
||||
<p *ngIf="toDateString(item.dateInit) != toDateString(item.dateEnd)">{{item.dateInit | date: 'd/M/yy' }}</p>
|
||||
<p *ngIf="toDateString(item.dateInit) != toDateString(item.dateEnd)">{{ item.dateEnd | date: 'dd/M/yy'}} </p>
|
||||
<div *ngIf="objectRead[item.notificationId] == true" >
|
||||
<div class="notification-item">
|
||||
<img class="notification-icon-error" slot="end" src="assets/images/exclamation_mark.svg" >
|
||||
</div>
|
||||
|
||||
<div class="approve-event-detail-error">
|
||||
<p id="profile-title-error">Possivelmente esta tarefa não foi criada ou já foi executada. Deseja dar a notificação como lida?</p>
|
||||
</div>
|
||||
|
||||
<div class="d-flex mt-10 width-100">
|
||||
<ion-buttons slot="start" class="buttonSize" >
|
||||
<button (click)="doNotKeppNotification(item)" class="btn-delete" fill="clear" >
|
||||
<ion-label style="color:#d30a0a;">Sim</ion-label>
|
||||
</button>
|
||||
<button (click)="keppNotification(item)" class="btn-cancel" fill="clear" color="#fff" >
|
||||
<ion-label>Não</ion-label>
|
||||
</button>
|
||||
</ion-buttons>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="approve-event-detail">
|
||||
<h3 id="profile-title">{{item.title}}</h3>
|
||||
<p *ngIf = "item.service == 'agenda'">{{item.location}}</p>
|
||||
<p id="profile-title" *ngIf = "item.service != 'agenda'">{{item.body}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="objectRead[item.notificationId] == true" >
|
||||
<div class="notification-item">
|
||||
<img class="notification-icon-error" slot="end" src="assets/images/exclamation_mark.svg" >
|
||||
</div>
|
||||
|
||||
<div class="approve-event-detail-error">
|
||||
<p id="profile-title-error">Possivelmente esta tarefa não foi criada ou já foi executada. Deseja dar a notificação como lida?</p>
|
||||
</div>
|
||||
|
||||
<div class="d-flex mt-10 width-100">
|
||||
<ion-buttons slot="start" class="buttonSize" >
|
||||
<button (click)="doNotKeppNotification(item)" class="btn-delete" fill="clear" >
|
||||
<ion-label style="color:#d30a0a;">Sim</ion-label>
|
||||
</button>
|
||||
<button (click)="keppNotification(item)" class="btn-cancel" fill="clear" color="#fff" >
|
||||
<ion-label>Não</ion-label>
|
||||
</button>
|
||||
</ion-buttons>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</ion-list>
|
||||
|
||||
|
||||
@@ -136,19 +136,15 @@ ion-list {
|
||||
.notifications-content {
|
||||
padding: 0px 20px;
|
||||
.item {
|
||||
.item-conten1{
|
||||
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07);
|
||||
border: solid 1px #e9e9e9;
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
color: #000;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07);
|
||||
border: solid 1px #e9e9e9;
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
color: #000;
|
||||
overflow: hidden;
|
||||
|
||||
.notification-item {
|
||||
width: fit-content;
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { NavigationExtras, Router } from '@angular/router';
|
||||
import { AnimationController, ModalController, Platform } from '@ionic/angular';
|
||||
import { AnimationController, ModalController } from '@ionic/angular';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { EditProfilePage } from './edit-profile/edit-profile.page';
|
||||
import { StorageService } from '../../services/storage.service';
|
||||
import { NotificationsService } from '../../services/notifications.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { EventTrigger } from '../../services/eventTrigger.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
@@ -19,7 +17,6 @@ import { NotificationRepositoryService } from 'src/app/module/notification/data/
|
||||
import { Observable } from 'rxjs';
|
||||
import { NotificationTable } from 'src/app/module/notification/data/infra/db/notification.db';
|
||||
import { isHttpError } from 'src/app/services/http.service';
|
||||
import { map, filter } from 'rxjs/operators';
|
||||
@Component({
|
||||
selector: 'app-profile',
|
||||
templateUrl: './profile.page.html',
|
||||
@@ -58,14 +55,10 @@ export class ProfilePage implements OnInit {
|
||||
private modalController: ModalController,
|
||||
private animationController: AnimationController,
|
||||
private router: Router,
|
||||
private storageservice: StorageService,
|
||||
private zone: NgZone,
|
||||
private platform: Platform,
|
||||
private eventTriger: EventTrigger,
|
||||
public ThemeService: ThemeService,
|
||||
private notificationService: NotificationsService,
|
||||
private processesService: ProcessesService,
|
||||
private eventsService: EventsService,
|
||||
private storageService: StorageService,
|
||||
public NotificationHolderService: NotificationHolderService,
|
||||
private authservice: AuthService,
|
||||
@@ -74,9 +67,6 @@ export class ProfilePage implements OnInit {
|
||||
private notificationRepositoryService: NotificationRepositoryService
|
||||
) {
|
||||
|
||||
this.notificationList$ = this.notificationRepositoryService.getNotificationLive().pipe(
|
||||
filter(data => data.some(item => item.status === false))
|
||||
)
|
||||
|
||||
window['e'] = () => {
|
||||
console.log(
|
||||
@@ -96,6 +86,12 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
|
||||
this.notificationRepositoryService.init()
|
||||
this.subscribe()
|
||||
}
|
||||
|
||||
subscribe() {
|
||||
this.notificationList$ = this.notificationRepositoryService.getNotificationLive()
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -134,89 +130,6 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
asyncNotification() { }
|
||||
|
||||
// async getNotificationData() {
|
||||
|
||||
// //const keyExist = await this.storageservice.keyExist("Notifications")
|
||||
|
||||
// //if(keyExist) {
|
||||
// await this.storageservice.get("Notifications").then((value) => {
|
||||
|
||||
// console.log('Getnotifications 111', value)
|
||||
|
||||
// this.DataArray = []
|
||||
// value.forEach((element, i) => {
|
||||
// console.log('Getnotifications', element, i)
|
||||
// let notificationObject;
|
||||
// if (element.notification) {
|
||||
|
||||
// notificationObject = {
|
||||
// index: i,
|
||||
// title: element.notification.title,
|
||||
// Service: element.data.Service,
|
||||
// Object: element.data.Object,
|
||||
// IdObject: element.data.IdObject,
|
||||
// FolderId: element.data.FolderId,
|
||||
// body: element.notification.body,
|
||||
// dateInit: this.getFormatedTime(element.data.dateInit),
|
||||
// dateEnd: this.getFormatedTime(element.data.dateEnd),
|
||||
// Location: element.data.Location,
|
||||
// TypeAgenda: element.data.TypeAgenda,
|
||||
// Role: element.data.Role,
|
||||
// Status: element.data.Status,
|
||||
// read: false,
|
||||
// }
|
||||
|
||||
// } else if (element.data) {
|
||||
// notificationObject = {
|
||||
// index: i,
|
||||
// title: element.title,
|
||||
// Service: element.data.Service,
|
||||
// Object: element.data.Object,
|
||||
// IdObject: element.data.IdObject,
|
||||
// FolderId: element.data.FolderId,
|
||||
// body: element.body,
|
||||
// dateInit: this.getFormatedTime(element.data.dateInit),
|
||||
// dateEnd: this.getFormatedTime(element.data.dateEnd),
|
||||
// Location: element.data.Location,
|
||||
// TypeAgenda: element.data.TypeAgenda,
|
||||
// Role: element.data.Role,
|
||||
// Status: element.data.Status,
|
||||
// read: false,
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// {
|
||||
// notificationObject = {
|
||||
// FolderId: element.FolderId,
|
||||
// IdObject: element.IdObject,
|
||||
// Location: element.Location,
|
||||
// Object: element.Object,
|
||||
// Role: element.Role,
|
||||
// Service: element.Service,
|
||||
// Status: element.Status,
|
||||
// TypeAgenda: element.TypeAgenda,
|
||||
// body: element.body,
|
||||
// dateEnd: element.dateEnd,
|
||||
// dateInit: element.dateInit,
|
||||
// index: element.index,
|
||||
// title: element.title,
|
||||
// read: false,
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// this.DataArray.push(notificationObject)
|
||||
// });
|
||||
// this.notificationdata = this.DataArray.reverse();
|
||||
// }).catch((error) => {
|
||||
// console.error('storage getnotification: ', error)
|
||||
// })
|
||||
// // }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
getFormatedTime(dateString) {
|
||||
var date = new Date(dateString);
|
||||
var hours = date.getHours() /* > 12 ? date.getHours() - 12 : date.getHours() */;
|
||||
@@ -229,9 +142,6 @@ export class ProfilePage implements OnInit {
|
||||
@XTracerAsync({name:'profile/notificationClick', bugPrint: true, module:'notification'})
|
||||
async notificatinsRoutes (index, item: NotificationTable, tracing?: TracingType) {
|
||||
|
||||
|
||||
console.log({item})
|
||||
|
||||
try {
|
||||
if (item.service === "agenda") {
|
||||
this.isloading = true
|
||||
@@ -243,7 +153,13 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
if(res.isOk()) {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', item.idObject, 'agenda']));
|
||||
|
||||
if(res.value.Status == 'Pending') {
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', item.idObject, 'agenda']));
|
||||
} else {
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', item.idObject, 'agenda']));
|
||||
}
|
||||
|
||||
this.deleteNotification(item);
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
} else {
|
||||
@@ -268,7 +184,7 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
this.isloading = false
|
||||
|
||||
} else if (item.service === "agenda" && item.object === "event-list") {
|
||||
} else if (item.service === "event-list" || item.object === "event-list") {
|
||||
this.isloading = true
|
||||
|
||||
if(item.idObject) {
|
||||
|
||||
@@ -9,6 +9,7 @@ export class SearchList {
|
||||
docId: number;
|
||||
subject: string;
|
||||
applicationId: number
|
||||
eventStatus?: number
|
||||
}
|
||||
|
||||
export class SearchList_v2 {
|
||||
|
||||
@@ -36,10 +36,18 @@ export class LocalNotificationService {
|
||||
async updateNotifications(data: NotificationTable[]) {
|
||||
// db.eve
|
||||
try {
|
||||
const result = await NotificationDataSource.notification.bulkUpdate(data.map(e => ({
|
||||
key: e.notificationId,
|
||||
changes: { status: e.status }
|
||||
})))
|
||||
const result = await NotificationDataSource.notification.bulkDelete(data.map(e => e.notificationId))
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
return err(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async deleteNotifications(data: NotificationTable[]) {
|
||||
// db.eve
|
||||
try {
|
||||
const result = await NotificationDataSource.notification.bulkDelete(data.map(e => e.notificationId))
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
return err(false)
|
||||
@@ -58,6 +66,46 @@ export class LocalNotificationService {
|
||||
return result.success;
|
||||
});
|
||||
|
||||
// Add valid notifications to the database
|
||||
if (validNotifications.length > 0) {
|
||||
|
||||
} else {
|
||||
console.log('No valid notifications to add.');
|
||||
}
|
||||
|
||||
console.log({failed})
|
||||
|
||||
return ok(failed)
|
||||
}
|
||||
|
||||
async clearAndAddRecords(notifications: NotificationTable[]) {
|
||||
try {
|
||||
await NotificationDataSource.transaction('rw', NotificationDataSource.notification, async () => {
|
||||
// Clear existing records from myTable
|
||||
await NotificationDataSource.notification.clear();
|
||||
|
||||
await NotificationDataSource.notification.bulkAdd(notifications);
|
||||
|
||||
});
|
||||
console.log('Clear and add operations completed within transaction.');
|
||||
} catch (error) {
|
||||
console.error('Error performing transaction:', error, notifications);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async addRemove(notifications: NotificationTable[]) {
|
||||
// Validate each notification
|
||||
const failed = []
|
||||
const validNotifications = notifications.filter(notification => {
|
||||
const result = NotificationTableSchema.safeParse(notification);
|
||||
|
||||
if(!result.success) {
|
||||
failed.push(notification)
|
||||
}
|
||||
return result.success;
|
||||
});
|
||||
|
||||
// Add valid notifications to the database
|
||||
if (validNotifications.length > 0) {
|
||||
await NotificationDataSource.notification.bulkAdd(validNotifications);
|
||||
@@ -73,6 +121,19 @@ export class LocalNotificationService {
|
||||
getNotificationLive() {
|
||||
return from(liveQuery( () => {
|
||||
return NotificationDataSource.notification.orderBy('createdAt').reverse().toArray()
|
||||
.then(notifications => {
|
||||
return notifications.filter(notification => notification.status === false)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
getNotificationLiveCount() {
|
||||
return from(liveQuery( () => {
|
||||
return NotificationDataSource.notification
|
||||
.toArray()
|
||||
.then(notifications => {
|
||||
return notifications.filter(notification => notification.status === false).length
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -21,5 +21,5 @@ export const NotificationDataSource = new Dexie('NotificationDataSource') as Dex
|
||||
};
|
||||
|
||||
NotificationDataSource.version(1).stores({
|
||||
notification: 'notificationId, title, service, object, idObject, folderId, dateInit, dateEnd, location, createdAt'
|
||||
notification: 'notificationId, title, service, object, idObject, folderId, dateInit, dateEnd, location, createdAt, status'
|
||||
});
|
||||
|
||||
@@ -5,7 +5,6 @@ import { FirebasePushNotificationService } from './datasource/firebase-push-noti
|
||||
import { LocalNotificationService } from './datasource/local-notification.service'
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { NotificationListMapper } from '../domain/mapper/notificationListMapper';
|
||||
import { NotificationListChanges } from './async/changes/notificationListChange';
|
||||
import { NotificationTable } from './infra/db/notification.db';
|
||||
|
||||
@Injectable({
|
||||
@@ -27,32 +26,33 @@ export class NotificationRepositoryService {
|
||||
})
|
||||
|
||||
|
||||
this.init()
|
||||
if(SessionStore.user.UserId) {
|
||||
this.init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async init() {
|
||||
const result = await this.getNotification({
|
||||
PageNumber: "1",
|
||||
PageSize: "50",
|
||||
PageSize: "100",
|
||||
userId: SessionStore.user.UserId.toString()
|
||||
})
|
||||
|
||||
if(result.isOk()) {
|
||||
console.log('notification-list', result.value.data.result)
|
||||
// console.log('notification-list', result.value.data.result)
|
||||
|
||||
const serverListFiltered = result.value.data.result.filter( e => e.body != 'Foi editado um evento na vossa agenda' && e.body != 'Foi apagado um evento na vossa agenda')
|
||||
result.value.data.result = serverListFiltered
|
||||
|
||||
if(result.value.data.result.length >= 1) {
|
||||
const localList = await this.LocalNotificationService.getNotification()
|
||||
const serverList = NotificationListMapper(result.value)
|
||||
const { insert, update } = NotificationListChanges(localList, serverList)
|
||||
// const localList = await this.LocalNotificationService.getNotification()
|
||||
// const serverList = NotificationListMapper(result.value)
|
||||
// const { insert, update, remove } = NotificationListChanges(localList, serverList)
|
||||
|
||||
console.log({insert, update})
|
||||
this.LocalNotificationService.addNotifications(insert)
|
||||
|
||||
this.LocalNotificationService.updateNotifications(update)
|
||||
// this.LocalNotificationService.addNotifications.
|
||||
this.LocalNotificationService.clearAndAddRecords(NotificationListMapper(result.value))
|
||||
|
||||
} else {
|
||||
this.LocalNotificationService.clear()
|
||||
}
|
||||
@@ -68,6 +68,10 @@ export class NotificationRepositoryService {
|
||||
return this.LocalNotificationService.getNotificationLive()
|
||||
}
|
||||
|
||||
getNotificationLiveCount() {
|
||||
return this.LocalNotificationService.getNotificationLiveCount()
|
||||
}
|
||||
|
||||
async notificationStatus(item: NotificationTable) {
|
||||
await this.RemoteNotificationService.notificationStatus(item.notificationId)
|
||||
item.status = true
|
||||
@@ -92,4 +96,9 @@ export class NotificationRepositoryService {
|
||||
this.init()
|
||||
return
|
||||
}
|
||||
|
||||
clearData() {
|
||||
return this.LocalNotificationService.clear()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import { StorageService } from 'src/app/services/storage.service';
|
||||
import { DeviceService } from 'src/app/services/device.service'
|
||||
import { Cy } from 'cypress/enum'
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
import { NotificationRepositoryService } from 'src/app/module/notification/data/notification-repository.service'
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
templateUrl: './login.page.html',
|
||||
@@ -66,6 +66,7 @@ export class LoginPage implements OnInit {
|
||||
private NotificationHolderService: NotificationHolderService,
|
||||
private DeviceService: DeviceService,
|
||||
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
||||
private NotificationRepositoryService: NotificationRepositoryService
|
||||
) { }
|
||||
|
||||
ngOnInit() { }
|
||||
@@ -161,6 +162,8 @@ export class LoginPage implements OnInit {
|
||||
await this.authService.loginToChatWs();
|
||||
this.ChatService.setheader()
|
||||
|
||||
this.NotificationRepositoryService.init()
|
||||
|
||||
} catch(error) {
|
||||
console.log("faild to clear chat")
|
||||
}
|
||||
@@ -178,6 +181,8 @@ export class LoginPage implements OnInit {
|
||||
} else {
|
||||
|
||||
|
||||
await this.NotificationRepositoryService.clearData()
|
||||
|
||||
await this.AgendaDataRepositoryService.clearSharedCalendar()
|
||||
this.RochetChatConnectorService.logout();
|
||||
this.clearStoreService.clear();
|
||||
@@ -191,6 +196,7 @@ export class LoginPage implements OnInit {
|
||||
this.storage.clear();
|
||||
|
||||
await this.authService.SetSession(attempt, this.userattempt);
|
||||
this.NotificationRepositoryService.init()
|
||||
/* CPSession.save(data) */
|
||||
this.changeProfileService.run();
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import { SessionStore } from 'src/app/store/session.service';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { isHttpError } from 'src/app/services/http.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { EEventFilterStatus } from 'src/app/services/Repositorys/Agenda/model/enums';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -388,7 +389,7 @@ export class SearchPage implements OnInit {
|
||||
}
|
||||
|
||||
if (this.type == "Agenda") {
|
||||
|
||||
this.showLoader = true
|
||||
|
||||
|
||||
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
|
||||
@@ -397,7 +398,11 @@ export class SearchPage implements OnInit {
|
||||
|
||||
} else {
|
||||
|
||||
const searchEvents = await this.agendaDataRepository.searchEvent({value: this.searchSubject.trim() }, tracing)
|
||||
const searchEvents = await this.agendaDataRepository.searchEvent({
|
||||
value: this.searchSubject.trim(),
|
||||
status: EEventFilterStatus.AllToCommunicate
|
||||
|
||||
}, tracing)
|
||||
if(searchEvents.isOk()) {
|
||||
|
||||
this.showDocuments = true;
|
||||
@@ -468,6 +473,8 @@ export class SearchPage implements OnInit {
|
||||
// // console.log(error)
|
||||
// });
|
||||
}
|
||||
|
||||
this.showLoader = false
|
||||
}
|
||||
else if (this.type == "AccoesPresidenciais & ArquivoDespachoElect" && this.eventAgenda == true) {
|
||||
this.showLoader = true;
|
||||
|
||||
@@ -108,7 +108,7 @@ export class AgendaDataRepositoryService {
|
||||
|
||||
}
|
||||
|
||||
async searchEvent(queryParameters: {value}, tracing?: TracingType) {
|
||||
async searchEvent(queryParameters: {value, status}, tracing?: TracingType) {
|
||||
const result = await this.agendaDataService.searchEvent(queryParameters)
|
||||
return result.map( response => {
|
||||
APINODReturn(EventListDataOutputDTOSchema, response, 'get/Events', tracing)
|
||||
|
||||
@@ -74,7 +74,7 @@ export class AgendaDataService {
|
||||
return this.http.get<any>(`${this.baseUrl}/Events`, { params });
|
||||
}
|
||||
|
||||
searchEvent(queryParameter: {value}) {
|
||||
searchEvent(queryParameter: {value, status}) {
|
||||
return this.httpService.get<EventListOutputDTO>(`${this.baseUrl}/Events`, queryParameter);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ export class EventMapper {
|
||||
// "RoleDescription": null,
|
||||
// "RoleId": 0
|
||||
})),
|
||||
"Status": status,
|
||||
"IsMeeting": category,
|
||||
"IsRecurring": dto.isRecurring,
|
||||
"IsAllDayEvent": dto.isAllDayEvent,
|
||||
|
||||
@@ -79,6 +79,13 @@ export class EventToApproveDetailsMapper {
|
||||
|
||||
|
||||
|
||||
let status;
|
||||
if(dto.status == EEventStatus.Pending) {
|
||||
status = 'Pending'
|
||||
} else if(dto.status == EEventStatus.Revision) {
|
||||
status = 'Revision'
|
||||
}
|
||||
|
||||
return {
|
||||
"owner": dto.owner,
|
||||
"serialNumber": dto.id,
|
||||
@@ -119,7 +126,7 @@ export class EventToApproveDetailsMapper {
|
||||
// "MDName": "Eduardo Vilarinho",
|
||||
// "MDEmail": "evilarinho@gabinetedigital.local",
|
||||
// "OriginatorComments": "",
|
||||
"Status": "Active",
|
||||
"Status": status,
|
||||
"TimeZone": getTextInsideParentheses(new Date(dto.startDate)+ ''),
|
||||
"Agenda": category ,
|
||||
"EventType": dto.type,
|
||||
|
||||
@@ -176,7 +176,7 @@ export class NotificationsService {
|
||||
|
||||
notificatinsRoutes = (notification) => {
|
||||
|
||||
console.log('BACK BACK',notification)
|
||||
console.log('BACK BACK 32',notification)
|
||||
|
||||
if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) {
|
||||
|
||||
|
||||
@@ -14,9 +14,7 @@ import { notificationObject } from '../models/notifications';
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import { AngularFireMessaging } from '@angular/fire/messaging';
|
||||
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { FCM } from '@capacitor-community/fcm';
|
||||
import { ChatSystemService } from './chat/chat-system.service';
|
||||
import {ChatController} from 'src/app/controller/chat'
|
||||
import { TracingType, XTracer, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { z } from 'zod';
|
||||
@@ -73,7 +71,7 @@ export class NotificationsService {
|
||||
private NotificationRepositoryService: NotificationRepositoryService) {
|
||||
|
||||
// this.onReciveForeground();
|
||||
// this.onReciveBackground();
|
||||
this.onReciveBackground();
|
||||
|
||||
}
|
||||
|
||||
@@ -363,64 +361,70 @@ export class NotificationsService {
|
||||
}
|
||||
|
||||
|
||||
@XTracer({name:'Notification/notificatinsRoutes', bugPrint: true, module:'notification'})
|
||||
@XTracer({name:'phone-notification/notificationRoutes', bugPrint: true, module:'notification'})
|
||||
notificatinsRoutes (notification, tracing?: TracingType) {
|
||||
|
||||
try {
|
||||
|
||||
console.log('BACK BACK', notification)
|
||||
console.log('BACK BACK 12', notification)
|
||||
|
||||
if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) {
|
||||
if (notification.notification.data.service === "agenda" ) {
|
||||
const data = JSON.parse(notification.notification.data.item)
|
||||
if(data.status == 1) {
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.notification.data.idObject, 'agenda']));
|
||||
} else {
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.idObject, 'agenda']));
|
||||
}
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.IdObject, 'agenda']));
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.idObject, 'agenda']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
else if (notification.notification.data.service === "gabinete-digital" && notification.notification.data.object === "expedientes") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.idObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "agenda" && notification.notification.data.Object === "event-list") {
|
||||
else if (notification.notification.data.service === "agenda" && notification.notification.data.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', notification.notification.data.IdObject, 'agenda']));
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.notification.data.idObject, 'agenda']));
|
||||
|
||||
} else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos") {
|
||||
} else if (notification.notification.data.service === "gabinete-digital" && notification.notification.data.object === "despachos") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true }));
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.notification.data.idObject, 'gabinete-digital'], { replaceUrl: true }));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "parecer") {
|
||||
else if (notification.notification.data.service === "gabinete-digital" && notification.notification.data.object === "parecer") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.idObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "deferimento") {
|
||||
else if (notification.notification.data.service === "gabinete-digital" && notification.notification.data.object === "deferimento") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.idObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos-pr") {
|
||||
else if (notification.notification.data.service === "gabinete-digital" && notification.notification.data.object === "despachos-pr") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.notification.data.idObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "accao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications', notification.notification.data.IdObject]));
|
||||
else if (notification.notification.data.service === "accoes" && notification.notification.data.object === "accao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications', notification.notification.data.idObject]));
|
||||
}
|
||||
else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "publicacao") {
|
||||
else if (notification.notification.data.service === "accoes" && notification.notification.data.object === "publicacao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.notification.data.FolderId, notification.data.IdObject]));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
else if (notification.notification.data.service === "gabinete-digital" && notification.notification.data.object === "diplomas") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.idObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas-assinar") {
|
||||
else if (notification.notification.data.service === "gabinete-digital" && notification.notification.data.object === "diplomas-assinar") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', notification.notification.data.idObject, 'gabinete-digital']));
|
||||
}
|
||||
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diploma-revisao") {
|
||||
else if (notification.notification.data.service === "gabinete-digital" && notification.notification.data.object === "diploma-revisao") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.idObject, 'gabinete-digital']));
|
||||
}
|
||||
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
} else if (notification.notification.data.Service === "chat") {
|
||||
else if (notification.notification.data.service === "gabinete-digital" && notification.notification.data.object === "expedientes-pr") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.idObject, 'gabinete-digital']));
|
||||
} else if (notification.notification.data.service === "chat") {
|
||||
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "roomId": notification.notification.data.IdObject, } };
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "roomId": notification.notification.data.idObject, } };
|
||||
|
||||
if (window.location.search.includes("roomId")) {
|
||||
this.zone.run(() => this.router.navigate(['/home/chat']));
|
||||
|
||||
@@ -75,9 +75,9 @@
|
||||
|
||||
|
||||
|
||||
<div class="profile-text">
|
||||
<div *ngIf="NotificationHolderService.notificationList.length > 0" class="icon-badge" style="right: -6px;top: 38px;top: -6px;">
|
||||
{{NotificationHolderService.notificationList.length}} </div>
|
||||
<div class="profile-text" *ngIf="(notificationCount$ | async) as notificationCount ">
|
||||
<div *ngIf="notificationCount > 0" class="icon-badge" style="right: -6px;top: 38px;top: -6px;">
|
||||
{{notificationCount}} </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -243,9 +243,10 @@
|
||||
<img class="profile-image font-45-em image-prety" src={{profilePicture}}>
|
||||
</div>
|
||||
|
||||
<div class="profile-text">
|
||||
<div *ngIf="NotificationHolderService.notificationList.length > 0" class="icon-badge" style="right: -6px;top: 38px;top: -6px;">
|
||||
{{NotificationHolderService.notificationList.length}} </div>
|
||||
<div class="profile-text" *ngIf="(notificationCount$ | async) as notificationCount ">
|
||||
|
||||
<div *ngIf="notificationCount > 0" class="icon-badge" style="right: -6px;top: 38px;top: -6px;">
|
||||
{{notificationCount}} </div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -19,6 +19,8 @@ import { NotificationHolderService } from 'src/app/store/notification-holder.ser
|
||||
import { HeaderSettingsService } from "src/app/services/header-settings.service"
|
||||
import { PublicationHolderService } from 'src/app/services/publication/publication-holder.service'
|
||||
import { Cy } from 'cypress/enum'
|
||||
import { NotificationRepositoryService } from 'src/app/module/notification/data/notification-repository.service';
|
||||
import { Observable } from 'rxjs';
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
templateUrl: './header.page.html',
|
||||
@@ -56,6 +58,8 @@ export class HeaderPage implements OnInit {
|
||||
|
||||
Cy = Cy
|
||||
|
||||
notificationCount$: Observable<number>
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
@@ -74,8 +78,16 @@ export class HeaderPage implements OnInit {
|
||||
private attachmentService: AttachmentsService,
|
||||
public NotificationHolderService: NotificationHolderService,
|
||||
public HeaderSettingsService: HeaderSettingsService,
|
||||
public PublicationHolderService: PublicationHolderService
|
||||
public PublicationHolderService: PublicationHolderService,
|
||||
private notificationRepositoryService: NotificationRepositoryService
|
||||
) {
|
||||
|
||||
this.notificationCount$ = this.notificationRepositoryService.getNotificationLiveCount()
|
||||
|
||||
this.notificationCount$.subscribe(count => {
|
||||
console.log('Notification Count:', count);
|
||||
});
|
||||
|
||||
this.loggeduser = SessionStore.user;
|
||||
router.events.subscribe((val) => {
|
||||
this.hideSearch();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
export let versionData = {
|
||||
"shortSHA": "11587cc94",
|
||||
"SHA": "11587cc944ab205b6f03aa1e1af4d43fcd92c509",
|
||||
"shortSHA": "ac0ead488",
|
||||
"SHA": "ac0ead488567a67d226beaac56ffd88f7a1d69f1",
|
||||
"branch": "feature/agenda-api-peter",
|
||||
"lastCommitAuthor": "'Peter Maquiran'",
|
||||
"lastCommitTime": "'Thu Jun 27 16:53:45 2024 +0100'",
|
||||
"lastCommitMessage": "ITOTEAM-523 notification status",
|
||||
"lastCommitNumber": "5845",
|
||||
"changeStatus": "On branch feature/agenda-api-peter\nYour branch is up to date with 'origin/feature/agenda-api-peter'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/modals/profile/profile.page.scss\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/module/notification/data/notification-repository.service.ts\n\tmodified: version/git-version.ts",
|
||||
"lastCommitTime": "'Thu Jun 27 17:43:44 2024 +0100'",
|
||||
"lastCommitMessage": "nice",
|
||||
"lastCommitNumber": "5846",
|
||||
"changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 1 commit.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/modals/profile/profile.page.scss\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/models/search-document.ts\n\tmodified: src/app/module/notification/data/datasource/local-notification.service.ts\n\tmodified: src/app/module/notification/data/infra/db/notification.db.ts\n\tmodified: src/app/module/notification/data/notification-repository.service.ts\n\tmodified: src/app/pages/login/login.page.ts\n\tmodified: src/app/pages/search/search.page.ts\n\tmodified: src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts\n\tmodified: src/app/services/Repositorys/Agenda/agenda-data.service.ts\n\tmodified: src/app/services/Repositorys/Agenda/mapper/EventDetailsMapper.ts\n\tmodified: src/app/services/Repositorys/Agenda/mapper/EventToApproveDetailsMapper.ts\n\tmodified: src/app/services/notification/notifications.service.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/app/shared/header/header.page.html\n\tmodified: src/app/shared/header/header.page.ts",
|
||||
"changeAuthor": "peter.maquiran"
|
||||
}
|
||||
Reference in New Issue
Block a user