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

@@ -51,7 +51,7 @@
</li>
</ul>
@if(listing && user && (user.id===listing?.userId || isAdmin())){
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editListing', listing.id]"></button>
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editBusinessListing', listing.id]"></button>
}
</div>
<div class="col-12 md:col-6">

View File

@@ -61,9 +61,9 @@ export class DetailsBusinessListingComponent {
private sanitizer: DomSanitizer,
private location: Location,
) {
this.mailinfo = { sender: {}, userId: '', email: '' };
this.userService.getUserObservable().subscribe(user => {
this.user = user;
this.mailinfo = { sender: {}, userId: '', email: user.email };
});
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
}
@@ -79,6 +79,7 @@ export class DetailsBusinessListingComponent {
return this.userService.hasAdminRole();
}
async mail() {
this.mailinfo.email = this.user.email;
this.mailinfo.userId = this.listing.userId;
this.mailinfo.listing = this.listing;
await this.mailService.mail(this.mailinfo);

View File

@@ -51,9 +51,10 @@
</ng-template> -->
</p-galleria>
@if(listing && user && (user.id===listing?.userId || isAdmin())){
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editListing', listing.id]"></button>
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editCommercialPropertyListing', listing.id]"></button>
}
</div>
@if (mailinfo){
<div class="col-12 md:col-6">
<div class="surface-card p-4 border-round p-fluid">
<div class="font-medium text-xl text-primary text-900 mb-3">Contact The Author of This Listing</div>
@@ -85,6 +86,7 @@
<button pButton pRipple label="Submit" icon="pi pi-file" class="w-auto" (click)="mail()"></button>
</div>
</div>
}
</div>
}
</div>

View File

@@ -62,9 +62,9 @@ export class DetailsCommercialPropertyListingComponent {
private sanitizer: DomSanitizer,
private location: Location,
) {
this.mailinfo = { sender: {}, userId: '', email: '' };
this.userService.getUserObservable().subscribe(user => {
this.user = user;
this.mailinfo = { sender: {}, userId: '', email: user.email };
});
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
}
@@ -81,6 +81,7 @@ export class DetailsCommercialPropertyListingComponent {
return this.userService.hasAdminRole();
}
async mail() {
this.mailinfo.email = this.user.email;
this.mailinfo.userId = this.listing.userId;
this.mailinfo.listing = this.listing;
await this.mailService.mail(this.mailinfo);

View File

@@ -92,11 +92,12 @@
}
</div>
</li>
@if(businessListings?.length>0){
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
<div class="text-500 w-full md:w-2 font-medium">My Listings For Sale</div>
<div class="text-500 w-full md:w-2 font-medium">My Business Listings For Sale</div>
<div class="text-900 w-full md:w-10">
<div class="grid mt-0 mr-0">
@for (listing of userListings; track listing) {
@for (listing of businessListings; track listing) {
<div class="col-12 md:col-6 cursor-pointer" [routerLink]="['/details-business-listing', listing.id]">
<div class="p-3 border-1 surface-border border-round surface-card">
<div class="text-900 mb-2">
@@ -112,6 +113,30 @@
</div>
</div>
</li>
} @if(commercialPropListings?.length>0){
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
<div class="text-500 w-full md:w-2 font-medium">My Commercial Property Listings For Sale</div>
<div class="text-900 w-full md:w-10">
<div class="grid mt-0 mr-0">
@for (listing of commercialPropListings; track listing) {
<div class="col-12 md:col-6 cursor-pointer" [routerLink]="['/details-commercial-property-listing', listing.id]">
<div class="p-3 border-1 surface-border border-round surface-card">
<div class="text-900 mb-2 flex align-items-center">
@if (listing.imageOrder?.length>0){
<img src="property/{{ listing.imagePath }}/{{ listing.imageOrder[0] }}" class="mr-3" style="width: 45px; height: 45px" />
} @else {
<img src="assets/images/placeholder_properties.jpg" class="mr-3" style="width: 45px; height: 45px" />
}
<span class="font-medium">{{ selectOptions.getCommercialProperty(listing.type) }}</span>
</div>
<div class="text-700">{{ listing.title }}</div>
</div>
</div>
}
</div>
</div>
</li>
}
</ul>
</div>
</div>

View File

@@ -5,7 +5,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { MessageService } from 'primeng/api';
import { GalleriaModule } from 'primeng/galleria';
import { Observable } from 'rxjs';
import { BusinessListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
import { BusinessListing, CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
import { KeyValue, ListingCriteria } from '../../../../../../bizmatch-server/src/models/main.model';
import { environment } from '../../../../environments/environment';
import { ImageService } from '../../../services/image.service';
@@ -28,7 +28,8 @@ export class DetailsUserComponent {
user$: Observable<User>;
environment = environment;
criteria: ListingCriteria;
userListings: BusinessListing[];
businessListings: BusinessListing[];
commercialPropListings: CommercialPropertyListing[];
companyOverview: SafeHtml;
offeredServices: SafeHtml;
userLicensedIn: KeyValue[];
@@ -49,7 +50,10 @@ export class DetailsUserComponent {
this.userLicensedIn = this.user.licensedIn.map(l => {
return { name: l.split('|')[0], value: l.split('|')[1] };
});
this.userListings = await this.listingsService.getListingByUserId(this.id);
const results = await Promise.all([await this.listingsService.getListingByUserId(this.id, 'business'), await this.listingsService.getListingByUserId(this.id, 'commercialProperty')]);
// Zuweisen der Ergebnisse zu den Member-Variablen der Klasse
this.businessListings = results[0];
this.commercialPropListings = results[1];
this.user$ = this.userService.getUserObservable();
this.companyOverview = this.sanitizer.bypassSecurityTrustHtml(this.user.companyOverview);
this.offeredServices = this.sanitizer.bypassSecurityTrustHtml(this.user.offeredServices);

View File

@@ -27,25 +27,25 @@
<div class="w-12 lg:w-6 text-center lg:text-right flex">
<div class="mt-5">
<ul class="flex flex-column align-items-left gap-3 px-2 py-3 list-none surface-border">
<li><button pButton pRipple icon="pi pi-user" (click)="activeTabAction = 'business'" label="Businesses" [ngClass]="{ 'p-button-text text-700': activeTabAction !== 'business' }"></button></li>
<li><button pButton pRipple icon="pi pi-user" (click)="changeTab('business')" label="Businesses" [ngClass]="{ 'p-button-text text-700': activeTabAction !== 'business' }"></button></li>
<li>
<button
pButton
pRipple
icon="pi pi-shield"
(click)="activeTabAction = 'commercialProperty'"
(click)="changeTab('commercialProperty')"
label="Commercial Property"
[ngClass]="{ 'p-button-text text-700': activeTabAction != 'commercialProperty' }"
></button>
</li>
<li>
<button pButton pRipple icon="pi pi-globe" (click)="activeTabAction = 'broker'" label="Professionals/Brokers Directory" [ngClass]="{ 'p-button-text text-700': activeTabAction != 'broker' }"></button>
<button pButton pRipple icon="pi pi-globe" (click)="changeTab('broker')" label="Professionals/Brokers Directory" [ngClass]="{ 'p-button-text text-700': activeTabAction != 'broker' }"></button>
</li>
</ul>
</div>
<div class="mt-5">
<div [ngClass]="{ 'mt-5': activeTabAction === 'business', 'mt-11': activeTabAction === 'commercialProperty', 'mt-22': activeTabAction === 'broker' }">
<div class="flex flex-column align-items-right gap-3 px-2 py-3 my-3 surface-border">
<p-dropdown [options]="selectOptions.states" [(ngModel)]="criteria.state" optionLabel="name" optionValue="value" [showClear]="true" placeholder="State" [style]="{ width: '200px' }"></p-dropdown>
<p-dropdown [options]="states" [(ngModel)]="criteria.state" optionLabel="name" optionValue="value" [showClear]="true" placeholder="State" [style]="{ width: '200px' }"></p-dropdown>
@if(activeTabAction === 'business'){
<p-dropdown [options]="selectOptions.typesOfBusiness" [(ngModel)]="criteria.type" optionLabel="name" optionValue="value" [showClear]="true" placeholder="Category" [style]="{ width: '200px' }"></p-dropdown>
} @if(activeTabAction === 'commercialProperty'){
@@ -61,10 +61,8 @@
} @if(activeTabAction === 'business' || activeTabAction === 'commercialProperty'){
<p-dropdown [options]="selectOptions.prices" [(ngModel)]="criteria.minPrice" optionLabel="name" optionValue="value" [showClear]="true" placeholder="Min Price" [style]="{ width: '200px' }"></p-dropdown>
<p-dropdown [options]="selectOptions.prices" [(ngModel)]="criteria.maxPrice" optionLabel="name" optionValue="value" [showClear]="true" placeholder="Max Price" [style]="{ width: '200px' }"></p-dropdown>
} @else {
<div style="height: 46px">&nbsp;</div>
}
<button pButton pRipple label="Find" class="ml-3 font-bold" [style]="{ width: '170px' }" (click)="search()"></button>
<button pButton pRipple label="Find" class="ml-3 font-bold" [style]="{ width: '200px' }" (click)="search()"></button>
</div>
</div>
</div>

View File

@@ -16,3 +16,9 @@
.p-button-white {
color: aliceblue;
}
.mt-11 {
margin-top: 5.9rem !important;
}
.mt-22 {
margin-top: 9.7rem !important;
}

View File

@@ -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<User>;
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() {

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
// }
}

View File

@@ -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) {

View File

@@ -103,7 +103,7 @@
@for (image of propertyImages; track image) {
<span cdkDropList mixedCdkDropList>
<div cdkDrag mixedCdkDragSizeHelper class="image-wrap">
<img src="property/{{ listing.id }}/{{ image }}" [alt]="image" class="shadow-2" cdkDrag />
<img src="property/{{ listing.imagePath }}/{{ image }}" [alt]="image" class="shadow-2" cdkDrag />
<fa-icon [icon]="faTrash" (click)="deleteConfirm(image)"></fa-icon>
</div>
</span>

View File

@@ -28,7 +28,7 @@
<tr>
<td class="wide-column line-height-3">{{ listing.title }}</td>
<td>{{ selectOptions.getListingsCategory(listing.listingsCategory) }}</td>
<td>{{ selectOptions.getState(listing.city) }}</td>
<td>{{ selectOptions.getState(listing.state) }}</td>
<td>
@if(isBusinessListing(listing)){
<button pButton pRipple icon="pi pi-pencil" class="p-button-rounded p-button-success mr-2" [routerLink]="['/editBusinessListing', listing.id]"></button>

View File

@@ -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) {

View File

@@ -23,8 +23,8 @@ export class ListingsService {
const result = this.http.get<ListingType>(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}/${id}`);
return result;
}
getListingByUserId(userid: string): Promise<ListingType[]> {
return lastValueFrom(this.http.get<BusinessListing[]>(`${this.apiBaseUrl}/bizmatch/listings/business/user/${userid}`));
getListingByUserId(userid: string, listingsCategory: 'business' | 'commercialProperty'): Promise<ListingType[]> {
return lastValueFrom(this.http.get<BusinessListing[]>(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}/user/${userid}`));
}
async save(listing: any, listingsCategory: 'business' | 'professionals_brokers' | 'commercialProperty') {
if (listing.id) {