show all listings, Bug Fixes

This commit is contained in:
2024-05-09 16:10:01 +02:00
parent 6b61c19bd7
commit d508415de4
29 changed files with 810 additions and 410 deletions

View File

@@ -8,7 +8,7 @@
<div class="col-2">
<p-inputGroup>
<input id="name" type="text" pInputText [(ngModel)]="criteria.name" placeholder="Name" />
<button type="button" pButton icon="pi pi-times" class="p-button-danger" (click)="reset()"></button>
<button type="button" pButton icon="pi pi-times" class="p-button-secondary" (click)="reset()"></button>
</p-inputGroup>
</div>
<div class="col-1 col-offset-7">

View File

@@ -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<ListingCriteria>(), getSessionStorageHandler);
this.route.data.subscribe(async () => {
if (!this.router.getCurrentNavigation().extras.state) {
resetCriteria(this.criteria);
}
this.init();
});

View File

@@ -42,7 +42,7 @@
<div class="wrapper">
<div class="grid">
@for (listing of listings; track listing.id) {
<div *ngIf="listing.listingsCategory === 'business'" class="col-12 lg:col-3 p-3">
<div class="col-12 lg:col-3 p-3">
<div class="shadow-2 border-round surface-card mb-3 h-full flex-column justify-content-between flex">
<div class="p-4 h-full flex flex-column">
<div class="flex align-items-center">

View File

@@ -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<ListingCriteria>(), getSessionStorageHandler);
this.criteria.type = undefined;
this.route.data.subscribe(async () => {
if (!this.router.getCurrentNavigation().extras.state) {
resetCriteria(this.criteria);
}
this.category = (<any>params).type;
this.init();
});
}

View File

@@ -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<ListingCriteria>(), getSessionStorageHandler);
this.route.data.subscribe(async () => {
if (!this.router.getCurrentNavigation().extras.state) {
resetCriteria(this.criteria);
}
this.init();
});

View File

@@ -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;
}

View File

@@ -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<ListingType>;
// users: Array<User>
// filteredListings: Array<ListingType>;
// 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<ListingCriteria>(),getSessionStorageHandler)
// this.first=0;
// }
// this.category = (<any>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
// }
}