Skip to content

Commit 8d95e6a

Browse files
authored
Merge pull request #613 from bcgov/oleks
DSS-764,DSS-766,DSS-765: Link/Unlink/Search Business Licence records
2 parents fb92f33 + e344d13 commit 8d95e6a

12 files changed

+294
-20
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface BLSearchResultRow {
2+
businessLicenceId: number;
3+
businessLicenceNo: string;
4+
physicalRentalAddressTxt: string;
5+
providingOrganizationId: number;
6+
}

frontend/src/app/common/models/listing-details.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export interface ListingDetails {
3030
isPrincipalResidenceRequired: boolean;
3131
isBusinessLicenceRequired: boolean;
3232
isEntireUnit: boolean;
33+
isChangedBusinessLicence: boolean;
3334
isChangedAddress: boolean;
3435
isLgTransferred: boolean;
3536
isMatchVerified: boolean;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface ListingTableRow {
3131
listingContactNamesTxt?: string;
3232
managingOrganizationId?: number;
3333
managingOrganizationNm?: string;
34+
isChangedBusinessLicence: boolean;
3435
isPrincipalResidenceRequired?: boolean;
3536
isBusinessLicenceRequired?: boolean;
3637
availableBedroomsQty?: number;

frontend/src/app/common/services/business-licence.service.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
22
import { Injectable } from '@angular/core';
33
import { Observable, of } from 'rxjs';
44
import { environment } from '../../../environments/environment';
5+
import { BLSearchResultRow } from '../models/bl-search-result-row';
56

67
@Injectable({
78
providedIn: 'root'
@@ -36,6 +37,10 @@ export class BusinessLicenceService {
3637
{ headers: this.textHeaders, responseType: 'text' as 'json' });
3738
}
3839

40+
searchBls(orgId: number, licenseNo: string): Observable<Array<BLSearchResultRow>> {
41+
return this.httpClient.get<Array<BLSearchResultRow>>(`${environment.API_HOST}/bizlicences/${orgId}/${licenseNo}`);
42+
}
43+
3944
uploadFile(file: any, orgId: number): Observable<any> {
4045
const formData = new FormData();
4146
formData.append('organizationId', orgId.toString());
@@ -46,4 +51,12 @@ export class BusinessLicenceService {
4651
formData,
4752
);
4853
}
54+
55+
linkBl(listingId: number, blId: number): Observable<any> {
56+
return this.httpClient.put<Array<BLSearchResultRow>>(`${environment.API_HOST}/RentalListings/${listingId}/linkbl/${blId}`, {});
57+
}
58+
59+
unLinkBl(listingId: number): Observable<any> {
60+
return this.httpClient.put<Array<BLSearchResultRow>>(`${environment.API_HOST}/RentalListings/${listingId}/unlinkbl`, {});
61+
}
4962
}

frontend/src/app/features/components/listings-table/aggregated-listings-table/aggregated-listings-table.component.html

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ <h2 class="title">Aggregated Listings</h2>
126126
<th>Listing Details</th>
127127
<th>Address (Best Match)</th>
128128
<th>Nights Stayed (YTD)</th>
129-
<th>Business Licence</th>
129+
<th>Business Licence on Listing</th>
130+
<th>Matched Business Licence</th>
130131
<th>Last Action</th>
131132
<th>Last Action Date</th>
132133
</tr>
@@ -177,8 +178,17 @@ <h2 class="title">Aggregated Listings</h2>
177178
</td>
178179
<td> {{ listing.nightsBookedYtdQty }}</td>
179180
<td><span>
180-
{{ listing.businessLicenceNo }}
181-
</span></td>
181+
{{ listing.businessLicenceNo || '-' }}
182+
</span>
183+
</td>
184+
<td>
185+
<div class="bl-matched-col">
186+
<span>
187+
{{ listing.businessLicenceNoMatched || '-' }}
188+
</span>
189+
<p-tag *ngIf="listing.isChangedBusinessLicence" value="Updated" class="updated-tag"></p-tag>
190+
</div>
191+
</td>
182192
<td>{{ listing.lastActionNm }}</td>
183193
<td>{{ listing.lastActionDtm |date }}</td>
184194
</tr>

frontend/src/app/features/components/listings-table/aggregated-listings-table/aggregated-listings-table.component.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@
212212
gap: 8px;
213213
}
214214

215-
.address-col {
215+
.address-col,
216+
.bl-matched-col {
216217
width: 100%;
217218
display: flex;
218219
gap: 8px;

frontend/src/app/features/components/listings-table/listing-details/listing-details.component.html

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,34 @@ <h2>Detailed Listing Information for</h2>
265265
</p-tag>
266266
</div>
267267
</ng-template>
268+
268269
<div *ngIf="!blInfo; else else_block" class="row no-bl-data">
269-
<strong>We were unable to find a business licence that matched this listing in our system.</strong>
270+
271+
272+
<div *ngIf="!listing.isChangedBusinessLicence; else changed" class="bl-description">
273+
<strong>
274+
This listing could not be matched to a business licence record. Listings may not match
275+
for one of the following reasons:
276+
</strong>
277+
<ul>
278+
<li>Host error—the host may not have entered their business licence number on their listing,
279+
or
280+
may have provided it in a format that could not be automatically matched to a local
281+
government business licence record.</li>
282+
<li>
283+
Up-to-date business licence records have not been uploaded to the Portal. Please check
284+
the
285+
Business licence upload history to confirm when records were last updated.
286+
</li>
287+
<li>Host does not have a business licence.</li>
288+
</ul>
289+
</div>
290+
<ng-template #changed>
291+
<strong>Business Licence Information was removed from this listing.</strong>
292+
</ng-template>
293+
<button pButton (click)="showBlMatchPopup()" class="p-button-link">Click here to link this listing
294+
to a business licence record</button>
295+
270296
</div>
271297
<ng-template #else_block>
272298
<div *ngIf="blInfo?.businessNm" class="row">
@@ -391,11 +417,66 @@ <h2>Detailed Listing Information for</h2>
391417
<strong>Legal Description: </strong> <span class="value">{{blInfo.propertyLegalDescriptionTxt
392418
||'-'}}</span>
393419
</div>
420+
421+
<div class="spacer-hr">
422+
</div>
423+
<div class="row">
424+
<button pButton (click)="showBlUnlinkPopup()" class="p-button-link">Click here to unlink this
425+
listing from this business licence record</button>
426+
</div>
394427
</ng-template>
395428
</p-panel>
396429
</div>
397430
</div>
398431

432+
<p-dialog header="Match a Business Licence to Listing" class="bl-match-popup" [modal]="true" [closable]="false"
433+
[(visible)]="isMatchBlShown" [style]="{width: '50vw'}">
434+
<div class="search-label"><strong>Enter a Business Licence Number</strong></div>
435+
<div class="search-row">
436+
<input pInputText type="text" class="full-width-text-field" [(ngModel)]="searchBlText"
437+
placeholder="Enter value..." (keyup.enter)="onSearchBl()">
438+
<button pButton class="search-bl-btn" id="search-bl-btn" (click)="onSearchBl()"
439+
[disabled]="isSearchBlDisabled"><i class="pi pi-search"></i></button>
440+
</div>
441+
<div class="no-bl-found" *ngIf="noBlsFound">
442+
No match was found for this business licence number in our system.
443+
</div>
444+
<div class="search-results" *ngIf="blSearchResults.length">
445+
<strong>Best Match Candidate</strong>
446+
447+
<div class="search-result-row" *ngFor="let blRow of blSearchResults">
448+
<p-radioButton [inputId]="'bl'+blRow.businessLicenceId" name="bl-search-result-row" [value]="blRow"
449+
[(ngModel)]="selectedBl"></p-radioButton>
450+
<label [for]="'bl'+blRow.businessLicenceId" class="ml-2">
451+
{{ blRow.businessLicenceNo }}, {{blRow.physicalRentalAddressTxt}}
452+
</label>
453+
</div>
454+
</div>
455+
456+
<ng-template pTemplate="footer">
457+
<button pButton name="submit-dialog-btn" id="submit-dialog-btn" (click)="onUpdateBl()"
458+
[disabled]="!selectedBl">Update</button>
459+
<button pButton name="cancel-dialog-btn" id="cancel-dialog-btn" class="outline-btn"
460+
(click)="onCancelUpdateBl()">Cancel</button>
461+
</ng-template>
462+
</p-dialog>
463+
464+
<p-dialog header="Unlink a business licence from Listing" class="bl-unlink-popup" [modal]="true" [closable]="false"
465+
[(visible)]="isUnlinkBlShow" [style]="{width: '50vw'}">
466+
<div class="search-label" *ngIf="this.listing && this.listing.bizLicenceInfo"><strong>Are you sure you want to
467+
unlink business
468+
licence number
469+
{{this.listing.bizLicenceInfo.businessLicenceNo}} from this
470+
listing?</strong></div>
471+
472+
<ng-template pTemplate="footer">
473+
<button pButton name="submit-dialog-btn" id="submit-dialog-btn" (click)="onUnlinkBl()">Yes, Unlink this Business
474+
Licence Number</button>
475+
<button pButton name="cancel-dialog-btn" id="cancel-dialog-btn" class="outline-btn"
476+
(click)="onCancelUnlinkBl()">Cancel</button>
477+
</ng-template>
478+
</p-dialog>
479+
399480
<p-dialog header="Legend" [modal]="true" [(visible)]="isLegendShown" [style]="{width: '50vw'}">
400481
<span>
401482
<strong>Status:</strong> Status of the listing using the following categories:

frontend/src/app/features/components/listings-table/listing-details/listing-details.component.scss

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,20 @@
159159
display: flex;
160160
gap: 8px;
161161

162+
&.no-bl-data {
163+
flex-direction: column;
164+
165+
.bl-description {
166+
strong {
167+
white-space: normal;
168+
}
169+
170+
button {
171+
color: #053662;
172+
}
173+
}
174+
}
175+
162176
.status-name {
163177
color: #42814A;
164178

@@ -187,6 +201,19 @@
187201
.row {
188202
display: flex;
189203

204+
&.search-row {
205+
position: relative;
206+
207+
input {
208+
padding-right: 30px;
209+
}
210+
211+
button {
212+
position: absolute;
213+
right: 0;
214+
}
215+
}
216+
190217
p-table {
191218
width: 100%;
192219
}
@@ -247,6 +274,47 @@
247274
}
248275
}
249276

277+
.search-label {
278+
padding: 12px 0;
279+
}
280+
281+
.search-row {
282+
position: relative;
283+
284+
input {
285+
padding-right: 70px;
286+
}
287+
288+
button {
289+
&.search-bl-btn {
290+
border-top-left-radius: 0;
291+
border-bottom-left-radius: 0;
292+
}
293+
294+
position: absolute;
295+
right: 0;
296+
height: 100%;
297+
}
298+
}
299+
300+
.no-bl-found {
301+
padding: 12px;
302+
padding-top: 18px;
303+
}
304+
305+
.search-results {
306+
padding: 12px;
307+
padding-top: 18px;
308+
309+
.search-result-row {
310+
margin-top: 12px;
311+
}
312+
313+
strong {
314+
margin-bottom: 12px;
315+
}
316+
}
317+
250318
.status-circle {
251319
background-color: #FFFFFF;
252320
width: 20px;

0 commit comments

Comments
 (0)