Bugfixes
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<div class="flex justify-content-between align-items-center align-content-center">
|
||||
<div class="font-medium text-3xl text-900 mb-3">{{ listing?.title }}</div>
|
||||
<!-- <button pButton pRipple type="button" label="Go back to listings" icon="pi pi-user-plus" class="mr-3 p-button-rounded"></button> -->
|
||||
@if(historyService.canGoBack()){
|
||||
@if(historyService.canGoBack){
|
||||
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="historyService.goBack()"></p-button>
|
||||
}
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@
|
||||
<div class="text-900 w-full md:w-10">{{ listing.brokerLicencing }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
@if(listing && user && (user.id===listing?.userId || isAdmin())){
|
||||
@if(listing && listingUser && (listingUser.id===listing?.userId || isAdmin())){
|
||||
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editBusinessListing', listing.id]"></button>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MessageService } from 'primeng/api';
|
||||
import { GalleriaModule } from 'primeng/galleria';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { BusinessListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { ListingCriteria, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { KeycloakUser, ListingCriteria, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import { HistoryService } from '../../../services/history.service';
|
||||
import { ListingsService } from '../../../services/listings.service';
|
||||
@@ -48,7 +48,7 @@ export class DetailsBusinessListingComponent {
|
||||
criteria: ListingCriteria;
|
||||
mailinfo: MailInfo;
|
||||
environment = environment;
|
||||
user: User;
|
||||
user: KeycloakUser;
|
||||
listingUser: User;
|
||||
description: SafeHtml;
|
||||
private history: string[] = [];
|
||||
@@ -68,7 +68,7 @@ export class DetailsBusinessListingComponent {
|
||||
this.history.push(event.urlAfterRedirects);
|
||||
}
|
||||
});
|
||||
this.mailinfo = { sender: {}, userId: '', email: '' };
|
||||
this.mailinfo = { sender: {}, userId: '', email: '', url: environment.mailinfoUrl };
|
||||
this.userService.getUserObservable().subscribe(user => {
|
||||
this.user = user;
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="flex justify-content-between align-items-center align-content-center mb-2">
|
||||
<div class="font-medium text-3xl text-900 mb-3">{{ listing?.title }}</div>
|
||||
<!-- <button pButton pRipple type="button" label="Go back to listings" icon="pi pi-user-plus" class="mr-3 p-button-rounded"></button> -->
|
||||
@if(historyService.canGoBack()){
|
||||
@if(historyService.canGoBack){
|
||||
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="historyService.goBack()"></p-button>
|
||||
}
|
||||
</div>
|
||||
@@ -43,7 +43,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@if(listing && user && (user.id===listing?.userId || isAdmin())){
|
||||
@if(listing && listingUser && (listingUser.id===listing?.userId || isAdmin())){
|
||||
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editCommercialPropertyListing', listing.id]"></button>
|
||||
}
|
||||
</div>
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="col-12 md:col-6">
|
||||
<p-galleria [value]="propertyImages" [showIndicators]="true" [showThumbnails]="false" [responsiveOptions]="responsiveOptions" [containerStyle]="{ 'max-width': '640px' }" [numVisible]="5">
|
||||
<ng-template pTemplate="item" let-item>
|
||||
<img src="pictures/property/{{ listing.imagePath }}/{{ item }}" style="width: 100%" />
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ item }}" style="width: 100%" />
|
||||
</ng-template>
|
||||
</p-galleria>
|
||||
@if (mailinfo){
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MessageService } from 'primeng/api';
|
||||
import { GalleriaModule } from 'primeng/galleria';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { ListingCriteria, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { KeycloakUser, ListingCriteria, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import { HistoryService } from '../../../services/history.service';
|
||||
import { ListingsService } from '../../../services/listings.service';
|
||||
@@ -49,9 +49,10 @@ export class DetailsCommercialPropertyListingComponent {
|
||||
mailinfo: MailInfo;
|
||||
propertyImages: string[] = [];
|
||||
environment = environment;
|
||||
user: User;
|
||||
user: KeycloakUser;
|
||||
listingUser: User;
|
||||
description: SafeHtml;
|
||||
env = environment;
|
||||
constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private listingsService: ListingsService,
|
||||
@@ -63,7 +64,7 @@ export class DetailsCommercialPropertyListingComponent {
|
||||
private sanitizer: DomSanitizer,
|
||||
public historyService: HistoryService,
|
||||
) {
|
||||
this.mailinfo = { sender: {}, userId: '', email: '' };
|
||||
this.mailinfo = { sender: {}, userId: '', email: '', url: environment.mailinfoUrl };
|
||||
this.userService.getUserObservable().subscribe(user => {
|
||||
this.user = user;
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="flex align-items-start flex-column lg:flex-row lg:justify-content-between">
|
||||
<div class="flex align-items-start flex-column md:flex-row">
|
||||
@if(user.hasProfile){
|
||||
<img src="pictures//profile/{{ user.id }}.avif?_ts={{ ts }}" class="mr-5 mb-3 lg:mb-0" style="width: 90px" />
|
||||
<img src="{{ env.imageBaseUrl }}/pictures//profile/{{ user.id }}.avif?_ts={{ ts }}" class="mr-5 mb-3 lg:mb-0" style="width: 90px" />
|
||||
} @else {
|
||||
<img src="assets/images/person_placeholder.jpg" class="mr-5 mb-3 lg:mb-0" style="width: 90px" />
|
||||
}
|
||||
@@ -30,7 +30,7 @@
|
||||
<!-- <span class="font-medium text-500">Logo</span> -->
|
||||
<div>
|
||||
@if(user.hasCompanyLogo){
|
||||
<img src="pictures/logo/{{ user.id }}.avif?_ts={{ ts }}" class="mr-5 lg:mb-0" style="height: 60px; max-width: 100px" />
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ user.id }}.avif?_ts={{ ts }}" class="mr-5 lg:mb-0" style="height: 60px; max-width: 100px" />
|
||||
}
|
||||
<!-- <img *ngIf="!user.hasCompanyLogo" src="assets/images/placeholder.png"
|
||||
class="mr-5 lg:mb-0" style="height:60px;max-width:100px" /> -->
|
||||
@@ -40,7 +40,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if(historyService.canGoBack()){
|
||||
@if(historyService.canGoBack){
|
||||
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="historyService.goBack()"></p-button>
|
||||
}
|
||||
</div>
|
||||
@@ -121,7 +121,7 @@
|
||||
<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="pictures/property/{{ listing.imagePath }}/{{ listing.imageOrder[0] }}?_ts={{ ts }}" class="mr-3" style="width: 45px; height: 45px" />
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ listing.imageOrder[0] }}?_ts={{ ts }}" class="mr-3" style="width: 45px; height: 45px" />
|
||||
} @else {
|
||||
<img src="assets/images/placeholder_properties.jpg" class="mr-3" style="width: 45px; height: 45px" />
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { MessageService } from 'primeng/api';
|
||||
import { GalleriaModule } from 'primeng/galleria';
|
||||
import { Observable } from 'rxjs';
|
||||
import { BusinessListing, CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { ListingCriteria } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { KeycloakUser, ListingCriteria } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import { HistoryService } from '../../../services/history.service';
|
||||
import { ImageService } from '../../../services/image.service';
|
||||
@@ -25,7 +25,7 @@ import { SharedModule } from '../../../shared/shared/shared.module';
|
||||
export class DetailsUserComponent {
|
||||
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
|
||||
user: User;
|
||||
user$: Observable<User>;
|
||||
user$: Observable<KeycloakUser>;
|
||||
environment = environment;
|
||||
criteria: ListingCriteria;
|
||||
businessListings: BusinessListing[];
|
||||
@@ -33,6 +33,7 @@ export class DetailsUserComponent {
|
||||
companyOverview: SafeHtml;
|
||||
offeredServices: SafeHtml;
|
||||
ts = new Date().getTime();
|
||||
env = environment;
|
||||
constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
|
||||
@@ -45,9 +45,29 @@
|
||||
</div>
|
||||
<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]="states" [(ngModel)]="criteria.state" optionLabel="name" optionValue="value" [showClear]="true" placeholder="State" [style]="{ width: '200px' }"></p-dropdown>
|
||||
<p-dropdown
|
||||
[filter]="true"
|
||||
filterBy="name"
|
||||
[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>
|
||||
<p-dropdown
|
||||
[filter]="true"
|
||||
filterBy="name"
|
||||
[options]="selectOptions.typesOfBusiness"
|
||||
[(ngModel)]="criteria.type"
|
||||
optionLabel="name"
|
||||
optionValue="value"
|
||||
[showClear]="true"
|
||||
placeholder="Category"
|
||||
[style]="{ width: '200px' }"
|
||||
></p-dropdown>
|
||||
} @if(activeTabAction === 'commercialProperty'){
|
||||
<p-dropdown
|
||||
[options]="selectOptions.typesOfCommercialProperty"
|
||||
|
||||
@@ -9,8 +9,7 @@ import { DropdownModule } from 'primeng/dropdown';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
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 { KeycloakUser, 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';
|
||||
@@ -28,7 +27,7 @@ export class HomeComponent {
|
||||
maxPrice: string;
|
||||
minPrice: string;
|
||||
criteria: ListingCriteria;
|
||||
user$: Observable<User>;
|
||||
user$: Observable<KeycloakUser>;
|
||||
states = [];
|
||||
public constructor(private router: Router, private activatedRoute: ActivatedRoute, public selectOptions: SelectOptionsService, public userService: UserService, private listingsService: ListingsService) {
|
||||
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
||||
|
||||
@@ -3,20 +3,10 @@
|
||||
<div class="wrapper">
|
||||
<div class="grid p-4 align-items-center">
|
||||
<div class="col-2">
|
||||
<p-dropdown
|
||||
[filter]="true"
|
||||
filterBy="name"
|
||||
[options]="selectOptions.states"
|
||||
[(ngModel)]="criteria.state"
|
||||
optionLabel="name"
|
||||
optionValue="value"
|
||||
[showClear]="true"
|
||||
placeholder="Location"
|
||||
[style]="{ width: '100%' }"
|
||||
>
|
||||
<p-dropdown [filter]="true" filterBy="name" [options]="states" [(ngModel)]="criteria.state" optionLabel="name" optionValue="value" [showClear]="true" placeholder="Location" [style]="{ width: '100%' }">
|
||||
<ng-template let-state pTemplate="item">
|
||||
<div class="flex align-items-center gap-2">
|
||||
<div>{{ state.name }}</div>
|
||||
<div>{{ state.name }} ({{ state.count }})</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-dropdown>
|
||||
@@ -42,7 +32,7 @@
|
||||
<div class="surface-card p-4 flex flex-column align-items-center md:flex-row md:align-items-stretch h-full">
|
||||
<span>
|
||||
@if(user.hasProfile){
|
||||
<img src="pictures/profile/{{ user.id }}.avif?_ts={{ ts }}" class="w-5rem" />
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/profile/{{ user.id }}.avif?_ts={{ ts }}" class="w-5rem" />
|
||||
} @else {
|
||||
<img src="assets/images/person_placeholder.jpg" class="w-5rem" />
|
||||
}
|
||||
@@ -55,7 +45,7 @@
|
||||
</div>
|
||||
<div class="px-4 py-3 text-right flex justify-content-between align-items-center">
|
||||
@if(user.hasCompanyLogo){
|
||||
<img src="pictures/logo/{{ user.id }}.avif?_ts={{ ts }}" class="rounded-image" />
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ user.id }}.avif?_ts={{ ts }}" class="rounded-image" />
|
||||
} @else {
|
||||
<img src="assets/images/placeholder.png" class="rounded-image" />
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ export class BrokerListingsComponent {
|
||||
rows: number = 12;
|
||||
totalRecords: number = 0;
|
||||
ts = new Date().getTime();
|
||||
env = environment;
|
||||
public category: 'business' | 'commercialProperty' | 'professionals_brokers' | undefined;
|
||||
|
||||
constructor(
|
||||
@@ -81,7 +82,7 @@ export class BrokerListingsComponent {
|
||||
});
|
||||
}
|
||||
async ngOnInit() {
|
||||
const statesResult = await this.listingsService.getAllStates('business');
|
||||
const statesResult = await this.userService.getAllStates();
|
||||
this.states = statesResult.map(ls => ({ name: this.selectOptions.getState(ls.state as string), value: ls.state, count: ls.count }));
|
||||
}
|
||||
async init() {
|
||||
|
||||
@@ -3,18 +3,7 @@
|
||||
<div class="wrapper">
|
||||
<div class="grid p-4 align-items-center">
|
||||
<div class="col-2">
|
||||
<p-dropdown
|
||||
[filter]="true"
|
||||
filterBy="name"
|
||||
[options]="states"
|
||||
[(ngModel)]="criteria.state"
|
||||
optionLabel="criteria.location"
|
||||
optionLabel="name"
|
||||
optionValue="value"
|
||||
[showClear]="true"
|
||||
placeholder="State"
|
||||
[style]="{ width: '100%' }"
|
||||
>
|
||||
<p-dropdown [filter]="true" filterBy="name" [options]="states" [(ngModel)]="criteria.state" optionLabel="name" optionValue="value" [showClear]="true" placeholder="State" [style]="{ width: '100%' }">
|
||||
<ng-template let-state pTemplate="item">
|
||||
<div class="flex align-items-center gap-2">
|
||||
<div>{{ state.name }} ({{ state.count }})</div>
|
||||
@@ -77,7 +66,7 @@
|
||||
<p class="mt-0 mb-1 text-700 line-height-3">Location: {{ selectOptions.getState(listing.state) }}</p>
|
||||
<p class="mt-0 mb-1 text-700 line-height-3">Established: {{ listing.established }}</p>
|
||||
<div class="icon-pos">
|
||||
<img src="pictures/logo/{{ listing.userId }}.avif?_ts={{ ts }}" (error)="imageErrorHandler(listing)" class="rounded-image" />
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ listing.userId }}.avif?_ts={{ ts }}" (error)="imageErrorHandler(listing)" class="rounded-image" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-4 py-3 surface-100 text-left">
|
||||
|
||||
@@ -56,6 +56,7 @@ export class BusinessListingsComponent {
|
||||
ts = new Date().getTime();
|
||||
first: number = 0;
|
||||
rows: number = 12;
|
||||
env = environment;
|
||||
public category: 'business' | 'commercialProperty' | 'professionals_brokers' | undefined;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<article class="flex flex-column md:flex-row w-full gap-3 p-3 surface-card">
|
||||
<div class="relative">
|
||||
@if (listing.imageOrder?.length>0){
|
||||
<img src="pictures/property/{{ listing.imagePath }}/{{ listing.imageOrder[0] }}?_ts={{ ts }}" alt="Image" class="border-round w-full h-full md:w-12rem md:h-9rem" />
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ listing.imageOrder[0] }}?_ts={{ ts }}" alt="Image" class="border-round w-full h-full md:w-12rem md:h-9rem" />
|
||||
} @else {
|
||||
<img src="assets/images/placeholder_properties.jpg" alt="Image" class="border-round w-full h-full md:w-12rem md:h-9rem" />
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ export class CommercialPropertyListingsComponent {
|
||||
state: string;
|
||||
totalRecords: number = 0;
|
||||
ts = new Date().getTime();
|
||||
env = environment;
|
||||
constructor(
|
||||
public selectOptions: SelectOptionsService,
|
||||
private listingsService: ListingsService,
|
||||
|
||||
@@ -43,6 +43,7 @@ export class AccountComponent {
|
||||
dialogRef: DynamicDialogRef | undefined;
|
||||
environment = environment;
|
||||
editorModules = TOOLBAR_OPTIONS;
|
||||
env = environment;
|
||||
constructor(
|
||||
public userService: UserService,
|
||||
private subscriptionService: SubscriptionsService,
|
||||
@@ -64,14 +65,14 @@ export class AccountComponent {
|
||||
try {
|
||||
this.user = await this.userService.getByMail(email);
|
||||
} catch (e) {
|
||||
this.user = { email, firstname: keycloakUser.firstname, lastname: keycloakUser.lastname, areasServed: [], licensedIn: [] };
|
||||
this.user = { email, firstname: keycloakUser.firstName, lastname: keycloakUser.lastName, areasServed: [], licensedIn: [], companyOverview: '', offeredServices: '' };
|
||||
this.user = await this.userService.save(this.user);
|
||||
}
|
||||
}
|
||||
|
||||
this.userSubscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions());
|
||||
this.profileUrl = this.user.hasProfile ? `/pictures/profile/${this.user.id}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
|
||||
this.companyLogoUrl = this.user.hasCompanyLogo ? `/pictures/logo/${this.user.id}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
|
||||
this.profileUrl = this.user.hasProfile ? `${this.env.imageBaseUrl}/pictures/profile/${this.user.id}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
|
||||
this.companyLogoUrl = this.user.hasCompanyLogo ? `${this.env.imageBaseUrl}/pictures/logo/${this.user.id}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
|
||||
}
|
||||
printInvoice(invoice: Invoice) {}
|
||||
|
||||
@@ -82,11 +83,11 @@ export class AccountComponent {
|
||||
|
||||
onUploadCompanyLogo(event: any) {
|
||||
const uniqueSuffix = '?_ts=' + new Date().getTime();
|
||||
this.companyLogoUrl = `pictures/logo/${this.user.id}${uniqueSuffix}`;
|
||||
this.companyLogoUrl = `${this.env.imageBaseUrl}/pictures/logo/${this.user.id}${uniqueSuffix}`;
|
||||
}
|
||||
onUploadProfilePicture(event: any) {
|
||||
const uniqueSuffix = '?_ts=' + new Date().getTime();
|
||||
this.profileUrl = `pictures/profile/${this.user.id}${uniqueSuffix}`;
|
||||
this.profileUrl = `${this.env.imageBaseUrl}/pictures/profile/${this.user.id}${uniqueSuffix}`;
|
||||
}
|
||||
setImageToFallback(event: Event) {
|
||||
(event.target as HTMLImageElement).src = `/assets/images/placeholder.png`; // Pfad zum Platzhalterbild
|
||||
@@ -142,10 +143,10 @@ export class AccountComponent {
|
||||
this.loadingService.stopLoading('uploadImage');
|
||||
if (this.type === 'company') {
|
||||
this.user.hasCompanyLogo = true; //
|
||||
this.companyLogoUrl = `pictures/logo/${this.user.id}.avif?_ts=${new Date().getTime()}`;
|
||||
this.companyLogoUrl = `${this.env.imageBaseUrl}/pictures/logo/${this.user.id}.avif?_ts=${new Date().getTime()}`;
|
||||
} else {
|
||||
this.user.hasProfile = true;
|
||||
this.profileUrl = `pictures/profile/${this.user.id}.avif?_ts=${new Date().getTime()}`;
|
||||
this.profileUrl = `${this.env.imageBaseUrl}/pictures/profile/${this.user.id}.avif?_ts=${new Date().getTime()}`;
|
||||
}
|
||||
await this.userService.save(this.user);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { ListingsService } from '../../../services/listings.service';
|
||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||
import { createGenericObject, getListingType, routeListingWithState } from '../../../utils/utils';
|
||||
import { createDefaultBusinessListing, routeListingWithState } from '../../../utils/utils';
|
||||
|
||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||
@@ -118,18 +118,19 @@ export class EditBusinessListingComponent {
|
||||
if (this.mode === 'edit') {
|
||||
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'business'));
|
||||
} else {
|
||||
this.listing = createGenericObject<BusinessListing>();
|
||||
this.listing.listingsCategory = 'business';
|
||||
this.listing = createDefaultBusinessListing();
|
||||
this.listing.userId = await this.userService.getId();
|
||||
this.listing.title = this.data?.title;
|
||||
this.listing.description = this.data?.description;
|
||||
if (this.data) {
|
||||
this.listing.title = this.data?.title;
|
||||
this.listing.description = this.data?.description;
|
||||
}
|
||||
}
|
||||
this.uploadUrl = `${environment.apiBaseUrl}/bizmatch/image/uploadPropertyPicture/${this.listing.id}`;
|
||||
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
||||
}
|
||||
|
||||
async save() {
|
||||
this.listing = await this.listingsService.save(this.listing, getListingType(this.listing));
|
||||
this.listing = await this.listingsService.save(this.listing, this.listing.listingsCategory);
|
||||
this.router.navigate(['editBusinessListing', this.listing.id]);
|
||||
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing changes have been persisted', life: 3000 });
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
@for (image of propertyImages; track image) {
|
||||
<span cdkDropList mixedCdkDropList>
|
||||
<div cdkDrag mixedCdkDragSizeHelper class="image-wrap">
|
||||
<img src="pictures/property/{{ listing.imagePath }}/{{ image }}" [alt]="image" class="shadow-2" cdkDrag />
|
||||
<img src="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ image }}?_ts={{ ts }}" [alt]="image" class="shadow-2" cdkDrag />
|
||||
<fa-icon [icon]="faTrash" (click)="deleteConfirm(image)"></fa-icon>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { ListingsService } from '../../../services/listings.service';
|
||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||
import { createGenericObject, getListingType, routeListingWithState } from '../../../utils/utils';
|
||||
import { createDefaultCommercialPropertyListing, routeListingWithState } from '../../../utils/utils';
|
||||
|
||||
import { DragDropModule, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||
import { HttpEventType } from '@angular/common/http';
|
||||
@@ -17,6 +17,7 @@ import { DialogModule } from 'primeng/dialog';
|
||||
import { DialogService, DynamicDialogModule, DynamicDialogRef } from 'primeng/dynamicdialog';
|
||||
import { EditorModule } from 'primeng/editor';
|
||||
import { FileUpload, FileUploadModule } from 'primeng/fileupload';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { BusinessListing, CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { AutoCompleteCompleteEvent, ImageProperty } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
@@ -90,6 +91,8 @@ export class EditCommercialPropertyListingComponent {
|
||||
data: BusinessListing;
|
||||
userId: string;
|
||||
typesOfCommercialProperty = [];
|
||||
env = environment;
|
||||
ts = new Date().getTime();
|
||||
constructor(
|
||||
public selectOptions: SelectOptionsService,
|
||||
private router: Router,
|
||||
@@ -123,17 +126,20 @@ export class EditCommercialPropertyListingComponent {
|
||||
if (this.mode === 'edit') {
|
||||
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'commercialProperty'));
|
||||
} else {
|
||||
this.listing = createGenericObject<CommercialPropertyListing>();
|
||||
this.listing = createDefaultCommercialPropertyListing();
|
||||
this.listing.userId = await this.userService.getId();
|
||||
this.listing.title = this.data?.title;
|
||||
this.listing.description = this.data?.description;
|
||||
this.listing.imagePath = uuidv4();
|
||||
if (this.data) {
|
||||
this.listing.title = this.data?.title;
|
||||
this.listing.description = this.data?.description;
|
||||
}
|
||||
}
|
||||
this.uploadUrl = `${environment.apiBaseUrl}/bizmatch/image/uploadPropertyPicture/${this.listing.id}`;
|
||||
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
||||
}
|
||||
|
||||
async save() {
|
||||
this.listing = await this.listingsService.save(this.listing, getListingType(this.listing));
|
||||
this.listing = await this.listingsService.save(this.listing, this.listing.listingsCategory);
|
||||
this.router.navigate(['editCommercialPropertyListing', this.listing.id]);
|
||||
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing changes have been persisted', life: 3000 });
|
||||
}
|
||||
@@ -166,7 +172,7 @@ export class EditCommercialPropertyListingComponent {
|
||||
if (cropper) {
|
||||
this.loadingService.startLoading('uploadImage');
|
||||
cropper.getCroppedCanvas().toBlob(async blob => {
|
||||
this.imageService.uploadImage(blob, 'uploadPropertyPicture', this.listing.id).subscribe(
|
||||
this.imageService.uploadImage(blob, 'uploadPropertyPicture', this.listing.imagePath).subscribe(
|
||||
async event => {
|
||||
if (event.type === HttpEventType.Response) {
|
||||
console.log('Upload abgeschlossen', event.body);
|
||||
@@ -194,7 +200,8 @@ export class EditCommercialPropertyListingComponent {
|
||||
rejectIcon: 'none',
|
||||
|
||||
accept: async () => {
|
||||
await this.imageService.deleteListingImage(this.listing.id, imageName);
|
||||
this.listing.imageOrder = this.listing.imageOrder.filter(item => item !== imageName);
|
||||
await Promise.all([this.imageService.deleteListingImage(this.listing.id, imageName), this.listingsService.save(this.listing, 'commercialProperty')]);
|
||||
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Image deleted' });
|
||||
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
||||
},
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
import { ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||
import { KeycloakUser, ListingType } 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';
|
||||
@@ -15,7 +14,7 @@ import { MenuAccountComponent } from '../../menu-account/menu-account.component'
|
||||
styleUrl: './favorites.component.scss',
|
||||
})
|
||||
export class FavoritesComponent {
|
||||
user: User;
|
||||
user: KeycloakUser;
|
||||
listings: Array<ListingType> = []; //= dataListings as unknown as Array<BusinessListing>;
|
||||
favorites: Array<ListingType>;
|
||||
constructor(public userService: UserService, private listingsService: ListingsService, public selectOptions: SelectOptionsService) {
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
<td>{{ selectOptions.getListingsCategory(listing.listingsCategory) }}</td>
|
||||
<td>{{ selectOptions.getState(listing.state) }}</td>
|
||||
<td>
|
||||
@if(isBusinessListing(listing)){
|
||||
@if(listing.listingsCategory==='business'){
|
||||
<button pButton pRipple icon="pi pi-pencil" class="p-button-rounded p-button-success mr-2" [routerLink]="['/editBusinessListing', listing.id]"></button>
|
||||
} @if(isCommercialPropertyListing(listing)){
|
||||
} @if(listing.listingsCategory==='commercialProperty'){
|
||||
<button pButton pRipple icon="pi pi-pencil" class="p-button-rounded p-button-success mr-2" [routerLink]="['/editCommercialPropertyListing', listing.id]"></button>
|
||||
}
|
||||
<button pButton pRipple icon="pi pi-trash" class="p-button-rounded p-button-warning" (click)="confirm($event, listing)"></button>
|
||||
|
||||
@@ -6,7 +6,6 @@ import { ListingsService } from '../../../services/listings.service';
|
||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||
import { UserService } from '../../../services/user.service';
|
||||
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||
import { getListingType, isBusinessListing, isCommercialPropertyListing } from '../../../utils/utils';
|
||||
import { MenuAccountComponent } from '../../menu-account/menu-account.component';
|
||||
@Component({
|
||||
selector: 'app-my-listing',
|
||||
@@ -20,8 +19,6 @@ export class MyListingComponent {
|
||||
listings: Array<ListingType> = []; //dataListings as unknown as Array<BusinessListing>;
|
||||
myListings: Array<ListingType>;
|
||||
user: User;
|
||||
isBusinessListing = isBusinessListing;
|
||||
isCommercialPropertyListing = isCommercialPropertyListing;
|
||||
constructor(
|
||||
public userService: UserService,
|
||||
private listingsService: ListingsService,
|
||||
@@ -39,7 +36,7 @@ export class MyListingComponent {
|
||||
}
|
||||
|
||||
async deleteListing(listing: ListingType) {
|
||||
await this.listingsService.deleteListing(listing.id, getListingType(listing));
|
||||
await this.listingsService.deleteListing(listing.id, listing.listingsCategory);
|
||||
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]];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user