fix further bugs
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
<div class="text-900 w-full md:w-10">{{ listing.brokerLicencing }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
@if(listing && listingUser && (listingUser.id===listing?.userId || isAdmin())){
|
||||
@if(listing && listingUser && (listingUser?.email===user?.email || isAdmin())){
|
||||
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editBusinessListing', listing.id]"></button>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@if(listing && listingUser && (listingUser.id===listing?.userId || isAdmin())){
|
||||
@if(listing && listingUser && (listingUser?.email===user?.email || isAdmin())){
|
||||
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editCommercialPropertyListing', listing.id]"></button>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@if( user?.id===(user$| async)?.id || isAdmin()){
|
||||
@if( user?.email===(user$| async)?.email || isAdmin()){
|
||||
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/account', user.id]"></button>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -48,7 +48,7 @@ export class DetailsUserComponent {
|
||||
|
||||
async ngOnInit() {
|
||||
this.user = await this.userService.getById(this.id);
|
||||
|
||||
this.user.email;
|
||||
const results = await Promise.all([await this.listingsService.getListingByUserId(this.id, 'business'), await this.listingsService.getListingByUserId(this.id, 'commercialProperty')]);
|
||||
// Zuweisen der Ergebnisse zu den Member-Variablen der Klasse
|
||||
this.businessListings = results[0];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ChangeDetectorRef, Component } from '@angular/core';
|
||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { ListingsService } from '../../../services/listings.service';
|
||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||
@@ -36,7 +36,11 @@ export class MyListingComponent {
|
||||
}
|
||||
|
||||
async deleteListing(listing: ListingType) {
|
||||
await this.listingsService.deleteListing(listing.id, listing.listingsCategory);
|
||||
if (listing.listingsCategory === 'business') {
|
||||
await this.listingsService.deleteBusinessListing(listing.id);
|
||||
} else {
|
||||
await this.listingsService.deleteCommercialPropertyListing(listing.id, (<CommercialPropertyListing>listing).imagePath);
|
||||
}
|
||||
const result = await Promise.all([await this.listingsService.getListingByUserId(this.user.id, 'business'), await this.listingsService.getListingByUserId(this.user.id, 'commercialProperty')]);
|
||||
this.myListings = [...result[0], ...result[1]];
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export class HistoryService {
|
||||
}
|
||||
|
||||
get canGoBack(): boolean {
|
||||
return !!this.previousUrl;
|
||||
return !!this.previousUrl || window.history.length > 2;
|
||||
}
|
||||
|
||||
goBack(): void {
|
||||
|
||||
@@ -31,12 +31,16 @@ export class ListingsService {
|
||||
}
|
||||
}
|
||||
async getAllStates(listingsCategory?: 'business' | 'commercialProperty'): Promise<StatesResult[]> {
|
||||
const result = lastValueFrom(this.http.get<StatesResult[]>(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}/states/all`));
|
||||
const result = lastValueFrom(this.http.get<StatesResult[]>(`${this.apiBaseUrl}/bizmatch/listings/business/states/all`));
|
||||
return result;
|
||||
}
|
||||
async deleteListing(id: string, listingsCategory: 'business' | 'professionals_brokers' | 'commercialProperty') {
|
||||
await lastValueFrom(this.http.delete<ListingType>(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}/${id}`));
|
||||
async deleteBusinessListing(id: string) {
|
||||
await lastValueFrom(this.http.delete<ListingType>(`${this.apiBaseUrl}/bizmatch/listings/business/${id}`));
|
||||
}
|
||||
async deleteCommercialPropertyListing(id: string, imagePath: string) {
|
||||
await lastValueFrom(this.http.delete<ListingType>(`${this.apiBaseUrl}/bizmatch/listings/commercialProperty/${id}/${imagePath}`));
|
||||
}
|
||||
|
||||
async getPropertyImages(id: string): Promise<string[]> {
|
||||
return await lastValueFrom(this.http.get<string[]>(`${this.apiBaseUrl}/bizmatch/image/${id}`));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user