format on save, resolve compile errors, functionality 1. stage

This commit is contained in:
2024-04-23 17:32:21 +02:00
parent 7f0f21b598
commit 9e03620be7
32 changed files with 1506 additions and 1389 deletions

View File

@@ -1,118 +1,115 @@
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { faUserGear } from '@fortawesome/free-solid-svg-icons';
import { MenuItem } from 'primeng/api';
import { ButtonModule } from 'primeng/button';
import { MenubarModule } from 'primeng/menubar';
import { OverlayPanelModule } from 'primeng/overlaypanel';
import { environment } from '../../../environments/environment';
import { UserService } from '../../services/user.service';
import { TabMenuModule } from 'primeng/tabmenu';
import { Observable } from 'rxjs';
import { faUserGear } from '@fortawesome/free-solid-svg-icons';
import { Router } from '@angular/router';
import {User} from '../../../../../bizmatch-server/src/models/db.model'
import { User } from '../../../../../bizmatch-server/src/models/db.model';
import { environment } from '../../../environments/environment';
import { UserService } from '../../services/user.service';
@Component({
selector: 'header',
standalone: true,
imports: [CommonModule, MenubarModule, ButtonModule, OverlayPanelModule, TabMenuModule ],
templateUrl: './header.component.html',
styleUrl: './header.component.scss'
selector: 'header',
standalone: true,
imports: [CommonModule, MenubarModule, ButtonModule, OverlayPanelModule, TabMenuModule],
templateUrl: './header.component.html',
styleUrl: './header.component.scss',
})
export class HeaderComponent {
public buildVersion = environment.buildVersion;
user$:Observable<User>
user:User;
public tabItems: MenuItem[];
public menuItems: MenuItem[];
activeItem
faUserGear=faUserGear
constructor(public userService: UserService,private router: Router) {
}
public buildVersion = environment.buildVersion;
user$: Observable<User>;
user: User;
public tabItems: MenuItem[];
public menuItems: MenuItem[];
activeItem;
faUserGear = faUserGear;
constructor(public userService: UserService, private router: Router) {}
ngOnInit(){
this.user$=this.userService.getUserObservable();
this.user$.subscribe(u=>{
this.user=u;
this.menuItems = [
{
label: 'User Actions',
icon: 'fas fa-cog',
items: [
{
label: 'Account',
icon: 'pi pi-user',
routerLink: `/account/${this.user.id}`,
visible: this.isUserLogedIn()
},
{
label: 'Create Listing',
icon: 'pi pi-plus-circle',
routerLink: "/createListing",
visible: this.isUserLogedIn()
},
{
label: 'My Listings',
icon: 'pi pi-list',
routerLink:"/myListings",
visible: this.isUserLogedIn()
},
{
label: 'My Favorites',
icon: 'pi pi-star',
routerLink:"/myFavorites",
visible: this.isUserLogedIn()
},
{
label: 'EMail Us',
icon: 'fa-regular fa-envelope',
routerLink:"/emailUs",
visible: this.isUserLogedIn()
},
{
label: 'Logout',
icon: 'fa-solid fa-right-from-bracket',
routerLink:"/logout",
visible: this.isUserLogedIn()
},
{
label: 'Login',
icon: 'fa-solid fa-right-from-bracket',
//routerLink:"/account",
command: () => this.login(),
visible: !this.isUserLogedIn()
},
]
}
]
});
this.tabItems = [
{
label: 'Businesses for Sale',
routerLink: '/listings/business',
fragment:''
},
{
label: 'Professionals/Brokers Directory',
routerLink: '/listings/professionals_brokers',
fragment:''
},
{
label: 'Commercial Property',
routerLink: '/listings/commercialProperty',
fragment:''
}
];
ngOnInit() {
this.user$ = this.userService.getUserObservable();
this.user$.subscribe(u => {
this.user = u;
this.menuItems = [
{
label: 'User Actions',
icon: 'fas fa-cog',
items: [
{
label: 'Account',
icon: 'pi pi-user',
routerLink: `/account`,
visible: this.isUserLogedIn(),
},
{
label: 'Create Listing',
icon: 'pi pi-plus-circle',
routerLink: '/createListing',
visible: this.isUserLogedIn(),
},
{
label: 'My Listings',
icon: 'pi pi-list',
routerLink: '/myListings',
visible: this.isUserLogedIn(),
},
{
label: 'My Favorites',
icon: 'pi pi-star',
routerLink: '/myFavorites',
visible: this.isUserLogedIn(),
},
{
label: 'EMail Us',
icon: 'fa-regular fa-envelope',
routerLink: '/emailUs',
visible: this.isUserLogedIn(),
},
{
label: 'Logout',
icon: 'fa-solid fa-right-from-bracket',
routerLink: '/logout',
visible: this.isUserLogedIn(),
},
{
label: 'Login',
icon: 'fa-solid fa-right-from-bracket',
command: () => this.login(),
visible: !this.isUserLogedIn(),
},
],
},
];
});
this.tabItems = [
{
label: 'Businesses for Sale',
routerLink: '/businessListings',
fragment: '',
},
{
label: 'Professionals/Brokers Directory',
routerLink: '/brokerListings',
fragment: '',
},
{
label: 'Commercial Property',
routerLink: '/commercialPropertyListings',
fragment: '',
},
];
this.activeItem=this.tabItems[0];
}
navigateWithState(dest: string, state: any) {
this.router.navigate([dest], { state: state });
}
isUserLogedIn(){
return this.userService?.isLoggedIn();
}
login(){
this.userService.login(window.location.href);
}
this.activeItem = this.tabItems[0];
}
navigateWithState(dest: string, state: any) {
this.router.navigate([dest], { state: state });
}
isUserLogedIn() {
return this.userService?.isLoggedIn();
}
login() {
this.userService.login(window.location.href);
}
}