Merge branch 'timo' of git.bizmatch.net:aknuth/bizmatch-project into timo
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { AfterViewInit, Component, HostListener } from '@angular/core';
|
||||
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
||||
import { AfterViewInit, Component, HostListener, PLATFORM_ID, inject } from '@angular/core';
|
||||
import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
||||
import { initFlowbite } from 'flowbite';
|
||||
import { filter } from 'rxjs/operators';
|
||||
@@ -29,6 +29,8 @@ export class AppComponent implements AfterViewInit {
|
||||
build = build;
|
||||
title = 'bizmatch';
|
||||
actualRoute = '';
|
||||
private platformId = inject(PLATFORM_ID);
|
||||
private isBrowser = isPlatformBrowser(this.platformId);
|
||||
|
||||
public constructor(
|
||||
public loadingService: LoadingService,
|
||||
@@ -48,9 +50,11 @@ export class AppComponent implements AfterViewInit {
|
||||
this.actualRoute = currentRoute.snapshot.url[0].path;
|
||||
|
||||
// Re-initialize Flowbite after navigation to ensure all components are ready
|
||||
setTimeout(() => {
|
||||
initFlowbite();
|
||||
}, 50);
|
||||
if (this.isBrowser) {
|
||||
setTimeout(() => {
|
||||
initFlowbite();
|
||||
}, 50);
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
@@ -60,7 +64,9 @@ export class AppComponent implements AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
// Initialize Flowbite for dropdowns, modals, and other interactive components
|
||||
// Note: Drawers work automatically with data-drawer-target attributes
|
||||
initFlowbite();
|
||||
if (this.isBrowser) {
|
||||
initFlowbite();
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('window:keydown', ['$event'])
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
||||
import { provideServerRendering } from '@angular/platform-server';
|
||||
import { provideServerRouting } from '@angular/ssr';
|
||||
import { appConfig } from './app.config';
|
||||
import { serverRoutes } from './app.routes.server';
|
||||
|
||||
const serverConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideServerRendering()
|
||||
provideServerRendering(),
|
||||
provideServerRouting(serverRoutes)
|
||||
]
|
||||
};
|
||||
|
||||
export const config = mergeApplicationConfig(appConfig, serverConfig);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { IMAGE_CONFIG } from '@angular/common';
|
||||
import { APP_INITIALIZER, ApplicationConfig, ErrorHandler } from '@angular/core';
|
||||
import { IMAGE_CONFIG, isPlatformBrowser } from '@angular/common';
|
||||
import { APP_INITIALIZER, ApplicationConfig, ErrorHandler, PLATFORM_ID, inject } from '@angular/core';
|
||||
import { provideClientHydration } from '@angular/platform-browser';
|
||||
import { provideRouter, withEnabledBlockingInitialNavigation, withInMemoryScrolling } from '@angular/router';
|
||||
|
||||
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||
@@ -10,7 +11,6 @@ import { GALLERY_CONFIG, GalleryConfig } from 'ng-gallery';
|
||||
import { provideQuillConfig } from 'ngx-quill';
|
||||
import { provideShareButtonsOptions, SharerMethods, withConfig } from 'ngx-sharebuttons';
|
||||
import { shareIcons } from 'ngx-sharebuttons/icons';
|
||||
import { provideNgxStripe } from 'ngx-stripe';
|
||||
import { environment } from '../environments/environment';
|
||||
import { routes } from './app.routes';
|
||||
import { AuthInterceptor } from './interceptors/auth.interceptor';
|
||||
@@ -20,10 +20,12 @@ import { GlobalErrorHandler } from './services/globalErrorHandler';
|
||||
import { POSTHOG_INIT_PROVIDER } from './services/posthog.factory';
|
||||
import { SelectOptionsService } from './services/select-options.service';
|
||||
import { createLogger } from './utils/utils';
|
||||
// provideClientHydration()
|
||||
|
||||
const logger = createLogger('ApplicationConfig');
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// Temporarily disabled for SSR debugging
|
||||
// provideClientHydration(),
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
@@ -77,7 +79,6 @@ export const appConfig: ApplicationConfig = {
|
||||
),
|
||||
...(environment.production ? [POSTHOG_INIT_PROVIDER] : []),
|
||||
provideAnimations(),
|
||||
provideNgxStripe('pk_test_IlpbVQhxAXZypLgnCHOCqlj8'),
|
||||
provideQuillConfig({
|
||||
modules: {
|
||||
syntax: true,
|
||||
@@ -92,7 +93,6 @@ export const appConfig: ApplicationConfig = {
|
||||
}),
|
||||
provideFirebaseApp(() => initializeApp(environment.firebaseConfig)),
|
||||
provideAuth(() => getAuth()),
|
||||
// provideFirestore(() => getFirestore()),
|
||||
],
|
||||
};
|
||||
function initServices(selectOptions: SelectOptionsService) {
|
||||
|
||||
8
bizmatch/src/app/app.routes.server.ts
Normal file
8
bizmatch/src/app/app.routes.server.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { RenderMode, ServerRoute } from '@angular/ssr';
|
||||
|
||||
export const serverRoutes: ServerRoute[] = [
|
||||
{
|
||||
path: '**',
|
||||
renderMode: RenderMode.Server
|
||||
}
|
||||
];
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { LogoutComponent } from './components/logout/logout.component';
|
||||
import { NotFoundComponent } from './components/not-found/not-found.component';
|
||||
import { TestSsrComponent } from './components/test-ssr/test-ssr.component';
|
||||
|
||||
import { EmailAuthorizedComponent } from './components/email-authorized/email-authorized.component';
|
||||
import { EmailVerificationComponent } from './components/email-verification/email-verification.component';
|
||||
@@ -15,7 +16,6 @@ import { HomeComponent } from './pages/home/home.component';
|
||||
import { BrokerListingsComponent } from './pages/listings/broker-listings/broker-listings.component';
|
||||
import { BusinessListingsComponent } from './pages/listings/business-listings/business-listings.component';
|
||||
import { CommercialPropertyListingsComponent } from './pages/listings/commercial-property-listings/commercial-property-listings.component';
|
||||
import { PricingComponent } from './pages/pricing/pricing.component';
|
||||
import { AccountComponent } from './pages/subscription/account/account.component';
|
||||
import { EditBusinessListingComponent } from './pages/subscription/edit-business-listing/edit-business-listing.component';
|
||||
import { EditCommercialPropertyListingComponent } from './pages/subscription/edit-commercial-property-listing/edit-commercial-property-listing.component';
|
||||
@@ -27,6 +27,10 @@ import { TermsOfUseComponent } from './pages/legal/terms-of-use.component';
|
||||
import { PrivacyStatementComponent } from './pages/legal/privacy-statement.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: 'test-ssr',
|
||||
component: TestSsrComponent,
|
||||
},
|
||||
{
|
||||
path: 'businessListings',
|
||||
component: BusinessListingsComponent,
|
||||
@@ -157,11 +161,7 @@ export const routes: Routes = [
|
||||
canActivate: [AuthGuard],
|
||||
},
|
||||
// #########
|
||||
// Pricing
|
||||
{
|
||||
path: 'pricing',
|
||||
component: PricingComponent,
|
||||
},
|
||||
// Email Verification
|
||||
{
|
||||
path: 'emailVerification',
|
||||
component: EmailVerificationComponent,
|
||||
@@ -170,17 +170,6 @@ export const routes: Routes = [
|
||||
path: 'email-authorized',
|
||||
component: EmailAuthorizedComponent,
|
||||
},
|
||||
{
|
||||
path: 'pricingOverview',
|
||||
component: PricingComponent,
|
||||
data: {
|
||||
pricingOverview: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'pricing/:id',
|
||||
component: PricingComponent,
|
||||
},
|
||||
{
|
||||
path: 'success',
|
||||
component: SuccessComponent,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, HostBinding, Input, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { AfterViewInit, Component, ElementRef, HostBinding, Input, OnDestroy, ViewChild, PLATFORM_ID, inject } from '@angular/core';
|
||||
import { isPlatformBrowser } from '@angular/common';
|
||||
import { createPopper, Instance as PopperInstance } from '@popperjs/core';
|
||||
|
||||
@Component({
|
||||
@@ -23,6 +24,8 @@ export class DropdownComponent implements AfterViewInit, OnDestroy {
|
||||
|
||||
@HostBinding('class.hidden') isHidden: boolean = true;
|
||||
|
||||
private platformId = inject(PLATFORM_ID);
|
||||
private isBrowser = isPlatformBrowser(this.platformId);
|
||||
private popperInstance: PopperInstance | null = null;
|
||||
isVisible: boolean = false;
|
||||
private clickOutsideListener: any;
|
||||
@@ -30,6 +33,8 @@ export class DropdownComponent implements AfterViewInit, OnDestroy {
|
||||
private hoverHideListener: any;
|
||||
|
||||
ngAfterViewInit() {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
if (!this.triggerEl) {
|
||||
console.error('Trigger element is not provided to the dropdown component.');
|
||||
return;
|
||||
@@ -58,6 +63,8 @@ export class DropdownComponent implements AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
private setupEventListeners() {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
if (this.triggerType === 'click') {
|
||||
this.triggerEl.addEventListener('click', () => this.toggle());
|
||||
} else if (this.triggerType === 'hover') {
|
||||
@@ -74,6 +81,8 @@ export class DropdownComponent implements AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
private removeEventListeners() {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
if (this.triggerType === 'click') {
|
||||
this.triggerEl.removeEventListener('click', () => this.toggle());
|
||||
} else if (this.triggerType === 'hover') {
|
||||
@@ -104,7 +113,7 @@ export class DropdownComponent implements AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
private handleClickOutside(event: MouseEvent) {
|
||||
if (!this.isVisible) return;
|
||||
if (!this.isVisible || !this.isBrowser) return;
|
||||
|
||||
const clickedElement = event.target as HTMLElement;
|
||||
if (this.ignoreClickOutsideClass) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,227 +1,210 @@
|
||||
<nav class="bg-white border-neutral-200 dark:bg-neutral-900 print:hidden">
|
||||
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
||||
<a routerLink="/home" class="flex items-center space-x-3 rtl:space-x-reverse">
|
||||
<img src="assets/images/header-logo.png" class="h-10 w-auto" alt="BizMatch - Business Marketplace for Buying and Selling Businesses" />
|
||||
<img src="/assets/images/header-logo.png" class="h-10 w-auto"
|
||||
alt="BizMatch - Business Marketplace for Buying and Selling Businesses" />
|
||||
</a>
|
||||
<div class="flex items-center md:order-2 space-x-3 rtl:space-x-reverse">
|
||||
<!-- Filter button -->
|
||||
@if(isFilterUrl()){
|
||||
|
||||
<div class="relative">
|
||||
<button
|
||||
type="button"
|
||||
id="sortDropdownButton"
|
||||
<button type="button" id="sortDropdownButton"
|
||||
class="max-sm:hidden px-4 py-2 text-sm font-medium bg-white border border-neutral-200 rounded-lg hover:bg-neutral-100 hover:text-primary-600 dark:bg-neutral-800 dark:text-neutral-400 dark:border-neutral-600 dark:hover:text-white dark:hover:bg-neutral-700"
|
||||
(click)="toggleSortDropdown()"
|
||||
[ngClass]="{ 'text-primary-500': selectOptions.getSortByOption(sortBy) !== 'Sort', 'text-neutral-900': selectOptions.getSortByOption(sortBy) === 'Sort' }"
|
||||
>
|
||||
[ngClass]="{ 'text-primary-500': selectOptions.getSortByOption(sortBy) !== 'Sort', 'text-neutral-900': selectOptions.getSortByOption(sortBy) === 'Sort' }">
|
||||
<i class="fas fa-sort mr-2"></i>{{ selectOptions.getSortByOption(sortBy) }}
|
||||
</button>
|
||||
|
||||
<!-- Sort options dropdown -->
|
||||
<div *ngIf="sortDropdownVisible" class="absolute right-0 z-50 w-48 md:mt-2 max-md:mt-20 max-md:mr-[-2.5rem] bg-white border border-neutral-200 rounded-lg drop-shadow-custom-bg dark:bg-neutral-800 dark:border-neutral-600">
|
||||
<div *ngIf="sortDropdownVisible"
|
||||
class="absolute right-0 z-50 w-48 md:mt-2 max-md:mt-20 max-md:mr-[-2.5rem] bg-white border border-neutral-200 rounded-lg drop-shadow-custom-bg dark:bg-neutral-800 dark:border-neutral-600">
|
||||
<ul class="py-1 text-sm text-neutral-700 dark:text-neutral-200">
|
||||
@for(item of sortByOptions; track item){
|
||||
<li (click)="sortByFct(item.value)" class="block px-4 py-2 hover:bg-neutral-100 dark:hover:bg-neutral-700 cursor-pointer">{{ item.selectName ? item.selectName : item.name }}</li>
|
||||
<li (click)="sortByFct(item.value)"
|
||||
class="block px-4 py-2 hover:bg-neutral-100 dark:hover:bg-neutral-700 cursor-pointer">{{ item.selectName ?
|
||||
item.selectName : item.name }}</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<button
|
||||
type="button"
|
||||
<button type="button"
|
||||
class="flex text-sm bg-neutral-400 rounded-full md:me-0 focus:ring-4 focus:ring-neutral-300 dark:focus:ring-neutral-600"
|
||||
id="user-menu-button"
|
||||
aria-expanded="false"
|
||||
[attr.data-dropdown-toggle]="user ? 'user-login' : 'user-unknown'"
|
||||
data-dropdown-placement="bottom"
|
||||
>
|
||||
id="user-menu-button" aria-expanded="false" [attr.data-dropdown-toggle]="user ? 'user-login' : 'user-unknown'">
|
||||
<span class="sr-only">Open user menu</span>
|
||||
@if(isProfessional || (authService.isAdmin() | async) && user?.hasProfile){
|
||||
<img class="w-8 h-8 rounded-full object-cover" src="{{ profileUrl }}" alt="{{ user?.firstname }} {{ user?.lastname }} profile photo" width="32" height="32" />
|
||||
<img class="w-8 h-8 rounded-full object-cover" src="{{ profileUrl }}"
|
||||
alt="{{ user?.firstname }} {{ user?.lastname }} profile photo" width="32" height="32" />
|
||||
} @else {
|
||||
<i class="flex justify-center items-center text-stone-50 w-8 h-8 rounded-full fa-solid fa-bars"></i>
|
||||
}
|
||||
</button>
|
||||
<!-- Dropdown menu -->
|
||||
@if(user){
|
||||
<div class="z-50 hidden my-4 text-base list-none bg-white divide-y divide-neutral-100 rounded-lg shadow dark:bg-neutral-700 dark:divide-neutral-600" id="user-login">
|
||||
<div
|
||||
class="z-50 hidden my-4 text-base list-none bg-white divide-y divide-neutral-100 rounded-lg shadow dark:bg-neutral-700 dark:divide-neutral-600"
|
||||
id="user-login">
|
||||
<div class="px-4 py-3">
|
||||
<span class="block text-sm text-neutral-900 dark:text-white">Welcome, {{ user.firstname }} </span>
|
||||
<span class="block text-sm text-neutral-500 truncate dark:text-neutral-400">{{ user.email }}</span>
|
||||
</div>
|
||||
<ul class="py-2" aria-labelledby="user-menu-button">
|
||||
<li>
|
||||
<a routerLink="/account" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Account</a>
|
||||
<a routerLink="/account" (click)="closeDropdown()"
|
||||
class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Account</a>
|
||||
</li>
|
||||
@if((user.customerType==='professional' && user.customerSubType==='broker') || user.customerType==='seller' || (authService.isAdmin() | async)){
|
||||
@if((user.customerType==='professional' && user.customerSubType==='broker') || user.customerType==='seller' ||
|
||||
(authService.isAdmin() | async)){
|
||||
<li>
|
||||
@if(user.customerType==='professional'){
|
||||
<a routerLink="/createBusinessListing" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white"
|
||||
>Create Listing</a
|
||||
>
|
||||
<a routerLink="/createBusinessListing" (click)="closeDropdown()"
|
||||
class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Create
|
||||
Listing</a>
|
||||
}@else {
|
||||
<a routerLink="/createCommercialPropertyListing" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white"
|
||||
>Create Listing</a
|
||||
>
|
||||
<a routerLink="/createCommercialPropertyListing" (click)="closeDropdown()"
|
||||
class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Create
|
||||
Listing</a>
|
||||
}
|
||||
</li>
|
||||
<li>
|
||||
<a routerLink="/myListings" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">My Listings</a>
|
||||
<a routerLink="/myListings" (click)="closeDropdown()"
|
||||
class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">My
|
||||
Listings</a>
|
||||
</li>
|
||||
}
|
||||
<li>
|
||||
<a routerLink="/myFavorites" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">My Favorites</a>
|
||||
<a routerLink="/myFavorites" (click)="closeDropdown()"
|
||||
class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">My
|
||||
Favorites</a>
|
||||
</li>
|
||||
<li>
|
||||
<a routerLink="/emailUs" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">EMail Us</a>
|
||||
<a routerLink="/emailUs" (click)="closeDropdown()"
|
||||
class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">EMail
|
||||
Us</a>
|
||||
</li>
|
||||
<li>
|
||||
<a routerLink="/logout" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Logout</a>
|
||||
<a routerLink="/logout" (click)="closeDropdown()"
|
||||
class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
@if(authService.isAdmin() | async){
|
||||
<ul class="py-2">
|
||||
<li>
|
||||
<a routerLink="admin/users" (click)="closeDropdown()" class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Users (Admin)</a>
|
||||
<a routerLink="admin/users" (click)="closeDropdown()"
|
||||
class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Users
|
||||
(Admin)</a>
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
<ul class="py-2 md:hidden">
|
||||
<li>
|
||||
<a
|
||||
routerLink="/businessListings"
|
||||
<a routerLink="/businessListings"
|
||||
[ngClass]="{ 'text-primary-600': isActive('/businessListings'), 'text-neutral-700': !isActive('/businessListings') }"
|
||||
class="block px-4 py-2 text-sm font-semibold"
|
||||
(click)="closeMenusAndSetCriteria('businessListings')"
|
||||
>Businesses</a
|
||||
>
|
||||
(click)="closeMenusAndSetCriteria('businessListings')">Businesses</a>
|
||||
</li>
|
||||
@if ((numberOfCommercial$ | async) > 0) {
|
||||
<li>
|
||||
<a
|
||||
routerLink="/commercialPropertyListings"
|
||||
<a routerLink="/commercialPropertyListings"
|
||||
[ngClass]="{ 'text-primary-600': isActive('/commercialPropertyListings'), 'text-neutral-700': !isActive('/commercialPropertyListings') }"
|
||||
class="block px-4 py-2 text-sm font-semibold"
|
||||
(click)="closeMenusAndSetCriteria('commercialPropertyListings')"
|
||||
>Properties</a
|
||||
>
|
||||
</li>
|
||||
} @if ((numberOfBroker$ | async) > 0) {
|
||||
<li>
|
||||
<a
|
||||
routerLink="/brokerListings"
|
||||
[ngClass]="{ 'text-primary-600': isActive('/brokerListings'), 'text-neutral-700': !isActive('/brokerListings') }"
|
||||
class="block px-4 py-2 text-sm font-semibold"
|
||||
(click)="closeMenusAndSetCriteria('brokerListings')"
|
||||
>Professionals</a
|
||||
>
|
||||
(click)="closeMenusAndSetCriteria('commercialPropertyListings')">Properties</a>
|
||||
</li>
|
||||
}
|
||||
<li>
|
||||
<a routerLink="/brokerListings"
|
||||
[ngClass]="{ 'text-primary-600': isActive('/brokerListings'), 'text-neutral-700': !isActive('/brokerListings') }"
|
||||
class="block px-4 py-2 text-sm font-semibold"
|
||||
(click)="closeMenusAndSetCriteria('brokerListings')">Professionals</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="z-50 hidden my-4 text-base list-none bg-white divide-y divide-neutral-100 rounded-lg shadow dark:bg-neutral-700 dark:divide-neutral-600" id="user-unknown">
|
||||
<div
|
||||
class="z-50 hidden my-4 text-base list-none bg-white divide-y divide-neutral-100 rounded-lg shadow dark:bg-neutral-700 dark:divide-neutral-600"
|
||||
id="user-unknown">
|
||||
<ul class="py-2" aria-labelledby="user-menu-button">
|
||||
<li>
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'login' }" class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Log In</a>
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'login' }"
|
||||
class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Log
|
||||
In</a>
|
||||
</li>
|
||||
<li>
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'register' }" class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Sign Up</a>
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'register' }"
|
||||
class="block px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-600 dark:text-neutral-200 dark:hover:text-white">Sign
|
||||
Up</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="py-2 md:hidden">
|
||||
<li>
|
||||
<a
|
||||
routerLink="/businessListings"
|
||||
<a routerLink="/businessListings"
|
||||
[ngClass]="{ 'text-primary-600': isActive('/businessListings'), 'text-neutral-700': !isActive('/businessListings') }"
|
||||
class="block px-4 py-2 text-sm font-bold"
|
||||
(click)="closeMenusAndSetCriteria('businessListings')"
|
||||
>Businesses</a
|
||||
>
|
||||
(click)="closeMenusAndSetCriteria('businessListings')">Businesses</a>
|
||||
</li>
|
||||
@if ((numberOfCommercial$ | async) > 0) {
|
||||
<li>
|
||||
<a
|
||||
routerLink="/commercialPropertyListings"
|
||||
<a routerLink="/commercialPropertyListings"
|
||||
[ngClass]="{ 'text-primary-600': isActive('/commercialPropertyListings'), 'text-neutral-700': !isActive('/commercialPropertyListings') }"
|
||||
class="block px-4 py-2 text-sm font-bold"
|
||||
(click)="closeMenusAndSetCriteria('commercialPropertyListings')"
|
||||
>Properties</a
|
||||
>
|
||||
</li>
|
||||
} @if ((numberOfBroker$ | async) > 0) {
|
||||
<li>
|
||||
<a
|
||||
routerLink="/brokerListings"
|
||||
[ngClass]="{ 'text-primary-600': isActive('/brokerListings'), 'text-neutral-700': !isActive('/brokerListings') }"
|
||||
class="block px-4 py-2 text-sm font-bold"
|
||||
(click)="closeMenusAndSetCriteria('brokerListings')"
|
||||
>Professionals</a
|
||||
>
|
||||
(click)="closeMenusAndSetCriteria('commercialPropertyListings')">Properties</a>
|
||||
</li>
|
||||
}
|
||||
<li>
|
||||
<a routerLink="/brokerListings"
|
||||
[ngClass]="{ 'text-primary-600': isActive('/brokerListings'), 'text-neutral-700': !isActive('/brokerListings') }"
|
||||
class="block px-4 py-2 text-sm font-bold"
|
||||
(click)="closeMenusAndSetCriteria('brokerListings')">Professionals</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="items-center justify-between hidden w-full md:flex md:w-auto md:order-1" id="navbar-user">
|
||||
<ul
|
||||
class="flex flex-col font-medium p-4 md:p-0 mt-4 border border-neutral-100 rounded-lg bg-neutral-50 md:space-x-8 rtl:space-x-reverse md:flex-row md:mt-0 md:border-0 md:bg-white dark:bg-neutral-800 md:dark:bg-neutral-900 dark:border-neutral-700"
|
||||
>
|
||||
class="flex flex-col font-medium p-4 md:p-0 mt-4 border border-neutral-100 rounded-lg bg-neutral-50 md:space-x-8 rtl:space-x-reverse md:flex-row md:mt-0 md:border-0 md:bg-white dark:bg-neutral-800 md:dark:bg-neutral-900 dark:border-neutral-700">
|
||||
<li>
|
||||
<a
|
||||
routerLinkActive="active-link"
|
||||
routerLink="/businessListings"
|
||||
<a routerLinkActive="active-link" routerLink="/businessListings"
|
||||
[ngClass]="{ 'bg-primary-600 text-white md:text-primary-600 md:bg-transparent md:dark:text-primary-500': isActive('/businessListings') }"
|
||||
class="block py-2 px-3 rounded hover:bg-neutral-100 md:hover:bg-transparent md:hover:text-primary-600 md:p-0 dark:text-white md:dark:hover:text-primary-500 dark:hover:bg-neutral-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-neutral-700 inline-flex items-center"
|
||||
aria-current="page"
|
||||
(click)="closeMenusAndSetCriteria('businessListings')"
|
||||
>
|
||||
<img src="assets/images/business_logo.png" alt="Business" class="w-5 h-5 mr-2 object-contain" width="20" height="20" />
|
||||
aria-current="page" (click)="closeMenusAndSetCriteria('businessListings')">
|
||||
<img src="/assets/images/business_logo.png" alt="Business" class="w-5 h-5 mr-2 object-contain" width="20"
|
||||
height="20" />
|
||||
<span>Businesses</span>
|
||||
</a>
|
||||
</li>
|
||||
@if ((numberOfCommercial$ | async) > 0) {
|
||||
<li>
|
||||
<a
|
||||
routerLinkActive="active-link"
|
||||
routerLink="/commercialPropertyListings"
|
||||
<a routerLinkActive="active-link" routerLink="/commercialPropertyListings"
|
||||
[ngClass]="{ 'bg-primary-600 text-white md:text-primary-600 md:bg-transparent md:dark:text-primary-500': isActive('/commercialPropertyListings') }"
|
||||
class="block py-2 px-3 rounded hover:bg-neutral-100 md:hover:bg-transparent md:hover:text-primary-600 md:p-0 dark:text-white md:dark:hover:text-primary-500 dark:hover:bg-neutral-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-neutral-700 inline-flex items-center"
|
||||
(click)="closeMenusAndSetCriteria('commercialPropertyListings')"
|
||||
>
|
||||
<img src="assets/images/properties_logo.png" alt="Properties" class="w-5 h-5 mr-2 object-contain" width="20" height="20" />
|
||||
(click)="closeMenusAndSetCriteria('commercialPropertyListings')">
|
||||
<img src="/assets/images/properties_logo.png" alt="Properties" class="w-5 h-5 mr-2 object-contain"
|
||||
width="20" height="20" />
|
||||
<span>Properties</span>
|
||||
</a>
|
||||
</li>
|
||||
} @if ((numberOfBroker$ | async) > 0) {
|
||||
}
|
||||
<li>
|
||||
<a
|
||||
routerLinkActive="active-link"
|
||||
routerLink="/brokerListings"
|
||||
<a routerLinkActive="active-link" routerLink="/brokerListings"
|
||||
[ngClass]="{ 'bg-primary-600 text-white md:text-primary-600 md:bg-transparent md:dark:text-primary-500': isActive('/brokerListings') }"
|
||||
class="inline-flex items-center py-2 px-3 rounded hover:bg-neutral-100 md:hover:bg-transparent md:hover:text-primary-600 md:p-0 dark:text-white md:dark:hover:text-primary-500 dark:hover:bg-neutral-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-neutral-700"
|
||||
(click)="closeMenusAndSetCriteria('brokerListings')"
|
||||
>
|
||||
<img src="assets/images/icon_professionals.png" alt="Professionals" class="w-5 h-5 mr-2 object-contain bg-transparent" style="mix-blend-mode: darken;" />
|
||||
(click)="closeMenusAndSetCriteria('brokerListings')">
|
||||
<img src="/assets/images/icon_professionals.png" alt="Professionals"
|
||||
class="w-5 h-5 mr-2 object-contain bg-transparent" style="mix-blend-mode: darken;" />
|
||||
<span>Professionals</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Mobile filter button -->
|
||||
<div class="md:hidden flex justify-center pb-4">
|
||||
<button
|
||||
(click)="toggleSortDropdown()"
|
||||
type="button"
|
||||
id="sortDropdownMobileButton"
|
||||
<button (click)="toggleSortDropdown()" type="button" id="sortDropdownMobileButton"
|
||||
class="mx-4 w-1/2 px-4 py-2 text-sm font-medium bg-white border border-neutral-200 rounded-lg hover:bg-neutral-100 hover:text-primary-600 focus:ring-2 focus:ring-primary-600 focus:text-primary-600 dark:bg-neutral-800 dark:text-neutral-400 dark:border-neutral-600 dark:hover:text-white dark:hover:bg-neutral-700"
|
||||
[ngClass]="{ 'text-primary-500': selectOptions.getSortByOption(sortBy) !== 'Sort', 'text-neutral-900': selectOptions.getSortByOption(sortBy) === 'Sort' }"
|
||||
>
|
||||
[ngClass]="{ 'text-primary-500': selectOptions.getSortByOption(sortBy) !== 'Sort', 'text-neutral-900': selectOptions.getSortByOption(sortBy) === 'Sort' }">
|
||||
<i class="fas fa-sort mr-2"></i>{{ selectOptions.getSortByOption(sortBy) }}
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, HostListener, OnDestroy, OnInit, AfterViewInit } from '@angular/core';
|
||||
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
||||
import { Component, HostListener, OnDestroy, OnInit, AfterViewInit, PLATFORM_ID, inject } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { NavigationEnd, Router, RouterModule } from '@angular/router';
|
||||
import { faUserGear } from '@fortawesome/free-solid-svg-icons';
|
||||
@@ -18,14 +18,14 @@ import { SelectOptionsService } from '../../services/select-options.service';
|
||||
import { SharedService } from '../../services/shared.service';
|
||||
import { UserService } from '../../services/user.service';
|
||||
import { map2User } from '../../utils/utils';
|
||||
import { DropdownComponent } from '../dropdown/dropdown.component';
|
||||
|
||||
import { ModalService } from '../search-modal/modal.service';
|
||||
|
||||
@UntilDestroy()
|
||||
@Component({
|
||||
selector: 'header',
|
||||
standalone: true,
|
||||
imports: [CommonModule, RouterModule, DropdownComponent, FormsModule],
|
||||
imports: [CommonModule, RouterModule, FormsModule],
|
||||
templateUrl: './header.component.html',
|
||||
styleUrl: './header.component.scss',
|
||||
})
|
||||
@@ -42,6 +42,8 @@ export class HeaderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
isMobile: boolean = false;
|
||||
private destroy$ = new Subject<void>();
|
||||
prompt: string;
|
||||
private platformId = inject(PLATFORM_ID);
|
||||
private isBrowser = isPlatformBrowser(this.platformId);
|
||||
|
||||
// Aktueller Listing-Typ basierend auf Route
|
||||
currentListingType: 'businessListings' | 'commercialPropertyListings' | 'brokerListings' | null = null;
|
||||
@@ -65,13 +67,25 @@ export class HeaderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
public selectOptions: SelectOptionsService,
|
||||
public authService: AuthService,
|
||||
private listingService: ListingsService,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
@HostListener('document:click', ['$event'])
|
||||
handleGlobalClick(event: Event) {
|
||||
const target = event.target as HTMLElement;
|
||||
if (target.id !== 'sortDropdownButton' && target.id !== 'sortDropdownMobileButton') {
|
||||
// Don't close sort dropdown when clicking on sort buttons or user menu button
|
||||
const excludedIds = ['sortDropdownButton', 'sortDropdownMobileButton', 'user-menu-button'];
|
||||
if (!excludedIds.includes(target.id) && !target.closest('#user-menu-button')) {
|
||||
this.sortDropdownVisible = false;
|
||||
|
||||
// Close User Menu if clicked outside
|
||||
// We check if the click was inside the menu containers
|
||||
const userLogin = document.getElementById('user-login');
|
||||
const userUnknown = document.getElementById('user-unknown');
|
||||
const clickedInsideMenu = (userLogin && userLogin.contains(target)) || (userUnknown && userUnknown.contains(target));
|
||||
|
||||
if (!clickedInsideMenu) {
|
||||
this.closeDropdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,9 +109,15 @@ export class HeaderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
this.profileUrl = photoUrl;
|
||||
});
|
||||
|
||||
// User Updates
|
||||
// User Updates - re-initialize Flowbite when user state changes
|
||||
// This ensures the dropdown bindings are updated when the dropdown target changes
|
||||
this.userService.currentUser.pipe(untilDestroyed(this)).subscribe(u => {
|
||||
const previousUser = this.user;
|
||||
this.user = u;
|
||||
// Re-initialize Flowbite if user logged in/out state changed
|
||||
if ((previousUser === null) !== (u === null) && this.isBrowser) {
|
||||
setTimeout(() => initFlowbite(), 50);
|
||||
}
|
||||
});
|
||||
|
||||
// Router Events
|
||||
@@ -215,6 +235,8 @@ export class HeaderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
}
|
||||
|
||||
closeDropdown() {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
const dropdownButton = document.getElementById('user-menu-button');
|
||||
const dropdownMenu = this.user ? document.getElementById('user-login') : document.getElementById('user-unknown');
|
||||
|
||||
@@ -225,6 +247,8 @@ export class HeaderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
}
|
||||
|
||||
closeMobileMenu() {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
const targetElement = document.getElementById('navbar-user');
|
||||
const triggerElement = document.querySelector('[data-collapse-toggle="navbar-user"]');
|
||||
|
||||
@@ -285,12 +309,10 @@ export class HeaderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
// Initialize Flowbite after header DOM is fully rendered
|
||||
// This ensures all dropdown elements exist before initialization
|
||||
setTimeout(() => {
|
||||
initFlowbite();
|
||||
}, 0);
|
||||
// Flowbite initialization is now handled manually or via AppComponent
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<!-- <fa-icon [icon]="isLoginMode ? 'fas fas-user-plus' : 'userplus'" class="mr-2"></fa-icon> -->
|
||||
<i *ngIf="isLoginMode" class="fa-solid fa-user-plus mr-2"></i>
|
||||
<i *ngIf="!isLoginMode" class="fa-solid fa-arrow-right mr-2"></i>
|
||||
{{ isLoginMode ? 'Sign in with Email' : 'Register' }}
|
||||
{{ isLoginMode ? 'Sign in with Email' : 'Sign Up' }}
|
||||
</button>
|
||||
|
||||
<!-- Trennlinie -->
|
||||
|
||||
24
bizmatch/src/app/components/test-ssr/test-ssr.component.ts
Normal file
24
bizmatch/src/app/components/test-ssr/test-ssr.component.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-test-ssr',
|
||||
standalone: true,
|
||||
template: `
|
||||
<div>
|
||||
<h1>SSR Test Component</h1>
|
||||
<p>If you see this, SSR is working!</p>
|
||||
</div>
|
||||
`,
|
||||
styles: [`
|
||||
div {
|
||||
padding: 20px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
h1 { color: green; }
|
||||
`]
|
||||
})
|
||||
export class TestSsrComponent {
|
||||
constructor() {
|
||||
console.log('[SSR] TestSsrComponent constructor called');
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, Input, SimpleChanges } from '@angular/core';
|
||||
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
||||
import { Component, Input, SimpleChanges, PLATFORM_ID, inject } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-tooltip',
|
||||
@@ -12,6 +12,9 @@ export class TooltipComponent {
|
||||
@Input() text: string;
|
||||
@Input() isVisible: boolean = false;
|
||||
|
||||
private platformId = inject(PLATFORM_ID);
|
||||
private isBrowser = isPlatformBrowser(this.platformId);
|
||||
|
||||
ngOnInit() {
|
||||
this.initializeTooltip();
|
||||
}
|
||||
@@ -27,6 +30,8 @@ export class TooltipComponent {
|
||||
}
|
||||
|
||||
private updateTooltipVisibility() {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
const tooltipElement = document.getElementById(this.id);
|
||||
if (tooltipElement) {
|
||||
if (this.isVisible) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ValidationMessagesService } from '../validation-messages.service';
|
||||
selector: 'app-validated-input',
|
||||
templateUrl: './validated-input.component.html',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, TooltipComponent, NgxMaskDirective, NgxMaskPipe],
|
||||
imports: [CommonModule, FormsModule, TooltipComponent, NgxMaskDirective],
|
||||
providers: [
|
||||
{
|
||||
provide: NG_VALUE_ACCESSOR,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, inject, PLATFORM_ID } from '@angular/core';
|
||||
import { isPlatformBrowser } from '@angular/common';
|
||||
import { Control, DomEvent, DomUtil, icon, Icon, latLng, Layer, Map, MapOptions, Marker, tileLayer } from 'leaflet';
|
||||
import { BusinessListing, CommercialPropertyListing } from '../../../../../bizmatch-server/src/models/db.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-base-details',
|
||||
template: ``,
|
||||
@@ -12,28 +14,39 @@ export abstract class BaseDetailsComponent {
|
||||
mapOptions: MapOptions;
|
||||
mapLayers: Layer[] = [];
|
||||
mapCenter: any;
|
||||
mapZoom: number = 13; // Standardzoomlevel
|
||||
mapZoom: number = 13;
|
||||
protected listing: BusinessListing | CommercialPropertyListing;
|
||||
protected isBrowser: boolean;
|
||||
private platformId = inject(PLATFORM_ID);
|
||||
|
||||
constructor() {
|
||||
this.mapOptions = {
|
||||
layers: [
|
||||
tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors',
|
||||
}),
|
||||
],
|
||||
zoom: this.mapZoom,
|
||||
center: latLng(0, 0), // Platzhalter, wird später gesetzt
|
||||
};
|
||||
this.isBrowser = isPlatformBrowser(this.platformId);
|
||||
// Only initialize mapOptions in browser context
|
||||
if (this.isBrowser) {
|
||||
this.mapOptions = {
|
||||
layers: [
|
||||
tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors',
|
||||
}),
|
||||
],
|
||||
zoom: this.mapZoom,
|
||||
center: latLng(0, 0),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
protected configureMap() {
|
||||
if (!this.isBrowser) {
|
||||
return; // Skip on server
|
||||
}
|
||||
|
||||
const latitude = this.listing.location.latitude;
|
||||
const longitude = this.listing.location.longitude;
|
||||
|
||||
if (latitude !== null && latitude !== undefined &&
|
||||
longitude !== null && longitude !== undefined) {
|
||||
longitude !== null && longitude !== undefined) {
|
||||
this.mapCenter = latLng(latitude, longitude);
|
||||
|
||||
// Build address string from available location data
|
||||
const addressParts = [];
|
||||
if (this.listing.location.housenumber) addressParts.push(this.listing.location.housenumber);
|
||||
if (this.listing.location.street) addressParts.push(this.listing.location.street);
|
||||
@@ -53,7 +66,6 @@ export abstract class BaseDetailsComponent {
|
||||
}),
|
||||
});
|
||||
|
||||
// Add popup to marker with address
|
||||
if (fullAddress) {
|
||||
marker.bindPopup(`
|
||||
<div style="padding: 8px;">
|
||||
@@ -76,8 +88,12 @@ export abstract class BaseDetailsComponent {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
onMapReady(map: Map) {
|
||||
// Build comprehensive address for the control
|
||||
if (!this.isBrowser) {
|
||||
return;
|
||||
}
|
||||
|
||||
const addressParts = [];
|
||||
if (this.listing.location.housenumber) addressParts.push(this.listing.location.housenumber);
|
||||
if (this.listing.location.street) addressParts.push(this.listing.location.street);
|
||||
@@ -99,10 +115,8 @@ export abstract class BaseDetailsComponent {
|
||||
</div>
|
||||
`;
|
||||
|
||||
// Verhindere, dass die Karte durch das Klicken des Links bewegt wird
|
||||
DomEvent.disableClickPropagation(container);
|
||||
|
||||
// Füge einen Event Listener für den Link hinzu
|
||||
const link = container.querySelector('#view-full-map') as HTMLElement;
|
||||
if (link) {
|
||||
DomEvent.on(link, 'click', (e: Event) => {
|
||||
@@ -117,12 +131,20 @@ export abstract class BaseDetailsComponent {
|
||||
addressControl.addTo(map);
|
||||
}
|
||||
}
|
||||
|
||||
openFullMap() {
|
||||
if (!this.isBrowser) {
|
||||
return;
|
||||
}
|
||||
|
||||
const latitude = this.listing.location.latitude;
|
||||
const longitude = this.listing.location.longitude;
|
||||
const address = `${this.listing.location.housenumber} ${this.listing.location.street}, ${this.listing.location.name ? this.listing.location.name : this.listing.location.county}, ${this.listing.location.state}`;
|
||||
const url = `https://www.openstreetmap.org/?mlat=${latitude}&mlon=${longitude}#map=15/${latitude}/${longitude}`;
|
||||
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
}
|
||||
|
||||
<div class="bg-white rounded-lg drop-shadow-custom-bg-mobile md:drop-shadow-custom-bg overflow-hidden relative">
|
||||
<button
|
||||
(click)="historyService.goBack()"
|
||||
class="absolute top-4 right-4 bg-red-500 text-white rounded-full w-8 h-8 flex items-center justify-center hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-opacity-50 print:hidden"
|
||||
>
|
||||
<button (click)="historyService.goBack()"
|
||||
class="absolute top-4 right-4 bg-red-500 text-white rounded-full w-8 h-8 flex items-center justify-center hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-opacity-50 print:hidden">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
@if(listing){
|
||||
@@ -19,30 +17,38 @@
|
||||
<p class="mb-4" [innerHTML]="description"></p>
|
||||
|
||||
<div class="space-y-2">
|
||||
<div *ngFor="let detail of listingDetails; let i = index" class="flex flex-col sm:flex-row" [ngClass]="{ 'bg-neutral-100': i % 2 === 0 }">
|
||||
<div *ngFor="let detail of listingDetails; let i = index" class="flex flex-col sm:flex-row"
|
||||
[ngClass]="{ 'bg-neutral-100': i % 2 === 0 }">
|
||||
<div class="w-full sm:w-1/3 font-semibold p-2">{{ detail.label }}</div>
|
||||
|
||||
<div class="w-full sm:w-2/3 p-2" *ngIf="!detail.isHtml && !detail.isListingBy">{{ detail.value }}</div>
|
||||
|
||||
<div class="w-full sm:w-2/3 p-2 flex space-x-2" [innerHTML]="detail.value" *ngIf="detail.isHtml && !detail.isListingBy"></div>
|
||||
<div class="w-full sm:w-2/3 p-2 flex space-x-2" [innerHTML]="detail.value"
|
||||
*ngIf="detail.isHtml && !detail.isListingBy"></div>
|
||||
|
||||
<div class="w-full sm:w-2/3 p-2 flex space-x-2" *ngIf="detail.isListingBy && listingUser">
|
||||
<a routerLink="/details-user/{{ listingUser.id }}" class="text-primary-600 dark:text-primary-500 hover:underline">{{ listingUser.firstname }} {{ listingUser.lastname }}</a>
|
||||
<img *ngIf="listing.imageName" src="{{ env.imageBaseUrl }}/pictures/logo/{{ listing.imageName }}.avif?_ts={{ ts }}" class="mr-5 lg:mb-0" style="max-height: 30px; max-width: 100px" width="100" height="30" />
|
||||
<a routerLink="/details-user/{{ listingUser.id }}"
|
||||
class="text-primary-600 dark:text-primary-500 hover:underline">{{ listingUser.firstname }} {{
|
||||
listingUser.lastname }}</a>
|
||||
<img *ngIf="listing.imageName"
|
||||
ngSrc="{{ env.imageBaseUrl }}/pictures/logo/{{ listing.imageName }}.avif?_ts={{ ts }}"
|
||||
class="mr-5 lg:mb-0" style="max-height: 30px; max-width: 100px" width="100" height="30" alt="Business logo for {{ listingUser.firstname }} {{ listingUser.lastname }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="py-4 print:hidden">
|
||||
@if(listing && listingUser && (listingUser?.email===user?.email || (authService.isAdmin() | async))){
|
||||
<div class="inline">
|
||||
<button class="share share-edit text-white font-bold text-xs py-1.5 px-2 inline-flex items-center" [routerLink]="['/editBusinessListing', listing.id]">
|
||||
<button class="share share-edit text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
[routerLink]="['/editBusinessListing', listing.id]">
|
||||
<i class="fa-regular fa-pen-to-square"></i>
|
||||
<span class="ml-2">Edit</span>
|
||||
</button>
|
||||
</div>
|
||||
} @if(user){
|
||||
<div class="inline">
|
||||
<button class="share share-save text-white font-bold text-xs py-1.5 px-2 inline-flex items-center" (click)="save()" [disabled]="listing.favoritesForUser.includes(user.email)">
|
||||
<button class="share share-save text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
(click)="save()" [disabled]="listing.favoritesForUser.includes(user.email)">
|
||||
<i class="fa-regular fa-heart"></i>
|
||||
@if(listing.favoritesForUser.includes(user.email)){
|
||||
<span class="ml-2">Saved ...</span>
|
||||
@@ -55,21 +61,46 @@
|
||||
<share-button button="print" showText="true" (click)="createEvent('print')"></share-button>
|
||||
<!-- <share-button button="email" showText="true"></share-button> -->
|
||||
<div class="inline">
|
||||
<button class="share share-email text-white font-bold text-xs py-1.5 px-2 inline-flex items-center" (click)="showShareByEMail()">
|
||||
<button class="share share-email text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
(click)="showShareByEMail()">
|
||||
<i class="fa-solid fa-envelope"></i>
|
||||
<span class="ml-2">Email</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<share-button button="facebook" showText="true" (click)="createEvent('facebook')"></share-button>
|
||||
<share-button button="x" showText="true" (click)="createEvent('x')"></share-button>
|
||||
<share-button button="linkedin" showText="true" (click)="createEvent('linkedin')"></share-button>
|
||||
<div class="inline">
|
||||
<button type="button"
|
||||
class="share share-facebook text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
(click)="shareToFacebook()">
|
||||
<i class="fab fa-facebook"></i>
|
||||
<span class="ml-2">Facebook</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<button type="button"
|
||||
class="share share-twitter text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
(click)="shareToTwitter()">
|
||||
<i class="fab fa-x-twitter"></i>
|
||||
<span class="ml-2">X</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<button type="button"
|
||||
class="share share-linkedin text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
(click)="shareToLinkedIn()">
|
||||
<i class="fab fa-linkedin"></i>
|
||||
<span class="ml-2">LinkedIn</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Karte hinzufügen, wenn Straße vorhanden ist -->
|
||||
<div *ngIf="listing.location.latitude && listing.location.longitude" class="mt-6">
|
||||
<h2 class="text-xl font-semibold mb-2">Location Map</h2>
|
||||
<!-- <div style="height: 300px" leaflet [leafletOptions]="mapOptions" [leafletLayers]="mapLayers" [leafletCenter]="mapCenter" [leafletZoom]="mapZoom"></div> -->
|
||||
<div style="height: 400px" leaflet [leafletOptions]="mapOptions" [leafletLayers]="mapLayers" [leafletCenter]="mapCenter" [leafletZoom]="mapZoom" (leafletMapReady)="onMapReady($event)"></div>
|
||||
<div style="height: 400px" leaflet [leafletOptions]="mapOptions" [leafletLayers]="mapLayers"
|
||||
[leafletCenter]="mapCenter" [leafletZoom]="mapZoom" (leafletMapReady)="onMapReady($event)"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -80,25 +111,59 @@
|
||||
<form class="space-y-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<app-validated-input label="Your Name" name="name" [(ngModel)]="mailinfo.sender.name"></app-validated-input>
|
||||
<app-validated-input label="Your Email" name="email" [(ngModel)]="mailinfo.sender.email" kind="email"></app-validated-input>
|
||||
<app-validated-input label="Your Email" name="email" [(ngModel)]="mailinfo.sender.email"
|
||||
kind="email"></app-validated-input>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<app-validated-input label="Phone Number" name="phoneNumber" [(ngModel)]="mailinfo.sender.phoneNumber" mask="(000) 000-0000"></app-validated-input>
|
||||
<app-validated-input label="Phone Number" name="phoneNumber" [(ngModel)]="mailinfo.sender.phoneNumber"
|
||||
mask="(000) 000-0000"></app-validated-input>
|
||||
<!-- <app-validated-input label="Country/State" name="state" [(ngModel)]="mailinfo.sender.state"></app-validated-input> -->
|
||||
<app-validated-ng-select label="State" name="state" [(ngModel)]="mailinfo.sender.state" [items]="selectOptions?.states"></app-validated-ng-select>
|
||||
<app-validated-ng-select label="State" name="state" [(ngModel)]="mailinfo.sender.state"
|
||||
[items]="selectOptions?.states"></app-validated-ng-select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<app-validated-textarea label="Questions/Comments" name="comments" [(ngModel)]="mailinfo.sender.comments"></app-validated-textarea>
|
||||
<app-validated-textarea label="Questions/Comments" name="comments"
|
||||
[(ngModel)]="mailinfo.sender.comments"></app-validated-textarea>
|
||||
</div>
|
||||
<button (click)="mail()" class="w-full sm:w-auto px-4 py-2 bg-primary-600 text-white rounded-md hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-opacity-50">Submit</button>
|
||||
<button (click)="mail()"
|
||||
class="w-full sm:w-auto px-4 py-2 bg-primary-600 text-white rounded-md hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-opacity-50">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- FAQ Section for AEO (Answer Engine Optimization) -->
|
||||
@if(businessFAQs && businessFAQs.length > 0) {
|
||||
<div class="container mx-auto p-4 mt-8">
|
||||
<div class="bg-white rounded-lg drop-shadow-custom-bg-mobile md:drop-shadow-custom-bg p-6">
|
||||
<h2 class="text-2xl font-bold mb-6 text-gray-900">Frequently Asked Questions</h2>
|
||||
<div class="space-y-4">
|
||||
@for (faq of businessFAQs; track $index) {
|
||||
<details class="group border border-gray-200 rounded-lg overflow-hidden hover:border-primary-300 transition-colors">
|
||||
<summary class="flex items-center justify-between cursor-pointer p-4 bg-gray-50 hover:bg-gray-100 transition-colors">
|
||||
<h3 class="text-lg font-semibold text-gray-900">{{ faq.question }}</h3>
|
||||
<svg class="w-5 h-5 text-gray-600 group-open:rotate-180 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
||||
</svg>
|
||||
</summary>
|
||||
<div class="p-4 bg-white border-t border-gray-200">
|
||||
<p class="text-gray-700 leading-relaxed">{{ faq.answer }}</p>
|
||||
</div>
|
||||
</details>
|
||||
}
|
||||
</div>
|
||||
<div class="mt-6 p-4 bg-primary-50 border-l-4 border-primary-500 rounded">
|
||||
<p class="text-sm text-gray-700">
|
||||
<strong class="text-primary-700">Have more questions?</strong> Contact the seller directly using the form above or reach out to our support team for assistance.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Related Listings Section for SEO Internal Linking -->
|
||||
@if(relatedListings && relatedListings.length > 0) {
|
||||
<div class="container mx-auto p-4 mt-8">
|
||||
@@ -107,13 +172,17 @@
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
@for (related of relatedListings; track related.id) {
|
||||
<a [routerLink]="['/business', related.slug || related.id]" class="block group">
|
||||
<div class="bg-white rounded-lg border border-gray-200 overflow-hidden hover:shadow-xl transition-all duration-300 hover:scale-[1.02]">
|
||||
<div
|
||||
class="bg-white rounded-lg border border-gray-200 overflow-hidden hover:shadow-xl transition-all duration-300 hover:scale-[1.02]">
|
||||
<div class="p-4">
|
||||
<div class="flex items-center mb-3">
|
||||
<i [class]="selectOptions.getIconAndTextColorType(related.type)" class="mr-2 text-lg"></i>
|
||||
<span [class]="selectOptions.getTextColorType(related.type)" class="font-semibold text-sm">{{ selectOptions.getBusiness(related.type) }}</span>
|
||||
<span [class]="selectOptions.getTextColorType(related.type)" class="font-semibold text-sm">{{
|
||||
selectOptions.getBusiness(related.type) }}</span>
|
||||
</div>
|
||||
<h3 class="text-lg font-bold mb-2 text-gray-900 group-hover:text-primary-600 transition-colors line-clamp-2">{{ related.title }}</h3>
|
||||
<h3
|
||||
class="text-lg font-bold mb-2 text-gray-900 group-hover:text-primary-600 transition-colors line-clamp-2">
|
||||
{{ related.title }}</h3>
|
||||
<div class="space-y-1 text-sm text-gray-600">
|
||||
<div class="flex justify-between">
|
||||
<span class="font-medium">Price:</span>
|
||||
@@ -127,11 +196,14 @@
|
||||
}
|
||||
<div class="flex justify-between">
|
||||
<span class="font-medium">Location:</span>
|
||||
<span>{{ related.location.name || related.location.county }}, {{ selectOptions.getState(related.location.state) }}</span>
|
||||
<span>{{ related.location.name || related.location.county }}, {{
|
||||
selectOptions.getState(related.location.state) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<span class="inline-block bg-primary-100 text-primary-800 text-xs font-medium px-2.5 py-0.5 rounded">View Details →</span>
|
||||
<span
|
||||
class="inline-block bg-primary-100 text-primary-800 text-xs font-medium px-2.5 py-0.5 rounded">View
|
||||
Details →</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -141,4 +213,4 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,8 +1,8 @@
|
||||
import { ChangeDetectorRef, Component } from '@angular/core';
|
||||
import { NgOptimizedImage } from '@angular/common';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
||||
import { LeafletModule } from '@bluehalo/ngx-leaflet';
|
||||
import { ShareButton } from 'ngx-sharebuttons/button';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { BusinessListing, EventTypeEnum, ShareByEMail, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { KeycloakUser, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
@@ -25,15 +25,16 @@ import { UserService } from '../../../services/user.service';
|
||||
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||
import { createMailInfo, map2User } from '../../../utils/utils';
|
||||
// Import für Leaflet
|
||||
// Benannte Importe für Leaflet
|
||||
// Note: Leaflet requires browser environment - protected by isBrowser checks in base class
|
||||
import { circle, Circle, Control, DomEvent, DomUtil, icon, Icon, latLng, LatLngBounds, Marker, polygon, Polygon, tileLayer } from 'leaflet';
|
||||
import dayjs from 'dayjs';
|
||||
import { AuthService } from '../../../services/auth.service';
|
||||
import { BaseDetailsComponent } from '../base-details.component';
|
||||
import { ShareButton } from 'ngx-sharebuttons/button';
|
||||
@Component({
|
||||
selector: 'app-details-business-listing',
|
||||
standalone: true,
|
||||
imports: [SharedModule, ValidatedInputComponent, ValidatedTextareaComponent, ShareButton, ValidatedNgSelectComponent, LeafletModule, BreadcrumbsComponent],
|
||||
imports: [SharedModule, ValidatedInputComponent, ValidatedTextareaComponent, ValidatedNgSelectComponent, LeafletModule, BreadcrumbsComponent, ShareButton, NgOptimizedImage],
|
||||
providers: [],
|
||||
templateUrl: './details-business-listing.component.html',
|
||||
styleUrl: '../details.scss',
|
||||
@@ -70,6 +71,7 @@ export class DetailsBusinessListingComponent extends BaseDetailsComponent {
|
||||
env = environment;
|
||||
breadcrumbs: BreadcrumbItem[] = [];
|
||||
relatedListings: BusinessListing[] = [];
|
||||
businessFAQs: Array<{ question: string; answer: string }> = [];
|
||||
|
||||
constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
@@ -155,7 +157,13 @@ export class DetailsBusinessListingComponent extends BaseDetailsComponent {
|
||||
{ name: 'Business Listings', url: '/businessListings' },
|
||||
{ name: this.selectOptions.getBusiness(this.listing.type), url: `/business/${this.listing.slug || this.listing.id}` }
|
||||
]);
|
||||
this.seoService.injectMultipleSchemas([productSchema, breadcrumbSchema]);
|
||||
|
||||
// Generate FAQ for AEO (Answer Engine Optimization)
|
||||
this.businessFAQs = this.generateBusinessFAQ();
|
||||
const faqSchema = this.seoService.generateFAQPageSchema(this.businessFAQs);
|
||||
|
||||
// Inject all schemas including FAQ
|
||||
this.seoService.injectMultipleSchemas([productSchema, breadcrumbSchema, faqSchema]);
|
||||
|
||||
// Generate breadcrumbs
|
||||
this.breadcrumbs = [
|
||||
@@ -193,6 +201,101 @@ export class DetailsBusinessListingComponent extends BaseDetailsComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate dynamic FAQ based on business listing data fields
|
||||
* Provides AEO (Answer Engine Optimization) content
|
||||
*/
|
||||
private generateBusinessFAQ(): Array<{ question: string; answer: string }> {
|
||||
const faqs: Array<{ question: string; answer: string }> = [];
|
||||
|
||||
// FAQ 1: When was this business established?
|
||||
if (this.listing.established) {
|
||||
faqs.push({
|
||||
question: 'When was this business established?',
|
||||
answer: `This business was established ${this.listing.established} years ago${this.listing.established >= 10 ? ', demonstrating a proven track record and market stability' : ''}.`
|
||||
});
|
||||
}
|
||||
|
||||
// FAQ 2: What is the asking price?
|
||||
if (this.listing.price) {
|
||||
faqs.push({
|
||||
question: 'What is the asking price for this business?',
|
||||
answer: `The asking price for this business is $${this.listing.price.toLocaleString()}.${this.listing.salesRevenue ? ` With an annual revenue of $${this.listing.salesRevenue.toLocaleString()}, this represents a competitive valuation.` : ''}`
|
||||
});
|
||||
} else {
|
||||
faqs.push({
|
||||
question: 'What is the asking price for this business?',
|
||||
answer: 'The asking price is available upon request. Please contact the seller for detailed pricing information.'
|
||||
});
|
||||
}
|
||||
|
||||
// FAQ 3: What is included in the sale?
|
||||
const includedItems: string[] = [];
|
||||
if (this.listing.realEstateIncluded) includedItems.push('real estate property');
|
||||
if (this.listing.ffe) includedItems.push(`furniture, fixtures, and equipment valued at $${this.listing.ffe.toLocaleString()}`);
|
||||
if (this.listing.inventory) includedItems.push(`inventory worth $${this.listing.inventory.toLocaleString()}`);
|
||||
|
||||
if (includedItems.length > 0) {
|
||||
faqs.push({
|
||||
question: 'What is included in the sale?',
|
||||
answer: `The sale includes: ${includedItems.join(', ')}.${this.listing.leasedLocation ? ' The business operates from a leased location.' : ''}${this.listing.franchiseResale ? ' This is a franchise resale opportunity.' : ''}`
|
||||
});
|
||||
}
|
||||
|
||||
// FAQ 4: How many employees does the business have?
|
||||
if (this.listing.employees) {
|
||||
faqs.push({
|
||||
question: 'How many employees does this business have?',
|
||||
answer: `The business currently employs ${this.listing.employees} ${this.listing.employees === 1 ? 'person' : 'people'}.${this.listing.supportAndTraining ? ' The seller offers support and training to ensure smooth transition.' : ''}`
|
||||
});
|
||||
}
|
||||
|
||||
// FAQ 5: What is the annual revenue and cash flow?
|
||||
if (this.listing.salesRevenue || this.listing.cashFlow) {
|
||||
let answer = '';
|
||||
if (this.listing.salesRevenue) {
|
||||
answer += `The business generates an annual revenue of $${this.listing.salesRevenue.toLocaleString()}.`;
|
||||
}
|
||||
if (this.listing.cashFlow) {
|
||||
answer += ` The annual cash flow is $${this.listing.cashFlow.toLocaleString()}.`;
|
||||
}
|
||||
faqs.push({
|
||||
question: 'What is the financial performance of this business?',
|
||||
answer: answer.trim()
|
||||
});
|
||||
}
|
||||
|
||||
// FAQ 6: Why is the business for sale?
|
||||
if (this.listing.reasonForSale) {
|
||||
faqs.push({
|
||||
question: 'Why is this business for sale?',
|
||||
answer: this.listing.reasonForSale
|
||||
});
|
||||
}
|
||||
|
||||
// FAQ 7: Where is the business located?
|
||||
faqs.push({
|
||||
question: 'Where is this business located?',
|
||||
answer: `This ${this.selectOptions.getBusiness(this.listing.type)} business is located in ${this.listing.location.name || this.listing.location.county}, ${this.selectOptions.getState(this.listing.location.state)}.`
|
||||
});
|
||||
|
||||
// FAQ 8: Is broker licensing required?
|
||||
if (this.listing.brokerLicencing) {
|
||||
faqs.push({
|
||||
question: 'Is a broker license required for this business?',
|
||||
answer: this.listing.brokerLicencing
|
||||
});
|
||||
}
|
||||
|
||||
// FAQ 9: What type of business is this?
|
||||
faqs.push({
|
||||
question: 'What type of business is this?',
|
||||
answer: `This is a ${this.selectOptions.getBusiness(this.listing.type)} business${this.listing.established ? ` that has been operating for ${this.listing.established} years` : ''}.`
|
||||
});
|
||||
|
||||
return faqs;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.validationMessagesService.clearMessages(); // Löschen Sie alle bestehenden Validierungsnachrichten
|
||||
this.seoService.clearStructuredData(); // Clean up SEO structured data
|
||||
@@ -231,28 +334,27 @@ export class DetailsBusinessListingComponent extends BaseDetailsComponent {
|
||||
{ label: 'Category', value: this.selectOptions.getBusiness(this.listing.type) },
|
||||
{
|
||||
label: 'Located in',
|
||||
value: `${this.listing.location.name ? this.listing.location.name : this.listing.location.county ? this.listing.location.county : ''} ${
|
||||
this.listing.location.name || this.listing.location.county ? ', ' : ''
|
||||
}${this.selectOptions.getState(this.listing.location.state)}`,
|
||||
value: `${this.listing.location.name ? this.listing.location.name : this.listing.location.county ? this.listing.location.county : ''} ${this.listing.location.name || this.listing.location.county ? ', ' : ''
|
||||
}${this.selectOptions.getState(this.listing.location.state)}`,
|
||||
},
|
||||
{ label: 'Asking Price', value: `${this.listing.price ? `$${this.listing.price.toLocaleString()}` : 'undisclosed '}` },
|
||||
{ label: 'Sales revenue', value: `${this.listing.salesRevenue ? `$${this.listing.salesRevenue.toLocaleString()}` : 'undisclosed '}` },
|
||||
{ label: 'Cash flow', value: `${this.listing.cashFlow ? `$${this.listing.cashFlow.toLocaleString()}` : 'undisclosed '}` },
|
||||
...(this.listing.ffe
|
||||
? [
|
||||
{
|
||||
label: 'Furniture, Fixtures / Equipment Value (FFE)',
|
||||
value: `$${this.listing.ffe.toLocaleString()}`,
|
||||
},
|
||||
]
|
||||
{
|
||||
label: 'Furniture, Fixtures / Equipment Value (FFE)',
|
||||
value: `$${this.listing.ffe.toLocaleString()}`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(this.listing.inventory
|
||||
? [
|
||||
{
|
||||
label: 'Inventory at Cost Value',
|
||||
value: `$${this.listing.inventory.toLocaleString()}`,
|
||||
},
|
||||
]
|
||||
{
|
||||
label: 'Inventory at Cost Value',
|
||||
value: `$${this.listing.inventory.toLocaleString()}`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{ label: 'Type of Real Estate', value: typeOfRealEstate },
|
||||
{ label: 'Employees', value: this.listing.employees },
|
||||
@@ -308,6 +410,26 @@ export class DetailsBusinessListingComponent extends BaseDetailsComponent {
|
||||
createEvent(eventType: EventTypeEnum) {
|
||||
this.auditService.createEvent(this.listing.id, eventType, this.user?.email);
|
||||
}
|
||||
|
||||
shareToFacebook() {
|
||||
const url = encodeURIComponent(window.location.href);
|
||||
window.open(`https://www.facebook.com/sharer/sharer.php?u=${url}`, '_blank', 'width=600,height=400');
|
||||
this.createEvent('facebook');
|
||||
}
|
||||
|
||||
shareToTwitter() {
|
||||
const url = encodeURIComponent(window.location.href);
|
||||
const text = encodeURIComponent(this.listing?.title || 'Check out this business listing');
|
||||
window.open(`https://twitter.com/intent/tweet?url=${url}&text=${text}`, '_blank', 'width=600,height=400');
|
||||
this.createEvent('x');
|
||||
}
|
||||
|
||||
shareToLinkedIn() {
|
||||
const url = encodeURIComponent(window.location.href);
|
||||
window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${url}`, '_blank', 'width=600,height=400');
|
||||
this.createEvent('linkedin');
|
||||
}
|
||||
|
||||
getDaysListed() {
|
||||
return dayjs().diff(this.listing.created, 'day');
|
||||
}
|
||||
@@ -330,7 +452,7 @@ export class DetailsBusinessListingComponent extends BaseDetailsComponent {
|
||||
|
||||
// Check if we have valid coordinates (null-safe check)
|
||||
if (latitude !== null && latitude !== undefined &&
|
||||
longitude !== null && longitude !== undefined) {
|
||||
longitude !== null && longitude !== undefined) {
|
||||
|
||||
this.mapCenter = latLng(latitude, longitude);
|
||||
|
||||
@@ -340,23 +462,23 @@ export class DetailsBusinessListingComponent extends BaseDetailsComponent {
|
||||
|
||||
// Fetch city boundary from Nominatim API
|
||||
this.geoService.getCityBoundary(cityName, state).subscribe({
|
||||
next: (data) => {
|
||||
if (data && data.length > 0 && data[0].geojson && data[0].geojson.type === 'Polygon') {
|
||||
const coordinates = data[0].geojson.coordinates[0]; // Get outer boundary
|
||||
next: (data) => {
|
||||
if (data && data.length > 0 && data[0].geojson && data[0].geojson.type === 'Polygon') {
|
||||
const coordinates = data[0].geojson.coordinates[0]; // Get outer boundary
|
||||
|
||||
// Convert GeoJSON coordinates [lon, lat] to Leaflet LatLng [lat, lon]
|
||||
const latlngs = coordinates.map((coord: number[]) => latLng(coord[1], coord[0]));
|
||||
// Convert GeoJSON coordinates [lon, lat] to Leaflet LatLng [lat, lon]
|
||||
const latlngs = coordinates.map((coord: number[]) => latLng(coord[1], coord[0]));
|
||||
|
||||
// Create red outlined polygon for city boundary
|
||||
const cityPolygon = polygon(latlngs, {
|
||||
color: '#ef4444', // Red color (like Google Maps)
|
||||
fillColor: '#ef4444',
|
||||
fillOpacity: 0.1,
|
||||
weight: 2
|
||||
});
|
||||
// Create red outlined polygon for city boundary
|
||||
const cityPolygon = polygon(latlngs, {
|
||||
color: '#ef4444', // Red color (like Google Maps)
|
||||
fillColor: '#ef4444',
|
||||
fillOpacity: 0.1,
|
||||
weight: 2
|
||||
});
|
||||
|
||||
// Add popup to polygon
|
||||
cityPolygon.bindPopup(`
|
||||
// Add popup to polygon
|
||||
cityPolygon.bindPopup(`
|
||||
<div style="padding: 8px;">
|
||||
<strong>General Area:</strong><br/>
|
||||
${cityName}, ${county ? county + ', ' : ''}${state}<br/>
|
||||
@@ -364,74 +486,74 @@ export class DetailsBusinessListingComponent extends BaseDetailsComponent {
|
||||
</div>
|
||||
`);
|
||||
|
||||
this.mapLayers = [
|
||||
tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors',
|
||||
}),
|
||||
cityPolygon
|
||||
];
|
||||
this.mapLayers = [
|
||||
tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors',
|
||||
}),
|
||||
cityPolygon
|
||||
];
|
||||
|
||||
// Fit map to polygon bounds
|
||||
const bounds = cityPolygon.getBounds();
|
||||
this.mapOptions = {
|
||||
...this.mapOptions,
|
||||
center: bounds.getCenter(),
|
||||
zoom: this.mapZoom,
|
||||
};
|
||||
} else if (data && data.length > 0 && data[0].geojson && data[0].geojson.type === 'MultiPolygon') {
|
||||
// Handle MultiPolygon case (cities with multiple areas)
|
||||
const allPolygons: Polygon[] = [];
|
||||
// Fit map to polygon bounds
|
||||
const bounds = cityPolygon.getBounds();
|
||||
this.mapOptions = {
|
||||
...this.mapOptions,
|
||||
center: bounds.getCenter(),
|
||||
zoom: this.mapZoom,
|
||||
};
|
||||
} else if (data && data.length > 0 && data[0].geojson && data[0].geojson.type === 'MultiPolygon') {
|
||||
// Handle MultiPolygon case (cities with multiple areas)
|
||||
const allPolygons: Polygon[] = [];
|
||||
|
||||
data[0].geojson.coordinates.forEach((polygonCoords: number[][][]) => {
|
||||
const latlngs = polygonCoords[0].map((coord: number[]) => latLng(coord[1], coord[0]));
|
||||
const cityPolygon = polygon(latlngs, {
|
||||
color: '#ef4444',
|
||||
fillColor: '#ef4444',
|
||||
fillOpacity: 0.1,
|
||||
weight: 2
|
||||
data[0].geojson.coordinates.forEach((polygonCoords: number[][][]) => {
|
||||
const latlngs = polygonCoords[0].map((coord: number[]) => latLng(coord[1], coord[0]));
|
||||
const cityPolygon = polygon(latlngs, {
|
||||
color: '#ef4444',
|
||||
fillColor: '#ef4444',
|
||||
fillOpacity: 0.1,
|
||||
weight: 2
|
||||
});
|
||||
allPolygons.push(cityPolygon);
|
||||
});
|
||||
allPolygons.push(cityPolygon);
|
||||
});
|
||||
|
||||
// Add popup to first polygon
|
||||
if (allPolygons.length > 0) {
|
||||
allPolygons[0].bindPopup(`
|
||||
// Add popup to first polygon
|
||||
if (allPolygons.length > 0) {
|
||||
allPolygons[0].bindPopup(`
|
||||
<div style="padding: 8px;">
|
||||
<strong>General Area:</strong><br/>
|
||||
${cityName}, ${county ? county + ', ' : ''}${state}<br/>
|
||||
<small style="color: #666;">City boundary shown for privacy.<br/>Exact location provided after contact.</small>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
this.mapLayers = [
|
||||
tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors',
|
||||
}),
|
||||
...allPolygons
|
||||
];
|
||||
this.mapLayers = [
|
||||
tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors',
|
||||
}),
|
||||
...allPolygons
|
||||
];
|
||||
|
||||
// Calculate combined bounds
|
||||
if (allPolygons.length > 0) {
|
||||
const bounds = new LatLngBounds([]);
|
||||
allPolygons.forEach(p => bounds.extend(p.getBounds()));
|
||||
this.mapOptions = {
|
||||
...this.mapOptions,
|
||||
center: bounds.getCenter(),
|
||||
zoom: this.mapZoom,
|
||||
};
|
||||
// Calculate combined bounds
|
||||
if (allPolygons.length > 0) {
|
||||
const bounds = new LatLngBounds([]);
|
||||
allPolygons.forEach(p => bounds.extend(p.getBounds()));
|
||||
this.mapOptions = {
|
||||
...this.mapOptions,
|
||||
center: bounds.getCenter(),
|
||||
zoom: this.mapZoom,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// Fallback: Use circle if no polygon data available
|
||||
this.useFallbackCircle(latitude, longitude, cityName, county, state);
|
||||
}
|
||||
} else {
|
||||
// Fallback: Use circle if no polygon data available
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('Error fetching city boundary:', err);
|
||||
// Fallback: Use circle on error
|
||||
this.useFallbackCircle(latitude, longitude, cityName, county, state);
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('Error fetching city boundary:', err);
|
||||
// Fallback: Use circle on error
|
||||
this.useFallbackCircle(latitude, longitude, cityName, county, state);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
// Case 2: Only state available (NEW) - show state-level circle
|
||||
else if (state) {
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
@if(listing){
|
||||
<div class="p-6 relative">
|
||||
<h1 class="text-3xl font-bold mb-4">{{ listing?.title }}</h1>
|
||||
<button
|
||||
(click)="historyService.goBack()"
|
||||
class="print:hidden absolute top-4 right-4 bg-red-500 text-white rounded-full w-8 h-8 flex items-center justify-center hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-opacity-50"
|
||||
>
|
||||
<button (click)="historyService.goBack()"
|
||||
class="print:hidden absolute top-4 right-4 bg-red-500 text-white rounded-full w-8 h-8 flex items-center justify-center hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-opacity-50">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
<div class="flex flex-col lg:flex-row">
|
||||
@@ -17,33 +15,41 @@
|
||||
<p class="mb-4" [innerHTML]="description"></p>
|
||||
|
||||
<div class="space-y-2">
|
||||
<div *ngFor="let detail of propertyDetails; let i = index" class="flex flex-col sm:flex-row" [ngClass]="{ 'bg-neutral-100': i % 2 === 0 }">
|
||||
<div *ngFor="let detail of propertyDetails; let i = index" class="flex flex-col sm:flex-row"
|
||||
[ngClass]="{ 'bg-neutral-100': i % 2 === 0 }">
|
||||
<div class="w-full sm:w-1/3 font-semibold p-2">{{ detail.label }}</div>
|
||||
|
||||
<!-- Standard Text -->
|
||||
<div class="w-full sm:w-2/3 p-2" *ngIf="!detail.isHtml && !detail.isListingBy">{{ detail.value }}</div>
|
||||
|
||||
<!-- HTML Content (nicht für RouterLink) -->
|
||||
<div class="w-full sm:w-2/3 p-2 flex space-x-2" [innerHTML]="detail.value" *ngIf="detail.isHtml && !detail.isListingBy"></div>
|
||||
<div class="w-full sm:w-2/3 p-2 flex space-x-2" [innerHTML]="detail.value"
|
||||
*ngIf="detail.isHtml && !detail.isListingBy"></div>
|
||||
|
||||
<!-- Speziell für Listing By mit RouterLink -->
|
||||
<div class="w-full sm:w-2/3 p-2 flex space-x-2" *ngIf="detail.isListingBy && detail.user">
|
||||
<a [routerLink]="['/details-user', detail.user.id]" class="text-primary-600 dark:text-primary-500 hover:underline"> {{ detail.user.firstname }} {{ detail.user.lastname }} </a>
|
||||
<img *ngIf="detail.user.hasCompanyLogo" [src]="detail.imageBaseUrl + '/pictures/logo/' + detail.imagePath + '.avif?_ts=' + detail.ts" class="mr-5 lg:mb-0" style="max-height: 30px; max-width: 100px" width="100" height="30" />
|
||||
<a [routerLink]="['/details-user', detail.user.id]"
|
||||
class="text-primary-600 dark:text-primary-500 hover:underline"> {{ detail.user.firstname }} {{
|
||||
detail.user.lastname }} </a>
|
||||
<img *ngIf="detail.user.hasCompanyLogo"
|
||||
[ngSrc]="detail.imageBaseUrl + '/pictures/logo/' + detail.imagePath + '.avif?_ts=' + detail.ts"
|
||||
class="mr-5 lg:mb-0" style="max-height: 30px; max-width: 100px" width="100" height="30" alt="Company logo for {{ detail.user.firstname }} {{ detail.user.lastname }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="py-4 print:hidden">
|
||||
@if(listing && listingUser && (listingUser?.email===user?.email || (authService.isAdmin() | async))){
|
||||
<div class="inline">
|
||||
<button class="share share-edit text-white font-bold text-xs py-1.5 px-2 inline-flex items-center" [routerLink]="['/editCommercialPropertyListing', listing.id]">
|
||||
<button class="share share-edit text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
[routerLink]="['/editCommercialPropertyListing', listing.id]">
|
||||
<i class="fa-regular fa-pen-to-square"></i>
|
||||
<span class="ml-2">Edit</span>
|
||||
</button>
|
||||
</div>
|
||||
} @if(user){
|
||||
<div class="inline">
|
||||
<button class="share share-save text-white font-bold text-xs py-1.5 px-2 inline-flex items-center" (click)="save()" [disabled]="listing.favoritesForUser.includes(user.email)">
|
||||
<button class="share share-save text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
(click)="save()" [disabled]="listing.favoritesForUser.includes(user.email)">
|
||||
<i class="fa-regular fa-heart"></i>
|
||||
@if(listing.favoritesForUser.includes(user.email)){
|
||||
<span class="ml-2">Saved ...</span>
|
||||
@@ -56,21 +62,46 @@
|
||||
<share-button button="print" showText="true" (click)="createEvent('print')"></share-button>
|
||||
<!-- <share-button button="email" showText="true"></share-button> -->
|
||||
<div class="inline">
|
||||
<button class="share share-email text-white font-bold text-xs py-1.5 px-2 inline-flex items-center" (click)="showShareByEMail()">
|
||||
<button class="share share-email text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
(click)="showShareByEMail()">
|
||||
<i class="fa-solid fa-envelope"></i>
|
||||
<span class="ml-2">Email</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<share-button button="facebook" showText="true" (click)="createEvent('facebook')"></share-button>
|
||||
<share-button button="x" showText="true" (click)="createEvent('x')"></share-button>
|
||||
<share-button button="linkedin" showText="true" (click)="createEvent('linkedin')"></share-button>
|
||||
<div class="inline">
|
||||
<button type="button"
|
||||
class="share share-facebook text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
(click)="shareToFacebook()">
|
||||
<i class="fab fa-facebook"></i>
|
||||
<span class="ml-2">Facebook</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<button type="button"
|
||||
class="share share-twitter text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
(click)="shareToTwitter()">
|
||||
<i class="fab fa-x-twitter"></i>
|
||||
<span class="ml-2">X</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<button type="button"
|
||||
class="share share-linkedin text-white font-bold text-xs py-1.5 px-2 inline-flex items-center"
|
||||
(click)="shareToLinkedIn()">
|
||||
<i class="fab fa-linkedin"></i>
|
||||
<span class="ml-2">LinkedIn</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Karte hinzufügen, wenn Straße vorhanden ist -->
|
||||
<div *ngIf="listing.location.latitude && listing.location.longitude" class="mt-6">
|
||||
<h2 class="text-lg font-semibold mb-2">Location Map</h2>
|
||||
<!-- <div style="height: 300px" leaflet [leafletOptions]="mapOptions" [leafletLayers]="mapLayers" [leafletCenter]="mapCenter" [leafletZoom]="mapZoom"></div> -->
|
||||
<div style="height: 400px" leaflet [leafletOptions]="mapOptions" [leafletLayers]="mapLayers" [leafletCenter]="mapCenter" [leafletZoom]="mapZoom" (leafletMapReady)="onMapReady($event)"></div>
|
||||
<div style="height: 400px" leaflet [leafletOptions]="mapOptions" [leafletLayers]="mapLayers"
|
||||
[leafletCenter]="mapCenter" [leafletZoom]="mapZoom" (leafletMapReady)="onMapReady($event)"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -89,20 +120,26 @@
|
||||
<p class="text-sm text-neutral-600 mb-4">Please include your contact info below</p>
|
||||
<form class="space-y-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<app-validated-input label="Your Name" name="name" [(ngModel)]="mailinfo.sender.name"></app-validated-input>
|
||||
<app-validated-input label="Your Email" name="email" [(ngModel)]="mailinfo.sender.email" kind="email"></app-validated-input>
|
||||
<app-validated-input label="Your Name" name="name"
|
||||
[(ngModel)]="mailinfo.sender.name"></app-validated-input>
|
||||
<app-validated-input label="Your Email" name="email" [(ngModel)]="mailinfo.sender.email"
|
||||
kind="email"></app-validated-input>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<app-validated-input label="Phone Number" name="phoneNumber" [(ngModel)]="mailinfo.sender.phoneNumber" mask="(000) 000-0000"></app-validated-input>
|
||||
<app-validated-input label="Phone Number" name="phoneNumber" [(ngModel)]="mailinfo.sender.phoneNumber"
|
||||
mask="(000) 000-0000"></app-validated-input>
|
||||
<!-- <app-validated-input label="Country/State" name="state" [(ngModel)]="mailinfo.sender.state"></app-validated-input> -->
|
||||
<app-validated-ng-select label="State" name="state" [(ngModel)]="mailinfo.sender.state" [items]="selectOptions?.states"></app-validated-ng-select>
|
||||
<app-validated-ng-select label="State" name="state" [(ngModel)]="mailinfo.sender.state"
|
||||
[items]="selectOptions?.states"></app-validated-ng-select>
|
||||
</div>
|
||||
<div>
|
||||
<app-validated-textarea label="Questions/Comments" name="comments" [(ngModel)]="mailinfo.sender.comments"></app-validated-textarea>
|
||||
<app-validated-textarea label="Questions/Comments" name="comments"
|
||||
[(ngModel)]="mailinfo.sender.comments"></app-validated-textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
<button (click)="mail()" class="bg-primary-500 text-white px-4 py-2 rounded hover:bg-primary-600">Submit</button>
|
||||
<button (click)="mail()"
|
||||
class="bg-primary-500 text-white px-4 py-2 rounded hover:bg-primary-600">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -112,6 +149,35 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- FAQ Section for AEO (Answer Engine Optimization) -->
|
||||
@if(propertyFAQs && propertyFAQs.length > 0) {
|
||||
<div class="container mx-auto p-4 mt-8">
|
||||
<div class="bg-white rounded-lg drop-shadow-custom-bg-mobile md:drop-shadow-custom-bg p-6">
|
||||
<h2 class="text-2xl font-bold mb-6 text-gray-900">Frequently Asked Questions</h2>
|
||||
<div class="space-y-4">
|
||||
@for (faq of propertyFAQs; track $index) {
|
||||
<details class="group border border-gray-200 rounded-lg overflow-hidden hover:border-primary-300 transition-colors">
|
||||
<summary class="flex items-center justify-between cursor-pointer p-4 bg-gray-50 hover:bg-gray-100 transition-colors">
|
||||
<h3 class="text-lg font-semibold text-gray-900">{{ faq.question }}</h3>
|
||||
<svg class="w-5 h-5 text-gray-600 group-open:rotate-180 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
||||
</svg>
|
||||
</summary>
|
||||
<div class="p-4 bg-white border-t border-gray-200">
|
||||
<p class="text-gray-700 leading-relaxed">{{ faq.answer }}</p>
|
||||
</div>
|
||||
</details>
|
||||
}
|
||||
</div>
|
||||
<div class="mt-6 p-4 bg-primary-50 border-l-4 border-primary-500 rounded">
|
||||
<p class="text-sm text-gray-700">
|
||||
<strong class="text-primary-700">Have more questions?</strong> Contact the seller directly using the form above or reach out to our support team for assistance.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Related Listings Section for SEO Internal Linking -->
|
||||
@if(relatedListings && relatedListings.length > 0) {
|
||||
<div class="container mx-auto p-4 mt-8">
|
||||
@@ -120,13 +186,17 @@
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
@for (related of relatedListings; track related.id) {
|
||||
<a [routerLink]="['/commercial-property', related.slug || related.id]" class="block group">
|
||||
<div class="bg-white rounded-lg border border-gray-200 overflow-hidden hover:shadow-xl transition-all duration-300 hover:scale-[1.02]">
|
||||
<div
|
||||
class="bg-white rounded-lg border border-gray-200 overflow-hidden hover:shadow-xl transition-all duration-300 hover:scale-[1.02]">
|
||||
<div class="p-4">
|
||||
<div class="flex items-center mb-3">
|
||||
<i [class]="selectOptions.getIconAndTextColorType(related.type)" class="mr-2 text-lg"></i>
|
||||
<span [class]="selectOptions.getTextColorType(related.type)" class="font-semibold text-sm">{{ selectOptions.getCommercialProperty(related.type) }}</span>
|
||||
<span [class]="selectOptions.getTextColorType(related.type)" class="font-semibold text-sm">{{
|
||||
selectOptions.getCommercialProperty(related.type) }}</span>
|
||||
</div>
|
||||
<h3 class="text-lg font-bold mb-2 text-gray-900 group-hover:text-primary-600 transition-colors line-clamp-2">{{ related.title }}</h3>
|
||||
<h3
|
||||
class="text-lg font-bold mb-2 text-gray-900 group-hover:text-primary-600 transition-colors line-clamp-2">
|
||||
{{ related.title }}</h3>
|
||||
<div class="space-y-1 text-sm text-gray-600">
|
||||
<div class="flex justify-between">
|
||||
<span class="font-medium">Price:</span>
|
||||
@@ -134,11 +204,14 @@
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="font-medium">Location:</span>
|
||||
<span>{{ related.location.name || related.location.county }}, {{ selectOptions.getState(related.location.state) }}</span>
|
||||
<span>{{ related.location.name || related.location.county }}, {{
|
||||
selectOptions.getState(related.location.state) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<span class="inline-block bg-primary-100 text-primary-800 text-xs font-medium px-2.5 py-0.5 rounded">View Details →</span>
|
||||
<span
|
||||
class="inline-block bg-primary-100 text-primary-800 text-xs font-medium px-2.5 py-0.5 rounded">View
|
||||
Details →</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -148,4 +221,4 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Component, NgZone } from '@angular/core';
|
||||
import { NgOptimizedImage } from '@angular/common';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { LeafletModule } from '@bluehalo/ngx-leaflet';
|
||||
import { faTimes } from '@fortawesome/free-solid-svg-icons';
|
||||
import dayjs from 'dayjs';
|
||||
import { GalleryModule, ImageItem } from 'ng-gallery';
|
||||
import { ShareButton } from 'ngx-sharebuttons/button';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { CommercialPropertyListing, EventTypeEnum, ShareByEMail, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { CommercialPropertyListingCriteria, ErrorResponse, KeycloakUser, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
@@ -29,11 +29,12 @@ import { SharedModule } from '../../../shared/shared/shared.module';
|
||||
import { createMailInfo, map2User } from '../../../utils/utils';
|
||||
import { BaseDetailsComponent } from '../base-details.component';
|
||||
import { BreadcrumbItem, BreadcrumbsComponent } from '../../../components/breadcrumbs/breadcrumbs.component';
|
||||
import { ShareButton } from 'ngx-sharebuttons/button';
|
||||
|
||||
@Component({
|
||||
selector: 'app-details-commercial-property-listing',
|
||||
standalone: true,
|
||||
imports: [SharedModule, ValidatedInputComponent, ValidatedTextareaComponent, ShareButton, ValidatedNgSelectComponent, GalleryModule, LeafletModule, BreadcrumbsComponent],
|
||||
imports: [SharedModule, ValidatedInputComponent, ValidatedTextareaComponent, ValidatedNgSelectComponent, GalleryModule, LeafletModule, BreadcrumbsComponent, ShareButton, NgOptimizedImage],
|
||||
providers: [],
|
||||
templateUrl: './details-commercial-property-listing.component.html',
|
||||
styleUrl: '../details.scss',
|
||||
@@ -73,6 +74,7 @@ export class DetailsCommercialPropertyListingComponent extends BaseDetailsCompon
|
||||
images: Array<ImageItem> = [];
|
||||
relatedListings: CommercialPropertyListing[] = [];
|
||||
breadcrumbs: BreadcrumbItem[] = [];
|
||||
propertyFAQs: Array<{ question: string; answer: string }> = [];
|
||||
constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private listingsService: ListingsService,
|
||||
@@ -162,7 +164,7 @@ export class DetailsCommercialPropertyListingComponent extends BaseDetailsCompon
|
||||
yearBuilt: (this.listing as any).yearBuilt,
|
||||
images: this.listing.imageOrder?.length > 0
|
||||
? this.listing.imageOrder.map(img =>
|
||||
`${this.env.imageBaseUrl}/pictures/property/${this.listing.imagePath}/${this.listing.serialId}/${img}`)
|
||||
`${this.env.imageBaseUrl}/pictures/property/${this.listing.imagePath}/${this.listing.serialId}/${img}`)
|
||||
: []
|
||||
};
|
||||
this.seoService.updateCommercialPropertyMeta(propertyData);
|
||||
@@ -174,7 +176,13 @@ export class DetailsCommercialPropertyListingComponent extends BaseDetailsCompon
|
||||
{ name: 'Commercial Properties', url: '/commercialPropertyListings' },
|
||||
{ name: propertyData.propertyType, url: `/details-commercial-property/${this.listing.id}` }
|
||||
]);
|
||||
this.seoService.injectMultipleSchemas([realEstateSchema, breadcrumbSchema]);
|
||||
|
||||
// Generate FAQ for AEO (Answer Engine Optimization)
|
||||
this.propertyFAQs = this.generatePropertyFAQ();
|
||||
const faqSchema = this.seoService.generateFAQPageSchema(this.propertyFAQs);
|
||||
|
||||
// Inject all schemas including FAQ
|
||||
this.seoService.injectMultipleSchemas([realEstateSchema, breadcrumbSchema, faqSchema]);
|
||||
|
||||
// Generate breadcrumbs for navigation
|
||||
this.breadcrumbs = [
|
||||
@@ -213,6 +221,60 @@ export class DetailsCommercialPropertyListingComponent extends BaseDetailsCompon
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate dynamic FAQ based on commercial property listing data
|
||||
* Provides AEO (Answer Engine Optimization) content
|
||||
*/
|
||||
private generatePropertyFAQ(): Array<{ question: string; answer: string }> {
|
||||
const faqs: Array<{ question: string; answer: string }> = [];
|
||||
|
||||
// FAQ 1: What type of property is this?
|
||||
faqs.push({
|
||||
question: 'What type of commercial property is this?',
|
||||
answer: `This is a ${this.selectOptions.getCommercialProperty(this.listing.type)} property located in ${this.listing.location.name || this.listing.location.county}, ${this.selectOptions.getState(this.listing.location.state)}.`
|
||||
});
|
||||
|
||||
// FAQ 2: What is the asking price?
|
||||
if (this.listing.price) {
|
||||
faqs.push({
|
||||
question: 'What is the asking price for this property?',
|
||||
answer: `The asking price for this commercial property is $${this.listing.price.toLocaleString()}.`
|
||||
});
|
||||
} else {
|
||||
faqs.push({
|
||||
question: 'What is the asking price for this property?',
|
||||
answer: 'The asking price is available upon request. Please contact the seller for detailed pricing information.'
|
||||
});
|
||||
}
|
||||
|
||||
// FAQ 3: Where is the property located?
|
||||
faqs.push({
|
||||
question: 'Where is this commercial property located?',
|
||||
answer: `The property is located in ${this.listing.location.name || this.listing.location.county}, ${this.selectOptions.getState(this.listing.location.state)}.${this.listing.location.street ? ' The exact address will be provided after initial contact.' : ''}`
|
||||
});
|
||||
|
||||
// FAQ 4: How long has the property been listed?
|
||||
const daysListed = this.getDaysListed();
|
||||
faqs.push({
|
||||
question: 'How long has this property been on the market?',
|
||||
answer: `This property was listed on ${this.dateInserted()} and has been on the market for ${daysListed} ${daysListed === 1 ? 'day' : 'days'}.`
|
||||
});
|
||||
|
||||
// FAQ 5: How can I schedule a viewing?
|
||||
faqs.push({
|
||||
question: 'How can I schedule a property viewing?',
|
||||
answer: 'To schedule a viewing of this commercial property, please use the contact form above to get in touch with the listing agent. They will coordinate a convenient time for you to visit the property.'
|
||||
});
|
||||
|
||||
// FAQ 6: What is the zoning for this property?
|
||||
faqs.push({
|
||||
question: 'What is this property suitable for?',
|
||||
answer: `This ${this.selectOptions.getCommercialProperty(this.listing.type)} property is ideal for various commercial uses. Contact the seller for specific zoning information and permitted use details.`
|
||||
});
|
||||
|
||||
return faqs;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.validationMessagesService.clearMessages(); // Löschen Sie alle bestehenden Validierungsnachrichten
|
||||
this.seoService.clearStructuredData(); // Clean up SEO structured data
|
||||
@@ -282,6 +344,26 @@ export class DetailsCommercialPropertyListingComponent extends BaseDetailsCompon
|
||||
createEvent(eventType: EventTypeEnum) {
|
||||
this.auditService.createEvent(this.listing.id, eventType, this.user?.email);
|
||||
}
|
||||
|
||||
shareToFacebook() {
|
||||
const url = encodeURIComponent(window.location.href);
|
||||
window.open(`https://www.facebook.com/sharer/sharer.php?u=${url}`, '_blank', 'width=600,height=400');
|
||||
this.createEvent('facebook');
|
||||
}
|
||||
|
||||
shareToTwitter() {
|
||||
const url = encodeURIComponent(window.location.href);
|
||||
const text = encodeURIComponent(this.listing?.title || 'Check out this commercial property');
|
||||
window.open(`https://twitter.com/intent/tweet?url=${url}&text=${text}`, '_blank', 'width=600,height=400');
|
||||
this.createEvent('x');
|
||||
}
|
||||
|
||||
shareToLinkedIn() {
|
||||
const url = encodeURIComponent(window.location.href);
|
||||
window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${url}`, '_blank', 'width=600,height=400');
|
||||
this.createEvent('linkedin');
|
||||
}
|
||||
|
||||
getDaysListed() {
|
||||
return dayjs().diff(this.listing.created, 'day');
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
<div class="flex items-center space-x-4">
|
||||
<!-- <img src="https://placehold.co/80x80" alt="Profile picture of Avery Brown smiling" class="w-20 h-20 rounded-full" /> -->
|
||||
@if(user.hasProfile){
|
||||
<img src="{{ env.imageBaseUrl }}/pictures//profile/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}" class="w-20 h-20 rounded-full object-cover" width="80" height="80" />
|
||||
<img ngSrc="{{ env.imageBaseUrl }}/pictures//profile/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}" class="w-20 h-20 rounded-full object-cover" width="80" height="80" priority alt="Profile picture of {{ user.firstname }} {{ user.lastname }}" />
|
||||
} @else {
|
||||
<img src="assets/images/person_placeholder.jpg" class="w-20 h-20 rounded-full" width="80" height="80" />
|
||||
<img ngSrc="assets/images/person_placeholder.jpg" class="w-20 h-20 rounded-full" width="80" height="80" priority alt="Default profile picture" />
|
||||
}
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold flex items-center">
|
||||
@@ -32,7 +32,7 @@
|
||||
</p>
|
||||
</div>
|
||||
@if(user.hasCompanyLogo){
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}" class="w-11 h-14" width="44" height="56" />
|
||||
<img ngSrc="{{ env.imageBaseUrl }}/pictures/logo/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}" class="w-11 h-14" width="44" height="56" alt="Company logo of {{ user.companyName }}" />
|
||||
}
|
||||
<!-- <img src="https://placehold.co/45x60" class="w-11 h-14" /> -->
|
||||
</div>
|
||||
@@ -130,9 +130,9 @@
|
||||
<div class="border rounded-lg p-4 hover:cursor-pointer" [routerLink]="['/commercial-property', listing.slug || listing.id]">
|
||||
<div class="flex items-center space-x-4">
|
||||
@if (listing.imageOrder?.length>0){
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ listing.serialId }}/{{ listing.imageOrder[0] }}?_ts={{ ts }}" class="w-12 h-12 object-cover rounded" />
|
||||
<img ngSrc="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ listing.serialId }}/{{ listing.imageOrder[0] }}?_ts={{ ts }}" class="w-12 h-12 object-cover rounded" width="48" height="48" alt="Property image for {{ listing.title }}" />
|
||||
} @else {
|
||||
<img src="assets/images/placeholder_properties.jpg" class="w-12 h-12 object-cover rounded" />
|
||||
<img ngSrc="assets/images/placeholder_properties.jpg" class="w-12 h-12 object-cover rounded" width="48" height="48" alt="Property placeholder image" />
|
||||
}
|
||||
<div>
|
||||
<p class="font-medium">{{ selectOptions.getCommercialProperty(listing.type) }}</p>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { NgOptimizedImage } from '@angular/common';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -18,7 +19,7 @@ import { formatPhoneNumber, map2User } from '../../../utils/utils';
|
||||
@Component({
|
||||
selector: 'app-details-user',
|
||||
standalone: true,
|
||||
imports: [SharedModule, BreadcrumbsComponent],
|
||||
imports: [SharedModule, BreadcrumbsComponent, NgOptimizedImage],
|
||||
templateUrl: './details-user.component.html',
|
||||
styleUrl: '../details.scss',
|
||||
})
|
||||
|
||||
@@ -58,6 +58,7 @@ button.share {
|
||||
margin-right: 4px;
|
||||
margin-left: 2px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
i {
|
||||
font-size: 15px;
|
||||
}
|
||||
@@ -71,6 +72,15 @@ button.share {
|
||||
.share-email {
|
||||
background-color: #ff961c;
|
||||
}
|
||||
.share-facebook {
|
||||
background-color: #1877f2;
|
||||
}
|
||||
.share-twitter {
|
||||
background-color: #000000;
|
||||
}
|
||||
.share-linkedin {
|
||||
background-color: #0a66c2;
|
||||
}
|
||||
:host ::ng-deep .ng-select-container {
|
||||
height: 42px !important;
|
||||
border-radius: 0.5rem;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<header class="w-full flex justify-between items-center p-4 bg-white top-0 z-10 h-16 md:h-20">
|
||||
<img src="assets/images/header-logo.png" alt="Logo" class="h-8 md:h-10 w-auto" />
|
||||
<img src="/assets/images/header-logo.png" alt="Logo" class="h-8 md:h-10 w-auto" />
|
||||
<div class="hidden md:flex items-center space-x-4">
|
||||
@if(user){
|
||||
<a routerLink="/account" class="text-primary-600 border border-primary-600 px-3 py-2 rounded">Account</a>
|
||||
} @else {
|
||||
<!-- <a routerLink="/pricing" class="text-neutral-800">Pricing</a> -->
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'login' }" class="text-primary-600 border border-primary-600 px-3 py-2 rounded">Log In</a>
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'register' }" class="text-white bg-primary-600 px-4 py-2 rounded">Register</a>
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'login' }"
|
||||
class="text-primary-600 border border-primary-600 px-3 py-2 rounded">Log In</a>
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'register' }" class="text-white bg-primary-600 px-4 py-2 rounded">Sign
|
||||
Up</a>
|
||||
<!-- <a routerLink="/login" class="text-primary-500 hover:underline">Login/Register</a> -->
|
||||
}
|
||||
</div>
|
||||
@@ -24,7 +26,7 @@
|
||||
<a routerLink="/account" class="text-white text-xl py-2">Account</a>
|
||||
} @else {
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'login' }" class="text-white text-xl py-2">Log In</a>
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'register' }" class="text-white text-xl py-2">Register</a>
|
||||
<a routerLink="/login" [queryParams]="{ mode: 'register' }" class="text-white text-xl py-2">Sign Up</a>
|
||||
}
|
||||
<button (click)="toggleMenu()" class="text-white mt-4">
|
||||
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
@@ -38,8 +40,7 @@
|
||||
<!-- 1. px-4 für <main> (vorher px-2 sm:px-4) -->
|
||||
<main class="flex flex-col items-center justify-center px-4 w-full flex-grow">
|
||||
<div
|
||||
class="bg-cover-custom pb-12 md:py-20 flex flex-col w-full rounded-xl lg:rounded-2xl md:drop-shadow-custom-md lg:drop-shadow-custom-lg min-h-[calc(100vh_-_20rem)] lg:min-h-[calc(100vh_-_10rem)] max-sm:bg-contain max-sm:bg-bottom max-sm:bg-no-repeat max-sm:min-h-[60vh] max-sm:bg-primary-600"
|
||||
>
|
||||
class="bg-cover-custom pb-12 md:py-20 flex flex-col w-full rounded-xl lg:rounded-2xl md:drop-shadow-custom-md lg:drop-shadow-custom-lg min-h-[calc(100vh_-_20rem)] lg:min-h-[calc(100vh_-_10rem)] max-sm:bg-contain max-sm:bg-bottom max-sm:bg-no-repeat max-sm:min-h-[60vh] max-sm:bg-primary-600">
|
||||
<div class="flex justify-center w-full">
|
||||
<!-- 3. Für Mobile: m-2 statt max-w-xs; ab sm: wieder max-width und kein Margin -->
|
||||
<div class="w-full m-2 sm:m-0 sm:max-w-md md:max-w-xl lg:max-w-2xl xl:max-w-3xl">
|
||||
@@ -52,72 +53,74 @@
|
||||
|
||||
<!-- 2) Textblock -->
|
||||
<div class="relative z-10 mx-auto max-w-4xl px-6 sm:px-6 py-4 sm:py-16 text-center text-white">
|
||||
<h1 class="text-[1.55rem] sm:text-4xl md:text-5xl lg:text-6xl font-extrabold tracking-tight leading-tight drop-shadow-[0_2px_6px_rgba(0,0,0,0.55)]">Buy & Sell Businesses and Commercial Properties</h1>
|
||||
<h1
|
||||
class="text-[1.55rem] sm:text-4xl md:text-5xl lg:text-6xl font-extrabold tracking-tight leading-tight drop-shadow-[0_2px_6px_rgba(0,0,0,0.55)]">
|
||||
Buy & Sell Businesses and Commercial Properties</h1>
|
||||
|
||||
<p class="mt-3 sm:mt-4 text-base sm:text-lg md:text-xl lg:text-2xl font-medium text-white/90 drop-shadow-[0_1.5px_4px_rgba(0,0,0,0.6)]">Find profitable businesses for sale, commercial real estate, and franchise opportunities across the United States</p>
|
||||
<p
|
||||
class="mt-3 sm:mt-4 text-base sm:text-lg md:text-xl lg:text-2xl font-medium text-white/90 drop-shadow-[0_1.5px_4px_rgba(0,0,0,0.6)]">
|
||||
Find profitable businesses for sale, commercial real estate, and franchise opportunities across the United
|
||||
States</p>
|
||||
</div>
|
||||
</section>
|
||||
<!-- Restliche Anpassungen (Innenabstände, Button-Paddings etc.) bleiben wie im vorherigen Schritt -->
|
||||
<div class="search-form-container bg-white bg-opacity-80 pb-4 md:pb-6 pt-2 px-3 sm:px-4 md:px-6 rounded-lg shadow-lg w-full" [ngClass]="{ 'pt-6': aiSearch }">
|
||||
<div
|
||||
class="search-form-container bg-white bg-opacity-80 pb-4 md:pb-6 pt-2 px-3 sm:px-4 md:px-6 rounded-lg shadow-lg w-full"
|
||||
[ngClass]="{ 'pt-6': aiSearch }">
|
||||
@if(!aiSearch){
|
||||
<div class="text-sm lg:text-base mb-1 text-center text-neutral-500 border-neutral-200 dark:text-neutral-400 dark:border-neutral-700 flex justify-between">
|
||||
<div
|
||||
class="text-sm lg:text-base mb-1 text-center text-neutral-500 border-neutral-200 dark:text-neutral-400 dark:border-neutral-700 flex justify-between">
|
||||
<ul class="flex flex-wrap -mb-px w-full">
|
||||
<li class="w-[33%]">
|
||||
<a
|
||||
(click)="changeTab('business')"
|
||||
[ngClass]="
|
||||
<a (click)="changeTab('business')" [ngClass]="
|
||||
activeTabAction === 'business'
|
||||
? ['text-primary-600', 'border-primary-600', 'active', 'dark:text-primary-500', 'dark:border-primary-500']
|
||||
: ['border-transparent', 'hover:text-neutral-600', 'hover:border-neutral-300', 'dark:hover:text-neutral-300']
|
||||
"
|
||||
class="tab-link hover:cursor-pointer inline-flex items-center justify-center px-1 py-2 md:p-4 border-b-2 rounded-t-lg"
|
||||
>
|
||||
<img src="assets/images/business_logo.png" alt="Search businesses for sale" class="tab-icon w-6 h-6 md:w-7 md:h-7 mr-1 md:mr-2 object-contain" width="28" height="28" />
|
||||
class="tab-link hover:cursor-pointer inline-flex items-center justify-center px-1 py-2 md:p-4 border-b-2 rounded-t-lg">
|
||||
<img src="/assets/images/business_logo.png" alt="Search businesses for sale"
|
||||
class="tab-icon w-6 h-6 md:w-7 md:h-7 mr-1 md:mr-2 object-contain" width="28" height="28" />
|
||||
<span>Businesses</span>
|
||||
</a>
|
||||
</li>
|
||||
@if ((numberOfCommercial$ | async) > 0) {
|
||||
<li class="w-[33%]">
|
||||
<a
|
||||
(click)="changeTab('commercialProperty')"
|
||||
[ngClass]="
|
||||
<a (click)="changeTab('commercialProperty')" [ngClass]="
|
||||
activeTabAction === 'commercialProperty'
|
||||
? ['text-primary-600', 'border-primary-600', 'active', 'dark:text-primary-500', 'dark:border-primary-500']
|
||||
: ['border-transparent', 'hover:text-neutral-600', 'hover:border-neutral-300', 'dark:hover:text-neutral-300']
|
||||
"
|
||||
class="tab-link hover:cursor-pointer inline-flex items-center justify-center px-1 py-2 md:p-4 border-b-2 rounded-t-lg"
|
||||
>
|
||||
<img src="assets/images/properties_logo.png" alt="Search commercial properties for sale" class="tab-icon w-6 h-6 md:w-7 md:h-7 mr-1 md:mr-2 object-contain" width="28" height="28" />
|
||||
class="tab-link hover:cursor-pointer inline-flex items-center justify-center px-1 py-2 md:p-4 border-b-2 rounded-t-lg">
|
||||
<img src="/assets/images/properties_logo.png" alt="Search commercial properties for sale"
|
||||
class="tab-icon w-6 h-6 md:w-7 md:h-7 mr-1 md:mr-2 object-contain" width="28" height="28" />
|
||||
<span>Properties</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
<li class="w-[33%]">
|
||||
<a
|
||||
(click)="changeTab('broker')"
|
||||
[ngClass]="
|
||||
<a (click)="changeTab('broker')" [ngClass]="
|
||||
activeTabAction === 'broker'
|
||||
? ['text-primary-600', 'border-primary-600', 'active', 'dark:text-primary-500', 'dark:border-primary-500']
|
||||
: ['border-transparent', 'hover:text-neutral-600', 'hover:border-neutral-300', 'dark:hover:text-neutral-300']
|
||||
"
|
||||
class="tab-link hover:cursor-pointer inline-flex items-center justify-center px-1 py-2 md:p-4 border-b-2 rounded-t-lg"
|
||||
>
|
||||
<img src="assets/images/icon_professionals.png" alt="Search business professionals and brokers" class="tab-icon w-6 h-6 md:w-7 md:h-7 mr-1 md:mr-2 object-contain bg-transparent" style="mix-blend-mode: darken;" />
|
||||
class="tab-link hover:cursor-pointer inline-flex items-center justify-center px-1 py-2 md:p-4 border-b-2 rounded-t-lg">
|
||||
<img src="/assets/images/icon_professionals.png" alt="Search business professionals and brokers"
|
||||
class="tab-icon w-6 h-6 md:w-7 md:h-7 mr-1 md:mr-2 object-contain bg-transparent"
|
||||
style="mix-blend-mode: darken;" />
|
||||
<span>Professionals</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
} @if(criteria && !aiSearch){
|
||||
<div class="w-full max-w-3xl mx-auto bg-white rounded-lg flex flex-col md:flex-row md:border md:border-neutral-300">
|
||||
<div
|
||||
class="w-full max-w-3xl mx-auto bg-white rounded-lg flex flex-col md:flex-row md:border md:border-neutral-300">
|
||||
<div class="md:flex-none md:w-48 flex-1 md:border-r border-neutral-300 overflow-hidden mb-2 md:mb-0">
|
||||
<div class="relative max-sm:border border-neutral-300 rounded-md">
|
||||
<select
|
||||
class="appearance-none bg-transparent w-full py-4 px-4 pr-8 focus:outline-none md:border-none rounded-md md:rounded-none min-h-[52px]"
|
||||
[ngModel]="criteria.types"
|
||||
(ngModelChange)="onTypesChange($event)"
|
||||
[ngClass]="{ 'placeholder-selected': criteria.types.length === 0 }"
|
||||
>
|
||||
[ngModel]="criteria.types" (ngModelChange)="onTypesChange($event)"
|
||||
[ngClass]="{ 'placeholder-selected': criteria.types.length === 0 }">
|
||||
<option [value]="[]">{{ getPlaceholderLabel() }}</option>
|
||||
@for(type of getTypes(); track type){
|
||||
<option [value]="type.value">{{ type.name }}</option>
|
||||
@@ -131,21 +134,12 @@
|
||||
|
||||
<div class="md:flex-auto md:w-36 flex-grow md:border-r border-neutral-300 mb-2 md:mb-0">
|
||||
<div class="relative max-sm:border border-neutral-300 rounded-md">
|
||||
<ng-select
|
||||
class="custom md:border-none rounded-md md:rounded-none"
|
||||
[multiple]="false"
|
||||
[hideSelected]="true"
|
||||
[trackByFn]="trackByFn"
|
||||
[minTermLength]="2"
|
||||
[loading]="cityLoading"
|
||||
typeToSearchText="Please enter 2 or more characters"
|
||||
[typeahead]="cityInput$"
|
||||
[ngModel]="cityOrState"
|
||||
(ngModelChange)="setCityOrState($event)"
|
||||
placeholder="Enter City or State ..."
|
||||
groupBy="type"
|
||||
>
|
||||
@for (city of cities$ | async; track city.id) { @let state = city.type==='city'?city.content.state:''; @let separator = city.type==='city'?' - ':'';
|
||||
<ng-select class="custom md:border-none rounded-md md:rounded-none" [multiple]="false"
|
||||
[hideSelected]="true" [trackByFn]="trackByFn" [minTermLength]="2" [loading]="cityLoading"
|
||||
typeToSearchText="Please enter 2 or more characters" [typeahead]="cityInput$" [ngModel]="cityOrState"
|
||||
(ngModelChange)="setCityOrState($event)" placeholder="Enter City or State ..." groupBy="type">
|
||||
@for (city of cities$ | async; track city.id) { @let state = city.type==='city'?city.content.state:'';
|
||||
@let separator = city.type==='city'?' - ':'';
|
||||
<ng-option [value]="city">{{ city.content.name }}{{ separator }}{{ state }}</ng-option>
|
||||
}
|
||||
</ng-select>
|
||||
@@ -156,10 +150,8 @@
|
||||
<div class="relative max-sm:border border-neutral-300 rounded-md">
|
||||
<select
|
||||
class="appearance-none bg-transparent w-full py-4 px-4 pr-8 focus:outline-none md:border-none rounded-md md:rounded-none min-h-[52px]"
|
||||
(ngModelChange)="onRadiusChange($event)"
|
||||
[ngModel]="criteria.radius"
|
||||
[ngClass]="{ 'placeholder-selected': !criteria.radius }"
|
||||
>
|
||||
(ngModelChange)="onRadiusChange($event)" [ngModel]="criteria.radius"
|
||||
[ngClass]="{ 'placeholder-selected': !criteria.radius }">
|
||||
<option [value]="null">City Radius</option>
|
||||
@for(dist of selectOptions.distances; track dist){
|
||||
<option [value]="dist.value">{{ dist.name }}</option>
|
||||
@@ -173,12 +165,16 @@
|
||||
}
|
||||
<div class="bg-primary-500 hover:bg-primary-600 max-sm:rounded-md search-button">
|
||||
@if( numberOfResults$){
|
||||
<button class="w-full h-full text-white font-bold py-2 px-4 md:py-3 md:px-6 focus:outline-none rounded-md md:rounded-none min-h-[52px] flex items-center justify-center gap-2" (click)="search()">
|
||||
<button
|
||||
class="w-full h-full text-white font-bold py-2 px-4 md:py-3 md:px-6 focus:outline-none rounded-md md:rounded-none min-h-[52px] flex items-center justify-center gap-2"
|
||||
(click)="search()">
|
||||
<i class="fas fa-search"></i>
|
||||
<span>Search {{ numberOfResults$ | async }}</span>
|
||||
</button>
|
||||
}@else {
|
||||
<button class="w-full h-full text-white font-bold py-2 px-4 md:py-3 md:px-6 focus:outline-none rounded-md md:rounded-none min-h-[52px] flex items-center justify-center gap-2" (click)="search()">
|
||||
<button
|
||||
class="w-full h-full text-white font-bold py-2 px-4 md:py-3 md:px-6 focus:outline-none rounded-md md:rounded-none min-h-[52px] flex items-center justify-center gap-2"
|
||||
(click)="search()">
|
||||
<i class="fas fa-search"></i>
|
||||
<span>Search</span>
|
||||
</button>
|
||||
@@ -191,68 +187,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Trust & Social Proof Section -->
|
||||
<div class="w-full px-4 mt-8">
|
||||
<div class="trust-section-container bg-white rounded-xl py-10 px-6 md:px-10 border border-neutral-200">
|
||||
<div class="max-w-6xl mx-auto">
|
||||
<h2 class="text-2xl md:text-3xl font-semibold text-center text-neutral-800 mb-2">Trusted by Thousands</h2>
|
||||
<p class="text-center text-neutral-500 mb-10 text-base">Join thousands of successful buyers and sellers on BizMatch</p>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 md:gap-8">
|
||||
<!-- Trust Badge 1 -->
|
||||
<div class="trust-badge text-center">
|
||||
<div class="trust-icon inline-flex items-center justify-center w-12 h-12 bg-neutral-100 text-neutral-600 rounded-full mb-3">
|
||||
<i class="fas fa-shield-alt text-lg"></i>
|
||||
</div>
|
||||
<h3 class="text-base font-semibold text-neutral-800 mb-1">Verified Listings</h3>
|
||||
<p class="text-sm text-neutral-500">All business listings are verified and reviewed by our team</p>
|
||||
</div>
|
||||
|
||||
<!-- Trust Badge 2 -->
|
||||
<div class="trust-badge text-center">
|
||||
<div class="trust-icon inline-flex items-center justify-center w-12 h-12 bg-neutral-100 text-neutral-600 rounded-full mb-3">
|
||||
<i class="fas fa-users text-lg"></i>
|
||||
</div>
|
||||
<h3 class="text-base font-semibold text-neutral-800 mb-1">Expert Support</h3>
|
||||
<p class="text-sm text-neutral-500">Connect with licensed business brokers and advisors</p>
|
||||
</div>
|
||||
|
||||
<!-- Trust Badge 3 -->
|
||||
<div class="trust-badge text-center">
|
||||
<div class="trust-icon inline-flex items-center justify-center w-12 h-12 bg-neutral-100 text-neutral-600 rounded-full mb-3">
|
||||
<i class="fas fa-lock text-lg"></i>
|
||||
</div>
|
||||
<h3 class="text-base font-semibold text-neutral-800 mb-1">Secure Platform</h3>
|
||||
<p class="text-sm text-neutral-500">Your information is protected with enterprise-grade security</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats Row -->
|
||||
<div class="stats-section grid grid-cols-2 md:grid-cols-4 gap-4 md:gap-6 mt-10 pt-6 border-t border-neutral-100">
|
||||
<div class="text-center">
|
||||
<div class="stat-number text-2xl md:text-3xl font-semibold text-neutral-700 mb-1">{{ activeListingsCount | number:'1.0-0' }}+</div>
|
||||
<div class="text-xs md:text-sm text-neutral-500">Active Listings</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<div class="stat-number text-2xl md:text-3xl font-semibold text-neutral-700 mb-1">{{ successfulSalesCount | number:'1.0-0' }}+</div>
|
||||
<div class="text-xs md:text-sm text-neutral-500">Successful Sales</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<div class="stat-number text-2xl md:text-3xl font-semibold text-neutral-700 mb-1">{{ brokersCount | number:'1.0-0' }}+</div>
|
||||
<div class="text-xs md:text-sm text-neutral-500">Business Brokers</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<div class="stat-number text-2xl md:text-3xl font-semibold text-neutral-700 mb-1">24/7</div>
|
||||
<div class="text-xs md:text-sm text-neutral-500">Platform Access</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- FAQ Section for SEO/AEO -->
|
||||
<div class="w-full px-4 mt-12 max-w-4xl mx-auto">
|
||||
<app-faq [faqItems]="faqItems"></app-faq>
|
||||
</div>
|
||||
</main>
|
||||
<!-- ==== ANPASSUNGEN ENDE ==== -->
|
||||
<!-- ==== ANPASSUNGEN ENDE ==== -->
|
||||
@@ -24,7 +24,7 @@ import { map2User } from '../../utils/utils';
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, RouterModule, NgSelectModule, TooltipComponent, FaqComponent],
|
||||
imports: [CommonModule, FormsModule, RouterModule, NgSelectModule, FaqComponent],
|
||||
templateUrl: './home.component.html',
|
||||
styleUrl: './home.component.scss',
|
||||
})
|
||||
@@ -59,12 +59,6 @@ export class HomeComponent {
|
||||
showInput: boolean = true;
|
||||
tooltipTargetBeta = 'tooltipTargetBeta';
|
||||
|
||||
// Counter animation
|
||||
activeListingsCount = 0;
|
||||
successfulSalesCount = 0;
|
||||
brokersCount = 0;
|
||||
hasAnimated = false;
|
||||
|
||||
// FAQ data optimized for AEO (Answer Engine Optimization) and Featured Snippets
|
||||
faqItems: FAQItem[] = [
|
||||
{
|
||||
@@ -123,7 +117,7 @@ export class HomeComponent {
|
||||
private authService: AuthService,
|
||||
private filterStateService: FilterStateService,
|
||||
private seoService: SeoService,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
async ngOnInit() {
|
||||
// Flowbite is now initialized once in AppComponent
|
||||
@@ -200,47 +194,6 @@ export class HomeComponent {
|
||||
this.user = map2User(token);
|
||||
this.loadCities();
|
||||
this.setTotalNumberOfResults();
|
||||
|
||||
// Setup intersection observer for counter animation
|
||||
this.setupCounterAnimation();
|
||||
}
|
||||
|
||||
setupCounterAnimation() {
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting && !this.hasAnimated) {
|
||||
this.hasAnimated = true;
|
||||
this.animateCounter('activeListingsCount', 1000, 2000);
|
||||
this.animateCounter('successfulSalesCount', 500, 2000);
|
||||
this.animateCounter('brokersCount', 50, 2000);
|
||||
}
|
||||
});
|
||||
},
|
||||
{ threshold: 0.3 }
|
||||
);
|
||||
|
||||
// Wait for the element to be available
|
||||
setTimeout(() => {
|
||||
const statsElement = document.querySelector('.stats-section');
|
||||
if (statsElement) {
|
||||
observer.observe(statsElement);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
animateCounter(property: 'activeListingsCount' | 'successfulSalesCount' | 'brokersCount', target: number, duration: number) {
|
||||
const start = 0;
|
||||
const increment = target / (duration / 16); // 60fps
|
||||
const step = () => {
|
||||
this[property] += increment;
|
||||
if (this[property] < target) {
|
||||
requestAnimationFrame(step);
|
||||
} else {
|
||||
this[property] = target;
|
||||
}
|
||||
};
|
||||
requestAnimationFrame(step);
|
||||
}
|
||||
|
||||
changeTab(tabname: 'business' | 'commercialProperty' | 'broker') {
|
||||
|
||||
@@ -14,13 +14,15 @@
|
||||
|
||||
<!-- SEO-optimized heading -->
|
||||
<div class="mb-6">
|
||||
<h1 class="text-3xl md:text-4xl font-bold text-neutral-900 mb-2">Business Professionals Directory</h1>
|
||||
<p class="text-lg text-neutral-600">Connect with licensed business brokers, CPAs, attorneys, and other professionals across the United States.</p>
|
||||
<h1 class="text-3xl md:text-4xl font-bold text-neutral-900 mb-2">Professional Business Brokers & Advisors</h1>
|
||||
<p class="text-lg text-neutral-600">Connect with licensed business brokers, CPAs, attorneys, and other
|
||||
professionals across the United States.</p>
|
||||
</div>
|
||||
|
||||
<!-- Mobile Filter Button -->
|
||||
<div class="md:hidden mb-4">
|
||||
<button (click)="openFilterModal()" class="w-full bg-primary-600 text-white py-3 px-4 rounded-lg flex items-center justify-center">
|
||||
<button (click)="openFilterModal()"
|
||||
class="w-full bg-primary-600 text-white py-3 px-4 rounded-lg flex items-center justify-center">
|
||||
<i class="fas fa-filter mr-2"></i>
|
||||
Filter Results
|
||||
</button>
|
||||
@@ -31,25 +33,23 @@
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<!-- Professional Cards -->
|
||||
@for (user of users; track user) {
|
||||
<div class="bg-white rounded-lg drop-shadow-custom-bg-mobile md:drop-shadow-custom-bg p-6 flex flex-col justify-between hover:shadow-2xl transition-all duration-300 hover:scale-[1.02]">
|
||||
<div
|
||||
class="bg-white rounded-lg drop-shadow-custom-bg-mobile md:drop-shadow-custom-bg p-6 flex flex-col justify-between hover:shadow-2xl transition-all duration-300 hover:scale-[1.02]">
|
||||
<div class="flex items-start space-x-4">
|
||||
@if(user.hasProfile){
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/profile/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}"
|
||||
[alt]="altText.generateBrokerProfileAlt(user)"
|
||||
class="rounded-md w-20 h-26 object-cover"
|
||||
width="80"
|
||||
height="104" />
|
||||
[alt]="altText.generateBrokerProfileAlt(user)" class="rounded-md w-20 h-26 object-cover" width="80"
|
||||
height="104" />
|
||||
} @else {
|
||||
<img src="assets/images/person_placeholder.jpg"
|
||||
alt="Default business broker placeholder profile photo"
|
||||
class="rounded-md w-20 h-26 object-cover"
|
||||
width="80"
|
||||
height="104" />
|
||||
<img src="/assets/images/person_placeholder.jpg" alt="Default business broker placeholder profile photo"
|
||||
class="rounded-md w-20 h-26 object-cover" width="80" height="104" />
|
||||
}
|
||||
<div class="flex-1">
|
||||
<p class="text-sm text-neutral-800 mb-2">{{ user.description }}</p>
|
||||
<h3 class="text-lg font-semibold">
|
||||
{{ user.firstname }} {{ user.lastname }}<span class="bg-neutral-200 text-neutral-700 text-xs font-semibold px-2 py-1 rounded ml-4">{{ user.location?.name }} - {{ user.location?.state }}</span>
|
||||
{{ user.firstname }} {{ user.lastname }}<span
|
||||
class="bg-neutral-200 text-neutral-700 text-xs font-semibold px-2 py-1 rounded ml-4">{{
|
||||
user.location?.name }} - {{ user.location?.state }}</span>
|
||||
</h3>
|
||||
<div class="flex items-center space-x-2 mt-2">
|
||||
<app-customer-sub-type [customerSubType]="user.customerSubType"></app-customer-sub-type>
|
||||
@@ -61,18 +61,15 @@
|
||||
<div class="mt-4 flex justify-between items-center">
|
||||
@if(user.hasCompanyLogo){
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}"
|
||||
[alt]="altText.generateCompanyLogoAlt(user.companyName, user.firstname + ' ' + user.lastname)"
|
||||
class="w-8 h-10 object-contain"
|
||||
width="32"
|
||||
height="40" />
|
||||
[alt]="altText.generateCompanyLogoAlt(user.companyName, user.firstname + ' ' + user.lastname)"
|
||||
class="w-8 h-10 object-contain" width="32" height="40" />
|
||||
} @else {
|
||||
<img src="assets/images/placeholder.png"
|
||||
alt="Default company logo placeholder"
|
||||
class="w-8 h-10 object-contain"
|
||||
width="32"
|
||||
height="40" />
|
||||
<img src="/assets/images/placeholder.png" alt="Default company logo placeholder"
|
||||
class="w-8 h-10 object-contain" width="32" height="40" />
|
||||
}
|
||||
<button class="bg-success-500 hover:bg-success-600 text-white font-medium py-2 px-4 rounded-full flex items-center" [routerLink]="['/details-user', user.id]">
|
||||
<button
|
||||
class="bg-success-500 hover:bg-success-600 text-white font-medium py-2 px-4 rounded-full flex items-center"
|
||||
[routerLink]="['/details-user', user.id]">
|
||||
View Full profile
|
||||
<i class="fas fa-arrow-right ml-2"></i>
|
||||
</button>
|
||||
@@ -84,39 +81,33 @@
|
||||
<!-- Empty State -->
|
||||
<div class="w-full flex items-center flex-wrap justify-center gap-10 py-12">
|
||||
<div class="grid gap-4 w-60">
|
||||
<svg class="mx-auto" xmlns="http://www.w3.org/2000/svg" width="154" height="161" viewBox="0 0 154 161" fill="none">
|
||||
<svg class="mx-auto" xmlns="http://www.w3.org/2000/svg" width="154" height="161" viewBox="0 0 154 161"
|
||||
fill="none">
|
||||
<path
|
||||
d="M0.0616455 84.4268C0.0616455 42.0213 34.435 7.83765 76.6507 7.83765C118.803 7.83765 153.224 42.0055 153.224 84.4268C153.224 102.42 147.026 118.974 136.622 132.034C122.282 150.138 100.367 161 76.6507 161C52.7759 161 30.9882 150.059 16.6633 132.034C6.25961 118.974 0.0616455 102.42 0.0616455 84.4268Z"
|
||||
fill="#EEF2FF"
|
||||
/>
|
||||
fill="#EEF2FF" />
|
||||
<path
|
||||
d="M96.8189 0.632498L96.8189 0.632384L96.8083 0.630954C96.2034 0.549581 95.5931 0.5 94.9787 0.5H29.338C22.7112 0.5 17.3394 5.84455 17.3394 12.4473V142.715C17.3394 149.318 22.7112 154.662 29.338 154.662H123.948C130.591 154.662 135.946 149.317 135.946 142.715V38.9309C135.946 38.0244 135.847 37.1334 135.648 36.2586L135.648 36.2584C135.117 33.9309 133.874 31.7686 132.066 30.1333C132.066 30.1331 132.065 30.1329 132.065 30.1327L103.068 3.65203C103.068 3.6519 103.067 3.65177 103.067 3.65164C101.311 2.03526 99.1396 0.995552 96.8189 0.632498Z"
|
||||
fill="white"
|
||||
stroke="#E5E7EB"
|
||||
/>
|
||||
fill="white" stroke="#E5E7EB" />
|
||||
<ellipse cx="80.0618" cy="81" rx="28.0342" ry="28.0342" fill="#EEF2FF" />
|
||||
<path
|
||||
d="M99.2393 61.3061L99.2391 61.3058C88.498 50.5808 71.1092 50.5804 60.3835 61.3061C49.6423 72.0316 49.6422 89.4361 60.3832 100.162C71.109 110.903 88.4982 110.903 99.2393 100.162C109.965 89.4363 109.965 72.0317 99.2393 61.3061ZM105.863 54.6832C120.249 69.0695 120.249 92.3985 105.863 106.785C91.4605 121.171 68.1468 121.171 53.7446 106.785C39.3582 92.3987 39.3582 69.0693 53.7446 54.683C68.1468 40.2965 91.4605 40.2966 105.863 54.6832Z"
|
||||
stroke="#E5E7EB"
|
||||
/>
|
||||
<path d="M110.782 119.267L102.016 110.492C104.888 108.267 107.476 105.651 109.564 102.955L118.329 111.729L110.782 119.267Z" stroke="#E5E7EB" />
|
||||
stroke="#E5E7EB" />
|
||||
<path
|
||||
d="M110.782 119.267L102.016 110.492C104.888 108.267 107.476 105.651 109.564 102.955L118.329 111.729L110.782 119.267Z"
|
||||
stroke="#E5E7EB" />
|
||||
<path
|
||||
d="M139.122 125.781L139.122 125.78L123.313 109.988C123.313 109.987 123.313 109.987 123.312 109.986C121.996 108.653 119.849 108.657 118.521 109.985L118.871 110.335L118.521 109.985L109.047 119.459C107.731 120.775 107.735 122.918 109.044 124.247L109.047 124.249L124.858 140.06C128.789 143.992 135.191 143.992 139.122 140.06C143.069 136.113 143.069 129.728 139.122 125.781Z"
|
||||
fill="#A5B4FC"
|
||||
stroke="#818CF8"
|
||||
/>
|
||||
fill="#A5B4FC" stroke="#818CF8" />
|
||||
<path
|
||||
d="M83.185 87.2285C82.5387 87.2285 82.0027 86.6926 82.0027 86.0305C82.0027 83.3821 77.9987 83.3821 77.9987 86.0305C77.9987 86.6926 77.4627 87.2285 76.8006 87.2285C76.1543 87.2285 75.6183 86.6926 75.6183 86.0305C75.6183 80.2294 84.3831 80.2451 84.3831 86.0305C84.3831 86.6926 83.8471 87.2285 83.185 87.2285Z"
|
||||
fill="#4F46E5"
|
||||
/>
|
||||
fill="#4F46E5" />
|
||||
<path
|
||||
d="M93.3528 77.0926H88.403C87.7409 77.0926 87.2049 76.5567 87.2049 75.8946C87.2049 75.2483 87.7409 74.7123 88.403 74.7123H93.3528C94.0149 74.7123 94.5509 75.2483 94.5509 75.8946C94.5509 76.5567 94.0149 77.0926 93.3528 77.0926Z"
|
||||
fill="#4F46E5"
|
||||
/>
|
||||
fill="#4F46E5" />
|
||||
<path
|
||||
d="M71.5987 77.0925H66.6488C65.9867 77.0925 65.4507 76.5565 65.4507 75.8945C65.4507 75.2481 65.9867 74.7122 66.6488 74.7122H71.5987C72.245 74.7122 72.781 75.2481 72.781 75.8945C72.781 76.5565 72.245 77.0925 71.5987 77.0925Z"
|
||||
fill="#4F46E5"
|
||||
/>
|
||||
fill="#4F46E5" />
|
||||
<rect x="38.3522" y="21.5128" width="41.0256" height="2.73504" rx="1.36752" fill="#4F46E5" />
|
||||
<rect x="38.3522" y="133.65" width="54.7009" height="5.47009" rx="2.73504" fill="#A5B4FC" />
|
||||
<rect x="38.3522" y="29.7179" width="13.6752" height="2.73504" rx="1.36752" fill="#4F46E5" />
|
||||
@@ -125,10 +116,14 @@
|
||||
<circle cx="67.0702" cy="31.0854" r="1.36752" fill="#4F46E5" />
|
||||
</svg>
|
||||
<div>
|
||||
<h2 class="text-center text-black text-xl font-semibold leading-loose pb-2">There're no professionals here</h2>
|
||||
<p class="text-center text-black text-base font-normal leading-relaxed pb-4">Try changing your filters to <br />see professionals</p>
|
||||
<h2 class="text-center text-black text-xl font-semibold leading-loose pb-2">There're no professionals here
|
||||
</h2>
|
||||
<p class="text-center text-black text-base font-normal leading-relaxed pb-4">Try changing your filters to
|
||||
<br />see professionals</p>
|
||||
<div class="flex gap-3">
|
||||
<button (click)="clearAllFilters()" class="w-full px-3 py-2 rounded-full border border-neutral-300 text-neutral-900 text-xs font-semibold leading-4">Clear Filter</button>
|
||||
<button (click)="clearAllFilters()"
|
||||
class="w-full px-3 py-2 rounded-full border border-neutral-300 text-neutral-900 text-xs font-semibold leading-4">Clear
|
||||
Filter</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -143,4 +138,4 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@ import { assignProperties, resetUserListingCriteria } from '../../../utils/utils
|
||||
@Component({
|
||||
selector: 'app-broker-listings',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, RouterModule, NgOptimizedImage, PaginatorComponent, CustomerSubTypeComponent, BreadcrumbsComponent, SearchModalBrokerComponent],
|
||||
imports: [CommonModule, FormsModule, RouterModule, PaginatorComponent, CustomerSubTypeComponent, BreadcrumbsComponent, SearchModalBrokerComponent],
|
||||
templateUrl: './broker-listings.component.html',
|
||||
styleUrls: ['./broker-listings.component.scss', '../../pages.scss'],
|
||||
})
|
||||
@@ -118,7 +118,7 @@ export class BrokerListingsComponent implements OnInit, OnDestroy {
|
||||
this.search();
|
||||
}
|
||||
|
||||
reset() {}
|
||||
reset() { }
|
||||
|
||||
// New methods for filter actions
|
||||
clearAllFilters() {
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
<!-- SEO-optimized heading -->
|
||||
<div class="mb-6">
|
||||
<h1 class="text-3xl md:text-4xl font-bold text-neutral-900 mb-2">Businesses for Sale</h1>
|
||||
<p class="text-lg text-neutral-600">Discover profitable business opportunities across the United States. Browse verified listings from business owners and brokers.</p>
|
||||
<p class="text-lg text-neutral-600">Discover profitable business opportunities across the United States. Browse
|
||||
verified listings from business owners and brokers.</p>
|
||||
</div>
|
||||
|
||||
<!-- Loading Skeleton -->
|
||||
@@ -55,39 +56,42 @@
|
||||
<h2 class="text-2xl font-semibold text-neutral-800 mb-4">Available Business Listings</h2>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
@for (listing of listings; track listing.id) {
|
||||
<div class="bg-white rounded-lg drop-shadow-custom-bg-mobile md:drop-shadow-custom-bg overflow-hidden hover:shadow-2xl transition-all duration-300 hover:scale-[1.02] group">
|
||||
<div
|
||||
class="bg-white rounded-lg drop-shadow-custom-bg-mobile md:drop-shadow-custom-bg overflow-hidden hover:shadow-2xl transition-all duration-300 hover:scale-[1.02] group">
|
||||
<div class="p-6 flex flex-col h-full relative z-[0]">
|
||||
<!-- Quick Actions Overlay -->
|
||||
<div class="absolute top-4 right-4 flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-20">
|
||||
<div
|
||||
class="absolute top-4 right-4 flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-20">
|
||||
@if(user) {
|
||||
<button
|
||||
class="bg-white rounded-full p-2 shadow-lg transition-colors"
|
||||
<button class="bg-white rounded-full p-2 shadow-lg transition-colors"
|
||||
[class.bg-red-50]="isFavorite(listing)"
|
||||
[title]="isFavorite(listing) ? 'Remove from favorites' : 'Save to favorites'"
|
||||
(click)="toggleFavorite($event, listing)">
|
||||
<i [class]="isFavorite(listing) ? 'fas fa-heart text-red-500' : 'far fa-heart text-red-500 hover:scale-110 transition-transform'"></i>
|
||||
<i
|
||||
[class]="isFavorite(listing) ? 'fas fa-heart text-red-500' : 'far fa-heart text-red-500 hover:scale-110 transition-transform'"></i>
|
||||
</button>
|
||||
}
|
||||
<button
|
||||
class="bg-white rounded-full p-2 shadow-lg hover:bg-blue-50 transition-colors"
|
||||
title="Share listing"
|
||||
(click)="$event.stopPropagation()">
|
||||
<button type="button" class="bg-white rounded-full p-2 shadow-lg hover:bg-blue-50 transition-colors"
|
||||
title="Share listing" (click)="shareListing($event, listing)">
|
||||
<i class="fas fa-share-alt text-blue-500 hover:scale-110 transition-transform"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center mb-4">
|
||||
<i [class]="selectOptions.getIconAndTextColorType(listing.type)" class="mr-2 text-xl"></i>
|
||||
<span [class]="selectOptions.getTextColorType(listing.type)" class="font-bold text-lg">{{ selectOptions.getBusiness(listing.type) }}</span>
|
||||
<span [class]="selectOptions.getTextColorType(listing.type)" class="font-bold text-lg">{{
|
||||
selectOptions.getBusiness(listing.type) }}</span>
|
||||
</div>
|
||||
<h2 class="text-xl font-semibold mb-4">
|
||||
{{ listing.title }}
|
||||
@if(listing.draft) {
|
||||
<span class="bg-amber-100 text-amber-800 border border-amber-300 text-sm font-medium me-2 ml-2 px-2.5 py-0.5 rounded">Draft</span>
|
||||
<span
|
||||
class="bg-amber-100 text-amber-800 border border-amber-300 text-sm font-medium me-2 ml-2 px-2.5 py-0.5 rounded">Draft</span>
|
||||
}
|
||||
</h2>
|
||||
<div class="flex justify-between">
|
||||
<span class="w-fit inline-flex items-center justify-center px-2 py-1 mb-4 text-xs font-bold leading-none bg-neutral-200 text-neutral-700 rounded-full">
|
||||
<span
|
||||
class="w-fit inline-flex items-center justify-center px-2 py-1 mb-4 text-xs font-bold leading-none bg-neutral-200 text-neutral-700 rounded-full">
|
||||
{{ selectOptions.getState(listing.location.state) }}
|
||||
</span>
|
||||
|
||||
@@ -97,8 +101,7 @@
|
||||
[ngClass]="{
|
||||
'bg-emerald-100 text-emerald-800 border-emerald-300': badge === 'NEW',
|
||||
'bg-teal-100 text-teal-800 border-teal-300': badge === 'UPDATED'
|
||||
}"
|
||||
>
|
||||
}">
|
||||
{{ badge }}
|
||||
</span>
|
||||
}
|
||||
@@ -112,28 +115,28 @@
|
||||
</p>
|
||||
<p class="text-sm text-neutral-600 mb-2">
|
||||
<strong>Sales revenue:</strong>
|
||||
{{ listing?.salesRevenue != null ? (listing.salesRevenue | currency : 'USD' : 'symbol' : '1.0-0') : 'undisclosed' }}
|
||||
{{ listing?.salesRevenue != null ? (listing.salesRevenue | currency : 'USD' : 'symbol' : '1.0-0') :
|
||||
'undisclosed' }}
|
||||
</p>
|
||||
<p class="text-sm text-neutral-600 mb-2">
|
||||
<strong>Net profit:</strong>
|
||||
{{ listing?.cashFlow != null ? (listing.cashFlow | currency : 'USD' : 'symbol' : '1.0-0') : 'undisclosed' }}
|
||||
{{ listing?.cashFlow != null ? (listing.cashFlow | currency : 'USD' : 'symbol' : '1.0-0') : 'undisclosed'
|
||||
}}
|
||||
</p>
|
||||
<p class="text-sm text-neutral-600 mb-2">
|
||||
<strong>Location:</strong> {{ listing.location.name ? listing.location.name : listing.location.county ? listing.location.county : this.selectOptions.getState(listing.location.state) }}
|
||||
<strong>Location:</strong> {{ listing.location.name ? listing.location.name : listing.location.county ?
|
||||
listing.location.county : this.selectOptions.getState(listing.location.state) }}
|
||||
</p>
|
||||
<p class="text-sm text-neutral-600 mb-4"><strong>Years established:</strong> {{ listing.established }}</p>
|
||||
@if(listing.imageName) {
|
||||
<img [appLazyLoad]="env.imageBaseUrl + '/pictures/logo/' + listing.imageName + '.avif?_ts=' + ts"
|
||||
[alt]="altText.generateListingCardLogoAlt(listing)"
|
||||
class="absolute bottom-[80px] right-[20px] h-[45px] w-auto"
|
||||
width="100"
|
||||
height="45" />
|
||||
[alt]="altText.generateListingCardLogoAlt(listing)"
|
||||
class="absolute bottom-[80px] right-[20px] h-[45px] w-auto" width="100" height="45" />
|
||||
}
|
||||
<div class="flex-grow"></div>
|
||||
<button
|
||||
class="bg-success-600 text-white px-5 py-3 rounded-full w-full flex items-center justify-center mt-4 transition-all duration-200 hover:bg-success-700 hover:shadow-lg group/btn"
|
||||
[routerLink]="['/business', listing.slug || listing.id]"
|
||||
>
|
||||
[routerLink]="['/business', listing.slug || listing.id]">
|
||||
<span class="font-semibold">View Opportunity</span>
|
||||
<i class="fas fa-arrow-right ml-2 group-hover/btn:translate-x-1 transition-transform duration-200"></i>
|
||||
</button>
|
||||
@@ -144,39 +147,33 @@
|
||||
} @else if (listings?.length === 0) {
|
||||
<div class="w-full flex items-center flex-wrap justify-center gap-10 py-12">
|
||||
<div class="grid gap-6 max-w-2xl w-full">
|
||||
<svg class="mx-auto" xmlns="http://www.w3.org/2000/svg" width="154" height="161" viewBox="0 0 154 161" fill="none">
|
||||
<svg class="mx-auto" xmlns="http://www.w3.org/2000/svg" width="154" height="161" viewBox="0 0 154 161"
|
||||
fill="none">
|
||||
<path
|
||||
d="M0.0616455 84.4268C0.0616455 42.0213 34.435 7.83765 76.6507 7.83765C118.803 7.83765 153.224 42.0055 153.224 84.4268C153.224 102.42 147.026 118.974 136.622 132.034C122.282 150.138 100.367 161 76.6507 161C52.7759 161 30.9882 150.059 16.6633 132.034C6.25961 118.974 0.0616455 102.42 0.0616455 84.4268Z"
|
||||
fill="#EEF2FF"
|
||||
/>
|
||||
fill="#EEF2FF" />
|
||||
<path
|
||||
d="M96.8189 0.632498L96.8189 0.632384L96.8083 0.630954C96.2034 0.549581 95.5931 0.5 94.9787 0.5H29.338C22.7112 0.5 17.3394 5.84455 17.3394 12.4473V142.715C17.3394 149.318 22.7112 154.662 29.338 154.662H123.948C130.591 154.662 135.946 149.317 135.946 142.715V38.9309C135.946 38.0244 135.847 37.1334 135.648 36.2586L135.648 36.2584C135.117 33.9309 133.874 31.7686 132.066 30.1333C132.066 30.1331 132.065 30.1329 132.065 30.1327L103.068 3.65203C103.068 3.6519 103.067 3.65177 103.067 3.65164C101.311 2.03526 99.1396 0.995552 96.8189 0.632498Z"
|
||||
fill="white"
|
||||
stroke="#E5E7EB"
|
||||
/>
|
||||
fill="white" stroke="#E5E7EB" />
|
||||
<ellipse cx="80.0618" cy="81" rx="28.0342" ry="28.0342" fill="#EEF2FF" />
|
||||
<path
|
||||
d="M99.2393 61.3061L99.2391 61.3058C88.498 50.5808 71.1092 50.5804 60.3835 61.3061C49.6423 72.0316 49.6422 89.4361 60.3832 100.162C71.109 110.903 88.4982 110.903 99.2393 100.162C109.965 89.4363 109.965 72.0317 99.2393 61.3061ZM105.863 54.6832C120.249 69.0695 120.249 92.3985 105.863 106.785C91.4605 121.171 68.1468 121.171 53.7446 106.785C39.3582 92.3987 39.3582 69.0693 53.7446 54.683C68.1468 40.2965 91.4605 40.2966 105.863 54.6832Z"
|
||||
stroke="#E5E7EB"
|
||||
/>
|
||||
<path d="M110.782 119.267L102.016 110.492C104.888 108.267 107.476 105.651 109.564 102.955L118.329 111.729L110.782 119.267Z" stroke="#E5E7EB" />
|
||||
stroke="#E5E7EB" />
|
||||
<path
|
||||
d="M110.782 119.267L102.016 110.492C104.888 108.267 107.476 105.651 109.564 102.955L118.329 111.729L110.782 119.267Z"
|
||||
stroke="#E5E7EB" />
|
||||
<path
|
||||
d="M139.122 125.781L139.122 125.78L123.313 109.988C123.313 109.987 123.313 109.987 123.312 109.986C121.996 108.653 119.849 108.657 118.521 109.985L118.871 110.335L118.521 109.985L109.047 119.459C107.731 120.775 107.735 122.918 109.044 124.247L109.047 124.249L124.858 140.06C128.789 143.992 135.191 143.992 139.122 140.06C143.069 136.113 143.069 129.728 139.122 125.781Z"
|
||||
fill="#A5B4FC"
|
||||
stroke="#818CF8"
|
||||
/>
|
||||
fill="#A5B4FC" stroke="#818CF8" />
|
||||
<path
|
||||
d="M83.185 87.2285C82.5387 87.2285 82.0027 86.6926 82.0027 86.0305C82.0027 86.0305 82.0027 83.3821 77.9987 83.3821C77.9987 83.3821 77.9987 86.0305 77.9987 86.0305C77.9987 86.6926 77.4627 87.2285 76.8006 87.2285C76.1543 87.2285 75.6183 86.6926 75.6183 86.0305C75.6183 80.2294 84.3831 80.2451 84.3831 86.0305C84.3831 86.6926 83.8471 87.2285 83.185 87.2285Z"
|
||||
fill="#4F46E5"
|
||||
/>
|
||||
fill="#4F46E5" />
|
||||
<path
|
||||
d="M93.3528 77.0926H88.403C87.7409 77.0926 87.2049 76.5567 87.2049 75.8946C87.2049 75.2483 87.7409 74.7123 88.403 74.7123H93.3528C94.0149 74.7123 94.5509 75.2483 94.5509 75.8946C94.5509 76.5567 94.0149 77.0926 93.3528 77.0926Z"
|
||||
fill="#4F46E5"
|
||||
/>
|
||||
fill="#4F46E5" />
|
||||
<path
|
||||
d="M71.5987 77.0925H66.6488C65.9867 77.0925 65.4507 76.5565 65.4507 75.8945C65.4507 75.2481 65.9867 74.7122 66.6488 74.7122H71.5987C72.245 74.7122 72.781 75.2481 72.781 75.8945C72.781 76.5565 72.245 77.0925 71.5987 77.0925Z"
|
||||
fill="#4F46E5"
|
||||
/>
|
||||
fill="#4F46E5" />
|
||||
<rect x="38.3522" y="21.5128" width="41.0256" height="2.73504" rx="1.36752" fill="#4F46E5" />
|
||||
<rect x="38.3522" y="133.65" width="54.7009" height="5.47009" rx="2.73504" fill="#A5B4FC" />
|
||||
<rect x="38.3522" y="29.7179" width="13.6752" height="2.73504" rx="1.36752" fill="#4F46E5" />
|
||||
@@ -186,14 +183,17 @@
|
||||
</svg>
|
||||
<div class="text-center">
|
||||
<h2 class="text-black text-2xl font-semibold leading-loose pb-2">No listings found</h2>
|
||||
<p class="text-neutral-600 text-base font-normal leading-relaxed pb-6">We couldn't find any businesses matching your criteria.<br />Try adjusting your filters or explore popular categories below.</p>
|
||||
<p class="text-neutral-600 text-base font-normal leading-relaxed pb-6">We couldn't find any businesses
|
||||
matching your criteria.<br />Try adjusting your filters or explore popular categories below.</p>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="flex flex-col sm:flex-row gap-3 justify-center mb-8">
|
||||
<button (click)="clearAllFilters()" class="px-6 py-3 rounded-full bg-primary-600 text-white text-sm font-semibold hover:bg-primary-700 transition-colors">
|
||||
<button (click)="clearAllFilters()"
|
||||
class="px-6 py-3 rounded-full bg-primary-600 text-white text-sm font-semibold hover:bg-primary-700 transition-colors">
|
||||
<i class="fas fa-redo mr-2"></i>Clear All Filters
|
||||
</button>
|
||||
<button [routerLink]="['/home']" class="px-6 py-3 rounded-full border-2 border-neutral-300 text-neutral-700 text-sm font-semibold hover:border-primary-600 hover:text-primary-600 transition-colors">
|
||||
<button [routerLink]="['/home']"
|
||||
class="px-6 py-3 rounded-full border-2 border-neutral-300 text-neutral-700 text-sm font-semibold hover:border-primary-600 hover:text-primary-600 transition-colors">
|
||||
<i class="fas fa-home mr-2"></i>Back to Home
|
||||
</button>
|
||||
</div>
|
||||
@@ -204,22 +204,28 @@
|
||||
<i class="fas fa-fire text-orange-500 mr-2"></i>Popular Categories
|
||||
</h3>
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 gap-3">
|
||||
<button (click)="filterByCategory('foodAndRestaurant')" class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<button (click)="filterByCategory('foodAndRestaurant')"
|
||||
class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<i class="fas fa-utensils mr-2"></i>Restaurants
|
||||
</button>
|
||||
<button (click)="filterByCategory('retail')" class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<button (click)="filterByCategory('retail')"
|
||||
class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<i class="fas fa-store mr-2"></i>Retail
|
||||
</button>
|
||||
<button (click)="filterByCategory('realEstate')" class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<button (click)="filterByCategory('realEstate')"
|
||||
class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<i class="fas fa-building mr-2"></i>Real Estate
|
||||
</button>
|
||||
<button (click)="filterByCategory('service')" class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<button (click)="filterByCategory('service')"
|
||||
class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<i class="fas fa-cut mr-2"></i>Services
|
||||
</button>
|
||||
<button (click)="filterByCategory('franchise')" class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<button (click)="filterByCategory('franchise')"
|
||||
class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<i class="fas fa-handshake mr-2"></i>Franchise
|
||||
</button>
|
||||
<button (click)="filterByCategory('professional')" class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<button (click)="filterByCategory('professional')"
|
||||
class="px-4 py-2 bg-white rounded-lg border border-neutral-200 hover:border-primary-500 hover:bg-primary-50 text-sm text-neutral-700 hover:text-primary-600 transition-all">
|
||||
<i class="fas fa-briefcase mr-2"></i>Professional
|
||||
</button>
|
||||
</div>
|
||||
@@ -247,5 +253,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Filter Button for Mobile -->
|
||||
<button (click)="openFilterModal()" class="md:hidden fixed bottom-4 right-4 bg-primary-500 text-white p-3 rounded-full shadow-lg z-20"><i class="fas fa-filter"></i> Filter</button>
|
||||
</div>
|
||||
<button (click)="openFilterModal()"
|
||||
class="md:hidden fixed bottom-4 right-4 bg-primary-500 text-white p-3 rounded-full shadow-lg z-20"><i
|
||||
class="fas fa-filter"></i> Filter</button>
|
||||
</div>
|
||||
@@ -77,7 +77,7 @@ export class BusinessListingsComponent implements OnInit, OnDestroy {
|
||||
private route: ActivatedRoute,
|
||||
private seoService: SeoService,
|
||||
private authService: AuthService,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
// Load user for favorites functionality
|
||||
@@ -259,6 +259,47 @@ export class BusinessListingsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Share a listing - opens native share dialog or copies to clipboard
|
||||
*/
|
||||
async shareListing(event: Event, listing: BusinessListing): Promise<void> {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
const url = `${window.location.origin}/business/${listing.slug || listing.id}`;
|
||||
const title = listing.title || 'Business Listing';
|
||||
|
||||
// Try native share API first (works on mobile and some desktop browsers)
|
||||
if (navigator.share) {
|
||||
try {
|
||||
await navigator.share({
|
||||
title: title,
|
||||
text: `Check out this business: ${title}`,
|
||||
url: url,
|
||||
});
|
||||
} catch (err) {
|
||||
// User cancelled or share failed - fall back to clipboard
|
||||
this.copyToClipboard(url);
|
||||
}
|
||||
} else {
|
||||
// Fallback: open Facebook share dialog
|
||||
const encodedUrl = encodeURIComponent(url);
|
||||
window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodedUrl}`, '_blank', 'width=600,height=400');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy URL to clipboard and show feedback
|
||||
*/
|
||||
private copyToClipboard(url: string): void {
|
||||
navigator.clipboard.writeText(url).then(() => {
|
||||
// Could add a toast notification here
|
||||
console.log('Link copied to clipboard!');
|
||||
}).catch(err => {
|
||||
console.error('Failed to copy link:', err);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
|
||||
@@ -2,9 +2,7 @@ import { CommonModule } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
import { SubscriptionsService } from '../../services/subscriptions.service';
|
||||
import { UserService } from '../../services/user.service';
|
||||
import { map2User } from '../../utils/utils';
|
||||
|
||||
@@ -21,7 +19,6 @@ export class LoginComponent {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
|
||||
private router: Router,
|
||||
private subscriptionService: SubscriptionsService,
|
||||
private authService: AuthService,
|
||||
) {}
|
||||
async ngOnInit() {
|
||||
@@ -29,18 +26,17 @@ export class LoginComponent {
|
||||
const keycloakUser = map2User(token);
|
||||
const email = keycloakUser.email;
|
||||
const user = await this.userService.getByMail(email);
|
||||
if (!user.subscriptionPlan) {
|
||||
//this.router.navigate(['/pricing']);
|
||||
const subscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions(user.email));
|
||||
const activeSubscription = subscriptions.filter(s => s.status === 'active');
|
||||
if (activeSubscription.length > 0) {
|
||||
user.subscriptionPlan = activeSubscription[0].metadata['plan'] === 'Broker Plan' ? 'broker' : 'professional';
|
||||
this.userService.saveGuaranteed(user);
|
||||
} else {
|
||||
this.router.navigate([`/pricing`]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if (!user.subscriptionPlan) {
|
||||
// const subscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions(user.email));
|
||||
// const activeSubscription = subscriptions.filter(s => s.status === 'active');
|
||||
// if (activeSubscription.length > 0) {
|
||||
// user.subscriptionPlan = activeSubscription[0].metadata['plan'] === 'Broker Plan' ? 'broker' : 'professional';
|
||||
// this.userService.saveGuaranteed(user);
|
||||
// } else {
|
||||
// this.router.navigate([`/home`]);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
this.router.navigate([`/${this.page}`]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
<div class="container mx-auto px-4 py-16">
|
||||
<h1 class="text-4xl font-bold text-center mb-12">Choose the Right Plan for Your Business</h1>
|
||||
|
||||
<div
|
||||
[ngClass]="{
|
||||
'grid gap-8 mx-auto': true,
|
||||
'md:grid-cols-3 max-w-7xl': !user || !user.subscriptionPlan,
|
||||
'md:grid-cols-2 max-w-4xl': user && user.subscriptionPlan
|
||||
}"
|
||||
>
|
||||
@if(!user || !user.subscriptionPlan) {
|
||||
<!-- Free Plan -->
|
||||
<div class="bg-white rounded-lg shadow-lg overflow-hidden flex flex-col h-full">
|
||||
<div class="px-6 py-8 bg-gray-50 text-center border-b">
|
||||
<h3 class="text-2xl font-semibold text-gray-700">Buyer & Seller</h3>
|
||||
<p class="mt-4 text-gray-600">Commercial Properties</p>
|
||||
<p class="mt-4 text-4xl font-bold text-gray-900">Free</p>
|
||||
<p class="mt-2 text-gray-600">Forever</p>
|
||||
</div>
|
||||
<div class="px-6 py-8 flex-grow">
|
||||
<ul class="text-sm text-gray-600">
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Create property listings
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Get early access to new listings
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Extended search functionality
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@if(!pricingOverview){
|
||||
<div class="px-6 py-4 mt-auto">
|
||||
<button (click)="register()" class="w-full bg-blue-500 text-white rounded-full px-4 py-2 font-semibold hover:bg-blue-600 transition duration-300">Sign Up Now</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Professional Plan -->
|
||||
<div class="bg-white rounded-lg shadow-lg overflow-hidden flex flex-col h-full">
|
||||
<div class="px-6 py-8 bg-blue-50 text-center border-b">
|
||||
<h3 class="text-2xl font-semibold text-gray-700">Professional</h3>
|
||||
<p class="mt-4 text-gray-600">CPA, Attorney, Title Company, etc.</p>
|
||||
<p class="mt-4 text-4xl font-bold text-gray-900">$29</p>
|
||||
<p class="mt-2 text-gray-600">per month</p>
|
||||
</div>
|
||||
<div class="px-6 py-8 flex-grow">
|
||||
<ul class="text-sm text-gray-600">
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Professionals Directory listing
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
3-Month Free Trial
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Detailed visitor statistics
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
In-portal contact forms
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
One-month refund guarantee
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Premium support
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Price stability
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@if(!pricingOverview){
|
||||
<div class="px-6 py-4 mt-auto">
|
||||
<button (click)="register('price_1PpSkpDjmFBOcNBs9UDPgBos')" class="w-full bg-blue-500 text-white rounded-full px-4 py-2 font-semibold hover:bg-blue-600 transition duration-300">Get Started</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Business Broker Plan -->
|
||||
<div class="bg-white rounded-lg shadow-lg overflow-hidden border-2 border-blue-500 flex flex-col h-full">
|
||||
<div class="px-6 py-8 bg-blue-500 text-center border-b">
|
||||
<h3 class="text-2xl font-semibold text-white">Business Broker</h3>
|
||||
<p class="mt-4 text-blue-100">Create & Manage Listings</p>
|
||||
<p class="mt-4 text-4xl font-bold text-white">$49</p>
|
||||
<p class="mt-2 text-blue-100">per month</p>
|
||||
</div>
|
||||
<div class="px-6 py-8 flex-grow">
|
||||
<ul class="text-sm text-gray-600">
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Create business listings
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Professionals Directory listing
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
3-Month Free Trial
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Detailed visitor statistics
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
In-portal contact forms
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
One-month refund guarantee
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Premium support
|
||||
</li>
|
||||
<li class="mb-4 flex items-center">
|
||||
<i class="fas fa-check text-green-500 mr-2"></i>
|
||||
Price stability
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@if(!pricingOverview){
|
||||
<div class="px-6 py-4 mt-auto">
|
||||
<button (click)="register('price_1PpSmRDjmFBOcNBsaaSp2nk9')" class="w-full bg-blue-500 text-white rounded-full px-4 py-2 font-semibold hover:bg-blue-600 transition duration-300">Start Listing Now</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-16 text-center">
|
||||
<h2 class="text-2xl font-semibold mb-4">Not sure which plan is right for you?</h2>
|
||||
<p class="text-gray-600 mb-8">Contact our sales team for a personalized recommendation.</p>
|
||||
<a routerLink="/emailUs" class="bg-blue-500 text-white rounded-full px-6 py-3 font-semibold hover:bg-blue-600 transition duration-300">Contact Sales</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,11 +0,0 @@
|
||||
:host {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
// .container {
|
||||
// background-image: url(../../../assets/images/index-bg.jpg), url(../../../assets/images/pricing-4.svg);
|
||||
// //background-image: url(../../../assets/images/corpusChristiSkyline.jpg);
|
||||
// background-size: cover;
|
||||
// background-position: center;
|
||||
// height: 100vh;
|
||||
// }
|
||||
@@ -1,103 +0,0 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { StripeService } from 'ngx-stripe';
|
||||
import { switchMap } from 'rxjs';
|
||||
import { User } from '../../../../../bizmatch-server/src/models/db.model';
|
||||
import { Checkout, KeycloakUser } from '../../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { AuditService } from '../../services/audit.service';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
import { UserService } from '../../services/user.service';
|
||||
import { SharedModule } from '../../shared/shared/shared.module';
|
||||
import { map2User } from '../../utils/utils';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pricing',
|
||||
standalone: true,
|
||||
imports: [SharedModule],
|
||||
templateUrl: './pricing.component.html',
|
||||
styleUrl: './pricing.component.scss',
|
||||
})
|
||||
export class PricingComponent {
|
||||
private apiBaseUrl = environment.apiBaseUrl;
|
||||
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
|
||||
pricingOverview: boolean | undefined = this.activatedRoute.snapshot.data['pricingOverview'] as boolean | undefined;
|
||||
keycloakUser: KeycloakUser;
|
||||
user: User;
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private stripeService: StripeService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private userService: UserService,
|
||||
private router: Router,
|
||||
private auditService: AuditService,
|
||||
private authService: AuthService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
const token = await this.authService.getToken();
|
||||
this.keycloakUser = map2User(token);
|
||||
if (this.keycloakUser) {
|
||||
this.user = await this.userService.getByMail(this.keycloakUser.email);
|
||||
const originalKeycloakUser = await this.userService.getKeycloakUser(this.keycloakUser.id);
|
||||
const priceId = originalKeycloakUser.attributes && originalKeycloakUser.attributes['priceID'] ? originalKeycloakUser.attributes['priceID'][0] : null;
|
||||
if (priceId) {
|
||||
originalKeycloakUser.attributes['priceID'] = null;
|
||||
await this.userService.updateKeycloakUser(originalKeycloakUser);
|
||||
}
|
||||
if (!this.user.subscriptionPlan) {
|
||||
if (this.id === 'free' || priceId === 'free') {
|
||||
this.user.subscriptionPlan = 'free';
|
||||
await this.userService.saveGuaranteed(this.user);
|
||||
this.router.navigate([`/account`]);
|
||||
} else if (this.id || priceId) {
|
||||
const base64PriceId = this.id ? this.id : priceId;
|
||||
this.checkout({ priceId: atob(base64PriceId), email: this.keycloakUser.email, name: `${this.keycloakUser.firstName} ${this.keycloakUser.lastName}` });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.pricingOverview = false;
|
||||
}
|
||||
}
|
||||
|
||||
async register(priceId?: string) {
|
||||
if (this.keycloakUser) {
|
||||
if (!priceId) {
|
||||
this.user = await this.userService.getByMail(this.keycloakUser.email);
|
||||
this.user.subscriptionPlan = 'free';
|
||||
await this.userService.saveGuaranteed(this.user);
|
||||
this.router.navigate([`/account`]);
|
||||
} else {
|
||||
this.checkout({ priceId: priceId, email: this.keycloakUser.email, name: `${this.keycloakUser.firstName} ${this.keycloakUser.lastName}` });
|
||||
}
|
||||
} else {
|
||||
// if (priceId) {
|
||||
// this.keycloakService.register({
|
||||
// redirectUri: `${window.location.origin}/pricing/${btoa(priceId)}`,
|
||||
// });
|
||||
// } else {
|
||||
// this.keycloakService.register({ redirectUri: `${window.location.origin}/pricing/free` });
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
checkout(checkout: Checkout) {
|
||||
// Check the server.js tab to see an example implementation
|
||||
this.http
|
||||
.post(`${this.apiBaseUrl}/bizmatch/payment/create-checkout-session`, checkout)
|
||||
.pipe(
|
||||
switchMap((session: any) => {
|
||||
return this.stripeService.redirectToCheckout({ sessionId: session.id });
|
||||
}),
|
||||
)
|
||||
.subscribe(result => {
|
||||
// If `redirectToCheckout` fails due to a browser or network
|
||||
// error, you should display the localized error message to your
|
||||
// customer using `error.message`.
|
||||
if (result.error) {
|
||||
alert(result.error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,10 @@
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<div class="md:col-span-2">
|
||||
<label for="email" class="block text-sm font-medium text-gray-700">E-mail (required)</label>
|
||||
<input type="email" id="email" name="email" [(ngModel)]="user.email" disabled class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" />
|
||||
<p class="text-xs text-gray-500 mt-1">You can only modify your email by contacting us at support@bizmatch.net</p>
|
||||
<input type="email" id="email" name="email" [(ngModel)]="user.email" disabled
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" />
|
||||
<p class="text-xs text-gray-500 mt-1">You can only modify your email by contacting us at
|
||||
support@bizmatch.net</p>
|
||||
</div>
|
||||
@if (isProfessional || (authService.isAdmin() | async)){
|
||||
<div class="flex flex-row items-center justify-around md:space-x-4">
|
||||
@@ -16,20 +18,21 @@
|
||||
<div class="w-20 h-20 w-full rounded-md flex items-center justify-center relative">
|
||||
@if(user?.hasCompanyLogo){
|
||||
<img src="{{ companyLogoUrl }}" alt="Company logo" class="max-w-full max-h-full" />
|
||||
<div class="absolute top-[-0.5rem] right-[0rem] bg-white rounded-full p-1 drop-shadow-custom-bg hover:cursor-pointer" (click)="deleteConfirm('logo')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-4 h-4 text-gray-600">
|
||||
<div
|
||||
class="absolute top-[-0.5rem] right-[0rem] bg-white rounded-full p-1 drop-shadow-custom-bg hover:cursor-pointer"
|
||||
(click)="deleteConfirm('logo')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"
|
||||
class="w-4 h-4 text-gray-600">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</div>
|
||||
} @else {
|
||||
<img src="assets/images/placeholder.png" class="max-w-full max-h-full" />
|
||||
<img src="/assets/images/placeholder.png" class="max-w-full max-h-full" />
|
||||
}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
<button type="button"
|
||||
class="mt-2 w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
||||
(click)="uploadCompanyLogo()"
|
||||
>
|
||||
(click)="uploadCompanyLogo()">
|
||||
Upload
|
||||
</button>
|
||||
</div>
|
||||
@@ -38,20 +41,21 @@
|
||||
<div class="w-20 h-20 w-full rounded-md flex items-center justify-center relative">
|
||||
@if(user?.hasProfile){
|
||||
<img src="{{ profileUrl }}" alt="Profile picture" class="max-w-full max-h-full" />
|
||||
<div class="absolute top-[-0.5rem] right-[0rem] bg-white rounded-full p-1 drop-shadow-custom-bg hover:cursor-pointer" (click)="deleteConfirm('profile')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-4 h-4 text-gray-600">
|
||||
<div
|
||||
class="absolute top-[-0.5rem] right-[0rem] bg-white rounded-full p-1 drop-shadow-custom-bg hover:cursor-pointer"
|
||||
(click)="deleteConfirm('profile')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"
|
||||
class="w-4 h-4 text-gray-600">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</div>
|
||||
} @else {
|
||||
<img src="assets/images/placeholder.png" class="max-w-full max-h-full" />
|
||||
<img src="/assets/images/placeholder.png" class="max-w-full max-h-full" />
|
||||
}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
<button type="button"
|
||||
class="mt-2 w-full px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
||||
(click)="uploadProfile()"
|
||||
>
|
||||
(click)="uploadProfile()">
|
||||
Upload
|
||||
</button>
|
||||
</div>
|
||||
@@ -74,11 +78,13 @@
|
||||
@if ((authService.isAdmin() | async) && !id){
|
||||
<div>
|
||||
<label for="customerType" class="block text-sm font-medium text-gray-700">User Type</label>
|
||||
<span class="bg-blue-100 text-blue-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">ADMIN</span>
|
||||
<span
|
||||
class="bg-blue-100 text-blue-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300">ADMIN</span>
|
||||
</div>
|
||||
|
||||
}@else{
|
||||
<app-validated-select label="Customer Type" name="customerType" [(ngModel)]="user.customerType" [options]="customerTypeOptions"></app-validated-select>
|
||||
<app-validated-select label="Customer Type" name="customerType" [(ngModel)]="user.customerType"
|
||||
[options]="customerTypeOptions"></app-validated-select>
|
||||
} @if (isProfessional){
|
||||
<!-- <div>
|
||||
<label for="customerSubType" class="block text-sm font-medium text-gray-700">Professional Type</label>
|
||||
@@ -86,7 +92,8 @@
|
||||
<option *ngFor="let subType of customerSubTypes" [value]="subType">{{ subType | titlecase }}</option>
|
||||
</select>
|
||||
</div> -->
|
||||
<app-validated-select label="Professional Type" name="customerSubType" [(ngModel)]="user.customerSubType" [options]="customerSubTypeOptions"></app-validated-select>
|
||||
<app-validated-select label="Professional Type" name="customerSubType" [(ngModel)]="user.customerSubType"
|
||||
[options]="customerSubTypeOptions"></app-validated-select>
|
||||
}
|
||||
</div>
|
||||
@if (isProfessional){
|
||||
@@ -99,8 +106,10 @@
|
||||
<label for="description" class="block text-sm font-medium text-gray-700">Describe yourself</label>
|
||||
<input type="text" id="description" name="description" [(ngModel)]="user.description" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" />
|
||||
</div> -->
|
||||
<app-validated-input label="Company Name" name="companyName" [(ngModel)]="user.companyName"></app-validated-input>
|
||||
<app-validated-input label="Describe Yourself" name="description" [(ngModel)]="user.description"></app-validated-input>
|
||||
<app-validated-input label="Company Name" name="companyName"
|
||||
[(ngModel)]="user.companyName"></app-validated-input>
|
||||
<app-validated-input label="Describe Yourself" name="description"
|
||||
[(ngModel)]="user.description"></app-validated-input>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
@@ -116,11 +125,14 @@
|
||||
<label for="companyLocation" class="block text-sm font-medium text-gray-700">Company Location</label>
|
||||
<input type="text" id="companyLocation" name="companyLocation" [(ngModel)]="user.companyLocation" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" />
|
||||
</div> -->
|
||||
<app-validated-input label="Your Phone Number" name="phoneNumber" [(ngModel)]="user.phoneNumber" mask="(000) 000-0000"></app-validated-input>
|
||||
<app-validated-input label="Company Website" name="companyWebsite" [(ngModel)]="user.companyWebsite"></app-validated-input>
|
||||
<app-validated-input label="Your Phone Number" name="phoneNumber" [(ngModel)]="user.phoneNumber"
|
||||
mask="(000) 000-0000"></app-validated-input>
|
||||
<app-validated-input label="Company Website" name="companyWebsite"
|
||||
[(ngModel)]="user.companyWebsite"></app-validated-input>
|
||||
<!-- <app-validated-input label="Company Location" name="companyLocation" [(ngModel)]="user.companyLocation"></app-validated-input> -->
|
||||
<!-- <app-validated-city label="Company Location" name="location" [(ngModel)]="user.location"></app-validated-city> -->
|
||||
<app-validated-location label="Company Location" name="location" [(ngModel)]="user.location"></app-validated-location>
|
||||
<app-validated-location label="Company Location" name="location"
|
||||
[(ngModel)]="user.location"></app-validated-location>
|
||||
</div>
|
||||
|
||||
<!-- <div>
|
||||
@@ -128,21 +140,21 @@
|
||||
<quill-editor [(ngModel)]="user.companyOverview" name="companyOverview" [modules]="quillModules"></quill-editor>
|
||||
</div> -->
|
||||
<div>
|
||||
<app-validated-quill label="Company Overview" name="companyOverview" [(ngModel)]="user.companyOverview"></app-validated-quill>
|
||||
<app-validated-quill label="Company Overview" name="companyOverview"
|
||||
[(ngModel)]="user.companyOverview"></app-validated-quill>
|
||||
</div>
|
||||
<div>
|
||||
<!-- <label for="offeredServices" class="block text-sm font-medium text-gray-700">Services We Offer</label>
|
||||
<quill-editor [(ngModel)]="user.offeredServices" name="offeredServices" [modules]="quillModules"></quill-editor> -->
|
||||
<app-validated-quill label="Services We Offer" name="offeredServices" [(ngModel)]="user.offeredServices"></app-validated-quill>
|
||||
<app-validated-quill label="Services We Offer" name="offeredServices"
|
||||
[(ngModel)]="user.offeredServices"></app-validated-quill>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 class="text-lg font-medium text-gray-700 mb-2 relative w-fit">
|
||||
Areas We Serve @if(getValidationMessage('areasServed')){
|
||||
<div
|
||||
[attr.data-tooltip-target]="tooltipTargetAreasServed"
|
||||
class="absolute inline-flex items-center justify-center w-6 h-6 text-xs font-bold text-white bg-red-500 border-2 border-white rounded-full -top-2 dark:border-gray-900 hover:cursor-pointer"
|
||||
>
|
||||
<div [attr.data-tooltip-target]="tooltipTargetAreasServed"
|
||||
class="absolute inline-flex items-center justify-center w-6 h-6 text-xs font-bold text-white bg-red-500 border-2 border-white rounded-full -top-2 dark:border-gray-900 hover:cursor-pointer">
|
||||
!
|
||||
</div>
|
||||
<app-tooltip [id]="tooltipTargetAreasServed" [text]="getValidationMessage('areasServed')"></app-tooltip>
|
||||
@@ -159,19 +171,25 @@
|
||||
@for (areasServed of user.areasServed; track areasServed; let i=$index){
|
||||
<div class="grid grid-cols-12 md:gap-4 gap-1 mb-3 md:mb-1">
|
||||
<div class="col-span-6">
|
||||
<ng-select [items]="selectOptions?.states" bindLabel="name" bindValue="value" [(ngModel)]="areasServed.state" (ngModelChange)="setState(i, $event)" name="areasServed_state{{ i }}"> </ng-select>
|
||||
<ng-select [items]="selectOptions?.states" bindLabel="name" bindValue="value"
|
||||
[(ngModel)]="areasServed.state" (ngModelChange)="setState(i, $event)" name="areasServed_state{{ i }}">
|
||||
</ng-select>
|
||||
</div>
|
||||
<div class="col-span-5">
|
||||
<!-- <input type="text" id="county{{ i }}" name="county{{ i }}" [(ngModel)]="areasServed.county" class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" /> -->
|
||||
<app-validated-county name="county{{ i }}" [(ngModel)]="areasServed.county" labelClasses="text-gray-900 font-medium" [state]="areasServed.state" [readonly]="!areasServed.state"></app-validated-county>
|
||||
<app-validated-county name="county{{ i }}" [(ngModel)]="areasServed.county"
|
||||
labelClasses="text-gray-900 font-medium" [state]="areasServed.state"
|
||||
[readonly]="!areasServed.state"></app-validated-county>
|
||||
</div>
|
||||
<div class="col-span-1">
|
||||
<button type="button" class="px-2 py-1 bg-red-500 text-white rounded-md h-[42px] w-8" (click)="removeArea(i)">-</button>
|
||||
<button type="button" class="px-2 py-1 bg-red-500 text-white rounded-md h-[42px] w-8"
|
||||
(click)="removeArea(i)">-</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="mt-2">
|
||||
<button type="button" class="px-2 py-1 bg-green-500 text-white rounded-md mr-2 h-[42px] w-8" (click)="addArea()">+</button>
|
||||
<button type="button" class="px-2 py-1 bg-green-500 text-white rounded-md mr-2 h-[42px] w-8"
|
||||
(click)="addArea()">+</button>
|
||||
|
||||
<span class="text-sm text-gray-500 ml-2">[Add more Areas or remove existing ones.]</span>
|
||||
</div>
|
||||
@@ -180,10 +198,8 @@
|
||||
<div>
|
||||
<h3 class="text-lg font-medium text-gray-700 mb-2 relative">
|
||||
Licensed In@if(getValidationMessage('licensedIn')){
|
||||
<div
|
||||
[attr.data-tooltip-target]="tooltipTargetLicensed"
|
||||
class="absolute inline-flex items-center justify-center w-6 h-6 text-xs font-bold text-white bg-red-500 border-2 border-white rounded-full -top-2 dark:border-gray-900 hover:cursor-pointer"
|
||||
>
|
||||
<div [attr.data-tooltip-target]="tooltipTargetLicensed"
|
||||
class="absolute inline-flex items-center justify-center w-6 h-6 text-xs font-bold text-white bg-red-500 border-2 border-white rounded-full -top-2 dark:border-gray-900 hover:cursor-pointer">
|
||||
!
|
||||
</div>
|
||||
<app-tooltip [id]="tooltipTargetLicensed" [text]="getValidationMessage('licensedIn')"></app-tooltip>
|
||||
@@ -200,22 +216,20 @@
|
||||
@for (licensedIn of user.licensedIn; track licensedIn; let i=$index){
|
||||
<div class="grid grid-cols-12 md:gap-4 gap-1 mb-3 md:mb-1">
|
||||
<div class="col-span-6">
|
||||
<ng-select [items]="selectOptions?.states" bindLabel="name" bindValue="value" [(ngModel)]="licensedIn.state" name="licensedIn_state{{ i }}"> </ng-select>
|
||||
<ng-select [items]="selectOptions?.states" bindLabel="name" bindValue="value" [(ngModel)]="licensedIn.state"
|
||||
name="licensedIn_state{{ i }}"> </ng-select>
|
||||
</div>
|
||||
<div class="col-span-5">
|
||||
<input
|
||||
type="text"
|
||||
id="licenseNumber{{ i }}"
|
||||
name="licenseNumber{{ i }}"
|
||||
[(ngModel)]="licensedIn.registerNo"
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"
|
||||
/>
|
||||
<input type="text" id="licenseNumber{{ i }}" name="licenseNumber{{ i }}" [(ngModel)]="licensedIn.registerNo"
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" />
|
||||
</div>
|
||||
<button type="button" class="px-2 py-1 bg-red-500 text-white rounded-md h-[42px] w-8" (click)="removeLicence(i)">-</button>
|
||||
<button type="button" class="px-2 py-1 bg-red-500 text-white rounded-md h-[42px] w-8"
|
||||
(click)="removeLicence(i)">-</button>
|
||||
</div>
|
||||
}
|
||||
<div class="mt-2">
|
||||
<button type="button" class="px-2 py-1 bg-green-500 text-white rounded-md mr-2 h-[42px] w-8" (click)="addLicence()">+</button>
|
||||
<button type="button" class="px-2 py-1 bg-green-500 text-white rounded-md mr-2 h-[42px] w-8"
|
||||
(click)="addLicence()">+</button>
|
||||
<span class="text-sm text-gray-500 ml-2">[Add more licenses or remove existing ones.]</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -231,7 +245,9 @@
|
||||
</div>
|
||||
|
||||
<div class="flex justify-start">
|
||||
<button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" (click)="updateProfile(user)">
|
||||
<button type="submit"
|
||||
class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
(click)="updateProfile(user)">
|
||||
Update Profile
|
||||
</button>
|
||||
</div>
|
||||
@@ -314,5 +330,6 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<app-image-crop-and-upload [uploadParams]="uploadParams" (uploadFinished)="uploadFinished($event)"></app-image-crop-and-upload>
|
||||
<app-confirmation></app-confirmation>
|
||||
<app-image-crop-and-upload [uploadParams]="uploadParams"
|
||||
(uploadFinished)="uploadFinished($event)"></app-image-crop-and-upload>
|
||||
<app-confirmation></app-confirmation>
|
||||
@@ -3,8 +3,6 @@ import { ChangeDetectorRef, Component } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||
import { NgSelectModule } from '@ng-select/ng-select';
|
||||
import { NgxCurrencyDirective } from 'ngx-currency';
|
||||
import { ImageCropperComponent } from 'ngx-image-cropper';
|
||||
import { QuillModule } from 'ngx-quill';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
@@ -13,10 +11,8 @@ import { environment } from '../../../../environments/environment';
|
||||
import { ConfirmationComponent } from '../../../components/confirmation/confirmation.component';
|
||||
import { ConfirmationService } from '../../../components/confirmation/confirmation.service';
|
||||
import { ImageCropAndUploadComponent, UploadReponse } from '../../../components/image-crop-and-upload/image-crop-and-upload.component';
|
||||
import { MessageComponent } from '../../../components/message/message.component';
|
||||
import { MessageService } from '../../../components/message/message.service';
|
||||
import { TooltipComponent } from '../../../components/tooltip/tooltip.component';
|
||||
import { ValidatedCityComponent } from '../../../components/validated-city/validated-city.component';
|
||||
import { ValidatedCountyComponent } from '../../../components/validated-county/validated-county.component';
|
||||
import { ValidatedInputComponent } from '../../../components/validated-input/validated-input.component';
|
||||
import { ValidatedLocationComponent } from '../../../components/validated-location/validated-location.component';
|
||||
@@ -39,16 +35,12 @@ import { TOOLBAR_OPTIONS } from '../../utils/defaults';
|
||||
imports: [
|
||||
SharedModule,
|
||||
QuillModule,
|
||||
NgxCurrencyDirective,
|
||||
NgSelectModule,
|
||||
ImageCropperComponent,
|
||||
ConfirmationComponent,
|
||||
ImageCropAndUploadComponent,
|
||||
MessageComponent,
|
||||
ValidatedInputComponent,
|
||||
ValidatedSelectComponent,
|
||||
ValidatedQuillComponent,
|
||||
ValidatedCityComponent,
|
||||
TooltipComponent,
|
||||
ValidatedCountyComponent,
|
||||
ValidatedLocationComponent,
|
||||
@@ -76,7 +68,6 @@ export class AccountComponent {
|
||||
customerSubTypeOptions: Array<{ value: string; label: string }> = [];
|
||||
tooltipTargetAreasServed = 'tooltip-areasServed';
|
||||
tooltipTargetLicensed = 'tooltip-licensedIn';
|
||||
// subscriptions: StripeSubscription[] | any[];
|
||||
constructor(
|
||||
public userService: UserService,
|
||||
private geoService: GeoService,
|
||||
@@ -91,11 +82,10 @@ export class AccountComponent {
|
||||
private sharedService: SharedService,
|
||||
private titleCasePipe: TitleCasePipe,
|
||||
private validationMessagesService: ValidationMessagesService,
|
||||
// private subscriptionService: SubscriptionsService,
|
||||
private datePipe: DatePipe,
|
||||
private router: Router,
|
||||
public authService: AuthService,
|
||||
) {}
|
||||
) { }
|
||||
async ngOnInit() {
|
||||
// Flowbite is now initialized once in AppComponent
|
||||
if (this.id) {
|
||||
@@ -162,7 +152,7 @@ export class AccountComponent {
|
||||
ngOnDestroy() {
|
||||
this.validationMessagesService.clearMessages(); // Löschen Sie alle bestehenden Validierungsnachrichten
|
||||
}
|
||||
printInvoice(invoice: Invoice) {}
|
||||
printInvoice(invoice: Invoice) { }
|
||||
|
||||
async updateProfile(user: User) {
|
||||
try {
|
||||
|
||||
@@ -37,17 +37,14 @@ import { TOOLBAR_OPTIONS } from '../../utils/defaults';
|
||||
standalone: true,
|
||||
imports: [
|
||||
SharedModule,
|
||||
ArrayToStringPipe,
|
||||
DragDropModule,
|
||||
QuillModule,
|
||||
NgxCurrencyDirective,
|
||||
NgSelectModule,
|
||||
ValidatedInputComponent,
|
||||
ValidatedQuillComponent,
|
||||
ValidatedNgSelectComponent,
|
||||
ValidatedPriceComponent,
|
||||
ValidatedTextareaComponent,
|
||||
ValidatedCityComponent,
|
||||
ValidatedLocationComponent,
|
||||
],
|
||||
providers: [],
|
||||
|
||||
@@ -41,12 +41,9 @@ import { TOOLBAR_OPTIONS } from '../../utils/defaults';
|
||||
standalone: true,
|
||||
imports: [
|
||||
SharedModule,
|
||||
ArrayToStringPipe,
|
||||
DragDropModule,
|
||||
QuillModule,
|
||||
NgxCurrencyDirective,
|
||||
NgSelectModule,
|
||||
ImageCropperComponent,
|
||||
ConfirmationComponent,
|
||||
DragDropMixedComponent,
|
||||
ValidatedInputComponent,
|
||||
@@ -54,7 +51,6 @@ import { TOOLBAR_OPTIONS } from '../../utils/defaults';
|
||||
ValidatedNgSelectComponent,
|
||||
ValidatedPriceComponent,
|
||||
ValidatedLocationComponent,
|
||||
ValidatedCityComponent,
|
||||
ImageCropAndUploadComponent,
|
||||
],
|
||||
providers: [],
|
||||
|
||||
@@ -15,7 +15,7 @@ import { map2User } from '../../../utils/utils';
|
||||
@Component({
|
||||
selector: 'app-my-listing',
|
||||
standalone: true,
|
||||
imports: [SharedModule, ConfirmationComponent, MessageComponent],
|
||||
imports: [SharedModule, ConfirmationComponent],
|
||||
providers: [],
|
||||
templateUrl: './my-listing.component.html',
|
||||
styleUrl: './my-listing.component.scss',
|
||||
@@ -45,7 +45,7 @@ export class MyListingComponent {
|
||||
private messageService: MessageService,
|
||||
private confirmationService: ConfirmationService,
|
||||
private authService: AuthService,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
async ngOnInit() {
|
||||
const token = await this.authService.getToken();
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { isPlatformBrowser } from '@angular/common';
|
||||
import { inject, PLATFORM_ID } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { KeycloakService } from '../services/keycloak.service';
|
||||
|
||||
export const authResolver: ResolveFn<boolean> = async (route, state) => {
|
||||
const keycloakService: KeycloakService = inject(KeycloakService);
|
||||
const platformId = inject(PLATFORM_ID);
|
||||
const isBrowser = isPlatformBrowser(platformId);
|
||||
|
||||
if (!keycloakService.isLoggedIn()) {
|
||||
if (!keycloakService.isLoggedIn() && isBrowser) {
|
||||
await keycloakService.login({
|
||||
redirectUri: window.location.href,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// auth.service.ts
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { isPlatformBrowser } from '@angular/common';
|
||||
import { HttpClient, HttpBackend, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { Injectable, inject, PLATFORM_ID } from '@angular/core';
|
||||
import { FirebaseApp } from '@angular/fire/app';
|
||||
import { GoogleAuthProvider, UserCredential, createUserWithEmailAndPassword, getAuth, signInWithCustomToken, signInWithEmailAndPassword, signInWithPopup } from 'firebase/auth';
|
||||
import { BehaviorSubject, Observable, catchError, firstValueFrom, map, of, shareReplay, take, tap } from 'rxjs';
|
||||
@@ -14,8 +15,10 @@ export type UserRole = 'admin' | 'pro' | 'guest';
|
||||
})
|
||||
export class AuthService {
|
||||
private app = inject(FirebaseApp);
|
||||
private auth = getAuth(this.app);
|
||||
private http = inject(HttpClient);
|
||||
private platformId = inject(PLATFORM_ID);
|
||||
private isBrowser = isPlatformBrowser(this.platformId);
|
||||
private auth = this.isBrowser ? getAuth(this.app) : null;
|
||||
private http = new HttpClient(inject(HttpBackend));
|
||||
private mailService = inject(MailService);
|
||||
// Add a BehaviorSubject to track the current user role
|
||||
private userRoleSubject = new BehaviorSubject<UserRole | null>(null);
|
||||
@@ -31,6 +34,26 @@ export class AuthService {
|
||||
this.loadRoleFromToken();
|
||||
}
|
||||
|
||||
// Helper methods for localStorage access (only in browser)
|
||||
private setLocalStorageItem(key: string, value: string): void {
|
||||
if (this.isBrowser) {
|
||||
localStorage.setItem(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
private getLocalStorageItem(key: string): string | null {
|
||||
if (this.isBrowser) {
|
||||
return localStorage.getItem(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private removeLocalStorageItem(key: string): void {
|
||||
if (this.isBrowser) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
}
|
||||
|
||||
private loadRoleFromToken(): void {
|
||||
this.getToken().then(token => {
|
||||
if (token) {
|
||||
@@ -54,18 +77,24 @@ export class AuthService {
|
||||
}
|
||||
// Registrierung mit Email und Passwort
|
||||
async registerWithEmail(email: string, password: string): Promise<UserCredential> {
|
||||
if (!this.isBrowser || !this.auth) {
|
||||
throw new Error('Auth is only available in browser context');
|
||||
}
|
||||
|
||||
// Bestimmen der aktuellen Umgebung/Domain für die Verifizierungs-URL
|
||||
let verificationUrl = '';
|
||||
let verificationUrl = 'https://www.bizmatch.net/email-authorized';
|
||||
|
||||
// Prüfen der aktuellen Umgebung basierend auf dem Host
|
||||
const currentHost = window.location.hostname;
|
||||
// Prüfen der aktuellen Umgebung basierend auf dem Host (nur im Browser)
|
||||
if (this.isBrowser) {
|
||||
const currentHost = window.location.hostname;
|
||||
|
||||
if (currentHost.includes('localhost')) {
|
||||
verificationUrl = 'http://localhost:4200/email-authorized';
|
||||
} else if (currentHost.includes('dev.bizmatch.net')) {
|
||||
verificationUrl = 'https://dev.bizmatch.net/email-authorized';
|
||||
} else {
|
||||
verificationUrl = 'https://www.bizmatch.net/email-authorized';
|
||||
if (currentHost.includes('localhost')) {
|
||||
verificationUrl = 'http://localhost:4200/email-authorized';
|
||||
} else if (currentHost.includes('dev.bizmatch.net')) {
|
||||
verificationUrl = 'https://dev.bizmatch.net/email-authorized';
|
||||
} else {
|
||||
verificationUrl = 'https://www.bizmatch.net/email-authorized';
|
||||
}
|
||||
}
|
||||
|
||||
// ActionCode-Einstellungen mit der dynamischen URL
|
||||
@@ -93,10 +122,10 @@ export class AuthService {
|
||||
}
|
||||
|
||||
// const token = await userCredential.user.getIdToken();
|
||||
// localStorage.setItem('authToken', token);
|
||||
// localStorage.setItem('refreshToken', userCredential.user.refreshToken);
|
||||
// this.setLocalStorageItem('authToken', token);
|
||||
// this.setLocalStorageItem('refreshToken', userCredential.user.refreshToken);
|
||||
// if (userCredential.user.photoURL) {
|
||||
// localStorage.setItem('photoURL', userCredential.user.photoURL);
|
||||
// this.setLocalStorageItem('photoURL', userCredential.user.photoURL);
|
||||
// }
|
||||
|
||||
return userCredential;
|
||||
@@ -104,13 +133,16 @@ export class AuthService {
|
||||
|
||||
// Login mit Email und Passwort
|
||||
loginWithEmail(email: string, password: string): Promise<UserCredential> {
|
||||
if (!this.isBrowser || !this.auth) {
|
||||
throw new Error('Auth is only available in browser context');
|
||||
}
|
||||
return signInWithEmailAndPassword(this.auth, email, password).then(async userCredential => {
|
||||
if (userCredential.user) {
|
||||
const token = await userCredential.user.getIdToken();
|
||||
localStorage.setItem('authToken', token);
|
||||
localStorage.setItem('refreshToken', userCredential.user.refreshToken);
|
||||
this.setLocalStorageItem('authToken', token);
|
||||
this.setLocalStorageItem('refreshToken', userCredential.user.refreshToken);
|
||||
if (userCredential.user.photoURL) {
|
||||
localStorage.setItem('photoURL', userCredential.user.photoURL);
|
||||
this.setLocalStorageItem('photoURL', userCredential.user.photoURL);
|
||||
}
|
||||
this.loadRoleFromToken();
|
||||
}
|
||||
@@ -120,14 +152,17 @@ export class AuthService {
|
||||
|
||||
// Login mit Google
|
||||
loginWithGoogle(): Promise<UserCredential> {
|
||||
if (!this.isBrowser || !this.auth) {
|
||||
throw new Error('Auth is only available in browser context');
|
||||
}
|
||||
const provider = new GoogleAuthProvider();
|
||||
return signInWithPopup(this.auth, provider).then(async userCredential => {
|
||||
if (userCredential.user) {
|
||||
const token = await userCredential.user.getIdToken();
|
||||
localStorage.setItem('authToken', token);
|
||||
localStorage.setItem('refreshToken', userCredential.user.refreshToken);
|
||||
this.setLocalStorageItem('authToken', token);
|
||||
this.setLocalStorageItem('refreshToken', userCredential.user.refreshToken);
|
||||
if (userCredential.user.photoURL) {
|
||||
localStorage.setItem('photoURL', userCredential.user.photoURL);
|
||||
this.setLocalStorageItem('photoURL', userCredential.user.photoURL);
|
||||
}
|
||||
this.loadRoleFromToken();
|
||||
}
|
||||
@@ -137,12 +172,15 @@ export class AuthService {
|
||||
|
||||
// Logout: Token, RefreshToken und photoURL entfernen
|
||||
logout(): Promise<void> {
|
||||
localStorage.removeItem('authToken');
|
||||
localStorage.removeItem('refreshToken');
|
||||
localStorage.removeItem('photoURL');
|
||||
this.removeLocalStorageItem('authToken');
|
||||
this.removeLocalStorageItem('refreshToken');
|
||||
this.removeLocalStorageItem('photoURL');
|
||||
this.clearRoleCache();
|
||||
this.userRoleSubject.next(null);
|
||||
return this.auth.signOut();
|
||||
if (this.auth) {
|
||||
return this.auth.signOut();
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
isAdmin(): Observable<boolean> {
|
||||
return this.getUserRole().pipe(
|
||||
@@ -202,10 +240,10 @@ export class AuthService {
|
||||
// Force refresh the token to get updated custom claims
|
||||
async refreshUserClaims(): Promise<void> {
|
||||
this.clearRoleCache();
|
||||
if (this.auth.currentUser) {
|
||||
if (this.auth && this.auth.currentUser) {
|
||||
await this.auth.currentUser.getIdToken(true);
|
||||
const token = await this.auth.currentUser.getIdToken();
|
||||
localStorage.setItem('authToken', token);
|
||||
this.setLocalStorageItem('authToken', token);
|
||||
this.loadRoleFromToken();
|
||||
}
|
||||
}
|
||||
@@ -234,7 +272,12 @@ export class AuthService {
|
||||
}
|
||||
// Versucht, mit dem RefreshToken einen neuen Access Token zu erhalten
|
||||
async refreshToken(): Promise<string | null> {
|
||||
const storedRefreshToken = localStorage.getItem('refreshToken');
|
||||
const storedRefreshToken = this.getLocalStorageItem('refreshToken');
|
||||
// SSR protection: refreshToken should only run in browser
|
||||
if (!this.isBrowser) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!storedRefreshToken) {
|
||||
return null;
|
||||
}
|
||||
@@ -250,8 +293,8 @@ export class AuthService {
|
||||
// response enthält z. B. id_token, refresh_token, expires_in etc.
|
||||
const newToken = response.id_token;
|
||||
const newRefreshToken = response.refresh_token;
|
||||
localStorage.setItem('authToken', newToken);
|
||||
localStorage.setItem('refreshToken', newRefreshToken);
|
||||
this.setLocalStorageItem('authToken', newToken);
|
||||
this.setLocalStorageItem('refreshToken', newRefreshToken);
|
||||
return newToken;
|
||||
} catch (error) {
|
||||
console.error('Error refreshing token:', error);
|
||||
@@ -266,7 +309,12 @@ export class AuthService {
|
||||
* Ist auch das nicht möglich, wird null zurückgegeben.
|
||||
*/
|
||||
async getToken(): Promise<string | null> {
|
||||
const token = localStorage.getItem('authToken');
|
||||
const token = this.getLocalStorageItem('authToken');
|
||||
// SSR protection: return null on server
|
||||
if (!this.isBrowser) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (token && !this.isEMailVerified(token)) {
|
||||
return null;
|
||||
} else if (token && this.isTokenValid(token) && this.isEMailVerified(token)) {
|
||||
@@ -278,6 +326,9 @@ export class AuthService {
|
||||
|
||||
// Add this new method to sign in with a custom token
|
||||
async signInWithCustomToken(token: string): Promise<void> {
|
||||
if (!this.isBrowser || !this.auth) {
|
||||
throw new Error('Auth is only available in browser context');
|
||||
}
|
||||
try {
|
||||
// Sign in to Firebase with the custom token
|
||||
const userCredential = await signInWithCustomToken(this.auth, token);
|
||||
@@ -285,11 +336,11 @@ export class AuthService {
|
||||
// Store the authentication token
|
||||
if (userCredential.user) {
|
||||
const idToken = await userCredential.user.getIdToken();
|
||||
localStorage.setItem('authToken', idToken);
|
||||
localStorage.setItem('refreshToken', userCredential.user.refreshToken);
|
||||
this.setLocalStorageItem('authToken', idToken);
|
||||
this.setLocalStorageItem('refreshToken', userCredential.user.refreshToken);
|
||||
|
||||
if (userCredential.user.photoURL) {
|
||||
localStorage.setItem('photoURL', userCredential.user.photoURL);
|
||||
this.setLocalStorageItem('photoURL', userCredential.user.photoURL);
|
||||
}
|
||||
|
||||
// Load user role from the token
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { isPlatformBrowser } from '@angular/common';
|
||||
import { inject, Injectable, PLATFORM_ID } from '@angular/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { SortByOptions } from '../../../../bizmatch-server/src/models/db.model';
|
||||
import { BusinessListingCriteria, CommercialPropertyListingCriteria, UserListingCriteria } from '../../../../bizmatch-server/src/models/main.model';
|
||||
@@ -27,6 +28,8 @@ interface FilterState {
|
||||
export class FilterStateService {
|
||||
private state: FilterState;
|
||||
private stateSubjects: Map<ListingType, BehaviorSubject<any>> = new Map();
|
||||
private platformId = inject(PLATFORM_ID);
|
||||
private isBrowser = isPlatformBrowser(this.platformId);
|
||||
|
||||
constructor() {
|
||||
// Initialize state from sessionStorage or with defaults
|
||||
@@ -125,10 +128,12 @@ export class FilterStateService {
|
||||
}
|
||||
|
||||
private saveToStorage(type: ListingType): void {
|
||||
if (!this.isBrowser) return;
|
||||
sessionStorage.setItem(type, JSON.stringify(this.state[type].criteria));
|
||||
}
|
||||
|
||||
private saveSortByToStorage(type: ListingType, sortBy: SortByOptions | null): void {
|
||||
if (!this.isBrowser) return;
|
||||
const sortByKey = type === 'businessListings' ? 'businessSortBy' : type === 'commercialPropertyListings' ? 'commercialSortBy' : 'professionalsSortBy';
|
||||
|
||||
if (sortBy) {
|
||||
@@ -156,9 +161,11 @@ export class FilterStateService {
|
||||
}
|
||||
|
||||
private loadCriteriaFromStorage(key: ListingType): CriteriaType {
|
||||
const stored = sessionStorage.getItem(key);
|
||||
if (stored) {
|
||||
return JSON.parse(stored);
|
||||
if (this.isBrowser) {
|
||||
const stored = sessionStorage.getItem(key);
|
||||
if (stored) {
|
||||
return JSON.parse(stored);
|
||||
}
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
@@ -172,6 +179,7 @@ export class FilterStateService {
|
||||
}
|
||||
|
||||
private loadSortByFromStorage(key: string): SortByOptions | null {
|
||||
if (!this.isBrowser) return null;
|
||||
const stored = sessionStorage.getItem(key);
|
||||
return stored && stored !== 'null' ? (stored as SortByOptions) : null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, PLATFORM_ID, inject } from '@angular/core';
|
||||
import { isPlatformBrowser } from '@angular/common';
|
||||
import { lastValueFrom, Observable, of } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { CityAndStateResult, CountyResult, GeoResult, IpInfo } from '../../../../bizmatch-server/src/models/main.model';
|
||||
@@ -21,6 +22,8 @@ export class GeoService {
|
||||
private readonly storageKey = 'ipInfo';
|
||||
private readonly boundaryStoragePrefix = 'nominatim_boundary_';
|
||||
private readonly cacheExpiration = 30 * 24 * 60 * 60 * 1000; // 30 days in milliseconds
|
||||
private platformId = inject(PLATFORM_ID);
|
||||
private isBrowser = isPlatformBrowser(this.platformId);
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
@@ -28,6 +31,8 @@ export class GeoService {
|
||||
* Get cached boundary data from localStorage
|
||||
*/
|
||||
private getCachedBoundary(cacheKey: string): any | null {
|
||||
if (!this.isBrowser) return null;
|
||||
|
||||
try {
|
||||
const cached = localStorage.getItem(this.boundaryStoragePrefix + cacheKey);
|
||||
if (!cached) {
|
||||
@@ -54,6 +59,8 @@ export class GeoService {
|
||||
* Save boundary data to localStorage
|
||||
*/
|
||||
private setCachedBoundary(cacheKey: string, data: any): void {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
try {
|
||||
const cachedData: CachedBoundary = {
|
||||
data: data,
|
||||
@@ -69,6 +76,8 @@ export class GeoService {
|
||||
* Clear all cached boundary data
|
||||
*/
|
||||
clearBoundaryCache(): void {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
try {
|
||||
const keys = Object.keys(localStorage);
|
||||
keys.forEach(key => {
|
||||
@@ -136,9 +145,11 @@ export class GeoService {
|
||||
|
||||
async getIpInfo(): Promise<IpInfo | null> {
|
||||
// Versuche zuerst, die Daten aus dem sessionStorage zu holen
|
||||
const storedData = sessionStorage.getItem(this.storageKey);
|
||||
if (storedData) {
|
||||
return JSON.parse(storedData);
|
||||
if (this.isBrowser) {
|
||||
const storedData = sessionStorage.getItem(this.storageKey);
|
||||
if (storedData) {
|
||||
return JSON.parse(storedData);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -146,7 +157,9 @@ export class GeoService {
|
||||
const data = await lastValueFrom(this.http.get<IpInfo>(`${this.apiBaseUrl}/bizmatch/geo/ipinfo/georesult/wysiwyg`));
|
||||
|
||||
// Speichere die Daten im sessionStorage
|
||||
sessionStorage.setItem(this.storageKey, JSON.stringify(data));
|
||||
if (this.isBrowser) {
|
||||
sessionStorage.setItem(this.storageKey, JSON.stringify(data));
|
||||
}
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { isPlatformBrowser } from '@angular/common';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { inject, Injectable, PLATFORM_ID } from '@angular/core';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { KeyValue, KeyValueAsSortBy, KeyValueStyle } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
@@ -9,20 +10,53 @@ import { environment } from '../../environments/environment';
|
||||
})
|
||||
export class SelectOptionsService {
|
||||
private apiBaseUrl = environment.apiBaseUrl;
|
||||
constructor(private http: HttpClient) {}
|
||||
private platformId = inject(PLATFORM_ID);
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
async init() {
|
||||
const allSelectOptions = await lastValueFrom(this.http.get<any>(`${this.apiBaseUrl}/bizmatch/select-options`));
|
||||
this.typesOfBusiness = allSelectOptions.typesOfBusiness;
|
||||
this.prices = allSelectOptions.prices;
|
||||
this.listingCategories = allSelectOptions.listingCategories;
|
||||
this.customerTypes = allSelectOptions.customerTypes;
|
||||
this.customerSubTypes = allSelectOptions.customerSubTypes;
|
||||
this.states = allSelectOptions.locations;
|
||||
this.gender = allSelectOptions.gender;
|
||||
this.typesOfCommercialProperty = allSelectOptions.typesOfCommercialProperty;
|
||||
this.distances = allSelectOptions.distances;
|
||||
this.sortByOptions = allSelectOptions.sortByOptions;
|
||||
// Skip HTTP call on server-side to avoid blocking SSR
|
||||
if (!isPlatformBrowser(this.platformId)) {
|
||||
console.log('[SSR] SelectOptionsService.init() - Skipping HTTP call on server');
|
||||
// Initialize with empty arrays - client will hydrate with real data
|
||||
this.typesOfBusiness = [];
|
||||
this.prices = [];
|
||||
this.listingCategories = [];
|
||||
this.customerTypes = [];
|
||||
this.customerSubTypes = [];
|
||||
this.states = [];
|
||||
this.gender = [];
|
||||
this.typesOfCommercialProperty = [];
|
||||
this.distances = [];
|
||||
this.sortByOptions = [];
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const allSelectOptions = await lastValueFrom(this.http.get<any>(`${this.apiBaseUrl}/bizmatch/select-options`));
|
||||
this.typesOfBusiness = allSelectOptions.typesOfBusiness;
|
||||
this.prices = allSelectOptions.prices;
|
||||
this.listingCategories = allSelectOptions.listingCategories;
|
||||
this.customerTypes = allSelectOptions.customerTypes;
|
||||
this.customerSubTypes = allSelectOptions.customerSubTypes;
|
||||
this.states = allSelectOptions.locations;
|
||||
this.gender = allSelectOptions.gender;
|
||||
this.typesOfCommercialProperty = allSelectOptions.typesOfCommercialProperty;
|
||||
this.distances = allSelectOptions.distances;
|
||||
this.sortByOptions = allSelectOptions.sortByOptions;
|
||||
} catch (error) {
|
||||
console.error('[SelectOptionsService] Failed to load select options:', error);
|
||||
// Initialize with empty arrays as fallback
|
||||
this.typesOfBusiness = this.typesOfBusiness || [];
|
||||
this.prices = this.prices || [];
|
||||
this.listingCategories = this.listingCategories || [];
|
||||
this.customerTypes = this.customerTypes || [];
|
||||
this.customerSubTypes = this.customerSubTypes || [];
|
||||
this.states = this.states || [];
|
||||
this.gender = this.gender || [];
|
||||
this.typesOfCommercialProperty = this.typesOfCommercialProperty || [];
|
||||
this.distances = this.distances || [];
|
||||
this.sortByOptions = this.sortByOptions || [];
|
||||
}
|
||||
}
|
||||
public typesOfBusiness: Array<KeyValueStyle>;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Injectable, inject, PLATFORM_ID } from '@angular/core';
|
||||
import { isPlatformBrowser } from '@angular/common';
|
||||
import { Meta, Title } from '@angular/platform-browser';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@@ -19,6 +20,8 @@ export class SeoService {
|
||||
private meta = inject(Meta);
|
||||
private title = inject(Title);
|
||||
private router = inject(Router);
|
||||
private platformId = inject(PLATFORM_ID);
|
||||
private isBrowser = isPlatformBrowser(this.platformId);
|
||||
|
||||
private readonly defaultImage = 'https://biz-match.com/assets/images/bizmatch-og-image.jpg';
|
||||
private readonly siteName = 'BizMatch';
|
||||
@@ -109,6 +112,8 @@ export class SeoService {
|
||||
* Update canonical URL
|
||||
*/
|
||||
private updateCanonicalUrl(url: string): void {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
let link: HTMLLinkElement | null = document.querySelector('link[rel="canonical"]');
|
||||
|
||||
if (link) {
|
||||
@@ -133,9 +138,18 @@ export class SeoService {
|
||||
'description': listing.description,
|
||||
'image': listing.images || [],
|
||||
'url': `${this.baseUrl}/business/${urlSlug}`,
|
||||
'offers': {
|
||||
'brand': {
|
||||
'@type': 'Brand',
|
||||
'name': listing.businessName
|
||||
},
|
||||
'category': listing.category || 'Business'
|
||||
};
|
||||
|
||||
// Only include offers if askingPrice is available
|
||||
if (listing.askingPrice && listing.askingPrice > 0) {
|
||||
schema['offers'] = {
|
||||
'@type': 'Offer',
|
||||
'price': listing.askingPrice,
|
||||
'price': listing.askingPrice.toString(),
|
||||
'priceCurrency': 'USD',
|
||||
'availability': 'https://schema.org/InStock',
|
||||
'url': `${this.baseUrl}/business/${urlSlug}`,
|
||||
@@ -145,13 +159,25 @@ export class SeoService {
|
||||
'name': this.siteName,
|
||||
'url': this.baseUrl
|
||||
}
|
||||
},
|
||||
'brand': {
|
||||
'@type': 'Brand',
|
||||
'name': listing.businessName
|
||||
},
|
||||
'category': listing.category || 'Business'
|
||||
};
|
||||
};
|
||||
} else {
|
||||
// For listings without a price, use PriceSpecification with "Contact for price"
|
||||
schema['offers'] = {
|
||||
'@type': 'Offer',
|
||||
'priceCurrency': 'USD',
|
||||
'availability': 'https://schema.org/InStock',
|
||||
'url': `${this.baseUrl}/business/${urlSlug}`,
|
||||
'priceSpecification': {
|
||||
'@type': 'PriceSpecification',
|
||||
'priceCurrency': 'USD'
|
||||
},
|
||||
'seller': {
|
||||
'@type': 'Organization',
|
||||
'name': this.siteName,
|
||||
'url': this.baseUrl
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Add aggregateRating with placeholder data
|
||||
schema['aggregateRating'] = {
|
||||
@@ -246,6 +272,8 @@ export class SeoService {
|
||||
* Inject JSON-LD structured data into page
|
||||
*/
|
||||
injectStructuredData(schema: object): void {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
// Remove existing schema script
|
||||
const existingScript = document.querySelector('script[type="application/ld+json"]');
|
||||
if (existingScript) {
|
||||
@@ -263,6 +291,8 @@ export class SeoService {
|
||||
* Clear all structured data
|
||||
*/
|
||||
clearStructuredData(): void {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
const scripts = document.querySelectorAll('script[type="application/ld+json"]');
|
||||
scripts.forEach(script => script.remove());
|
||||
}
|
||||
@@ -271,7 +301,7 @@ export class SeoService {
|
||||
* Generate RealEstateListing schema for commercial property
|
||||
*/
|
||||
generateRealEstateListingSchema(property: any): object {
|
||||
const schema = {
|
||||
const schema: any = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'RealEstateListing',
|
||||
'name': property.propertyName || `${property.propertyType} in ${property.city}`,
|
||||
@@ -290,19 +320,36 @@ export class SeoService {
|
||||
'@type': 'GeoCoordinates',
|
||||
'latitude': property.latitude,
|
||||
'longitude': property.longitude
|
||||
} : undefined,
|
||||
'offers': {
|
||||
} : undefined
|
||||
};
|
||||
|
||||
// Only include offers with price if askingPrice is available
|
||||
if (property.askingPrice && property.askingPrice > 0) {
|
||||
schema['offers'] = {
|
||||
'@type': 'Offer',
|
||||
'price': property.askingPrice,
|
||||
'price': property.askingPrice.toString(),
|
||||
'priceCurrency': 'USD',
|
||||
'availability': 'https://schema.org/InStock',
|
||||
'url': `${this.baseUrl}/details-commercial-property/${property.id}`,
|
||||
'priceSpecification': {
|
||||
'@type': 'PriceSpecification',
|
||||
'price': property.askingPrice,
|
||||
'price': property.askingPrice.toString(),
|
||||
'priceCurrency': 'USD'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
} else {
|
||||
// For listings without a price, provide minimal offer information
|
||||
schema['offers'] = {
|
||||
'@type': 'Offer',
|
||||
'priceCurrency': 'USD',
|
||||
'availability': 'https://schema.org/InStock',
|
||||
'url': `${this.baseUrl}/details-commercial-property/${property.id}`,
|
||||
'priceSpecification': {
|
||||
'@type': 'PriceSpecification',
|
||||
'priceCurrency': 'USD'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Add property-specific details
|
||||
if (property.squareFootage) {
|
||||
@@ -442,6 +489,8 @@ export class SeoService {
|
||||
* Inject multiple structured data schemas
|
||||
*/
|
||||
injectMultipleSchemas(schemas: object[]): void {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
// Remove existing schema scripts
|
||||
this.clearStructuredData();
|
||||
|
||||
@@ -553,6 +602,8 @@ export class SeoService {
|
||||
* Inject pagination link elements (rel="next" and rel="prev")
|
||||
*/
|
||||
injectPaginationLinks(baseUrl: string, currentPage: number, totalPages: number): void {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
// Remove existing pagination links
|
||||
document.querySelectorAll('link[rel="next"], link[rel="prev"]').forEach(link => link.remove());
|
||||
|
||||
@@ -577,6 +628,8 @@ export class SeoService {
|
||||
* Clear pagination links
|
||||
*/
|
||||
clearPaginationLinks(): void {
|
||||
if (!this.isBrowser) return;
|
||||
|
||||
document.querySelectorAll('link[rel="next"], link[rel="prev"]').forEach(link => link.remove());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { StripeSubscription } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SubscriptionsService {
|
||||
private apiBaseUrl = environment.apiBaseUrl;
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
getAllSubscriptions(email: string): Observable<StripeSubscription[]> {
|
||||
return this.http.get<StripeSubscription[]>(`${this.apiBaseUrl}/bizmatch/payment/subscriptions/${email}`);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { PaymentMethod } from '@stripe/stripe-js';
|
||||
import { catchError, forkJoin, lastValueFrom, map, Observable, of, Subject } from 'rxjs';
|
||||
import urlcat from 'urlcat';
|
||||
import { User } from '../../../../bizmatch-server/src/models/db.model';
|
||||
import { CombinedUser, FirebaseUserInfo, KeycloakUser, ResponseUsersArray, StripeSubscription, StripeUser, UserListingCriteria, UserRole, UsersResponse } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { CombinedUser, FirebaseUserInfo, KeycloakUser, ResponseUsersArray, UserListingCriteria, UserRole, UsersResponse } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
@@ -109,31 +108,7 @@ export class UserService {
|
||||
);
|
||||
}
|
||||
|
||||
getAllStripeSubscriptions(): Observable<StripeSubscription[]> {
|
||||
return this.http.get<StripeSubscription[]>(`${this.apiBaseUrl}/bizmatch/payment/subscription/all`).pipe(
|
||||
catchError(error => {
|
||||
console.error('Fehler beim Laden der Stripe-Subscriptions', error);
|
||||
return of([]);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
getAllStripeUsers(): Observable<StripeUser[]> {
|
||||
return this.http.get<StripeUser[]>(`${this.apiBaseUrl}/bizmatch/payment/user/all`).pipe(
|
||||
catchError(error => {
|
||||
console.error('Fehler beim Laden der Stripe-Benutzer', error);
|
||||
return of([]);
|
||||
}),
|
||||
);
|
||||
}
|
||||
getPaymentMethods(email: string): Observable<PaymentMethod[]> {
|
||||
return this.http.get<PaymentMethod[]>(`${this.apiBaseUrl}/bizmatch/payment/paymentmethod/${email}`).pipe(
|
||||
catchError(error => {
|
||||
console.error('Fehler beim Laden der Zahlungsinformationen', error);
|
||||
return of([]);
|
||||
}),
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Lädt alle Benutzer aus den verschiedenen Quellen und kombiniert sie.
|
||||
* @returns Ein Observable mit einer Liste von CombinedUser.
|
||||
@@ -142,10 +117,9 @@ export class UserService {
|
||||
return forkJoin({
|
||||
keycloakUsers: this.getKeycloakUsers(),
|
||||
appUsers: this.getAppUsers(),
|
||||
stripeSubscriptions: this.getAllStripeSubscriptions(),
|
||||
stripeUsers: this.getAllStripeUsers(),
|
||||
|
||||
}).pipe(
|
||||
map(({ keycloakUsers, appUsers, stripeSubscriptions, stripeUsers }) => {
|
||||
map(({ keycloakUsers, appUsers }) => {
|
||||
const combinedUsers: CombinedUser[] = [];
|
||||
|
||||
// Map App Users mit Keycloak und Stripe Subscription
|
||||
@@ -153,30 +127,14 @@ export class UserService {
|
||||
const keycloakUser = keycloakUsers.find(kcUser => kcUser.email.toLowerCase() === appUser.email.toLowerCase());
|
||||
|
||||
// const stripeSubscription = appUser.subscriptionId ? stripeSubscriptions.find(sub => sub.id === appUser.subscriptionId) : null;
|
||||
const stripeUser = stripeUsers.find(suser => suser.email === appUser.email);
|
||||
const stripeSubscription = stripeUser ? stripeSubscriptions.find(sub => sub.customer === stripeUser.id) : null;
|
||||
const stripeUser = null;
|
||||
const stripeSubscription = null;
|
||||
combinedUsers.push({
|
||||
appUser,
|
||||
keycloakUser,
|
||||
stripeUser,
|
||||
stripeSubscription,
|
||||
keycloakUser
|
||||
});
|
||||
});
|
||||
|
||||
// Füge Stripe-Benutzer hinzu, die nicht in App oder Keycloak vorhanden sind
|
||||
stripeUsers.forEach(stripeUser => {
|
||||
const existsInApp = appUsers.some(appUser => appUser.email.toLowerCase() === stripeUser.email.toLowerCase());
|
||||
const existsInKeycloak = keycloakUsers.some(kcUser => kcUser.email.toLowerCase() === stripeUser.email.toLowerCase());
|
||||
|
||||
if (!existsInApp && !existsInKeycloak) {
|
||||
combinedUsers.push({
|
||||
stripeUser,
|
||||
// Optional: Verknüpfe Stripe-Benutzer mit ihren Subscriptions
|
||||
stripeSubscription: stripeSubscriptions.find(sub => sub.customer === stripeUser.id) || null,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return combinedUsers;
|
||||
}),
|
||||
catchError(err => {
|
||||
|
||||
@@ -159,8 +159,10 @@ export function formatPhoneNumber(phone: string): string {
|
||||
}
|
||||
|
||||
export const getSessionStorageHandler = function (criteriaType, path, value, previous, applyData) {
|
||||
sessionStorage.setItem(`${criteriaType}_criteria`, JSON.stringify(this));
|
||||
console.log('Zusätzlicher Parameter:', criteriaType);
|
||||
if (typeof sessionStorage !== 'undefined') {
|
||||
sessionStorage.setItem(`${criteriaType}_criteria`, JSON.stringify(this));
|
||||
console.log('Zusätzlicher Parameter:', criteriaType);
|
||||
}
|
||||
};
|
||||
export const getSessionStorageHandlerWrapper = param => {
|
||||
return function (path, value, previous, applyData) {
|
||||
@@ -191,6 +193,11 @@ export function map2User(jwt: string | null): KeycloakUser {
|
||||
}
|
||||
export function getImageDimensions(imageUrl: string): Promise<{ width: number; height: number }> {
|
||||
return new Promise(resolve => {
|
||||
// Only use Image in browser context
|
||||
if (typeof Image === 'undefined') {
|
||||
resolve({ width: 0, height: 0 });
|
||||
return;
|
||||
}
|
||||
const img = new Image();
|
||||
img.onload = () => {
|
||||
resolve({ width: img.width, height: img.height });
|
||||
@@ -295,9 +302,11 @@ export function checkAndUpdate(changed: boolean, condition: boolean, assignment:
|
||||
return changed || condition;
|
||||
}
|
||||
export function removeSortByStorage() {
|
||||
sessionStorage.removeItem('businessSortBy');
|
||||
sessionStorage.removeItem('commercialSortBy');
|
||||
sessionStorage.removeItem('professionalsSortBy');
|
||||
if (typeof sessionStorage !== 'undefined') {
|
||||
sessionStorage.removeItem('businessSortBy');
|
||||
sessionStorage.removeItem('commercialSortBy');
|
||||
sessionStorage.removeItem('professionalsSortBy');
|
||||
}
|
||||
}
|
||||
// -----------------------------
|
||||
// Criteria Proxy
|
||||
@@ -311,8 +320,11 @@ export function getCriteriaStateObject(criteriaType: 'businessListings' | 'comme
|
||||
} else {
|
||||
initialState = createEmptyUserListingCriteria();
|
||||
}
|
||||
const storedState = sessionStorage.getItem(`${criteriaType}`);
|
||||
return storedState ? JSON.parse(storedState) : initialState;
|
||||
if (typeof sessionStorage !== 'undefined') {
|
||||
const storedState = sessionStorage.getItem(`${criteriaType}`);
|
||||
return storedState ? JSON.parse(storedState) : initialState;
|
||||
}
|
||||
return initialState;
|
||||
}
|
||||
export function getCriteriaProxy(path: string, component: any): BusinessListingCriteria | CommercialPropertyListingCriteria | UserListingCriteria {
|
||||
if ('businessListings' === path) {
|
||||
@@ -327,7 +339,9 @@ export function getCriteriaProxy(path: string, component: any): BusinessListingC
|
||||
}
|
||||
export function createEnhancedProxy(obj: BusinessListingCriteria | CommercialPropertyListingCriteria | UserListingCriteria, component: any) {
|
||||
const sessionStorageHandler = function (path, value, previous, applyData) {
|
||||
sessionStorage.setItem(`${obj.criteriaType}`, JSON.stringify(this));
|
||||
if (typeof sessionStorage !== 'undefined') {
|
||||
sessionStorage.setItem(`${obj.criteriaType}`, JSON.stringify(this));
|
||||
}
|
||||
};
|
||||
|
||||
return onChange(obj, function (path, value, previous, applyData) {
|
||||
@@ -341,16 +355,20 @@ export function createEnhancedProxy(obj: BusinessListingCriteria | CommercialPro
|
||||
});
|
||||
}
|
||||
export function getCriteriaByListingCategory(listingsCategory: 'business' | 'professionals_brokers' | 'commercialProperty') {
|
||||
if (typeof sessionStorage === 'undefined') return null;
|
||||
|
||||
const storedState =
|
||||
listingsCategory === 'business'
|
||||
? sessionStorage.getItem('businessListings')
|
||||
: listingsCategory === 'commercialProperty'
|
||||
? sessionStorage.getItem('commercialPropertyListings')
|
||||
: sessionStorage.getItem('brokerListings');
|
||||
return JSON.parse(storedState);
|
||||
return storedState ? JSON.parse(storedState) : null;
|
||||
}
|
||||
|
||||
export function getSortByListingCategory(listingsCategory: 'business' | 'professionals_brokers' | 'commercialProperty') {
|
||||
if (typeof sessionStorage === 'undefined') return null;
|
||||
|
||||
const storedSortBy =
|
||||
listingsCategory === 'business' ? sessionStorage.getItem('businessSortBy') : listingsCategory === 'commercialProperty' ? sessionStorage.getItem('commercialSortBy') : sessionStorage.getItem('professionalsSortBy');
|
||||
const sortBy = storedSortBy && storedSortBy !== 'null' ? (storedSortBy as SortByOptions) : null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Build information, automatically generated by `the_build_script` :zwinkern:
|
||||
const build = {
|
||||
timestamp: "GER: 01.12.2025 20:23 | TX: 12/01/2025 1:23 PM"
|
||||
timestamp: "GER: 06.01.2026 22:33 | TX: 01/06/2026 3:33 PM"
|
||||
};
|
||||
|
||||
export default build;
|
||||
@@ -1,4 +1,5 @@
|
||||
export const hostname = window.location.hostname;
|
||||
// SSR-safe: check if window exists (it doesn't on server-side)
|
||||
const hostname = typeof window !== 'undefined' ? window.location.hostname : 'localhost';
|
||||
export const environment_base = {
|
||||
// apiBaseUrl: 'http://localhost:3000',
|
||||
apiBaseUrl: `http://${hostname}:4200`,
|
||||
|
||||
@@ -4,7 +4,7 @@ export const environment = environment_base;
|
||||
environment.production = true;
|
||||
environment.apiBaseUrl = 'https://api.bizmatch.net';
|
||||
environment.mailinfoUrl = 'https://www.bizmatch.net';
|
||||
environment.imageBaseUrl = 'https://www.bizmatch.net';
|
||||
environment.imageBaseUrl = 'https://api.bizmatch.net';
|
||||
|
||||
environment.POSTHOG_KEY = 'phc_eUIcIq0UPVzEDtZLy78klKhGudyagBz3goDlKx8SQFe';
|
||||
environment.POSTHOG_HOST = 'https://eu.i.posthog.com';
|
||||
|
||||
@@ -2,4 +2,4 @@ import { environment_base } from './environment.base';
|
||||
|
||||
export const environment = environment_base;
|
||||
environment.mailinfoUrl = 'http://localhost:4200';
|
||||
environment.imageBaseUrl = 'http://localhost:4200';
|
||||
environment.imageBaseUrl = 'http://localhost:3001';
|
||||
|
||||
@@ -1,63 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Bizmatch - Find Business for sale</title>
|
||||
<meta name="description" content="Find or Sell Businesses and Restaurants" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<!-- Mobile App & Theme Meta Tags -->
|
||||
<meta name="theme-color" content="#0066cc" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="apple-mobile-web-app-title" content="BizMatch" />
|
||||
<meta name="application-name" content="BizMatch" />
|
||||
<meta name="msapplication-TileColor" content="#0066cc" />
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Bizmatch - Find Business for sale</title>
|
||||
<meta name="description" content="Find or Sell Businesses and Restaurants" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<!-- Resource Hints for Performance -->
|
||||
<!-- Google Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link rel="dns-prefetch" href="https://fonts.googleapis.com" />
|
||||
<link rel="dns-prefetch" href="https://fonts.gstatic.com" />
|
||||
<!-- Mobile App & Theme Meta Tags -->
|
||||
<meta name="theme-color" content="#0066cc" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="apple-mobile-web-app-title" content="BizMatch" />
|
||||
<meta name="application-name" content="BizMatch" />
|
||||
<meta name="msapplication-TileColor" content="#0066cc" />
|
||||
|
||||
<!-- Image CDN -->
|
||||
<link rel="preconnect" href="https://dev.bizmatch.net" crossorigin />
|
||||
<link rel="dns-prefetch" href="https://dev.bizmatch.net" />
|
||||
<!-- Resource Hints for Performance -->
|
||||
<!-- Google Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link rel="dns-prefetch" href="https://fonts.googleapis.com" />
|
||||
<link rel="dns-prefetch" href="https://fonts.gstatic.com" />
|
||||
|
||||
<!-- Firebase Services -->
|
||||
<link rel="preconnect" href="https://firebase.google.com" />
|
||||
<link rel="preconnect" href="https://firebasestorage.googleapis.com" />
|
||||
<link rel="dns-prefetch" href="https://firebasestorage.googleapis.com" />
|
||||
<link rel="dns-prefetch" href="https://firebaseapp.com" />
|
||||
<!-- Image CDN -->
|
||||
<link rel="preconnect" href="https://dev.bizmatch.net" crossorigin />
|
||||
<link rel="dns-prefetch" href="https://dev.bizmatch.net" />
|
||||
|
||||
<!-- Preload critical assets -->
|
||||
<link rel="preload" as="image" href="assets/images/header-logo.png" type="image/png" />
|
||||
<!-- Firebase Services -->
|
||||
<link rel="preconnect" href="https://firebase.google.com" />
|
||||
<link rel="preconnect" href="https://firebasestorage.googleapis.com" />
|
||||
<link rel="dns-prefetch" href="https://firebasestorage.googleapis.com" />
|
||||
<link rel="dns-prefetch" href="https://firebaseapp.com" />
|
||||
|
||||
<!-- Prefetch common assets -->
|
||||
<link rel="prefetch" as="image" href="assets/images/business_logo.png" />
|
||||
<link rel="prefetch" as="image" href="assets/images/properties_logo.png" />
|
||||
<link rel="prefetch" as="image" href="assets/images/placeholder.png" />
|
||||
<link rel="prefetch" as="image" href="assets/images/person_placeholder.jpg" />
|
||||
<meta name="robots" content="index, follow" />
|
||||
<meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
|
||||
<meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
|
||||
<meta property="og:locale" content="en_US" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="front-page - BizMatch" />
|
||||
<meta property="og:description" content="We are dedicated to providing a simple to use way for people in business to get in contact with each other." />
|
||||
<meta property="og:site_name" content="BizMatch" />
|
||||
<meta property="article:modified_time" content="2016-11-17T15:57:10+00:00" />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<meta property="og:image:height" content="630" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<base href="/" />
|
||||
<link rel="icon" href="assets/cropped-Favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" href="assets/cropped-Favicon-192x192.png" sizes="192x192" />
|
||||
<link rel="apple-touch-icon" href="assets/cropped-Favicon-180x180.png" />
|
||||
</head>
|
||||
<body class="flex flex-col min-h-screen">
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
<!-- Preload critical assets -->
|
||||
<link rel="preload" as="image" href="/assets/images/header-logo.png" type="image/png" />
|
||||
|
||||
<!-- Prefetch common assets -->
|
||||
<link rel="prefetch" as="image" href="/assets/images/business_logo.png" />
|
||||
<link rel="prefetch" as="image" href="/assets/images/properties_logo.png" />
|
||||
<link rel="prefetch" as="image" href="/assets/images/placeholder.png" />
|
||||
<link rel="prefetch" as="image" href="/assets/images/person_placeholder.jpg" />
|
||||
<meta name="robots" content="index, follow" />
|
||||
<meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
|
||||
<meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
|
||||
<meta property="og:locale" content="en_US" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="front-page - BizMatch" />
|
||||
<meta property="og:description"
|
||||
content="We are dedicated to providing a simple to use way for people in business to get in contact with each other." />
|
||||
<meta property="og:site_name" content="BizMatch" />
|
||||
<meta property="article:modified_time" content="2016-11-17T15:57:10+00:00" />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<meta property="og:image:height" content="630" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<base href="/" />
|
||||
<link rel="icon" href="/assets/cropped-Favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" href="/assets/cropped-Favicon-192x192.png" sizes="192x192" />
|
||||
<link rel="apple-touch-icon" href="/assets/cropped-Favicon-180x180.png" />
|
||||
</head>
|
||||
|
||||
<body class="flex flex-col min-h-screen">
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,7 +1,20 @@
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
// IMPORTANT: DOM polyfill must be imported FIRST, before any browser-dependent libraries
|
||||
import './ssr-dom-polyfill';
|
||||
|
||||
import { bootstrapApplication, BootstrapContext } from '@angular/platform-browser';
|
||||
import { AppComponent } from './app/app.component';
|
||||
import { config } from './app/app.config.server';
|
||||
|
||||
const bootstrap = () => bootstrapApplication(AppComponent, config);
|
||||
const bootstrap = (context: BootstrapContext) => {
|
||||
console.log('[SSR] Bootstrap function called');
|
||||
const appRef = bootstrapApplication(AppComponent, config, context);
|
||||
appRef.then(() => {
|
||||
console.log('[SSR] Application bootstrapped successfully');
|
||||
}).catch((err) => {
|
||||
console.error('[SSR] Bootstrap error:', err);
|
||||
console.error('[SSR] Error stack:', err.stack);
|
||||
});
|
||||
return appRef;
|
||||
};
|
||||
|
||||
export default bootstrap;
|
||||
|
||||
@@ -1,27 +1,140 @@
|
||||
# robots.txt for BizMatch
|
||||
# robots.txt for BizMatch - Business Marketplace
|
||||
# https://biz-match.com
|
||||
# Last updated: 2026-01-02
|
||||
|
||||
# ===========================================
|
||||
# Default rules for all crawlers
|
||||
# ===========================================
|
||||
User-agent: *
|
||||
|
||||
# Allow all public pages
|
||||
Allow: /
|
||||
Allow: /home
|
||||
Allow: /listings
|
||||
Allow: /listings-2
|
||||
Allow: /listings-3
|
||||
Allow: /listings-4
|
||||
Allow: /details-business-listing/
|
||||
Allow: /details-commercial-property/
|
||||
Allow: /businessListings
|
||||
Allow: /commercialPropertyListings
|
||||
Allow: /brokerListings
|
||||
Allow: /business/*
|
||||
Allow: /commercial-property/*
|
||||
Allow: /details-user/*
|
||||
Allow: /terms-of-use
|
||||
Allow: /privacy-statement
|
||||
|
||||
# Disallow private/admin areas
|
||||
Disallow: /admin/
|
||||
Disallow: /profile/
|
||||
Disallow: /dashboard/
|
||||
Disallow: /favorites/
|
||||
Disallow: /settings/
|
||||
Disallow: /account
|
||||
Disallow: /myListings
|
||||
Disallow: /myFavorites
|
||||
Disallow: /createBusinessListing
|
||||
Disallow: /createCommercialPropertyListing
|
||||
Disallow: /editBusinessListing/*
|
||||
Disallow: /editCommercialPropertyListing/*
|
||||
Disallow: /login
|
||||
Disallow: /logout
|
||||
Disallow: /register
|
||||
Disallow: /emailUs
|
||||
|
||||
# Allow common crawlers
|
||||
# Disallow duplicate content / API routes
|
||||
Disallow: /api/
|
||||
Disallow: /bizmatch/
|
||||
|
||||
# Disallow search result pages with parameters (to avoid duplicate content)
|
||||
Disallow: /*?*sortBy=
|
||||
Disallow: /*?*page=
|
||||
Disallow: /*?*start=
|
||||
|
||||
# ===========================================
|
||||
# Google-specific rules
|
||||
# ===========================================
|
||||
User-agent: Googlebot
|
||||
Allow: /
|
||||
Crawl-delay: 1
|
||||
|
||||
# Allow Google to index images
|
||||
User-agent: Googlebot-Image
|
||||
Allow: /assets/
|
||||
Disallow: /assets/leaflet/
|
||||
|
||||
# ===========================================
|
||||
# Bing-specific rules
|
||||
# ===========================================
|
||||
User-agent: Bingbot
|
||||
Allow: /
|
||||
Crawl-delay: 2
|
||||
|
||||
# Sitemap location (served from backend API)
|
||||
Sitemap: https://biz-match.com/bizmatch/sitemap/sitemap.xml
|
||||
# ===========================================
|
||||
# Other major search engines
|
||||
# ===========================================
|
||||
User-agent: DuckDuckBot
|
||||
Allow: /
|
||||
Crawl-delay: 2
|
||||
|
||||
User-agent: Slurp
|
||||
Allow: /
|
||||
Crawl-delay: 2
|
||||
|
||||
User-agent: Yandex
|
||||
Allow: /
|
||||
Crawl-delay: 5
|
||||
|
||||
User-agent: Baiduspider
|
||||
Allow: /
|
||||
Crawl-delay: 5
|
||||
|
||||
# ===========================================
|
||||
# AI/LLM Crawlers (Answer Engine Optimization)
|
||||
# ===========================================
|
||||
User-agent: GPTBot
|
||||
Allow: /
|
||||
Allow: /businessListings
|
||||
Allow: /business/*
|
||||
Disallow: /admin/
|
||||
Disallow: /account
|
||||
|
||||
User-agent: ChatGPT-User
|
||||
Allow: /
|
||||
|
||||
User-agent: Claude-Web
|
||||
Allow: /
|
||||
|
||||
User-agent: Anthropic-AI
|
||||
Allow: /
|
||||
|
||||
User-agent: PerplexityBot
|
||||
Allow: /
|
||||
|
||||
User-agent: Cohere-ai
|
||||
Allow: /
|
||||
|
||||
# ===========================================
|
||||
# Block unwanted bots
|
||||
# ===========================================
|
||||
User-agent: AhrefsBot
|
||||
Disallow: /
|
||||
|
||||
User-agent: SemrushBot
|
||||
Disallow: /
|
||||
|
||||
User-agent: MJ12bot
|
||||
Disallow: /
|
||||
|
||||
User-agent: DotBot
|
||||
Disallow: /
|
||||
|
||||
User-agent: BLEXBot
|
||||
Disallow: /
|
||||
|
||||
# ===========================================
|
||||
# Sitemap locations
|
||||
# ===========================================
|
||||
# Main sitemap index (dynamically generated, contains all sub-sitemaps)
|
||||
Sitemap: https://biz-match.com/bizmatch/sitemap.xml
|
||||
|
||||
# Individual sitemaps (auto-listed in sitemap index)
|
||||
# - https://biz-match.com/bizmatch/sitemap/static.xml
|
||||
# - https://biz-match.com/bizmatch/sitemap/business-1.xml
|
||||
# - https://biz-match.com/bizmatch/sitemap/commercial-1.xml
|
||||
|
||||
# ===========================================
|
||||
# Host directive (for Yandex)
|
||||
# ===========================================
|
||||
Host: https://biz-match.com
|
||||
|
||||
163
bizmatch/src/ssr-dom-polyfill.ts
Normal file
163
bizmatch/src/ssr-dom-polyfill.ts
Normal file
@@ -0,0 +1,163 @@
|
||||
/**
|
||||
* DOM Polyfills for Server-Side Rendering
|
||||
*
|
||||
* This file must be imported BEFORE any browser-only libraries like Leaflet.
|
||||
* It provides minimal stubs for browser globals that are required during module loading.
|
||||
*/
|
||||
|
||||
// Create a minimal screen mock
|
||||
const screenMock = {
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
availWidth: 1920,
|
||||
availHeight: 1080,
|
||||
colorDepth: 24,
|
||||
pixelDepth: 24,
|
||||
deviceXDPI: 96,
|
||||
deviceYDPI: 96,
|
||||
logicalXDPI: 96,
|
||||
logicalYDPI: 96,
|
||||
};
|
||||
|
||||
// Create a minimal document mock
|
||||
const documentMock = {
|
||||
createElement: (tag: string) => ({
|
||||
style: {},
|
||||
setAttribute: () => { },
|
||||
getAttribute: () => null,
|
||||
appendChild: () => { },
|
||||
removeChild: () => { },
|
||||
classList: {
|
||||
add: () => { },
|
||||
remove: () => { },
|
||||
contains: () => false,
|
||||
},
|
||||
tagName: tag.toUpperCase(),
|
||||
}),
|
||||
createElementNS: (ns: string, tag: string) => ({
|
||||
style: {},
|
||||
setAttribute: () => { },
|
||||
getAttribute: () => null,
|
||||
appendChild: () => { },
|
||||
getBBox: () => ({ x: 0, y: 0, width: 0, height: 0 }),
|
||||
tagName: tag.toUpperCase(),
|
||||
}),
|
||||
createTextNode: () => ({}),
|
||||
head: { appendChild: () => { }, removeChild: () => { } },
|
||||
body: { appendChild: () => { }, removeChild: () => { } },
|
||||
documentElement: {
|
||||
style: {},
|
||||
clientWidth: 1920,
|
||||
clientHeight: 1080,
|
||||
},
|
||||
addEventListener: () => { },
|
||||
removeEventListener: () => { },
|
||||
querySelector: () => null,
|
||||
querySelectorAll: () => [],
|
||||
getElementById: () => null,
|
||||
getElementsByTagName: () => [],
|
||||
getElementsByClassName: () => [],
|
||||
};
|
||||
|
||||
// Create a minimal window mock for libraries that check for window existence during load
|
||||
const windowMock = {
|
||||
requestAnimationFrame: (callback: FrameRequestCallback) => setTimeout(callback, 16),
|
||||
cancelAnimationFrame: (id: number) => clearTimeout(id),
|
||||
addEventListener: () => { },
|
||||
removeEventListener: () => { },
|
||||
getComputedStyle: () => ({
|
||||
getPropertyValue: () => '',
|
||||
}),
|
||||
matchMedia: () => ({
|
||||
matches: false,
|
||||
addListener: () => { },
|
||||
removeListener: () => { },
|
||||
addEventListener: () => { },
|
||||
removeEventListener: () => { },
|
||||
}),
|
||||
document: documentMock,
|
||||
screen: screenMock,
|
||||
devicePixelRatio: 1,
|
||||
navigator: {
|
||||
userAgent: 'node',
|
||||
platform: 'server',
|
||||
language: 'en',
|
||||
languages: ['en'],
|
||||
onLine: true,
|
||||
geolocation: null,
|
||||
},
|
||||
location: {
|
||||
hostname: 'localhost',
|
||||
href: 'http://localhost',
|
||||
protocol: 'http:',
|
||||
pathname: '/',
|
||||
search: '',
|
||||
hash: '',
|
||||
host: 'localhost',
|
||||
origin: 'http://localhost',
|
||||
},
|
||||
history: {
|
||||
pushState: () => { },
|
||||
replaceState: () => { },
|
||||
back: () => { },
|
||||
forward: () => { },
|
||||
go: () => { },
|
||||
length: 0,
|
||||
},
|
||||
localStorage: {
|
||||
getItem: () => null,
|
||||
setItem: () => { },
|
||||
removeItem: () => { },
|
||||
clear: () => { },
|
||||
},
|
||||
sessionStorage: {
|
||||
getItem: () => null,
|
||||
setItem: () => { },
|
||||
removeItem: () => { },
|
||||
clear: () => { },
|
||||
},
|
||||
setTimeout,
|
||||
clearTimeout,
|
||||
setInterval,
|
||||
clearInterval,
|
||||
innerWidth: 1920,
|
||||
innerHeight: 1080,
|
||||
outerWidth: 1920,
|
||||
outerHeight: 1080,
|
||||
scrollX: 0,
|
||||
scrollY: 0,
|
||||
pageXOffset: 0,
|
||||
pageYOffset: 0,
|
||||
scrollTo: () => { },
|
||||
scroll: () => { },
|
||||
Image: class Image { },
|
||||
HTMLElement: class HTMLElement { },
|
||||
SVGElement: class SVGElement { },
|
||||
};
|
||||
|
||||
// Only set globals if they don't exist (i.e., we're in Node.js)
|
||||
if (typeof window === 'undefined') {
|
||||
(global as any).window = windowMock;
|
||||
}
|
||||
|
||||
if (typeof document === 'undefined') {
|
||||
(global as any).document = documentMock;
|
||||
}
|
||||
|
||||
if (typeof navigator === 'undefined') {
|
||||
(global as any).navigator = windowMock.navigator;
|
||||
}
|
||||
|
||||
if (typeof screen === 'undefined') {
|
||||
(global as any).screen = screenMock;
|
||||
}
|
||||
|
||||
if (typeof HTMLElement === 'undefined') {
|
||||
(global as any).HTMLElement = windowMock.HTMLElement;
|
||||
}
|
||||
|
||||
if (typeof SVGElement === 'undefined') {
|
||||
(global as any).SVGElement = windowMock.SVGElement;
|
||||
}
|
||||
|
||||
export { };
|
||||
@@ -1,31 +1,34 @@
|
||||
// @import 'primeng/resources/primeng.css';
|
||||
// @import 'primeicons/primeicons.css';
|
||||
@import '@ng-select/ng-select/themes/default.theme.css';
|
||||
// @import 'primeflex/primeflex.css';
|
||||
@import url('https://fonts.googleapis.com/css?family=Open+Sans&display=swap');
|
||||
// @import 'primeng/resources/themes/lara-light-blue/theme.css';
|
||||
@import '@fortawesome/fontawesome-free/css/all.min.css';
|
||||
// Use @tailwind directives instead of @import both to silence deprecation warnings
|
||||
// and because it's the recommended Tailwind CSS syntax
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
// External CSS imports - these URL imports don't trigger deprecation warnings
|
||||
@import url('https://fonts.googleapis.com/css?family=Open+Sans&display=swap');
|
||||
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css');
|
||||
|
||||
// Local CSS files loaded as CSS (not SCSS) to avoid @import deprecation
|
||||
// Note: These are loaded via angular.json styles array is the preferred approach,
|
||||
// but for now we keep them here for simplicity
|
||||
@import '@ng-select/ng-select/themes/default.theme.css';
|
||||
|
||||
// In Ihrer src/styles.css Datei:
|
||||
@import 'tailwindcss/base';
|
||||
@import 'tailwindcss/components';
|
||||
@import 'tailwindcss/utilities';
|
||||
@import 'ngx-sharebuttons/themes/default';
|
||||
/* styles.scss */
|
||||
@import 'leaflet/dist/leaflet.css';
|
||||
:root {
|
||||
--text-color-secondary: rgba(255, 255, 255);
|
||||
--wrapper-width: 1491px;
|
||||
// --secondary-color: #ffffff; /* Setzt die secondary Farbe auf weiß */
|
||||
}
|
||||
|
||||
.p-button.p-button-secondary.p-button-outlined {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
app-root {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
|
||||
&:hover a {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -67,11 +70,13 @@ textarea {
|
||||
// }
|
||||
|
||||
main {
|
||||
flex: 1 0 auto; /* Füllt den verfügbaren Platz */
|
||||
flex: 1 0 auto;
|
||||
/* Füllt den verfügbaren Platz */
|
||||
}
|
||||
|
||||
footer {
|
||||
flex-shrink: 0; /* Verhindert Schrumpfen */
|
||||
flex-shrink: 0;
|
||||
/* Verhindert Schrumpfen */
|
||||
}
|
||||
|
||||
*:focus,
|
||||
@@ -103,14 +108,17 @@ p-menubarsub ul {
|
||||
height: 100%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.p-editor-container .ql-toolbar {
|
||||
background: #f9fafb;
|
||||
border-top-right-radius: 6px;
|
||||
border-top-left-radius: 6px;
|
||||
}
|
||||
|
||||
.p-dropdown-panel .p-dropdown-header .p-dropdown-filter {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
input::placeholder,
|
||||
textarea::placeholder {
|
||||
color: #999 !important;
|
||||
@@ -131,4 +139,4 @@ textarea::placeholder {
|
||||
/* Optional: Anpassen der Marker-Icon-Größe */
|
||||
width: 25px;
|
||||
height: 41px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user