account, myListings and emailUs pages

This commit is contained in:
2024-07-10 18:40:46 +02:00
parent 08c179fa09
commit 7bd5e1aaf8
19 changed files with 622 additions and 226 deletions

View File

@@ -2,6 +2,10 @@ import { ChangeDetectorRef, Component } from '@angular/core';
import { KeycloakService } from 'keycloak-angular';
import { CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
import { ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
import { ConfirmationComponent } from '../../../components/confirmation/confirmation.component';
import { ConfirmationService } from '../../../components/confirmation/confirmation.service';
import { MessageComponent } from '../../../components/message/message.component';
import { MessageService } from '../../../components/message/message.service';
import { ListingsService } from '../../../services/listings.service';
import { SelectOptionsService } from '../../../services/select-options.service';
import { UserService } from '../../../services/user.service';
@@ -11,7 +15,7 @@ import { map2User } from '../../../utils/utils';
@Component({
selector: 'app-my-listing',
standalone: true,
imports: [SharedModule],
imports: [SharedModule, ConfirmationComponent, MessageComponent],
providers: [],
templateUrl: './my-listing.component.html',
styleUrl: './my-listing.component.scss',
@@ -20,7 +24,15 @@ export class MyListingComponent {
listings: Array<ListingType> = []; //dataListings as unknown as Array<BusinessListing>;
myListings: Array<ListingType>;
user: User;
constructor(public userService: UserService, public keycloakService: KeycloakService, private listingsService: ListingsService, private cdRef: ChangeDetectorRef, public selectOptions: SelectOptionsService) {}
constructor(
public userService: UserService,
public keycloakService: KeycloakService,
private listingsService: ListingsService,
private cdRef: ChangeDetectorRef,
public selectOptions: SelectOptionsService,
private messageService: MessageService,
private confirmationService: ConfirmationService,
) {}
async ngOnInit() {
// const keycloakUser = this.userService.getKeycloakUser();
const token = await this.keycloakService.getToken();
@@ -41,7 +53,12 @@ export class MyListingComponent {
this.myListings = [...result[0], ...result[1]];
}
confirm(event: Event, listing: ListingType) {
async confirm(listing: ListingType) {
const confirmed = await this.confirmationService.showConfirmation(`Are you sure you want to delete this listing?`);
if (confirmed) {
this.messageService.showMessage('Listing has been deleted');
this.deleteListing(listing);
}
// this.confirmationService.confirm({
// target: event.target as EventTarget,
// message: 'Are you sure you want to delet this listing?',