fix inputnumber, Umbau auf redis-om, Neubenamung

This commit is contained in:
2024-03-11 18:27:43 +01:00
parent 6ad40b6dca
commit be146fdc6a
25 changed files with 1830 additions and 224 deletions

View File

@@ -20,26 +20,27 @@ import { TableModule } from 'primeng/table';
import { createGenericObject } from '../../../utils/utils';
import { ListingsService } from '../../../services/listings.service';
import { lastValueFrom } from 'rxjs';
import { InputNumberModule } from 'primeng/inputnumber';
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 { AutoCompleteCompleteEvent, BusinessListing, ListingType, User } from '../../../../../../common-models/src/main.model';
import { GeoResult, GeoService } from '../../../services/geo.service';
import { InputNumberComponent, InputNumberModule } from '../../../components/inputnumber/inputnumber.component';
@Component({
selector: 'create-listing',
standalone: true,
imports: [SharedModule,ArrayToStringPipe],
imports: [SharedModule,ArrayToStringPipe, InputNumberModule],
providers:[MessageService],
templateUrl: './edit-listing.component.html',
styleUrl: './edit-listing.component.scss'
})
export class EditListingComponent {
listingCategory:'Business'|'Professionals/Brokers Directory'|'Investment Property';
listingCategory:'Business'|'Commercial Property';
category:string;
location:string;
mode:'edit'|'create';
@@ -47,6 +48,7 @@ export class EditListingComponent {
listing:ListingType = createGenericObject<BusinessListing>();
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
user:User;
value:12;
constructor(public selectOptions:SelectOptionsService,
private router: Router,
private activatedRoute: ActivatedRoute,
@@ -66,6 +68,7 @@ export class EditListingComponent {
async ngOnInit(){
if (this.mode==='edit'){
this.listing=await lastValueFrom(this.listingsService.getListingById(this.id));
this.listing.price=123456
} else {
this.listing=createGenericObject<BusinessListing>();
this.listing.userId=this.user.id
@@ -76,19 +79,19 @@ export class EditListingComponent {
// 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 });
}
async create(){
await this.listingsService.create(this.listing);
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing has been created', life: 3000 });
// 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 });
// }
async save(){
await this.listingsService.save(this.listing);
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing changes have been persisted', 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);
const result = await lastValueFrom(this.geoService.findCitiesStartingWith(event.query,this.listing.state))
this.suggestions = result.map(r=>r.city).slice(0,5);
}
}