diff --git a/bizmatch-server/src/listings/business-listings.controller.ts b/bizmatch-server/src/listings/business-listings.controller.ts
index 9926c69..1ed3f1b 100644
--- a/bizmatch-server/src/listings/business-listings.controller.ts
+++ b/bizmatch-server/src/listings/business-listings.controller.ts
@@ -19,10 +19,11 @@ export class BusinessListingsController {
findById(@Param('id') id:string): any {
return this.listingsService.getBusinessListingById(id);
}
- // @Get(':type/:location/:minPrice/:maxPrice/:realEstateChecked')
- // find(@Param('type') type:string,@Param('location') location:string,@Param('minPrice') minPrice:string,@Param('maxPrice') maxPrice:string,@Param('realEstateChecked') realEstateChecked:boolean): any {
- // return this.listingsService.find(type,location,minPrice,maxPrice,realEstateChecked);
- // }
+ @Get('user/:userid')
+ findByUserId(@Param('userid') userid:string): any {
+ return this.listingsService.getBusinessListingByUserId(userid);
+ }
+
@Post('search')
find(@Body() criteria: any): any {
return this.listingsService.findBusinessListings(criteria);
diff --git a/bizmatch-server/src/listings/listings.service.ts b/bizmatch-server/src/listings/listings.service.ts
index 5122622..72812f0 100644
--- a/bizmatch-server/src/listings/listings.service.ts
+++ b/bizmatch-server/src/listings/listings.service.ts
@@ -83,6 +83,9 @@ export class ListingsService {
async getBusinessListingById(id: string) {
return await this.businessListingRepository.fetch(id)
}
+ async getBusinessListingByUserId(userid:string){
+ return await this.businessListingRepository.search().where('userId').equals(userid).return.all()
+ }
async deleteBusinessListing(id: string){
return await this.businessListingRepository.remove(id);
}
diff --git a/bizmatch/src/app/app.routes.ts b/bizmatch/src/app/app.routes.ts
index 99a5681..a538ba5 100644
--- a/bizmatch/src/app/app.routes.ts
+++ b/bizmatch/src/app/app.routes.ts
@@ -1,7 +1,7 @@
import { Routes } from '@angular/router';
import { ListingsComponent } from './pages/listings/listings.component';
import { HomeComponent } from './pages/home/home.component';
-import { DetailsComponent } from './pages/details/details.component';
+import { DetailsListingComponent } from './pages/details/details-listing/details-listing.component';
import { AccountComponent } from './pages/subscription/account/account.component';
import { EditListingComponent } from './pages/subscription/edit-listing/edit-listing.component';
import { MyListingComponent } from './pages/subscription/my-listing/my-listing.component';
@@ -10,6 +10,7 @@ import { EmailUsComponent } from './pages/subscription/email-us/email-us.compone
import { authGuard } from './guards/auth.guard';
import { PricingComponent } from './pages/pricing/pricing.component';
import { LogoutComponent } from './components/logout/logout.component';
+import { DetailsUserComponent } from './pages/details/details-user/details-user.component';
export const routes: Routes = [
@@ -29,9 +30,17 @@ export const routes: Routes = [
component: HomeComponent,
},
{
- path: 'details/:id',
- component: DetailsComponent,
+ path: 'details-listing/:type/:id',
+ component: DetailsListingComponent,
},
+ {
+ path: 'details-listing/:type/:id',
+ component: DetailsListingComponent,
+ },
+ {
+ path: 'details-user/:id',
+ component: DetailsUserComponent,
+ },
{
path: 'account',
component: AccountComponent,
diff --git a/bizmatch/src/app/pages/details/details-listing/details-listing.component.html b/bizmatch/src/app/pages/details/details-listing/details-listing.component.html
new file mode 100644
index 0000000..254a597
--- /dev/null
+++ b/bizmatch/src/app/pages/details/details-listing/details-listing.component.html
@@ -0,0 +1,141 @@
+
+
+
+
+
{{listing?.title}}
+
+
+
+
+
+
+
+
+ -
+
Description
+ {{listing?.description}}
+
+ @if (listing && (listing.listingsCategory==='business')){
+ -
+
Category
+
+
+ -
+
Located in
+ {{selectOptions.getState(listing.state)}}
+
+ -
+
Asking Price
+ {{listing.price | currency}}
+
+ -
+
Real Estate Included
+ {{listing.realEstateIncluded?'Yes':'No'}}
+
+ -
+
Sales revenue
+ {{listing.salesRevenue | currency}}
+
+ -
+
Cash flow
+ {{listing.cashFlow | currency}}
+
+ -
+
Employees
+ {{listing.employees}}
+
+ -
+
Broker licensing
+ {{listing.brokerLicencing}}
+
+ }
+ @if (listing && (listing.listingsCategory==='commercialProperty')){
+ -
+
Property Category
+ {{selectOptions.getCommercialProperty(listing.type)}}
+
+
+ -
+
Located in
+ {{selectOptions.getState(listing.state)}}
+
+ -
+
City
+ {{listing.city}}
+
+ -
+
Zip Code
+ {{listing.zipCode}}
+
+ -
+
County
+ {{listing.county}}
+
+ -
+
Asking Price:
+ {{listing.price | currency}}
+
+ }
+
+
+
+
+
+
+
+ @if(listing && user && (user.id===listing?.userId || isAdmin())){
+
+ }
+
+
+
+
Contact The Author of This Listing
+
+
Please Include your contact info below:
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bizmatch/src/app/pages/details/details.component.scss b/bizmatch/src/app/pages/details/details-listing/details-listing.component.scss
similarity index 100%
rename from bizmatch/src/app/pages/details/details.component.scss
rename to bizmatch/src/app/pages/details/details-listing/details-listing.component.scss
diff --git a/bizmatch/src/app/pages/details/details-listing/details-listing.component.ts b/bizmatch/src/app/pages/details/details-listing/details-listing.component.ts
new file mode 100644
index 0000000..7f55a5d
--- /dev/null
+++ b/bizmatch/src/app/pages/details/details-listing/details-listing.component.ts
@@ -0,0 +1,91 @@
+import { 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 { TagModule } from 'primeng/tag';
+import data from '../../../../assets/data/listings.json';
+import { ActivatedRoute, Router, RouterModule } from '@angular/router';
+import { InputTextareaModule } from 'primeng/inputtextarea';
+import { ChipModule } from 'primeng/chip';
+import { lastValueFrom } from 'rxjs';
+import { ListingsService } from '../../../services/listings.service';
+import { UserService } from '../../../services/user.service';
+import onChange from 'on-change';
+import { createGenericObject, getCriteriaStateObject, getSessionStorageHandler } from '../../../utils/utils';
+import { ImageProperty, ListingCriteria, ListingType, MailInfo, User } from '../../../../../../common-models/src/main.model';
+import { MailService } from '../../../services/mail.service';
+import { MessageService } from 'primeng/api';
+import { SharedModule } from '../../../shared/shared/shared.module';
+import { GalleriaModule } from 'primeng/galleria';
+import { environment } from '../../../../environments/environment';
+@Component({
+ selector: 'app-details-listing',
+ standalone: true,
+ imports: [SharedModule, GalleriaModule],
+ providers: [MessageService],
+ templateUrl: './details-listing.component.html',
+ styleUrl: './details-listing.component.scss'
+})
+export class DetailsListingComponent {
+ // listings: Array;
+ responsiveOptions = [
+ {
+ breakpoint: '1199px',
+ numVisible: 1,
+ numScroll: 1
+ },
+ {
+ breakpoint: '991px',
+ numVisible: 2,
+ numScroll: 1
+ },
+ {
+ breakpoint: '767px',
+ numVisible: 1,
+ numScroll: 1
+ }
+ ];
+ private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
+ private type: 'business'|'commercialProperty' | undefined = this.activatedRoute.snapshot.params['type'] as 'business'|'commercialProperty' | undefined;
+ listing: ListingType;
+ criteria: ListingCriteria
+ mailinfo: MailInfo;
+ propertyImages: ImageProperty[] = []
+ environment = environment;
+ user:User
+ constructor(private activatedRoute: ActivatedRoute,
+ private listingsService: ListingsService,
+ private router: Router,
+ private userService: UserService,
+ public selectOptions: SelectOptionsService,
+ private mailService: MailService,
+ private messageService: MessageService) {
+ this.userService.getUserObservable().subscribe(user => {
+ this.user = user
+ });
+ this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
+ this.mailinfo = { sender: {}, userId: '' }
+ }
+
+ async ngOnInit() {
+ this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, this.type));
+ this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id)
+ }
+ back() {
+ this.router.navigate(['listings', this.criteria.listingsCategory])
+ }
+ isAdmin() {
+ return this.userService.hasAdminRole();
+ }
+ async mail() {
+ this.mailinfo.userId = this.listing.userId;
+ await this.mailService.mail(this.mailinfo);
+ this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Your message has been sent to the creator of the listing', life: 3000 });
+ }
+}
diff --git a/bizmatch/src/app/pages/details/details-user/details-user.component.html b/bizmatch/src/app/pages/details/details-user/details-user.component.html
new file mode 100644
index 0000000..769abfc
--- /dev/null
+++ b/bizmatch/src/app/pages/details/details-user/details-user.component.html
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+

+
+
{{user.firstname}} {{user.lastname}}
+
+
+
+
Company
+
{{user.companyName}}
+
+
+
+
+
+
+
+
+
+
+
+
{{user.description}}
+
+
+
+
Company Profile
+
{{user.companyOverview}}
+
+
+
+ @if( user?.id===(user$| async)?.id || isAdmin()){
+
+ }
+
+
+
+
\ No newline at end of file
diff --git a/bizmatch/src/app/pages/details/details-user/details-user.component.scss b/bizmatch/src/app/pages/details/details-user/details-user.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/bizmatch/src/app/pages/details/details-user/details-user.component.ts b/bizmatch/src/app/pages/details/details-user/details-user.component.ts
new file mode 100644
index 0000000..741cf2a
--- /dev/null
+++ b/bizmatch/src/app/pages/details/details-user/details-user.component.ts
@@ -0,0 +1,47 @@
+import { Component } from '@angular/core';
+import { SharedModule } from '../../../shared/shared/shared.module';
+import { GalleriaModule } from 'primeng/galleria';
+import { MessageService } from 'primeng/api';
+import { BusinessListing, ListingCriteria, ListingType, User } from '../../../../../../common-models/src/main.model';
+import { environment } from '../../../../environments/environment';
+import { ActivatedRoute, Router } from '@angular/router';
+import { UserService } from '../../../services/user.service';
+import { Observable } from 'rxjs';
+import { ListingsService } from '../../../services/listings.service';
+import { SelectOptionsService } from '../../../services/select-options.service';
+
+@Component({
+ selector: 'app-details-user',
+ standalone: true,
+ imports: [SharedModule, GalleriaModule],
+ providers: [MessageService],
+ templateUrl: './details-user.component.html',
+ styleUrl: './details-user.component.scss'
+})
+export class DetailsUserComponent {
+ private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
+ user: User;
+ user$:Observable
+ environment = environment;
+ criteria:ListingCriteria;
+ userListings:BusinessListing[]
+ constructor(private activatedRoute: ActivatedRoute,
+ private router: Router,
+ private userService: UserService,
+ private listingsService:ListingsService,
+ private messageService: MessageService,
+ public selectOptions: SelectOptionsService) {
+ }
+
+ async ngOnInit() {
+ this.user = await this.userService.getById(this.id);
+ this.userListings = await this.listingsService.getListingByUserId(this.id);
+ this.user$ = this.userService.getUserObservable();
+ }
+ back() {
+ this.router.navigate(['listings', this.criteria.listingsCategory])
+ }
+ isAdmin() {
+ return this.userService.hasAdminRole();
+ }
+}
diff --git a/bizmatch/src/app/pages/details/details.component.html b/bizmatch/src/app/pages/details/details.component.html
deleted file mode 100644
index 0591d44..0000000
--- a/bizmatch/src/app/pages/details/details.component.html
+++ /dev/null
@@ -1,243 +0,0 @@
-
-
-
-
-
{{listing?.title}}
-
-
-
-
- @if (listing){
-
-
-
-
- -
-
Description
- {{listing?.description}}
-
- @if (listing && (listing.listingsCategory==='business')){
- -
-
Category
-
-
- -
-
Located in
- {{selectOptions.getState(listing.state)}}
-
- -
-
Asking Price
- {{listing.price | currency}}
-
- -
-
Real Estate Included
- {{listing.realEstateIncluded?'Yes':'No'}}
-
- -
-
Sales revenue
- {{listing.salesRevenue | currency}}
-
- -
-
Cash flow
- {{listing.cashFlow | currency}}
-
- -
-
Employees
- {{listing.employees}}
-
- -
-
Broker licensing
- {{listing.brokerLicencing}}
-
- }
- @if (listing && (listing.listingsCategory==='commercialProperty')){
- -
-
Property Category
- {{selectOptions.getCommercialProperty(listing.type)}}
-
- -
-
Located in
- {{selectOptions.getState(listing.state)}}
-
- -
-
City
- {{listing.city}}
-
- -
-
Zip Code
- {{listing.zipCode}}
-
- -
-
County
- {{listing.county}}
-
- -
-
Asking Price:
- {{listing.price | currency}}
-
- }
-
-
-
-
-
-
-
- @if(listing && user && (user.id===listing?.userId || isAdmin())){
-
- }
-
-
-
-
Contact The Author of This Listing
-
-
Please Include your contact info below:
-
-
-
-
-
- } @else {
-
-
-
-

-
-
{{user.firstname}} {{user.lastname}}
-
-
-
-
Company
-
{{user.companyName}}
-
-
-
-
-
-
-
-
-
-
-
-
-
Company Profile
-
{{user.companyOverview}}
-
-
-
- }
-
-
-
-
\ No newline at end of file
diff --git a/bizmatch/src/app/pages/details/details.component.ts b/bizmatch/src/app/pages/details/details.component.ts
deleted file mode 100644
index 256aafb..0000000
--- a/bizmatch/src/app/pages/details/details.component.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-import { 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 { TagModule } from 'primeng/tag';
-import data from '../../../assets/data/listings.json';
-import { ActivatedRoute, Router, RouterModule } from '@angular/router';
-import { InputTextareaModule } from 'primeng/inputtextarea';
-import { ChipModule } from 'primeng/chip';
-import { lastValueFrom } from 'rxjs';
-import { ListingsService } from '../../services/listings.service';
-import { UserService } from '../../services/user.service';
-import onChange from 'on-change';
-import { createGenericObject, getCriteriaStateObject, getSessionStorageHandler } from '../../utils/utils';
-import { ImageProperty, ListingCriteria, ListingType, MailInfo, User } from '../../../../../common-models/src/main.model';
-import { MailService } from '../../services/mail.service';
-import { MessageService } from 'primeng/api';
-import { SharedModule } from '../../shared/shared/shared.module';
-import { GalleriaModule } from 'primeng/galleria';
-import { environment } from '../../../environments/environment';
-@Component({
- selector: 'app-details',
- standalone: true,
- imports: [SharedModule,GalleriaModule],
- providers:[MessageService],
- templateUrl: './details.component.html',
- styleUrl: './details.component.scss'
-})
-export class DetailsComponent {
- // listings: Array
;
- responsiveOptions = [
- {
- breakpoint: '1199px',
- numVisible: 1,
- numScroll: 1
- },
- {
- breakpoint: '991px',
- numVisible: 2,
- numScroll: 1
- },
- {
- breakpoint: '767px',
- numVisible: 1,
- numScroll: 1
- }
-];
- private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
- listing: ListingType;
- user:User;
- criteria:ListingCriteria
- mailinfo: MailInfo;
- propertyImages:ImageProperty[]=[]
- environment=environment;
- constructor(private activatedRoute: ActivatedRoute,
- private listingsService:ListingsService,
- private router:Router,
- private userService:UserService,
- public selectOptions: SelectOptionsService,
- private mailService:MailService,
- private messageService: MessageService){
- this.criteria = onChange(getCriteriaStateObject(),getSessionStorageHandler);
- this.mailinfo = {sender:{},userId:''}
- }
-
- async ngOnInit(){
- this.userService.getUserObservable().subscribe(user=>{
- this.user=user
- });
- this.listing=await lastValueFrom(this.listingsService.getListingById(this.id,this.criteria.listingsCategory));
- this.propertyImages=await this.listingsService.getPropertyImages(this.listing.id)
- }
- back(){
- this.router.navigate(['listings',this.criteria.listingsCategory])
- }
- isAdmin(){
- return this.userService.hasAdminRole();
- }
- async mail(){
- this.mailinfo.userId=this.listing.userId;
- await this.mailService.mail(this.mailinfo);
- this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Your message has been sent to the creator of the listing', life: 3000 });
- }
-}
diff --git a/bizmatch/src/app/pages/listings/listings.component.html b/bizmatch/src/app/pages/listings/listings.component.html
index a1401f2..3813700 100644
--- a/bizmatch/src/app/pages/listings/listings.component.html
+++ b/bizmatch/src/app/pages/listings/listings.component.html
@@ -80,7 +80,7 @@
+ class="p-button-rounded p-button-success" [routerLink]="['/details-listing/business',listing.id]">
@@ -114,7 +114,7 @@
+ class="p-button-rounded p-button-success" [routerLink]="['/details-listing/commercialProperty',listing.id]">
@@ -136,7 +136,7 @@
+ class="p-button-rounded p-button-success" [routerLink]="['/details-user',user.id]">