Skip to content

Commit

Permalink
Merge pull request #561 from bcgov/oleks
Browse files Browse the repository at this point in the history
BL stories: DSS-735, DSS-693, DSS-736, DSS-738, DSS-708
  • Loading branch information
ychung-mot committed Aug 22, 2024
2 parents 215f70c + d9cd627 commit 6015125
Show file tree
Hide file tree
Showing 30 changed files with 911 additions and 123 deletions.
9 changes: 8 additions & 1 deletion frontend/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { PageNotFoundComponent } from './common/components/page-not-found/page-n
import { approvedUserGuard } from './common/guards/approved-user.guard';
import { activeUserGuard } from './common/guards/active-user.guard';
import { accessRequestTokenGuard } from './common/guards/access-request-token.guard';
import { listing_file_upload, listing_read, role_read, role_write, takedown_action, upload_history_read, user_read, user_write } from './common/consts/permissions.const';
import { licence_file_upload, listing_file_upload, listing_read, role_read, role_write, takedown_action, upload_history_read, user_read, user_write } from './common/consts/permissions.const';
import { hasPermissionsGuard } from './common/guards/has-permissions.guard';
import { TermsAndConditionsComponent } from './common/components/terms-and-conditions/terms-and-conditions.component';
import { areTermsAceptedGuard } from './common/guards/are-terms-acepted.guard';
Expand All @@ -23,6 +23,7 @@ import { RolesListComponent } from './features/components/roles-list/roles-list.
import { RoleDetailsComponent } from './features/components/roles-list/role-details/role-details.component';
import { UserDetailsComponent } from './features/components/user-management/user-details/user-details.component';
import { ExportListingsComponent } from './features/components/export-listings/export-listings.component';
import { UploadBusinessLicenseComponent } from './features/components/upload-business-license/upload-business-license.component';

export const routes: Routes = [
{
Expand All @@ -36,6 +37,12 @@ export const routes: Routes = [
component: UploadListingsComponent,
data: { permissions: [listing_file_upload] }
},
{
path: 'upload-business-licence-data',
canActivate: [approvedUserGuard, activeUserGuard, areTermsAceptedGuard, hasPermissionsGuard],
component: UploadBusinessLicenseComponent,
data: { permissions: [licence_file_upload] }
},
{
path: 'upload-listing-history',
canActivate: [approvedUserGuard, activeUserGuard, areTermsAceptedGuard, hasPermissionsGuard],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class UploadFileComponent {
}

this.filesSelected.emit(validFiles);
(fileInput as any).value = null;
}
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h2>Platform Upload History</h2>
<p-card *ngIf="currentUser">
<p-card *ngIf="currentUser" class="upload-history-card">
<div class="form-group-row" *ngIf="!isSmall && currentUser.organizationType !== 'Platform'">
<div class="form-group-row-col">
<label for="platformId">Select Platform</label>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
:host {
width: 100%;
background-color: #FFFFFF;

h2 {
padding: 0;
Expand Down
50 changes: 50 additions & 0 deletions frontend/src/app/common/models/business-licence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
export interface BusinessLicence {

businessLicenceId: number;

updDtm: string;

businessNm?: string;
physicalRentalAddressTxt: string;

businessLicenceNo: string;
licenceTypeTxt: string;
expiryDt: string;
licenceStatusType: 'ISSUED' | 'EXPIRED' | 'SUSPENDED' | 'REVOKED' | 'CANCELLED' | 'PENDING';
restrictionTxt?: string;

businessOwnerNm?: string;
businessOwnerEmailAddressDsc?: string;
businessOwnerPhoneNo?: string;

businessOperatorNm?: string;
businessOperatorEmailAddressDsc?: string;
businessOperatorPhoneNo?: string;

propertyZoneTxt?: string;
availableBedroomsQty: number;
maxGuestsAllowedQty: number;
isPrincipalResidence: boolean;
isOwnerLivingOnsite: boolean;
isOwnerPropertyTenant: boolean;
infractionTxt?: string;
infractionDt?: string;

propertyFolioNo?: string;
propertyParcelIdentifierNo?: string;
propertyLegalDescriptionTxt?: string;

providingOrganizationId: number;
affectedByPhysicalAddressId: number;
updUserGuid: string;
licenceStatus: {
licenceStatusType: "ISSUED";
licenceStatusTypeNm: "Issued";
licenceStatusSortNo: number;
}

mailingStreetAddressTxt: string;
mailingCityNm: string;
mailingProvinceCd: string;
mailingPostalCd: string;
}
3 changes: 3 additions & 0 deletions frontend/src/app/common/models/listing-details.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { BusinessLicence } from "./business-licence";

export interface ListingDetails {
rentalListingId: number;
listingStatusType: 'N' | 'I' | 'R' | 'A' | 'T';
Expand Down Expand Up @@ -44,6 +46,7 @@ export interface ListingDetails {
actionHistory: Array<ListingDetailsActionHistory>;
hasAtLeastOneValidHostEmail: boolean;
hostsInfo: Array<ListingDetailsHostInfo>;
bizLicenceInfo: BusinessLicence;
}

export interface ListingDetailsWithHostCheckboxExtension extends ListingDetails {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/common/models/listing-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface ListingFilter {
};
byLocation: {
isPrincipalResidenceRequired: '' | 'Yes' | 'No';
isBusinessLicenseRequired: '' | 'Yes' | 'No';
isBusinessLicenceRequired: '' | 'Yes' | 'No';
};
community: number;
}
2 changes: 1 addition & 1 deletion frontend/src/app/common/models/listing-search-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export interface ListingSearchRequest {
url?: string;
listingId?: string;
hostName?: string;
businessLicense?: string;
businessLicence?: string;
}
2 changes: 1 addition & 1 deletion frontend/src/app/common/models/listing-search-state.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface ListingSearchState {
searchTerm?: string;
searchBy?: 'all' | 'address' | 'url' | 'listingId' | 'hostName' | 'businessLicense';
searchBy?: 'all' | 'address' | 'url' | 'listingId' | 'hostName' | 'businessLicence';
sortColumn?: string;
sortDirection?: 'asc' | 'desc';
pageNumber?: number;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/common/models/listing-table-row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface ListingTableRow {
isEntireUnit: boolean;
nightsBookedYtdQty: number;
businessLicenceNo: string;
businessLicenceNoMatched: string;
lastActionNm: string;
lastActionDtm: string;

Expand Down
19 changes: 19 additions & 0 deletions frontend/src/app/common/services/business-licence.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { TestBed } from '@angular/core/testing';

import { BusinessLicenceService } from './business-licence.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';

xdescribe('BusinessLicenceService', () => {
let service: BusinessLicenceService;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
});
service = TestBed.inject(BusinessLicenceService);
});

it('should be created', () => {
expect(service).toBeTruthy();
});
});
42 changes: 42 additions & 0 deletions frontend/src/app/common/services/business-licence.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { environment } from '../../../environments/environment';

@Injectable({
providedIn: 'root'
})
export class BusinessLicenceService {
constructor(private httpClient: HttpClient) { }

getUploadHistory(
pageNumber: number = 1,
pageSize: number = 10,
orderBy: string = '',
direction: 'asc' | 'desc' = 'asc',
orgId: number = 0,
): Observable<any> {
let url = `${environment.API_HOST}/bizlicences/uploadhistory?pageSize=${pageSize}&pageNumber=${pageNumber}`;

if (!!orgId) {
url += `&orgId=${orgId}`;
}

if (orderBy) {
url += `&orderBy=${orderBy}&direction=${direction}`;
}

return this.httpClient.get<any>(url);
}

uploadFile(file: any, orgId: number): Observable<any> {
const formData = new FormData();
formData.append('organizationId', orgId.toString());
formData.append('file', file);

return this.httpClient.post<any>(
`${environment.API_HOST}/bizlicences`,
formData,
);
}
}
12 changes: 11 additions & 1 deletion frontend/src/app/common/services/dashboard.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { DashboardCard } from '../models/dashboard-card';
import { ceu_action, listing_file_upload, listing_read, role_read, takedown_action, upload_history_read, user_write } from '../consts/permissions.const';
import { ceu_action, licence_file_upload, listing_file_upload, listing_read, role_read, takedown_action, upload_history_read, user_write } from '../consts/permissions.const';
import { User } from '../models/user';

@Injectable({
Expand Down Expand Up @@ -189,6 +189,16 @@ export class DashboardService {
boxId: 'uploadPlatformData_box',
buttonId: 'uploadPlatformData_btn',
},
{
accessPermission: licence_file_upload,
buttonIcon: '',
buttonText: 'Upload Business Licence Data',
description: 'Upload your local government’s business licence data',
route: '/upload-business-licence-data',
title: 'Upload Business Licence Data',
boxId: 'uploadBlData_box',
buttonId: 'uploadBlData_btn',
},
];
}
}
9 changes: 4 additions & 5 deletions frontend/src/app/common/services/listing-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ export class ListingDataService {
if (searchReq.hostName) {
endpointUrl += `&hostName=${searchReq.hostName}`;
}
if (searchReq.businessLicense) {
endpointUrl += `&businessLicense=${searchReq.businessLicense}`;
if (searchReq.businessLicence) {
endpointUrl += `&businessLicence=${searchReq.businessLicence}`;
}

if (filter) {
if (filter.byLocation) {
if (!!filter.byLocation?.isPrincipalResidenceRequired) {
endpointUrl += `&prRequirement=${filter.byLocation.isPrincipalResidenceRequired == 'Yes'}`;
}
if (!!filter.byLocation?.isBusinessLicenseRequired) {
endpointUrl += `&blRequirement=${filter.byLocation.isBusinessLicenseRequired == 'Yes'}`;
if (!!filter.byLocation?.isBusinessLicenceRequired) {
endpointUrl += `&blRequirement=${filter.byLocation.isBusinessLicenceRequired == 'Yes'}`;
}
}
if (filter.byStatus) {
Expand Down Expand Up @@ -153,7 +153,6 @@ export class ListingDataService {
{ responseType: 'arraybuffer' });
}

// Note: Address change methods
getAddressCandidates(addressString: string): Observable<Array<ListingAddressCandidate>> {
return this.httpClient.get<Array<ListingAddressCandidate>>(`${environment.API_HOST}/rentallistings/addresses/candidates`, {
params: {
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/app/common/services/top-menu.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,10 @@ export class TopMenuService {
},
{
accessPermission: licence_file_upload,
buttonId: 'businessLicenses_mi_btn',
route: '',
disabled: true,
description: '',
title: 'Business Licenses',
buttonId: 'businessLicences_mi_btn',
route: '/upload-business-licence-data',
description: 'Upload Business Licence Data',
title: 'Upload Business Licence Data',
folderName: 'Upload',
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
:host {
width: 100%;
padding: 24px;
background-color: #FFFFFF;
padding-top: 12px;
}
Loading

0 comments on commit 6015125

Please sign in to comment.