counties, pagination, filter count, show total results

This commit is contained in:
2024-07-19 18:06:56 +02:00
parent abcde3991d
commit 9db23c2177
25 changed files with 67207 additions and 509 deletions

View File

@@ -50,14 +50,6 @@ export class BusinessListingsComponent {
private searchService: SearchService,
) {
this.criteria = getCriteriaStateObject('business');
// this.route.data.subscribe(async () => {
// if (this.router.getCurrentNavigation().extras.state) {
// } else {
// this.first = this.criteria.page * this.criteria.length;
// this.rows = this.criteria.length;
// }
// this.init();
// });
this.init();
this.searchService.currentCriteria.subscribe(criteria => {
if (criteria && criteria.criteriaType === 'business') {
@@ -66,20 +58,14 @@ export class BusinessListingsComponent {
}
});
}
async ngOnInit() {
//initFlowbite();
}
async ngOnInit() {}
async init() {
this.reset();
const statesResult = await this.listingsService.getAllStates('business');
this.states = statesResult.map(ls => ({ name: this.selectOptions.getState(ls.state as string), value: ls.state, count: ls.count }));
this.search();
}
// refine() {
// this.criteria.start = 0;
// this.criteria.page = 0;
// this.search();
// }
async search() {
//this.listings = await this.listingsService.getListingsByPrompt(this.criteria);
const listingReponse = await this.listingsService.getListings(this.criteria, 'business');
@@ -90,10 +76,9 @@ export class BusinessListingsComponent {
this.cdRef.detectChanges();
}
onPageChange(page: any) {
this.criteria.start = (page - 1) * LISTINGS_PER_PAGE + 1;
this.criteria.start = (page - 1) * LISTINGS_PER_PAGE;
this.criteria.length = LISTINGS_PER_PAGE;
this.criteria.page = page;
// this.criteria.pageCount = event.pageCount;
this.search();
}
imageErrorHandler(listing: ListingType) {