geo coding, user service, listing for business

This commit is contained in:
2024-03-10 20:59:23 +01:00
parent 06f349d1c3
commit 6ad40b6dca
59 changed files with 120466 additions and 687 deletions

View File

@@ -25,7 +25,11 @@ import { ArrayToStringPipe } from '../../../pipes/array-to-string.pipe';
import { UserService } from '../../../services/user.service';
import { SharedModule } from '../../../shared/shared/shared.module';
import { MessageService } from 'primeng/api';
import { BusinessListing, ListingType, User } from '../../../../../../common-models/src/main.model';
import { AutoCompleteCompleteEvent, BusinessListing, ListingType, User } from '../../../../../../common-models/src/main.model';
import { GeoResult, GeoService } from '../../../services/geo.service';
@Component({
selector: 'create-listing',
standalone: true,
@@ -43,7 +47,13 @@ export class EditListingComponent {
listing:ListingType = createGenericObject<BusinessListing>();
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
user:User;
constructor(public selectOptions:SelectOptionsService,private router: Router,private activatedRoute: ActivatedRoute,private listingsService:ListingsService,public userService: UserService,private messageService: MessageService){
constructor(public selectOptions:SelectOptionsService,
private router: Router,
private activatedRoute: ActivatedRoute,
private listingsService:ListingsService,
public userService: UserService,
private messageService: MessageService,
private geoService:GeoService){
this.user=this.userService.getUser();
// Abonniere Router-Events, um den aktiven Link zu ermitteln
this.router.events.subscribe(event => {
@@ -62,10 +72,10 @@ export class EditListingComponent {
this.listing.listingsCategory='business';
}
}
updateSummary(value: string): void {
const lines = value.split('\n');
(<BusinessListing>this.listing).summary = lines.filter(l=>l.trim().length>0);
}
// updateSummary(value: string): void {
// const lines = value.split('\n');
// (<BusinessListing>this.listing).summary = lines.filter(l=>l.trim().length>0);
// }
async update(id:string){
await this.listingsService.update(this.listing,this.listing.id);
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing has been updated', life: 3000 });
@@ -74,4 +84,11 @@ export class EditListingComponent {
await this.listingsService.create(this.listing);
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing has been created', life: 3000 });
}
suggestions: string[] | undefined;
async search(event: AutoCompleteCompleteEvent) {
const result = await lastValueFrom(this.geoService.findCitiesStartingWith(event.query,this.listing.state))//[...Array(5).keys()].map(item => event.query + '-' + item);
this.suggestions = result.map(r=>r.city).slice(0,5);
}
}