einbau von rollen, neue Admin Ansicht

This commit is contained in:
2025-03-08 11:18:31 +01:00
parent dded8b8ca9
commit 5a56b3554d
29 changed files with 788 additions and 426 deletions

View File

@@ -68,7 +68,7 @@
<li>
<a routerLink="/account" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">Account</a>
</li>
@if(user.customerType==='professional' || user.customerType==='seller' || isAdmin()){
@if(user.customerType==='professional' || user.customerType==='seller' || (authService.isAdmin() | async)){
<li>
@if(user.customerSubType==='broker'){
<a routerLink="/createBusinessListing" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
@@ -94,7 +94,7 @@
<a routerLink="/logout" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">Logout</a>
</li>
</ul>
@if(isAdmin()){
@if(authService.isAdmin() | async){
<ul class="py-2">
<li>
<a routerLink="admin/users" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">Users (Admin)</a>
@@ -121,8 +121,7 @@
>Properties</a
>
</li>
}
@if ((numberOfBroker$ | async) > 0) {
} @if ((numberOfBroker$ | async) > 0) {
<li>
<a
routerLink="/brokerListings"
@@ -165,8 +164,7 @@
>Properties</a
>
</li>
}
@if ((numberOfBroker$ | async) > 0) {
} @if ((numberOfBroker$ | async) > 0) {
<li>
<a
routerLink="/brokerListings"
@@ -219,8 +217,7 @@
>Properties</a
>
</li>
}
@if ((numberOfBroker$ | async) > 0) {
} @if ((numberOfBroker$ | async) > 0) {
<li>
<a
routerLinkActive="active-link"

View File

@@ -17,7 +17,7 @@ import { SearchService } from '../../services/search.service';
import { SelectOptionsService } from '../../services/select-options.service';
import { SharedService } from '../../services/shared.service';
import { UserService } from '../../services/user.service';
import { assignProperties, compareObjects, createEmptyBusinessListingCriteria, createEmptyCommercialPropertyListingCriteria, createEmptyUserListingCriteria, getCriteriaProxy, isAdmin, map2User } from '../../utils/utils';
import { assignProperties, compareObjects, createEmptyBusinessListingCriteria, createEmptyCommercialPropertyListingCriteria, createEmptyUserListingCriteria, getCriteriaProxy, map2User } from '../../utils/utils';
import { DropdownComponent } from '../dropdown/dropdown.component';
import { ModalService } from '../search-modal/modal.service';
@UntilDestroy()
@@ -58,8 +58,8 @@ export class HeaderComponent {
private searchService: SearchService,
private criteriaChangeService: CriteriaChangeService,
public selectOptions: SelectOptionsService,
private authService: AuthService,
private listingService: ListingsService,
public authService: AuthService,
private listingService: ListingsService,
) {}
@HostListener('document:click', ['$event'])
handleGlobalClick(event: Event) {
@@ -76,7 +76,7 @@ export class HeaderComponent {
this.profileUrl = this.user.hasProfile ? `${this.env.imageBaseUrl}/pictures/profile/${emailToDirName(this.user.email)}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
}
this.numberOfBroker$ = this.userService.getNumberOfBroker(createEmptyUserListingCriteria());
this.numberOfCommercial$ = this.listingService.getNumberOfListings(createEmptyCommercialPropertyListingCriteria(), 'commercialProperty');
this.numberOfCommercial$ = this.listingService.getNumberOfListings(createEmptyCommercialPropertyListingCriteria(), 'commercialProperty');
setTimeout(() => {
initFlowbite();
}, 10);
@@ -198,7 +198,4 @@ export class HeaderComponent {
toggleSortDropdown() {
this.sortDropdownVisible = !this.sortDropdownVisible;
}
isAdmin() {
return isAdmin(this.user.email);
}
}