history service, mail template improved, general listing entry

This commit is contained in:
2024-05-14 11:53:20 -05:00
parent aff55c5433
commit d2e5562602
17 changed files with 261 additions and 49 deletions

View File

@@ -4,7 +4,9 @@
<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> -->
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="back()"></p-button>
@if(historyService.canGoBack()){
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="historyService.goBack()"></p-button>
}
</div>
<!-- <div class="text-500 mb-5">Egestas sed tempus urna et pharetra pharetra massa massa ultricies.</div> -->
@if(listing){
@@ -12,7 +14,7 @@
<div class="col-12 md:col-6">
<ul class="list-none p-0 m-0 border-top-1 border-300">
<li class="flex align-items-center py-3 px-2 flex-wrap">
<div class="text-500 w-full md:w-2 font-medium flex align-self-start">Description</div>
<div class="text-500 w-full md:w-2 font-medium flex">Description</div>
<div class="text-900 w-full md:w-10 line-height-3" [innerHTML]="description"></div>
</li>
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">

View File

@@ -1,4 +1,3 @@
import { Location } from '@angular/common';
import { Component } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { ActivatedRoute, Router } from '@angular/router';
@@ -9,6 +8,7 @@ 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 { environment } from '../../../../environments/environment';
import { HistoryService } from '../../../services/history.service';
import { ListingsService } from '../../../services/listings.service';
import { MailService } from '../../../services/mail.service';
import { SelectOptionsService } from '../../../services/select-options.service';
@@ -50,6 +50,7 @@ export class DetailsCommercialPropertyListingComponent {
propertyImages: string[] = [];
environment = environment;
user: User;
listingUser: User;
description: SafeHtml;
constructor(
private activatedRoute: ActivatedRoute,
@@ -60,7 +61,7 @@ export class DetailsCommercialPropertyListingComponent {
private mailService: MailService,
private messageService: MessageService,
private sanitizer: DomSanitizer,
private location: Location,
public historyService: HistoryService,
) {
this.mailinfo = { sender: {}, userId: '', email: '' };
this.userService.getUserObservable().subscribe(user => {
@@ -72,16 +73,14 @@ export class DetailsCommercialPropertyListingComponent {
async ngOnInit() {
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'commercialProperty'));
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
this.listingUser = await this.userService.getById(this.listing.userId);
this.description = this.sanitizer.bypassSecurityTrustHtml(this.listing.description);
}
back() {
this.location.back();
}
isAdmin() {
return this.userService.hasAdminRole();
}
async mail() {
this.mailinfo.email = this.user.email;
this.mailinfo.email = this.listingUser.email;
this.mailinfo.userId = this.listing.userId;
this.mailinfo.listing = this.listing;
await this.mailService.mail(this.mailinfo);