From 7bd5e1aaf883b2aeb35f031fc0e93d1a3f59de9b Mon Sep 17 00:00:00 2001 From: Andreas Knuth Date: Wed, 10 Jul 2024 18:40:46 +0200 Subject: [PATCH] account, myListings and emailUs pages --- bizmatch-server/src/models/main.model.ts | 5 + .../components/header/header.component.html | 6 +- .../app/components/header/header.component.ts | 21 +- .../image-crop-and-upload.component.html | 12 + .../image-crop-and-upload.component.scss | 6 + .../image-crop-and-upload.component.ts | 74 ++++++ .../components/message/message.component.ts | 10 +- .../details-business-listing.component.html | 214 +++++++++--------- .../details-user/details-user.component.html | 2 + .../account/account.component.html | 180 ++++++++------- .../account/account.component.scss | 6 + .../subscription/account/account.component.ts | 105 ++++++--- .../edit-business-listing.component.html | 2 + .../edit-business-listing.component.scss | 6 + ...commercial-property-listing.component.scss | 7 +- .../email-us/email-us.component.html | 62 +++++ .../my-listing/my-listing.component.html | 91 ++++++++ .../my-listing/my-listing.component.ts | 23 +- bizmatch/src/app/services/shared.service.ts | 16 ++ 19 files changed, 622 insertions(+), 226 deletions(-) create mode 100644 bizmatch/src/app/components/image-crop-and-upload/image-crop-and-upload.component.html create mode 100644 bizmatch/src/app/components/image-crop-and-upload/image-crop-and-upload.component.scss create mode 100644 bizmatch/src/app/components/image-crop-and-upload/image-crop-and-upload.component.ts create mode 100644 bizmatch/src/app/services/shared.service.ts diff --git a/bizmatch-server/src/models/main.model.ts b/bizmatch-server/src/models/main.model.ts index 6e115b5..2eb5530 100644 --- a/bizmatch-server/src/models/main.model.ts +++ b/bizmatch-server/src/models/main.model.ts @@ -185,6 +185,11 @@ export interface FieldError { fieldname: string; message: string; } +export interface UploadParams { + type: 'uploadPropertyPicture' | 'uploadCompanyLogo' | 'uploadProfile'; + imagePath: string; + serialId?: number; +} export function isEmpty(value: any): boolean { // Check for undefined or null if (value === undefined || value === null) { diff --git a/bizmatch/src/app/components/header/header.component.html b/bizmatch/src/app/components/header/header.component.html index 19a460f..263b4ba 100644 --- a/bizmatch/src/app/components/header/header.component.html +++ b/bizmatch/src/app/components/header/header.component.html @@ -19,7 +19,7 @@
+ +
+ + + diff --git a/bizmatch/src/app/components/image-crop-and-upload/image-crop-and-upload.component.scss b/bizmatch/src/app/components/image-crop-and-upload/image-crop-and-upload.component.scss new file mode 100644 index 0000000..667bdef --- /dev/null +++ b/bizmatch/src/app/components/image-crop-and-upload/image-crop-and-upload.component.scss @@ -0,0 +1,6 @@ +::ng-deep image-cropper { + justify-content: center; + & > div { + width: unset !important; + } +} diff --git a/bizmatch/src/app/components/image-crop-and-upload/image-crop-and-upload.component.ts b/bizmatch/src/app/components/image-crop-and-upload/image-crop-and-upload.component.ts new file mode 100644 index 0000000..de82d27 --- /dev/null +++ b/bizmatch/src/app/components/image-crop-and-upload/image-crop-and-upload.component.ts @@ -0,0 +1,74 @@ +import { Component, ElementRef, Input, output, ViewChild } from '@angular/core'; +import { ImageCroppedEvent, ImageCropperComponent } from 'ngx-image-cropper'; +import { UploadParams } from '../../../../../bizmatch-server/src/models/main.model'; +import { ImageService } from '../../services/image.service'; +import { ListingsService } from '../../services/listings.service'; +import { SharedModule } from '../../shared/shared/shared.module'; +export interface UploadReponse { + success: boolean; + type: 'uploadPropertyPicture' | 'uploadCompanyLogo' | 'uploadProfile'; +} +@Component({ + selector: 'app-image-crop-and-upload', + standalone: true, + imports: [SharedModule, ImageCropperComponent], + templateUrl: './image-crop-and-upload.component.html', + styleUrl: './image-crop-and-upload.component.scss', +}) +export class ImageCropAndUploadComponent { + showModal = false; + imageChangedEvent: any = ''; + croppedImage: Blob | null = null; + @Input() uploadParams: UploadParams; + uploadFinished = output(); + @ViewChild('fileInput', { static: true }) fileInput!: ElementRef; + + constructor(private imageService: ImageService, private listingsService: ListingsService) {} + + ngOnInit() {} + ngOnChanges() { + this.openFileDialog(); + } + openFileDialog() { + if (this.uploadParams) { + this.fileInput.nativeElement.click(); + } + } + + fileChangeEvent(event: any): void { + this.imageChangedEvent = event; + this.showModal = true; + } + + imageCropped(event: ImageCroppedEvent) { + this.croppedImage = event.blob; + } + + closeModal() { + this.imageChangedEvent = null; + this.croppedImage = null; + this.showModal = false; + this.uploadFinished.emit({ success: false, type: this.uploadParams.type }); + } + + uploadImage() { + if (this.croppedImage) { + this.imageService.uploadImage(this.croppedImage, this.uploadParams.type, this.uploadParams.imagePath, this.uploadParams.serialId).subscribe( + response => { + console.log('Upload successful', response); + this.closeModal(); + this.uploadFinished.emit({ success: true, type: this.uploadParams.type }); + }, + error => { + console.error('Upload failed', error); + this.closeModal(); + this.uploadFinished.emit({ success: false, type: this.uploadParams.type }); + }, + ); + } + } + + loadImageFailed() { + console.error('Load image failed'); + } +} diff --git a/bizmatch/src/app/components/message/message.component.ts b/bizmatch/src/app/components/message/message.component.ts index 13285a1..6d8eba3 100644 --- a/bizmatch/src/app/components/message/message.component.ts +++ b/bizmatch/src/app/components/message/message.component.ts @@ -8,19 +8,25 @@ import { MessageService } from './message.service'; standalone: true, imports: [AsyncPipe, NgIf], template: ` - + - -
-
- -
- -
-

{{ listing.title }}

-

- -
-
-
{{ item.label }}
- @if(item.label==='Category'){ - {{ item.value }} - } @else { -
{{ item.value }}
- } -
-
- @if(listing && listingUser && (listingUser?.email===user?.email || isAdmin())){ - - } -
- - -
-

Contact the Author of this Listing

-

Please include your contact info below

-
-
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
-
- - -
- @if(listingUser){ -
-

Listing by

- - {{ listingUser.firstname }} {{ listingUser.lastname }} - - @if(listingUser.hasCompanyLogo){ - - } -
- } - -
-
-
-
-
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 index 91eefd9..f1fb38d 100644 --- a/bizmatch/src/app/pages/details/details-user/details-user.component.html +++ b/bizmatch/src/app/pages/details/details-user/details-user.component.html @@ -135,6 +135,7 @@ -->
+ @if(user){
@@ -266,4 +267,5 @@ }
+ }
diff --git a/bizmatch/src/app/pages/subscription/account/account.component.html b/bizmatch/src/app/pages/subscription/account/account.component.html index e65d748..082242d 100644 --- a/bizmatch/src/app/pages/subscription/account/account.component.html +++ b/bizmatch/src/app/pages/subscription/account/account.component.html @@ -1,4 +1,5 @@
+ @if (user){

Account Details

@@ -9,26 +10,46 @@

You can only modify your email by contacting us at support@bizwatch.net

-
+

Company Logo

-
- Company logo +
+ @if(user?.hasCompanyLogo){ + Company logo +
+ + + +
+ } @else { + + }
-
+

Your Profile Picture

-
- Profile picture +
+ @if(user?.hasProfile){ + Profile picture +
+ + + +
+ } @else { + + }
@@ -90,12 +111,12 @@
- +
- +
@@ -103,76 +124,68 @@
-
-
+ @for (areasServed of user.areasServed; track areasServed; let i=$index){ +
+
+ +
+
+ +
+
+ }
- - + + [Add more Areas or remove existing ones.]

Licensed In

- @for (licensedIn of user.licensedIn; track licensedIn){
- - +
- - + +
+
+ @for (licensedIn of user.licensedIn; track licensedIn; let i=$index){ +
+
+ +
+
+
}
- - + + [Add more licenses or remove existing ones.]
- +
- - -
+

Membership Level

@@ -190,12 +203,14 @@ - 1 - Business Broker - May 24, 2024 - May 24, 2024 - Feb 12, 9999 - active + @for (subscription of userSubscriptions; track userSubscriptions){ + {{ subscription.id }} + {{ subscription.level }} + {{ subscription.start | date }} + {{ subscription.modified | date }} + {{ subscription.end | date }} + {{ subscription.status }} + } @@ -206,43 +221,50 @@
-

Membership Level

-
+

Membership Level

+
+ @for (subscription of userSubscriptions; track userSubscriptions){
-
-
-
ID
-
1
+
+
+
ID
+
{{ subscription.id }}
-
-
Level
-
Business Broker
+
+
Level
+
{{ subscription.level }}
-
-
Start Date
-
May 24, 2024
+
+
Start Date
+
{{ subscription.start | date }}
-
-
Date Modified
-
May 24, 2024
+
+
Date Modified
+
{{ subscription.modified | date }}
-
-
End Date
-
Feb 12, 9999
+
+
End Date
+
{{ subscription.end | date }}
-
-
Status
-
active
+
+
Status
+
{{ subscription.status }}
+ }
+ }
- + + + + + + + + +
+
+

{{ listing.title }}

+

Category: {{ listing.listingsCategory === 'commercialProperty' ? 'Commercial Property' : 'Business' }}

+

Located in: {{ listing.state }}

+
+ + +
+
+
+ +
+

Showing 1 to 2 of 2 entries

+
+ + + + + + +
+
+
+
+ +