This commit is contained in:
Peter Maquiran
2024-06-27 17:43:44 +01:00
parent 11587cc944
commit ac0ead4885
5 changed files with 52 additions and 34 deletions
+4 -4
View File
@@ -97,7 +97,7 @@
<div class="item cursor-pointer ion-no-padding ion-no-margin" lines="none"
*ngFor="let item of notificationList; let i = index">
<div *ngIf="item.status==false" class="item-conten1 item-conten-{{item.service}}-{{item.typeAgenda}}-{{item.role}}" (click)="notificatinsRoutes(item.index, item)">
<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 class="notification-item">
<img class="notification-icon" slot="end" *ngIf = "item.service == 'agenda'" src="assets/images/icons-default-agenda.svg" >
@@ -122,7 +122,7 @@
</div>
</div>
<div *ngIf="item.read == true" >
<div *ngIf="objectRead[item.notificationId] == true" >
<div class="notification-item">
<img class="notification-icon-error" slot="end" src="assets/images/exclamation_mark.svg" >
</div>
@@ -133,10 +133,10 @@
<div class="d-flex mt-10 width-100">
<ion-buttons slot="start" class="buttonSize" >
<button (click)="doNotKeppNotification(item.index)" class="btn-delete" fill="clear" >
<button (click)="doNotKeppNotification(item)" class="btn-delete" fill="clear" >
<ion-label style="color:#d30a0a;">Sim</ion-label>
</button>
<button (click)="keppNotification(i)" class="btn-cancel" fill="clear" color="#fff" >
<button (click)="keppNotification(item)" class="btn-cancel" fill="clear" color="#fff" >
<ion-label>Não</ion-label>
</button>
</ion-buttons>
+1
View File
@@ -149,6 +149,7 @@ ion-list {
overflow: hidden;
}
.notification-item {
width: fit-content;
float: left;
+29 -24
View File
@@ -19,7 +19,7 @@ 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',
@@ -52,6 +52,8 @@ export class ProfilePage implements OnInit {
notificationList$: Observable<NotificationTable[]>
objectRead = {}
constructor(
private modalController: ModalController,
private animationController: AnimationController,
@@ -72,7 +74,9 @@ export class ProfilePage implements OnInit {
private notificationRepositoryService: NotificationRepositoryService
) {
this.notificationList$ = this.notificationRepositoryService.getNotificationLive()
this.notificationList$ = this.notificationRepositoryService.getNotificationLive().pipe(
filter(data => data.some(item => item.status === false))
)
window['e'] = () => {
console.log(
@@ -227,7 +231,6 @@ export class ProfilePage implements OnInit {
console.log({item})
this.notificationRepositoryService.notificationStatus(item)
try {
if (item.service === "agenda") {
@@ -241,18 +244,19 @@ export class ProfilePage implements OnInit {
if(res.isOk()) {
this.zone.run(() => this.router.navigate(['/home/agenda', item.idObject, 'agenda']));
this.deleteNotification(index);
this.deleteNotification(item);
tracing.setAttribute('outcome', 'success')
} else {
tracing.setAttribute('outcome', 'success')
tracing.setAttribute('data.exist', 'false')
this.NotificationHolderService.notificationList[index].read = true;
if (isHttpError(res.error)) {
if(res.error.status == 404) {
this.toastService._badRequest('Este evento já não existe')
this.notificationRepositoryService.localNotificationStatus(item)
// this.toastService._badRequest('Este evento já não existe')
this.objectRead[item.notificationId] = true
}
}
@@ -274,13 +278,13 @@ export class ProfilePage implements OnInit {
console.log('evento exist')
tracing.setAttribute('outcome', 'success')
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', item.idObject, 'agenda']));
this.deleteNotification(index);
this.deleteNotification(item);
this.isloading = false
} else {
tracing.setAttribute('outcome', 'success')
console.log('evento não existe')
tracing.setAttribute('data.exist', 'false')
// this.NotificationHolderService.notificationList[index].read = true;
this.objectRead[item.notificationId] = true
this.isloading = false
}
} else {
@@ -330,11 +334,11 @@ export class ProfilePage implements OnInit {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', item.idObject, 'gabinete-digital']));
}
this.deleteNotification(index);
this.deleteNotification(item);
this.isloading = false
}, (error) => {
// this.NotificationHolderService.notificationList[i].read = true;
this.objectRead[item.notificationId] = true
this.isloading = false
})
@@ -342,11 +346,11 @@ export class ProfilePage implements OnInit {
} else if (item.service === "accoes") {
if (item.service === "accoes" && item.idObject === "accao") {
this.zone.run(() => this.router.navigate(['/home/publications', item.idObject]));
this.deleteNotification(index);
this.deleteNotification(item);
}
else if (item.service === "accoes" && item.idObject === "publicacao") {
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', item.folderId, item.idObject]));
this.deleteNotification(index);
this.deleteNotification(item);
}
} else if (item.service === "chat") {
@@ -360,7 +364,7 @@ export class ProfilePage implements OnInit {
}, 200);
this.deleteNotification(index);
this.deleteNotification(item);
} else {
console.log({service:item.service, Object, IdObject:item.idObject, FolderId:item.folderId})
@@ -379,13 +383,11 @@ export class ProfilePage implements OnInit {
}
}
deleteNotification(index) {
const notificationdata = this.NotificationHolderService.notificationList.find(item => item.index == index);
this.NotificationHolderService.removeNotification(notificationdata)
deleteNotification(item: NotificationTable) {
this.objectRead[item.notificationId] = false
this.notificationRepositoryService.RemoveNotificationStatus(item)
}
logout() {
@@ -464,12 +466,15 @@ export class ProfilePage implements OnInit {
}
keppNotification(index) {
this.NotificationHolderService.notificationList[index].read = false;
keppNotification(item: NotificationTable) {
// this.NotificationHolderService.notificationList[index].read = false;
this.objectRead[item.notificationId] = false
this.notificationRepositoryService.localNotificationStatus(item)
}
doNotKeppNotification(index) {
this.deleteNotification(index);
doNotKeppNotification(item: NotificationTable) {
this.objectRead[item.notificationId] = false
this.deleteNotification(item);
}
}
@@ -40,6 +40,9 @@ export class NotificationRepositoryService {
if(result.isOk()) {
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)
@@ -74,6 +77,15 @@ export class NotificationRepositoryService {
return
}
async RemoveNotificationStatus(item: NotificationTable) {
await this.RemoteNotificationService.notificationStatus(item.notificationId)
item.status = true
this.LocalNotificationService.updateNotification(item)
this.init()
return
}
async localNotificationStatus(item: NotificationTable) {
item.status = true
this.LocalNotificationService.updateNotification(item)
+6 -6
View File
@@ -1,11 +1,11 @@
export let versionData = {
"shortSHA": "78c13d1bf",
"SHA": "78c13d1bfb0b5e24a79a101990ba73e50e831107",
"shortSHA": "11587cc94",
"SHA": "11587cc944ab205b6f03aa1e1af4d43fcd92c509",
"branch": "feature/agenda-api-peter",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Wed Jun 26 13:45:25 2024 +0100'",
"lastCommitMessage": "ITOTEAM-609 search event>",
"lastCommitNumber": "5844",
"changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 7 commits.\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\tnew file: src/app/module/notification/data/async/changes/notificationListChange.ts\n\tnew file: src/app/module/notification/data/datasource/firebase-push-notification.service.spec.ts\n\tnew file: src/app/module/notification/data/datasource/firebase-push-notification.service.ts\n\tnew file: src/app/module/notification/data/datasource/local-notification.service.spec.ts\n\tnew file: src/app/module/notification/data/datasource/local-notification.service.ts\n\tnew file: src/app/module/notification/data/datasource/remote-notification.service.spec.ts\n\tnew file: src/app/module/notification/data/datasource/remote-notification.service.ts\n\tnew file: src/app/module/notification/data/dto/NotificationInputDTO.ts\n\tnew file: src/app/module/notification/data/dto/NotificationOutputDTO.ts\n\tnew file: src/app/module/notification/data/infra/db/notification.db.ts\n\tnew file: src/app/module/notification/data/notification-repository.service.spec.ts\n\tnew file: src/app/module/notification/data/notification-repository.service.ts\n\tnew file: src/app/module/notification/domain/mapper/notificationListMapper.ts\n\tmodified: src/app/pages/agenda/agenda.page.html\n\tmodified: src/app/pages/agenda/agenda.page.ts\n\tmodified: src/app/services/agenda/list-box.service.ts\n\tmodified: src/app/services/http.service.ts\n\tmodified: src/app/services/notification/notifications.service.ts\n\tmodified: src/app/services/notifications.service.ts",
"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",
"changeAuthor": "peter.maquiran"
}