-
+
-
+
@if(activeTabAction === 'business'){
} @if(activeTabAction === 'commercialProperty'){
@@ -61,10 +61,8 @@
} @if(activeTabAction === 'business' || activeTabAction === 'commercialProperty'){
- } @else {
-
}
-
+
diff --git a/bizmatch/src/app/pages/home/home.component.scss b/bizmatch/src/app/pages/home/home.component.scss
index 0951e29..b73e824 100644
--- a/bizmatch/src/app/pages/home/home.component.scss
+++ b/bizmatch/src/app/pages/home/home.component.scss
@@ -16,3 +16,9 @@
.p-button-white {
color: aliceblue;
}
+.mt-11 {
+ margin-top: 5.9rem !important;
+}
+.mt-22 {
+ margin-top: 9.7rem !important;
+}
diff --git a/bizmatch/src/app/pages/home/home.component.ts b/bizmatch/src/app/pages/home/home.component.ts
index 80604cd..6088b74 100644
--- a/bizmatch/src/app/pages/home/home.component.ts
+++ b/bizmatch/src/app/pages/home/home.component.ts
@@ -11,6 +11,7 @@ import { StyleClassModule } from 'primeng/styleclass';
import { Observable } from 'rxjs';
import { User } from '../../../../../bizmatch-server/src/models/db.model';
import { ListingCriteria } from '../../../../../bizmatch-server/src/models/main.model';
+import { ListingsService } from '../../services/listings.service';
import { SelectOptionsService } from '../../services/select-options.service';
import { UserService } from '../../services/user.service';
import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from '../../utils/utils';
@@ -22,22 +23,38 @@ import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from
styleUrl: './home.component.scss',
})
export class HomeComponent {
- activeTabAction = 'business';
+ activeTabAction: 'business' | 'commercialProperty' | 'broker' = 'business';
type: string;
maxPrice: string;
minPrice: string;
criteria: ListingCriteria;
user$: Observable
;
- public constructor(private router: Router, private activatedRoute: ActivatedRoute, public selectOptions: SelectOptionsService, public userService: UserService) {
+ states = [];
+ public constructor(private router: Router, private activatedRoute: ActivatedRoute, public selectOptions: SelectOptionsService, public userService: UserService, private listingsService: ListingsService) {
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
resetCriteria(this.criteria);
}
- ngOnInit() {
+ async ngOnInit() {
this.user$ = this.userService.getUserObservable();
+ if (this.activeTabAction === 'business' || this.activeTabAction === 'commercialProperty') {
+ const statesResult = await this.listingsService.getAllStates(this.activeTabAction);
+ this.states = statesResult.map(s => s.state).map(ls => ({ name: this.selectOptions.getState(ls as string), value: ls }));
+ } else {
+ this.states = [];
+ }
+ }
+ async changeTab(tabname: 'business' | 'commercialProperty' | 'broker') {
+ this.activeTabAction = tabname;
+ if (this.activeTabAction === 'business' || this.activeTabAction === 'commercialProperty') {
+ const statesResult = await this.listingsService.getAllStates(this.activeTabAction);
+ this.states = statesResult.map(s => s.state).map(ls => ({ name: this.selectOptions.getState(ls as string), value: ls }));
+ } else {
+ this.states = this.selectOptions.states;
+ }
}
-
search() {
- this.router.navigate([`${this.activeTabAction}Listings`]);
+ const data = { keep: true };
+ this.router.navigate([`${this.activeTabAction}Listings`], { state: { data } });
}
login() {
diff --git a/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.html b/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.html
index 134eb09..b221d8f 100644
--- a/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.html
+++ b/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.html
@@ -8,7 +8,7 @@
diff --git a/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.ts b/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.ts
index 3d5d5e5..a2e3392 100644
--- a/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.ts
+++ b/bizmatch/src/app/pages/listings/broker-listings/broker-listings.component.ts
@@ -18,7 +18,7 @@ import { ImageService } from '../../../services/image.service';
import { ListingsService } from '../../../services/listings.service';
import { SelectOptionsService } from '../../../services/select-options.service';
import { UserService } from '../../../services/user.service';
-import { createGenericObject, getCriteriaStateObject, getSessionStorageHandler } from '../../../utils/utils';
+import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from '../../../utils/utils';
@Component({
selector: 'app-broker-listings',
@@ -54,14 +54,13 @@ export class BrokerListingsComponent {
private router: Router,
private cdRef: ChangeDetectorRef,
private imageService: ImageService,
+ private route: ActivatedRoute,
) {
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
this.criteria.type = undefined;
- this.router.getCurrentNavigation();
- this.activatedRoute.snapshot;
- this.activatedRoute.params.subscribe(params => {
- if (this.activatedRoute.snapshot.fragment === '') {
- this.criteria = onChange(createGenericObject
(), getSessionStorageHandler);
+ this.route.data.subscribe(async () => {
+ if (!this.router.getCurrentNavigation().extras.state) {
+ resetCriteria(this.criteria);
}
this.init();
});
diff --git a/bizmatch/src/app/pages/listings/business-listings/business-listings.component.html b/bizmatch/src/app/pages/listings/business-listings/business-listings.component.html
index 201b398..cb2478e 100644
--- a/bizmatch/src/app/pages/listings/business-listings/business-listings.component.html
+++ b/bizmatch/src/app/pages/listings/business-listings/business-listings.component.html
@@ -42,7 +42,7 @@
@for (listing of listings; track listing.id) {
-
+
diff --git a/bizmatch/src/app/pages/listings/business-listings/business-listings.component.ts b/bizmatch/src/app/pages/listings/business-listings/business-listings.component.ts
index c5a003e..8f9e8bb 100644
--- a/bizmatch/src/app/pages/listings/business-listings/business-listings.component.ts
+++ b/bizmatch/src/app/pages/listings/business-listings/business-listings.component.ts
@@ -18,7 +18,7 @@ import { environment } from '../../../../environments/environment';
import { ImageService } from '../../../services/image.service';
import { ListingsService } from '../../../services/listings.service';
import { SelectOptionsService } from '../../../services/select-options.service';
-import { createGenericObject, getCriteriaStateObject, getSessionStorageHandler } from '../../../utils/utils';
+import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from '../../../utils/utils';
@Component({
selector: 'app-business-listings',
@@ -65,15 +65,14 @@ export class BusinessListingsComponent {
private router: Router,
private cdRef: ChangeDetectorRef,
private imageService: ImageService,
+ private route: ActivatedRoute,
) {
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
- this.router.getCurrentNavigation();
- this.activatedRoute.snapshot;
- this.activatedRoute.params.subscribe(params => {
- if (this.activatedRoute.snapshot.fragment === '') {
- this.criteria = onChange(createGenericObject
(), getSessionStorageHandler);
+ this.criteria.type = undefined;
+ this.route.data.subscribe(async () => {
+ if (!this.router.getCurrentNavigation().extras.state) {
+ resetCriteria(this.criteria);
}
- this.category = (params).type;
this.init();
});
}
diff --git a/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts b/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts
index d3dec2c..2cf7360 100644
--- a/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts
+++ b/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts
@@ -17,7 +17,7 @@ import { environment } from '../../../../environments/environment';
import { ImageService } from '../../../services/image.service';
import { ListingsService } from '../../../services/listings.service';
import { SelectOptionsService } from '../../../services/select-options.service';
-import { createGenericObject, getCriteriaStateObject, getSessionStorageHandler } from '../../../utils/utils';
+import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from '../../../utils/utils';
@Component({
selector: 'app-commercial-property-listings',
@@ -50,14 +50,13 @@ export class CommercialPropertyListingsComponent {
private router: Router,
private cdRef: ChangeDetectorRef,
private imageService: ImageService,
+ private route: ActivatedRoute,
) {
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
this.criteria.type = undefined;
- this.router.getCurrentNavigation();
- this.activatedRoute.snapshot;
- this.activatedRoute.params.subscribe(params => {
- if (this.activatedRoute.snapshot.fragment === '') {
- this.criteria = onChange(createGenericObject(), getSessionStorageHandler);
+ this.route.data.subscribe(async () => {
+ if (!this.router.getCurrentNavigation().extras.state) {
+ resetCriteria(this.criteria);
}
this.init();
});
diff --git a/bizmatch/src/app/pages/listings/listings.component.html b/bizmatch/src/app/pages/listings/listings.component.html
deleted file mode 100644
index e69de29..0000000
diff --git a/bizmatch/src/app/pages/listings/listings.component.scss b/bizmatch/src/app/pages/listings/listings.component.scss
deleted file mode 100644
index af0a00b..0000000
--- a/bizmatch/src/app/pages/listings/listings.component.scss
+++ /dev/null
@@ -1,23 +0,0 @@
-#sky-line {
- background-image: url(../../../assets/images/bw-sky.jpg);
- height: 204px;
- background-position: bottom;
- background-size: cover;
- margin-bottom: -1px;
-}
-.search{
- background-color: #343F69;
-}
-::ng-deep p-paginator div {
- background-color: var(--surface-200) !important;
- // background-color: var(--surface-400) !important;
-}
-.rounded-image {
- border-radius: 6px;
- // width: 100px;
- max-width: 100px;
- height: 45px;
- border: 1px solid rgba(0,0,0,0.2);
- padding: 1px 1px;
- object-fit: contain;
-}
\ No newline at end of file
diff --git a/bizmatch/src/app/pages/listings/listings.component.ts b/bizmatch/src/app/pages/listings/listings.component.ts
deleted file mode 100644
index b393f67..0000000
--- a/bizmatch/src/app/pages/listings/listings.component.ts
+++ /dev/null
@@ -1,124 +0,0 @@
-import { ChangeDetectorRef, Component } from '@angular/core';
-import { ButtonModule } from 'primeng/button';
-import { CheckboxModule } from 'primeng/checkbox';
-import { InputTextModule } from 'primeng/inputtext';
-import { StyleClassModule } from 'primeng/styleclass';
-import { SelectOptionsService } from '../../services/select-options.service';
-import { DropdownModule } from 'primeng/dropdown';
-import { FormsModule } from '@angular/forms';
-import { CommonModule } from '@angular/common';
-import { ToggleButtonModule } from 'primeng/togglebutton';
-import { ActivatedRoute, Router, RouterModule } from '@angular/router';
-import { ListingsService } from '../../services/listings.service';
-import { Observable, lastValueFrom } from 'rxjs';
-import { PaginatorModule } from 'primeng/paginator';
-import onChange from 'on-change';
-import { createGenericObject, getCriteriaStateObject, getSessionStorageHandler } from '../../utils/utils';
-import { InitEditableRow } from 'primeng/table';
-import { environment } from '../../../environments/environment';
-
-import { UserService } from '../../services/user.service';
-import { ImageService } from '../../services/image.service';
-import { ListingCriteria, ListingType } from '../../../../../bizmatch-server/src/models/main.model';
-import { User } from '../../../../../bizmatch-server/src/models/db.model';
-@Component({
- selector: 'app-listings',
- standalone: true,
- imports: [CommonModule, StyleClassModule, ButtonModule, CheckboxModule, InputTextModule, DropdownModule, FormsModule, StyleClassModule, ToggleButtonModule, RouterModule, PaginatorModule],
- templateUrl: './listings.component.html',
- styleUrls: ['./listings.component.scss', '../pages.scss']
-})
-export class ListingsComponent {
- // environment=environment;
- // listings: Array;
- // users: Array
- // filteredListings: Array;
- // criteria:ListingCriteria;
- // realEstateChecked: boolean;
- // maxPrice: string;
- // minPrice: string;
- // type:string;
- // states = [];
- // statesSet = new Set();
- // state:string;
- // first: number = 0;
- // rows: number = 12;
- // totalRecords:number = 0;
- // ts = new Date().getTime()
- // public category: 'business' | 'commercialProperty' | 'professionals_brokers' | undefined;
-
- // constructor(public selectOptions: SelectOptionsService,
- // private listingsService:ListingsService,
- // private userService:UserService,
- // private activatedRoute: ActivatedRoute,
- // private router:Router,
- // private cdRef:ChangeDetectorRef,
- // private imageService:ImageService) {
- // this.criteria = onChange(getCriteriaStateObject(),getSessionStorageHandler);
- // this.router.getCurrentNavigation()
- // this.activatedRoute.snapshot
- // this.activatedRoute.params.subscribe(params => {
- // if (this.activatedRoute.snapshot.fragment===''){
- // this.criteria = onChange(createGenericObject(),getSessionStorageHandler)
- // this.first=0;
- // }
- // this.category = (params).type;
- // this.criteria.listingsCategory=this.category;
- // this.init()
- // })
-
- // }
- // async ngOnInit(){
- // }
- // async init(){
- // if (this.category==='business' || this.category==='commercialProperty'){
- // this.users=[]
- // this.listings=await this.listingsService.getListings(this.criteria);
-
- // this.setStates();
- // this.totalRecords=this.listings.length
- // this.cdRef.markForCheck();
- // this.cdRef.detectChanges();
- // } else {
- // this.listings=[]
- // this.filteredListings=[];
- // this.users=await this.userService.search(this.criteria);
- // const profiles = await this.imageService.getProfileImagesForUsers(this.users.map(u=>u.id));
- // const logos = await this.imageService.getCompanyLogosForUsers(this.users.map(u=>u.id));
- // this.users.forEach(u=>{
- // u.hasProfile=profiles[u.id]
- // u.hasCompanyLogo=logos[u.id]
- // })
- // this.cdRef.markForCheck();
- // this.cdRef.detectChanges();
- // }
-
- // }
- // setStates(){
- // this.statesSet=new Set();
- // this.listings.forEach(l=>{
- // if (l.state){
- // this.statesSet.add(l.state)
- // }
- // })
- // this.states = [...this.statesSet].map((ls) =>({name:this.selectOptions.getState(ls as string),value:ls}))
- // }
- // async search() {
- // this.listings= await this.listingsService.getListings(this.criteria);
- // this.setStates();
- // this.totalRecords=this.listings.length
- // this.filteredListings =[...this.listings].splice(this.first,this.rows);
- // this.cdRef.markForCheck();
- // this.cdRef.detectChanges();
- // }
- // onPageChange(event: any) {
- // this.criteria.start=event.first;
- // this.criteria.length=event.rows;
- // this.criteria.page=event.page;
- // this.criteria.pageCount=event.pageCount;
- // }
- // imageErrorHandler(listing: ListingType) {
- // listing.hideImage = true; // Bild ausblenden, wenn es nicht geladen werden kann
- // }
-
-}
diff --git a/bizmatch/src/app/pages/subscription/account/account.component.ts b/bizmatch/src/app/pages/subscription/account/account.component.ts
index f74b8f7..8b88b7d 100644
--- a/bizmatch/src/app/pages/subscription/account/account.component.ts
+++ b/bizmatch/src/app/pages/subscription/account/account.component.ts
@@ -80,7 +80,9 @@ export class AccountComponent {
printInvoice(invoice: Invoice) {}
async updateProfile(user: User) {
+ this.user.licensedIn = this.userLicensedIn.map(l => `${l.name}|${l.value}`);
await this.userService.save(this.user);
+ this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Acount changes have been persisted', life: 3000 });
}
onUploadCompanyLogo(event: any) {
diff --git a/bizmatch/src/app/pages/subscription/edit-commercial-property-listing/edit-commercial-property-listing.component.html b/bizmatch/src/app/pages/subscription/edit-commercial-property-listing/edit-commercial-property-listing.component.html
index 73a28e1..8077d56 100644
--- a/bizmatch/src/app/pages/subscription/edit-commercial-property-listing/edit-commercial-property-listing.component.html
+++ b/bizmatch/src/app/pages/subscription/edit-commercial-property-listing/edit-commercial-property-listing.component.html
@@ -103,7 +103,7 @@
@for (image of propertyImages; track image) {
-

+
diff --git a/bizmatch/src/app/pages/subscription/my-listing/my-listing.component.html b/bizmatch/src/app/pages/subscription/my-listing/my-listing.component.html
index c5fc30c..d931fc5 100644
--- a/bizmatch/src/app/pages/subscription/my-listing/my-listing.component.html
+++ b/bizmatch/src/app/pages/subscription/my-listing/my-listing.component.html
@@ -28,7 +28,7 @@
| {{ listing.title }} |
{{ selectOptions.getListingsCategory(listing.listingsCategory) }} |
- {{ selectOptions.getState(listing.city) }} |
+ {{ selectOptions.getState(listing.state) }} |
@if(isBusinessListing(listing)){
diff --git a/bizmatch/src/app/pages/subscription/my-listing/my-listing.component.ts b/bizmatch/src/app/pages/subscription/my-listing/my-listing.component.ts
index 2fa42d2..7896b4c 100644
--- a/bizmatch/src/app/pages/subscription/my-listing/my-listing.component.ts
+++ b/bizmatch/src/app/pages/subscription/my-listing/my-listing.component.ts
@@ -34,12 +34,14 @@ export class MyListingComponent {
const keycloakUser = this.userService.getKeycloakUser();
const email = keycloakUser.email;
this.user = await this.userService.getByMail(email);
- this.myListings = await this.listingsService.getListingByUserId(this.user.id);
+ const result = await Promise.all([await this.listingsService.getListingByUserId(this.user.id, 'business'), await this.listingsService.getListingByUserId(this.user.id, 'commercialProperty')]);
+ this.myListings = [...result[0], ...result[1]];
}
async deleteListing(listing: ListingType) {
await this.listingsService.deleteListing(listing.id, getListingType(listing));
- this.myListings = await this.listingsService.getListingByUserId(this.user.id);
+ const result = await Promise.all([await this.listingsService.getListingByUserId(this.user.id, 'business'), await this.listingsService.getListingByUserId(this.user.id, 'commercialProperty')]);
+ this.myListings = [...result[0], ...result[1]];
}
confirm(event: Event, listing: ListingType) {
diff --git a/bizmatch/src/app/services/listings.service.ts b/bizmatch/src/app/services/listings.service.ts
index 55d5a88..ed22c9c 100644
--- a/bizmatch/src/app/services/listings.service.ts
+++ b/bizmatch/src/app/services/listings.service.ts
@@ -23,8 +23,8 @@ export class ListingsService {
const result = this.http.get(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}/${id}`);
return result;
}
- getListingByUserId(userid: string): Promise {
- return lastValueFrom(this.http.get(`${this.apiBaseUrl}/bizmatch/listings/business/user/${userid}`));
+ getListingByUserId(userid: string, listingsCategory: 'business' | 'commercialProperty'): Promise {
+ return lastValueFrom(this.http.get(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}/user/${userid}`));
}
async save(listing: any, listingsCategory: 'business' | 'professionals_brokers' | 'commercialProperty') {
if (listing.id) {
|