diff --git a/bizmatch-server/src/models/db.model.ts b/bizmatch-server/src/models/db.model.ts
index 2142d76..c8bf44b 100644
--- a/bizmatch-server/src/models/db.model.ts
+++ b/bizmatch-server/src/models/db.model.ts
@@ -268,7 +268,7 @@ export const BusinessListingSchema = z
title: z.string().min(10),
description: z.string().min(10),
location: GeoSchema,
- price: z.number().positive(),
+ price: z.number().positive().optional().nullable(),
favoritesForUser: z.array(z.string()),
draft: z.boolean(),
listingsCategory: ListingsCategoryEnum,
@@ -326,7 +326,7 @@ export const CommercialPropertyListingSchema = z
title: z.string().min(10),
description: z.string().min(10),
location: GeoSchema,
- price: z.number().positive(),
+ price: z.number().positive().optional().nullable(),
favoritesForUser: z.array(z.string()),
listingsCategory: ListingsCategoryEnum,
internalListingNumber: z.number().int().positive().optional().nullable(),
diff --git a/bizmatch/src/app/components/search-modal/search-modal-commercial.component.html b/bizmatch/src/app/components/search-modal/search-modal-commercial.component.html
index bd54207..eec8da0 100644
--- a/bizmatch/src/app/components/search-modal/search-modal-commercial.component.html
+++ b/bizmatch/src/app/components/search-modal/search-modal-commercial.component.html
@@ -54,11 +54,11 @@
@@ -71,7 +71,7 @@
type="button"
class="px-3 py-2 text-xs font-medium text-center border border-gray-200 hover:bg-gray-500 hover:text-white"
[ngClass]="criteria.radius === radius ? 'text-white bg-gray-500' : 'text-gray-900 bg-white'"
- (click)="criteria.radius = radius"
+ (click)="setRadius(radius)"
>
{{ radius }}
@@ -81,9 +81,11 @@
@@ -91,9 +93,9 @@
@@ -158,11 +160,11 @@
@@ -199,9 +201,9 @@
@@ -209,9 +211,9 @@
diff --git a/bizmatch/src/app/components/search-modal/search-modal-commercial.component.ts b/bizmatch/src/app/components/search-modal/search-modal-commercial.component.ts
index ca7e706..4c730a8 100644
--- a/bizmatch/src/app/components/search-modal/search-modal-commercial.component.ts
+++ b/bizmatch/src/app/components/search-modal/search-modal-commercial.component.ts
@@ -77,7 +77,7 @@ export class SearchModalCommercialComponent implements OnInit, OnDestroy {
}
// Setup debounced search
- this.searchDebounce$.pipe(debounceTime(400), distinctUntilChanged(), takeUntil(this.destroy$)).subscribe(() => {
+ this.searchDebounce$.pipe(debounceTime(400), takeUntil(this.destroy$)).subscribe(() => {
this.triggerSearch();
});
}
@@ -236,7 +236,7 @@ export class SearchModalCommercialComponent implements OnInit, OnDestroy {
}
// Helper methods
- private updateCriteria(updates: any): void {
+ public updateCriteria(updates: any): void {
if (this.isModal) {
// In modal: Update locally only
this.criteria = { ...this.criteria, ...updates };
@@ -262,7 +262,7 @@ export class SearchModalCommercialComponent implements OnInit, OnDestroy {
}
private setTotalNumberOfResults(): void {
- this.numberOfResults$ = this.listingService.getNumberOfListings('commercialProperty');
+ this.numberOfResults$ = this.listingService.getNumberOfListings('commercialProperty', this.criteria);
}
private getDefaultCriteria(): CommercialPropertyListingCriteria {
diff --git a/bizmatch/src/app/components/search-modal/search-modal.component.html b/bizmatch/src/app/components/search-modal/search-modal.component.html
index d7a5be3..dfe295a 100644
--- a/bizmatch/src/app/components/search-modal/search-modal.component.html
+++ b/bizmatch/src/app/components/search-modal/search-modal.component.html
@@ -71,11 +71,11 @@
@@ -88,7 +88,7 @@
type="button"
class="px-3 py-2 text-xs font-medium text-center border border-gray-200 hover:bg-gray-500 hover:text-white"
[ngClass]="criteria.radius === radius ? 'text-white bg-gray-500' : 'text-gray-900 bg-white'"
- (click)="criteria.radius = radius"
+ (click)="setRadius(radius)"
>
{{ radius }}
@@ -98,25 +98,31 @@
@@ -124,9 +130,9 @@
@@ -162,18 +168,18 @@
-
@@ -184,9 +190,9 @@
@@ -196,9 +202,9 @@
@@ -269,11 +275,11 @@
@@ -296,25 +302,29 @@
@@ -322,9 +332,9 @@
@@ -360,18 +370,18 @@
-
@@ -382,9 +392,9 @@
@@ -394,9 +404,9 @@
diff --git a/bizmatch/src/app/components/search-modal/search-modal.component.ts b/bizmatch/src/app/components/search-modal/search-modal.component.ts
index 3831ea0..c2ffb1f 100644
--- a/bizmatch/src/app/components/search-modal/search-modal.component.ts
+++ b/bizmatch/src/app/components/search-modal/search-modal.component.ts
@@ -86,14 +86,12 @@ export class SearchModalComponent implements OnInit, OnDestroy {
}
// Setup debounced search
- this.searchDebounce$.pipe(debounceTime(400), distinctUntilChanged(), takeUntil(this.destroy$)).subscribe(() => {
- this.triggerSearch();
- });
+ this.searchDebounce$.pipe(debounceTime(400), takeUntil(this.destroy$)).subscribe(() => this.triggerSearch());
}
private initializeWithCriteria(criteria: any): void {
this.criteria = criteria;
- this.currentListingType = criteria.criteriaType;
+ this.currentListingType = criteria?.criteriaType;
this.backupCriteria = JSON.parse(JSON.stringify(criteria));
this.updateSelectedPropertyType();
this.setTotalNumberOfResults();
@@ -312,7 +310,7 @@ export class SearchModalComponent implements OnInit, OnDestroy {
}
// Helper methods
- private updateCriteria(updates: any): void {
+ public updateCriteria(updates: any): void {
if (this.isModal) {
// In modal: Update locally only
this.criteria = { ...this.criteria, ...updates };
@@ -356,10 +354,10 @@ export class SearchModalComponent implements OnInit, OnDestroy {
switch (this.currentListingType) {
case 'businessListings':
- this.numberOfResults$ = this.listingService.getNumberOfListings('business');
+ this.numberOfResults$ = this.listingService.getNumberOfListings('business', this.criteria);
break;
case 'commercialPropertyListings':
- this.numberOfResults$ = this.listingService.getNumberOfListings('commercialProperty');
+ this.numberOfResults$ = this.listingService.getNumberOfListings('commercialProperty', this.criteria);
break;
case 'brokerListings':
this.numberOfResults$ = this.userService.getNumberOfBroker();
diff --git a/bizmatch/src/app/pages/listings/business-listings/business-listings.component.html b/bizmatch/src/app/pages/listings/business-listings/business-listings.component.html
index 2aea9d2..d8f83e0 100644
--- a/bizmatch/src/app/pages/listings/business-listings/business-listings.component.html
+++ b/bizmatch/src/app/pages/listings/business-listings/business-listings.component.html
@@ -41,10 +41,19 @@
- Asking price: {{ listing.price | currency : 'USD' : 'symbol' : '1.0-0' }}
+ Asking price:
+
+ {{ listing?.price != null ? (listing.price | currency : 'USD' : 'symbol' : '1.0-0') : 'undisclosed' }}
+
+
+
+ Sales revenue:
+ {{ listing?.salesRevenue != null ? (listing.salesRevenue | currency : 'USD' : 'symbol' : '1.0-0') : 'undisclosed' }}
+
+
+ Net profit:
+ {{ listing?.cashFlow != null ? (listing.cashFlow | currency : 'USD' : 'symbol' : '1.0-0') : 'undisclosed' }}
- Sales revenue: {{ listing.salesRevenue | currency : 'USD' : 'symbol' : '1.0-0' }}
- Net profit: {{ listing.cashFlow | currency : 'USD' : 'symbol' : '1.0-0' }}
Location: {{ listing.location.name ? listing.location.name : listing.location.county ? listing.location.county : this.selectOptions.getState(listing.location.state) }}
diff --git a/bizmatch/src/app/services/listings.service.ts b/bizmatch/src/app/services/listings.service.ts
index 06bcc02..4d02ae9 100644
--- a/bizmatch/src/app/services/listings.service.ts
+++ b/bizmatch/src/app/services/listings.service.ts
@@ -21,8 +21,8 @@ export class ListingsService {
return result;
}
- getNumberOfListings(listingsCategory: 'business' | 'commercialProperty'): Observable {
- const criteria = getCriteriaByListingCategory(listingsCategory);
+ getNumberOfListings(listingsCategory: 'business' | 'commercialProperty', crit?: any): Observable {
+ const criteria = crit ? crit : getCriteriaByListingCategory(listingsCategory);
const sortBy = getSortByListingCategory(listingsCategory);
const body = { ...criteria, sortBy }; // Merge, falls relevant (wenn Backend sortBy für Count braucht; sonst ignorieren)
return this.http.post(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}/findTotal`, body);