Skip to content

Commit 469fadb

Browse files
authored
Merge pull request #2503 from bcgov/2395-add-ownership-documents-to-intake-form-qa-1
2395 QA 1: Auto-assign property to COT
2 parents 860e972 + dde1fce commit 469fadb

File tree

9 files changed

+36
-11
lines changed

9 files changed

+36
-11
lines changed

alcs-frontend/src/app/features/compliance-and-enforcement/details/complaint-referral/complaint-referral.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<app-compliance-and-enforcement-documents
1616
#submissionDocumentsComponent
1717
[title]="'Complaint/Referral Submission'"
18+
[noDocumentsText]="'No Complaint/Referral'"
1819
[fileNumber]="fileNumber"
1920
[options]="submissionDocumentOptions"
2021
[section]="Section.SUBMISSION"

alcs-frontend/src/app/features/compliance-and-enforcement/documents/documents.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ <h3>{{ title }}</h3>
5050
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
5151
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
5252
<tr class="mat-row" *matNoDataRow>
53-
<td class="text-center" colspan="6">No Complaint/Referral</td>
53+
<td class="text-center" colspan="6">{{ noDocumentsText }}</td>
5454
</tr>
5555
</table>

alcs-frontend/src/app/features/compliance-and-enforcement/documents/documents.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class ComplianceAndEnforcementDocumentsComponent implements OnDestroy {
2727
isSubscribed = false;
2828

2929
@Input() title?: string;
30+
@Input() noDocumentsText?: string;
3031
@Input() fileNumber?: string;
3132
@Input() options?: DocumentUploadDialogData;
3233
@Input() section?: Section;

alcs-frontend/src/app/features/compliance-and-enforcement/draft/draft.component.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ <h3>Overview</h3>
1717
<app-compliance-and-enforcement-documents
1818
#submissionDocumentsComponent
1919
[title]="'Complaint/Referral Submission'"
20+
[noDocumentsText]="'No Complaint/Referral'"
2021
[fileNumber]="fileNumber"
2122
[options]="submissionDocumentOptions"
2223
[section]="Section.SUBMISSION"
@@ -36,6 +37,7 @@ <h3>Overview</h3>
3637
<app-compliance-and-enforcement-documents
3738
#ownershipDocumentsComponent
3839
[title]="'Property Ownership Documents'"
40+
[noDocumentsText]="'No owner information'"
3941
[fileNumber]="fileNumber"
4042
[options]="ownershipDocumentOptions"
4143
[section]="Section.OWNERSHIP"
@@ -44,11 +46,17 @@ <h3>Overview</h3>
4446

4547
<div class="button-row">
4648
<div class="left-actions">
47-
<button type="button" mat-stroked-button color="warn" (click)="onCancelDiscardClicked()">Cancel & Discard</button>
49+
<button type="button" mat-stroked-button color="warn" (click)="onCancelDiscardClicked()">
50+
Cancel & Discard
51+
</button>
4852
</div>
4953
<div class="right-actions">
50-
<button type="button" mat-stroked-button color="primary" (click)="onSaveDraftClicked()">Save Draft & Exit</button>
51-
<button type="button" mat-flat-button color="primary" (click)="onFinishCreateFileClicked()">Finish & Create File</button>
54+
<button type="button" mat-stroked-button color="primary" (click)="onSaveDraftClicked()">
55+
Save Draft & Exit
56+
</button>
57+
<button type="button" mat-flat-button color="primary" (click)="onFinishCreateFileClicked()">
58+
Finish & Create File
59+
</button>
5260
</div>
5361
</div>
5462
</form>

alcs-frontend/src/app/features/compliance-and-enforcement/draft/draft.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export class DraftComponent implements OnInit, AfterViewInit, OnDestroy {
7272
DOCUMENT_SOURCE.OTHER_AGENCY,
7373
DOCUMENT_SOURCE.ALC,
7474
],
75-
defaultDocumentSource: DOCUMENT_SOURCE.ALC,
7675
allowedDocumentTypes: [
7776
DOCUMENT_TYPE.CERTIFICATE_OF_TITLE,
7877
DOCUMENT_TYPE.CORPORATE_SUMMARY,
@@ -236,6 +235,10 @@ export class DraftComponent implements OnInit, AfterViewInit, OnDestroy {
236235

237236
// Watch for property ownership changes to update Crown status
238237
this.propertyComponent.$changes.pipe(takeUntil(this.$destroy)).subscribe(async (propertyUpdate) => {
238+
if (this.ownershipDocumentOptions.fixedParcel) {
239+
this.ownershipDocumentOptions.fixedParcel.pid = propertyUpdate.pid ?? undefined;
240+
}
241+
239242
if (propertyUpdate.ownershipTypeCode) {
240243
const wasCrown = this.isPropertyCrown;
241244
this.isPropertyCrown = propertyUpdate.ownershipTypeCode === 'CRWN';
@@ -262,6 +265,8 @@ export class DraftComponent implements OnInit, AfterViewInit, OnDestroy {
262265
const properties = await this.complianceAndEnforcementPropertyService.fetchByFileUuid(this.file.uuid);
263266
this.property = properties[0];
264267

268+
this.ownershipDocumentOptions.fixedParcel = this.property;
269+
265270
if (this.propertyComponent && this.property) {
266271
this.propertyComponent.property = this.property;
267272
}

alcs-frontend/src/app/services/compliance-and-enforcement/property/property.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export class ComplianceAndEnforcementPropertyService {
1313
constructor(private readonly http: HttpClient) {}
1414

1515
async fetchParcels(fileNumber: string): Promise<ComplianceAndEnforcementPropertyDto[]> {
16-
return await firstValueFrom(this.http.get<ComplianceAndEnforcementPropertyDto[]>(`${this.url}/${fileNumber}`));
16+
return await firstValueFrom(
17+
this.http.get<ComplianceAndEnforcementPropertyDto[]>(`${this.url}/${fileNumber}?idType=fileNumber`),
18+
);
1719
}
1820

1921
async fetchByFileUuid(fileUuid: string): Promise<ComplianceAndEnforcementPropertyDto[]> {

alcs-frontend/src/app/shared/document-upload-dialog/document-upload-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ <h4>{{ title }} Document</h4>
8888
</mat-select>
8989
</mat-form-field>
9090
</div>
91-
<div *ngIf="selectableParcels && type.value === DOCUMENT_TYPE.CERTIFICATE_OF_TITLE">
91+
<div *ngIf="type.value === DOCUMENT_TYPE.CERTIFICATE_OF_TITLE && !data.fixedParcel && selectableParcels">
9292
<mat-form-field appearance="outline" class="full-width">
9393
<mat-label>Associated Parcel</mat-label>
9494
<mat-select [formControl]="parcelId">

alcs-frontend/src/app/shared/document-upload-dialog/document-upload-dialog.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface DocumentUploadDialogData extends DocumentUploadDialogOptions {
3232
documentService?: DocumentService;
3333
parcelService?: ParcelFetchingService;
3434
submissionService?: SubmissionFetchingService;
35+
fixedParcel?: SelectableParcelDto;
3536
}
3637

3738
export interface DecisionService {

services/apps/alcs/src/alcs/compliance-and-enforcement/property/property.controller.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Body, Controller, Delete, Get, Param, Patch, Post, UseGuards } from '@nestjs/common';
1+
import { Body, Controller, Delete, Get, Param, Patch, Post, Query, UseGuards } from '@nestjs/common';
22
import { ApiOAuth2 } from '@nestjs/swagger';
33
import * as config from 'config';
44
import { RolesGuard } from '../../../common/authorization/roles-guard.service';
@@ -14,10 +14,17 @@ import { DeleteResult } from 'typeorm';
1414
export class ComplianceAndEnforcementPropertyController {
1515
constructor(private service: ComplianceAndEnforcementPropertyService) {}
1616

17-
@Get('/:fileUuid')
17+
@Get('/:id')
1818
@UserRoles(...ROLES_ALLOWED_APPLICATIONS)
19-
async fetchParcelsByFileUuid(@Param('fileUuid') fileUuid: string): Promise<ComplianceAndEnforcementPropertyDto[]> {
20-
return await this.service.fetchParcelsByFileUuid(fileUuid);
19+
async fetchParcelsByid(
20+
@Param('id') id: string,
21+
@Query('idType') idType?: string,
22+
): Promise<ComplianceAndEnforcementPropertyDto[]> {
23+
if (idType === 'fileNumber') {
24+
return await this.service.fetchParcels(id);
25+
}
26+
27+
return await this.service.fetchParcelsByFileUuid(id);
2128
}
2229

2330
@Post('')

0 commit comments

Comments
 (0)