Issues gitea

This commit is contained in:
2026-01-15 21:26:07 +01:00
parent 897ab1ff77
commit 09e7ce59a9
18 changed files with 496 additions and 124 deletions

View File

@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { ChangeDetectorRef, Component } from '@angular/core';
import { NgOptimizedImage } from '@angular/common';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
@@ -59,7 +59,8 @@ export class DetailsUserComponent {
private auditService: AuditService,
private emailService: EMailService,
private messageService: MessageService,
) {}
private cdref: ChangeDetectorRef,
) { }
async ngOnInit() {
this.user = await this.userService.getById(this.id);
@@ -74,25 +75,40 @@ export class DetailsUserComponent {
}
/**
* Add professional to favorites
* Toggle professional favorite status
*/
async save() {
await this.listingsService.addToFavorites(this.user.id, 'user');
if (!this.user.favoritesForUser) {
this.user.favoritesForUser = [];
async toggleFavorite() {
try {
const isFavorited = this.user.favoritesForUser?.includes(this.keycloakUser.email);
if (isFavorited) {
// Remove from favorites
await this.listingsService.removeFavorite(this.user.id, 'user');
this.user.favoritesForUser = this.user.favoritesForUser.filter(
email => email !== this.keycloakUser.email
);
} else {
// Add to favorites
await this.listingsService.addToFavorites(this.user.id, 'user');
if (!this.user.favoritesForUser) {
this.user.favoritesForUser = [];
}
this.user.favoritesForUser.push(this.keycloakUser.email);
this.auditService.createEvent(this.user.id, 'favorite', this.keycloakUser?.email);
}
this.cdref.detectChanges();
} catch (error) {
console.error('Error toggling favorite', error);
}
this.user.favoritesForUser.push(this.keycloakUser.email);
this.auditService.createEvent(this.user.id, 'favorite', this.keycloakUser?.email);
}
/**
* Check if already in favorites
*/
isAlreadyFavorite(): boolean {
if (!this.keycloakUser?.email || !this.user?.favoritesForUser) return false;
return this.user.favoritesForUser.includes(this.keycloakUser.email);
}
/**
* Show email sharing modal
*/