Skip to content

Commit f4c0756

Browse files
authored
Merge pull request #602 from bcgov/oleks
DSS-757, DSS-758, DSS-759: Aggregated Listings
2 parents 2edde74 + ab65d4a commit f4c0756

11 files changed

+1294
-2
lines changed

frontend/src/app/app.routes.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { RoleDetailsComponent } from './features/components/roles-list/role-deta
2424
import { UserDetailsComponent } from './features/components/user-management/user-details/user-details.component';
2525
import { ExportListingsComponent } from './features/components/export-listings/export-listings.component';
2626
import { UploadBusinessLicenseComponent } from './features/components/upload-business-license/upload-business-license.component';
27+
import { AggregatedListingsTableComponent } from './features/components/listings-table/aggregated-listings-table/aggregated-listings-table.component';
2728

2829
export const routes: Routes = [
2930
{
@@ -84,6 +85,12 @@ export const routes: Routes = [
8485
canActivate: [approvedUserGuard, activeUserGuard, hasPermissionsGuard, areTermsAceptedGuard],
8586
data: { permissions: [listing_read] },
8687
},
88+
{
89+
path: 'aggregated-listings',
90+
component: AggregatedListingsTableComponent,
91+
canActivate: [approvedUserGuard, activeUserGuard, hasPermissionsGuard, areTermsAceptedGuard],
92+
data: { permissions: [listing_read] },
93+
},
8794
{
8895
path: 'listing/:id', component: ListingDetailsComponent,
8996
canActivate: [approvedUserGuard, activeUserGuard, hasPermissionsGuard, areTermsAceptedGuard],

frontend/src/app/common/models/listing-table-row.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,21 @@ export interface ListingTableRow {
3838
bcRegistryNo?: string;
3939

4040
rentalListingContacts?: [];
41+
selected?: boolean;
42+
4143
}
4244

45+
export interface AggregatedListingTableRow {
46+
id?: string;
47+
effectiveBusinessLicenceNo?: string;
48+
effectiveHostNm?: string;
49+
primaryHostNm: string;
50+
matchAddressTxt: string;
51+
nightsBookedYtdQty: number;
52+
businessLicenceNo: string;
53+
lastActionNm?: string;
54+
lastActionDtm?: string;
55+
56+
listings: Array<ListingTableRow>;
57+
selected?: boolean;
58+
}

frontend/src/app/common/services/dashboard.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ export class DashboardService {
3939

4040
private initCards(): void {
4141
this.cards = [
42+
{
43+
accessPermission: listing_read,
44+
buttonIcon: '',
45+
buttonText: 'View Aggregated Listing Data',
46+
description: 'View aggregated platform listing data for your community',
47+
route: 'aggregated-listings',
48+
title: 'Aggregated Listing Data',
49+
boxId: 'aggregated_listings_box',
50+
buttonId: 'aggregated_listings_btn',
51+
},
4252
{
4353
accessPermission: listing_read,
4454
buttonIcon: '',

frontend/src/app/common/services/listing-data.service.ts

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs';
44
import { environment } from '../../../environments/environment';
55
import { PagingResponse } from '../models/paging-response';
66
import { ListingUploadHistoryRecord } from '../models/listing-upload-history-record';
7-
import { ListingTableRow } from '../models/listing-table-row';
7+
import { AggregatedListingTableRow, ListingTableRow } from '../models/listing-table-row';
88
import { ListingSearchRequest } from '../models/listing-search-request';
99
import { ListingAddressCandidate, ListingDetails } from '../models/listing-details';
1010
import { ExportJurisdiction } from '../models/export-listing';
@@ -140,6 +140,73 @@ export class ListingDataService {
140140
return this.httpClient.get<PagingResponse<ListingTableRow>>(endpointUrl);
141141
}
142142

143+
getAggregatedListings(
144+
pageNumber: number = 1,
145+
pageSize: number = 10,
146+
orderBy: string = '',
147+
direction: 'asc' | 'desc' = 'asc',
148+
searchReq: ListingSearchRequest = {},
149+
filter?: ListingFilter
150+
): Observable<PagingResponse<AggregatedListingTableRow>> {
151+
let endpointUrl = `${environment.API_HOST}/rentallistings/grouped?pageSize=${pageSize}&pageNumber=${pageNumber}`;
152+
153+
if (orderBy) {
154+
endpointUrl += `&orderBy=${orderBy}&direction=${direction}`;
155+
}
156+
157+
if (searchReq.all) {
158+
endpointUrl += `&all=${searchReq.all}`;
159+
}
160+
if (searchReq.address) {
161+
endpointUrl += `&address=${searchReq.address}`;
162+
}
163+
if (searchReq.url) {
164+
endpointUrl += `&url=${searchReq.url}`;
165+
}
166+
if (searchReq.listingId) {
167+
endpointUrl += `&listingId=${searchReq.listingId}`;
168+
}
169+
if (searchReq.hostName) {
170+
endpointUrl += `&hostName=${searchReq.hostName}`;
171+
}
172+
if (searchReq.businessLicence) {
173+
endpointUrl += `&businessLicence=${searchReq.businessLicence}`;
174+
}
175+
176+
if (filter) {
177+
if (filter.byLocation) {
178+
if (!!filter.byLocation?.isPrincipalResidenceRequired) {
179+
endpointUrl += `&prRequirement=${filter.byLocation.isPrincipalResidenceRequired == 'Yes'}`;
180+
}
181+
if (!!filter.byLocation?.isBusinessLicenceRequired) {
182+
endpointUrl += `&blRequirement=${filter.byLocation.isBusinessLicenceRequired == 'Yes'}`;
183+
}
184+
}
185+
if (filter.byStatus) {
186+
if (filter.byStatus.reassigned !== null && filter.byStatus.reassigned !== undefined) {
187+
endpointUrl += `&reassigned=${!!filter.byStatus.reassigned}`;
188+
}
189+
if (filter.byStatus.takedownComplete !== null && filter.byStatus.takedownComplete !== undefined) {
190+
endpointUrl += `&takedownComplete=${!!filter.byStatus.takedownComplete}`;
191+
}
192+
193+
const statuses = new Array();
194+
if (filter.byStatus.active) statuses.push('A')
195+
if (filter.byStatus.inactive) statuses.push('I')
196+
if (filter.byStatus.new) statuses.push('N')
197+
198+
if (statuses.length) {
199+
endpointUrl += `&statuses=${statuses.join(',')}`;
200+
}
201+
}
202+
if (!!filter.community) {
203+
endpointUrl += `&lgId=${filter.community}`;
204+
}
205+
}
206+
207+
return this.httpClient.get<PagingResponse<AggregatedListingTableRow>>(endpointUrl);
208+
}
209+
143210
getListingDetailsById(id: number): Observable<ListingDetails> {
144211
return this.httpClient.get<ListingDetails>(`${environment.API_HOST}/rentallistings/${id}`);
145212
}

frontend/src/app/common/services/top-menu.service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ export class TopMenuService {
3939

4040
private initMenuItems(): void {
4141
this.menuItems = [
42+
{
43+
accessPermission: listing_read,
44+
buttonId: 'aggregated_listings_mi_btn',
45+
route: '/aggregated-listings',
46+
title: 'Aggregated Listing Data',
47+
folderName: 'Listings',
48+
},
4249
{
4350
accessPermission: listing_read,
4451
buttonId: 'listings_mi_btn',

0 commit comments

Comments
 (0)