Image Upload, spinner aktivirt, listings & details überarbeitet

This commit is contained in:
2024-03-18 18:17:04 +01:00
parent 2b27ab8ba5
commit fd91adda57
31 changed files with 582 additions and 263 deletions

View File

@@ -31,6 +31,6 @@ export class ListingsService {
await lastValueFrom(this.http.delete<ListingType>(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}/${id}`));
}
async getPropertyImages(id:string):Promise<ImageProperty[]>{
return await lastValueFrom(this.http.get<ImageProperty[]>(`${this.apiBaseUrl}/bizmatch/listings/commercialProperty/images/${id}`));
return await lastValueFrom(this.http.get<ImageProperty[]>(`${this.apiBaseUrl}/bizmatch/image/${id}`));
}
}

View File

@@ -1,11 +1,14 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, debounceTime, distinctUntilChanged, map, shareReplay } from 'rxjs';
import { BehaviorSubject, Observable, debounceTime, distinctUntilChanged, map, shareReplay } from 'rxjs';
@Injectable({
providedIn: 'root',
})
export class LoadingService {
public loading$ = new BehaviorSubject<string[]>([]);
private loadingTextSubject = new BehaviorSubject<string | null>(null);
loadingText$: Observable<string | null> = this.loadingTextSubject.asObservable();
public isLoading$ = this.loading$.asObservable().pipe(
map((loading) => loading.length > 0),
@@ -14,15 +17,21 @@ export class LoadingService {
shareReplay(1)
);
public startLoading(type: string): void {
public startLoading(type: string,request:string): void {
if (!this.loading$.value.includes(type)) {
this.loading$.next(this.loading$.value.concat(type));
if (request.includes('uploadPropertyPicture')) {
this.loadingTextSubject.next("Please wait - we're processing your image...");
} else {
this.loadingTextSubject.next(null);
}
}
}
public stopLoading(type: string): void {
if (this.loading$.value.includes(type)) {
this.loading$.next(this.loading$.value.filter((t) => t !== type));
this.loadingTextSubject.next(null);
}
}
}

View File

@@ -42,7 +42,9 @@ export class SelectOptionsService {
getBusiness(value:string):string{
return this.typesOfBusiness.find(t=>t.value===value)?.name
}
getCommercialProperty(value:string):string{
return this.typesOfCommercialProperty.find(t=>t.value===value)?.name
}
getListingsCategory(value:string):string{
return this.listingCategories.find(l=>l.value===value)?.name
}

View File

@@ -4,7 +4,7 @@ import { jwtDecode } from 'jwt-decode';
import { Observable, distinctUntilChanged, filter, from, lastValueFrom, map } from 'rxjs';
import { CommonModule } from '@angular/common';
import { KeycloakService } from './keycloak.service';
import { JwtToken, User } from '../../../../common-models/src/main.model';
import { JwtToken, ListingCriteria, User } from '../../../../common-models/src/main.model';
import { environment } from '../../environments/environment';
import { HttpClient } from '@angular/common/http';
@@ -103,4 +103,7 @@ export class UserService {
async getById(id:string):Promise<User>{
return await lastValueFrom(this.http.get<User>(`${this.apiBaseUrl}/bizmatch/user/${id}`));
}
async search(criteria?:ListingCriteria){
return await lastValueFrom(this.http.post<User[]>(`${this.apiBaseUrl}/bizmatch/user/search`,criteria));
}
}