From 1c6eed4e9e14ccc1749fac8b175bc3e7b2dd33dc Mon Sep 17 00:00:00 2001 From: Daniel Haselhan Date: Tue, 5 Sep 2023 13:24:18 -0700 Subject: [PATCH] Add Notification Parcel UI * Cleanup isDraft flag since not needed for Notifications * Merge modules for the same reason * Delete unused parcel fields --- .../edit-submission-base.module.ts | 12 - .../edit-submission.component.html | 10 +- .../edit-submission.component.ts | 17 +- .../edit-submission/edit-submission.module.ts | 16 +- .../edit-submission/files-step.partial.ts | 16 -- .../delete-parcel-dialog.component.html | 36 +++ .../delete-parcel-dialog.component.scss | 24 ++ .../delete-parcel-dialog.component.spec.ts | 47 ++++ .../delete-parcel-dialog.component.ts | 52 ++++ .../parcels/parcel-details.component.html | 57 ++++ .../parcels/parcel-details.component.scss | 0 .../parcels/parcel-details.component.spec.ts | 60 +++++ .../parcels/parcel-details.component.ts | 138 ++++++++++ ...l-entry-confirmation-dialog.component.html | 35 +++ ...l-entry-confirmation-dialog.component.scss | 24 ++ ...ntry-confirmation-dialog.component.spec.ts | 35 +++ ...cel-entry-confirmation-dialog.component.ts | 33 +++ .../parcel-entry/parcel-entry.component.html | 136 ++++++++++ .../parcel-entry/parcel-entry.component.scss | 96 +++++++ .../parcel-entry.component.spec.ts | 62 +++++ .../parcel-entry/parcel-entry.component.ts | 247 ++++++++++++++++++ .../edit-submission/step.partial.ts | 8 +- .../notification-parcel.dto.ts | 2 - .../notification-parcel.service.ts | 5 +- .../notification-parcel.entity.ts | 14 - .../notification-parcel.service.spec.ts | 1 - .../notification-parcel.service.ts | 7 +- ...940144496-clean_up_notification_parcels.ts | 19 ++ 28 files changed, 1144 insertions(+), 65 deletions(-) delete mode 100644 portal-frontend/src/app/features/notifications/edit-submission/edit-submission-base.module.ts create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.html create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.scss create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.spec.ts create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.ts create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.html create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.scss create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.spec.ts create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.ts create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.html create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.scss create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.spec.ts create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.ts create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.html create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.scss create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.spec.ts create mode 100644 portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.ts create mode 100644 services/apps/alcs/src/providers/typeorm/migrations/1693940144496-clean_up_notification_parcels.ts diff --git a/portal-frontend/src/app/features/notifications/edit-submission/edit-submission-base.module.ts b/portal-frontend/src/app/features/notifications/edit-submission/edit-submission-base.module.ts deleted file mode 100644 index 0caf1a7971..0000000000 --- a/portal-frontend/src/app/features/notifications/edit-submission/edit-submission-base.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { NgxMaskDirective, NgxMaskPipe } from 'ngx-mask'; -import { SharedModule } from '../../../shared/shared.module'; -import { EditSubmissionComponent } from './edit-submission.component'; - -@NgModule({ - imports: [CommonModule, SharedModule, NgxMaskDirective, NgxMaskPipe], - declarations: [EditSubmissionComponent], - exports: [EditSubmissionComponent], -}) -export class EditSubmissionBaseModule {} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.component.html b/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.component.html index c16152382b..932a741a8a 100644 --- a/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.component.html +++ b/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.component.html @@ -31,7 +31,15 @@
Notice of Intent ID: {{ notificationSubmissio > -
+
+ + +
diff --git a/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.component.ts b/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.component.ts index 2d77d82860..bd702397f0 100644 --- a/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.component.ts +++ b/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.component.ts @@ -4,16 +4,13 @@ import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Router } from '@angular/router'; import { BehaviorSubject, combineLatest, Observable, of, Subject, takeUntil } from 'rxjs'; import { NoticeOfIntentDocumentDto } from '../../../services/notice-of-intent-document/notice-of-intent-document.dto'; -import { - NOI_SUBMISSION_STATUS, - NoticeOfIntentSubmissionDetailedDto, -} from '../../../services/notice-of-intent-submission/notice-of-intent-submission.dto'; import { NotificationSubmissionDetailedDto } from '../../../services/notification-submission/notification-submission.dto'; import { NotificationSubmissionService } from '../../../services/notification-submission/notification-submission.service'; import { ToastService } from '../../../services/toast/toast.service'; import { CustomStepperComponent } from '../../../shared/custom-stepper/custom-stepper.component'; import { OverlaySpinnerService } from '../../../shared/overlay-spinner/overlay-spinner.service'; import { scrollToElement } from '../../../shared/utils/scroll-helper'; +import { ParcelDetailsComponent } from './parcels/parcel-details.component'; export enum EditNotificationSteps { Parcel = 0, @@ -43,6 +40,7 @@ export class EditSubmissionComponent implements OnDestroy, AfterViewInit { showValidationErrors = false; @ViewChild('cdkStepper') public customStepper!: CustomStepperComponent; + @ViewChild(ParcelDetailsComponent) parcelDetailsComponent!: ParcelDetailsComponent; constructor( private notificationSubmissionService: NotificationSubmissionService, @@ -116,9 +114,20 @@ export class EditSubmissionComponent implements OnDestroy, AfterViewInit { await this.router.navigateByUrl(`notification/${this.fileId}/edit/${index}`); } + onParcelDetailsInitialized() { + if (this.expandedParcelUuid && this.parcelDetailsComponent) { + this.parcelDetailsComponent.openParcel(this.expandedParcelUuid); + this.expandedParcelUuid = undefined; + } + } + async saveSubmission(step: number) { switch (step) { case EditNotificationSteps.Parcel: + if (this.parcelDetailsComponent) { + await this.parcelDetailsComponent.onSave(); + } + break; case EditNotificationSteps.Transferees: case EditNotificationSteps.PrimaryContact: case EditNotificationSteps.Government: diff --git a/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.module.ts b/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.module.ts index ba969b4f33..b4bdc31cde 100644 --- a/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.module.ts +++ b/portal-frontend/src/app/features/notifications/edit-submission/edit-submission.module.ts @@ -3,8 +3,11 @@ import { CommonModule } from '@angular/common'; import { RouterModule, Routes } from '@angular/router'; import { CanDeactivateGuard } from '../../../shared/guard/can-deactivate.guard'; import { SharedModule } from '../../../shared/shared.module'; -import { EditSubmissionBaseModule } from './edit-submission-base.module'; import { EditSubmissionComponent } from './edit-submission.component'; +import { DeleteParcelDialogComponent } from './parcels/delete-parcel/delete-parcel-dialog.component'; +import { ParcelDetailsComponent } from './parcels/parcel-details.component'; +import { ParcelEntryConfirmationDialogComponent } from './parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component'; +import { ParcelEntryComponent } from './parcels/parcel-entry/parcel-entry.component'; import { StepComponent } from './step.partial'; const routes: Routes = [ @@ -20,7 +23,14 @@ const routes: Routes = [ ]; @NgModule({ - declarations: [StepComponent], - imports: [CommonModule, SharedModule, RouterModule.forChild(routes), EditSubmissionBaseModule], + declarations: [ + StepComponent, + EditSubmissionComponent, + ParcelDetailsComponent, + ParcelEntryComponent, + ParcelEntryConfirmationDialogComponent, + DeleteParcelDialogComponent, + ], + imports: [CommonModule, SharedModule, RouterModule.forChild(routes)], }) export class EditSubmissionModule {} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/files-step.partial.ts b/portal-frontend/src/app/features/notifications/edit-submission/files-step.partial.ts index 5c5cdcf681..000753042e 100644 --- a/portal-frontend/src/app/features/notifications/edit-submission/files-step.partial.ts +++ b/portal-frontend/src/app/features/notifications/edit-submission/files-step.partial.ts @@ -5,7 +5,6 @@ import { NoticeOfIntentDocumentDto } from '../../../services/notice-of-intent-do import { NoticeOfIntentDocumentService } from '../../../services/notice-of-intent-document/notice-of-intent-document.service'; import { DOCUMENT_TYPE } from '../../../shared/dto/document.dto'; import { FileHandle } from '../../../shared/file-drag-drop/drag-drop.directive'; -import { RemoveFileConfirmationDialogComponent } from '../../applications/alcs-edit-submission/remove-file-confirmation-dialog/remove-file-confirmation-dialog.component'; import { StepComponent } from './step.partial'; @Component({ @@ -42,21 +41,6 @@ export abstract class FilesStepComponent extends StepComponent { } async onDeleteFile($event: NoticeOfIntentDocumentDto) { - if (this.draftMode) { - this.dialog - .open(RemoveFileConfirmationDialogComponent) - .beforeClosed() - .subscribe(async (didConfirm) => { - if (didConfirm) { - this.deleteFile($event); - } - }); - } else { - await this.deleteFile($event); - } - } - - private async deleteFile($event: NoticeOfIntentDocumentDto) { await this.noticeOfIntentDocumentService.deleteExternalFile($event.uuid); if (this.fileId) { const documents = await this.noticeOfIntentDocumentService.getByFileId(this.fileId); diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.html b/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.html new file mode 100644 index 0000000000..77c2809519 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.html @@ -0,0 +1,36 @@ + + + + + + + + + + +
+

Delete Parcel #{{ parcelNumber }}

+
+ +
+
+ + Warning: All information relevant to this parcel, including information added in subsequent steps, will be + deleted. + + +
+ +
+
+ +
+
+
Are you sure you want to delete this? This action cannot be undone.
+
+ +
+ +
+
+
diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.scss b/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.scss new file mode 100644 index 0000000000..1f78db7f1e --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.scss @@ -0,0 +1,24 @@ +@use '../../../../../../styles/functions' as *; + +.margin-bottom-1 { + margin-bottom: rem(16); +} + +.step-controls { + display: flex; + justify-content: space-between; +} + +.confirm-content { + margin: rem(24) 0; +} + +@media screen and (min-width: $desktopBreakpoint) { + .step-controls { + justify-content: flex-end; + + button { + margin-left: rem(25) !important; + } + } +} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.spec.ts b/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.spec.ts new file mode 100644 index 0000000000..59d4818b54 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.spec.ts @@ -0,0 +1,47 @@ +import { HttpClient } from '@angular/common/http'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { createMock, DeepMocked } from '@golevelup/ts-jest'; +import { NoticeOfIntentParcelService } from '../../../../../services/notice-of-intent-parcel/notice-of-intent-parcel.service'; +import { DeleteParcelDialogComponent } from './delete-parcel-dialog.component'; + +describe('DeleteParcelDialogComponent', () => { + let component: DeleteParcelDialogComponent; + let fixture: ComponentFixture; + let mockHttpClient: DeepMocked; + let mockNoiParcelService: DeepMocked; + + beforeEach(async () => { + mockHttpClient = createMock(); + mockNoiParcelService = createMock(); + + await TestBed.configureTestingModule({ + declarations: [DeleteParcelDialogComponent], + providers: [ + { + provide: HttpClient, + useValue: mockHttpClient, + }, + { + provide: NoticeOfIntentParcelService, + useValue: mockNoiParcelService, + }, + { + provide: MatDialogRef, + useValue: {}, + }, + { provide: MAT_DIALOG_DATA, useValue: {} }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + + fixture = TestBed.createComponent(DeleteParcelDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.ts b/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.ts new file mode 100644 index 0000000000..7445939f2f --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/delete-parcel/delete-parcel-dialog.component.ts @@ -0,0 +1,52 @@ +import { Component, Inject } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { NoticeOfIntentParcelService } from '../../../../../services/notice-of-intent-parcel/notice-of-intent-parcel.service'; + +export enum NotificationParcelDeleteStepsEnum { + warning = 0, + confirmation = 1, +} + +@Component({ + selector: 'app-delete-parcel-dialog', + templateUrl: './delete-parcel-dialog.component.html', + styleUrls: ['./delete-parcel-dialog.component.scss'], +}) +export class DeleteParcelDialogComponent { + parcelUuid!: string; + parcelNumber!: string; + + stepIdx = 0; + + warningStep = NotificationParcelDeleteStepsEnum.warning; + confirmationStep = NotificationParcelDeleteStepsEnum.confirmation; + + constructor( + private noticeOfIntentParcelService: NoticeOfIntentParcelService, + private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: DeleteParcelDialogComponent + ) { + this.parcelUuid = data.parcelUuid; + this.parcelNumber = data.parcelNumber; + } + + async next() { + this.stepIdx += 1; + } + + async back() { + this.stepIdx -= 1; + } + + async onCancel(dialogResult: boolean = false) { + this.dialogRef.close(dialogResult); + } + + async onDelete() { + const result = await this.noticeOfIntentParcelService.deleteMany([this.parcelUuid]); + + if (result) { + this.onCancel(true); + } + } +} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.html b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.html new file mode 100644 index 0000000000..6ce7b7f4b2 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.html @@ -0,0 +1,57 @@ +
+
+

Identify Parcels Under SRW

+

Provide parcel identification and registered ownership information for each parcel.

+

*All fields are required unless stated optional.

+
+ + + Parcel #{{ parcelInd + 1 }} Details & Owner Information + + + + +
+
+ + +
+
+
+ +
+ +
+ +
+ +
+
+ +
+
+
diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.scss b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.spec.ts b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.spec.ts new file mode 100644 index 0000000000..2d71c5772a --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.spec.ts @@ -0,0 +1,60 @@ +import { HttpClient } from '@angular/common/http'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatDialog } from '@angular/material/dialog'; +import { createMock, DeepMocked } from '@golevelup/ts-jest'; +import { BehaviorSubject } from 'rxjs'; +import { NotificationParcelService } from '../../../../services/notification-parcel/notification-parcel.service'; +import { NotificationSubmissionDetailedDto } from '../../../../services/notification-submission/notification-submission.dto'; +import { ToastService } from '../../../../services/toast/toast.service'; +import { ParcelDetailsComponent } from './parcel-details.component'; + +describe('ParcelDetailsComponent', () => { + let component: ParcelDetailsComponent; + let fixture: ComponentFixture; + let mockHttpClient: DeepMocked; + let mockParcelService: DeepMocked; + let mockToastService: DeepMocked; + let mockMatDialog: DeepMocked; + let notificationPipe = new BehaviorSubject(undefined); + + beforeEach(async () => { + mockHttpClient = createMock(); + mockParcelService = createMock(); + mockToastService = createMock(); + mockMatDialog = createMock(); + + await TestBed.configureTestingModule({ + declarations: [ParcelDetailsComponent], + providers: [ + { + provide: HttpClient, + useValue: mockHttpClient, + }, + { + provide: NotificationParcelService, + useValue: mockParcelService, + }, + { + provide: ToastService, + useValue: mockToastService, + }, + { + provide: MatDialog, + useValue: mockMatDialog, + }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + + fixture = TestBed.createComponent(ParcelDetailsComponent); + component = fixture.componentInstance; + component.$notificationSubmission = notificationPipe; + + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.ts b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.ts new file mode 100644 index 0000000000..d057afd748 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-details.component.ts @@ -0,0 +1,138 @@ +import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { Router } from '@angular/router'; +import { takeUntil } from 'rxjs'; +import { + NotificationParcelDto, + NotificationParcelUpdateDto, +} from '../../../../services/notification-parcel/notification-parcel.dto'; +import { NotificationParcelService } from '../../../../services/notification-parcel/notification-parcel.service'; +import { ToastService } from '../../../../services/toast/toast.service'; +import { EditNotificationSteps } from '../edit-submission.component'; +import { StepComponent } from '../step.partial'; +import { DeleteParcelDialogComponent } from './delete-parcel/delete-parcel-dialog.component'; +import { ParcelEntryFormData } from './parcel-entry/parcel-entry.component'; + +@Component({ + selector: 'app-notification-parcel-details', + templateUrl: './parcel-details.component.html', + styleUrls: ['./parcel-details.component.scss'], +}) +export class ParcelDetailsComponent extends StepComponent implements OnInit, AfterViewInit { + @Output() componentInitialized = new EventEmitter(); + + currentStep = EditNotificationSteps.Parcel; + fileId = ''; + submissionUuid = ''; + parcels: NotificationParcelDto[] = []; + newParcelAdded = false; + isDirty = false; + expandedParcel: string = ''; + + constructor( + private router: Router, + private notificationParcelService: NotificationParcelService, + private toastService: ToastService, + private dialog: MatDialog + ) { + super(); + } + + ngOnInit(): void { + this.$notificationSubmission.pipe(takeUntil(this.$destroy)).subscribe((noiSubmission) => { + if (noiSubmission) { + this.fileId = noiSubmission.fileNumber; + this.submissionUuid = noiSubmission.uuid; + this.loadParcels(); + } + }); + + this.newParcelAdded = false; + } + + ngAfterViewInit(): void { + setTimeout((_) => this.componentInitialized.emit(true)); + } + + openParcel(index: string) { + this.expandedParcel = index; + } + + async loadParcels() { + this.parcels = (await this.notificationParcelService.fetchBySubmissionUuid(this.submissionUuid)) || []; + if (!this.parcels || this.parcels.length === 0) { + await this.onAddParcel(); + } + } + + async onAddParcel() { + const parcel = await this.notificationParcelService.create(this.submissionUuid); + + if (parcel) { + this.parcels.push({ + uuid: parcel!.uuid, + }); + this.newParcelAdded = true; + } else { + this.toastService.showErrorToast('Error adding new parcel. Please refresh page and try again.'); + } + } + + async onParcelFormChange(formData: Partial) { + const parcel = this.parcels.find((e) => e.uuid === formData.uuid); + if (!parcel) { + this.toastService.showErrorToast('Error updating the parcel. Please refresh page and try again.'); + return; + } + + this.isDirty = true; + parcel.pid = formData.pid !== undefined ? formData.pid : parcel.pid; + parcel.pin = formData.pid !== undefined ? formData.pin : parcel.pin; + parcel.civicAddress = formData.civicAddress !== undefined ? formData.civicAddress : parcel.civicAddress; + parcel.legalDescription = + formData.legalDescription !== undefined ? formData.legalDescription : parcel.legalDescription; + + parcel.mapAreaHectares = formData.mapArea !== undefined ? formData.mapArea : parcel.mapAreaHectares; + parcel.ownershipTypeCode = formData.parcelType !== undefined ? formData.parcelType : parcel.ownershipTypeCode; + } + + private async saveProgress() { + if (this.isDirty || this.newParcelAdded) { + const parcelsToUpdate: NotificationParcelUpdateDto[] = []; + for (const parcel of this.parcels) { + parcelsToUpdate.push({ + uuid: parcel.uuid, + pid: parcel.pid?.toString() || null, + pin: parcel.pin?.toString() || null, + civicAddress: parcel.civicAddress ?? null, + legalDescription: parcel.legalDescription, + mapAreaHectares: parcel.mapAreaHectares, + ownershipTypeCode: parcel.ownershipTypeCode, + }); + } + await this.notificationParcelService.update(parcelsToUpdate); + } + } + + async onSave() { + await this.saveProgress(); + } + + async onDelete(parcelUuid: string, parcelNumber: number) { + this.dialog + .open(DeleteParcelDialogComponent, { + panelClass: 'no-padding', + disableClose: true, + data: { + parcelUuid, + parcelNumber, + }, + }) + .beforeClosed() + .subscribe((result) => { + if (result) { + this.loadParcels(); + } + }); + } +} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.html b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.html new file mode 100644 index 0000000000..e7e96cb4c5 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.html @@ -0,0 +1,35 @@ + + + + + + + + + + +
+

Change Parcel Ownership Type

+
+ +
+
+ + Warning: Changing parcel ownership type will remove some inputs relevant to the current parcel. + + +
+ +
+
+ +
+
+
Are you sure you want to change parcel ownership type? This action cannot be undone.
+
+ +
+ +
+
+
diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.scss b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.scss new file mode 100644 index 0000000000..c4e03e5c59 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.scss @@ -0,0 +1,24 @@ +@use '../../../../../../../styles/functions' as *; + +.margin-bottom-1 { + margin-bottom: rem(16); +} + +.step-controls { + display: flex; + justify-content: space-between; +} + +.confirm-content { + margin: rem(24) 0; +} + +@media screen and (min-width: $desktopBreakpoint) { + .step-controls { + justify-content: flex-end; + + button { + margin-left: rem(25) !important; + } + } +} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.spec.ts b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.spec.ts new file mode 100644 index 0000000000..705f0c459e --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.spec.ts @@ -0,0 +1,35 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { ParcelEntryConfirmationDialogComponent } from './parcel-entry-confirmation-dialog.component'; + +describe('ParcelEntryConfirmationDialogComponent', () => { + let component: ParcelEntryConfirmationDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ParcelEntryConfirmationDialogComponent], + providers: [ + { + provide: MatDialog, + useValue: {}, + }, + { + provide: MatDialogRef, + useValue: {}, + }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + + fixture = TestBed.createComponent(ParcelEntryConfirmationDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.ts b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.ts new file mode 100644 index 0000000000..1a40b4b055 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component.ts @@ -0,0 +1,33 @@ +import { Component } from '@angular/core'; +import { MatDialogRef } from '@angular/material/dialog'; +import { NotificationParcelDeleteStepsEnum } from '../../delete-parcel/delete-parcel-dialog.component'; + +@Component({ + selector: 'app-parcel-entry-confirmation-dialog', + templateUrl: './parcel-entry-confirmation-dialog.component.html', + styleUrls: ['./parcel-entry-confirmation-dialog.component.scss'], +}) +export class ParcelEntryConfirmationDialogComponent { + stepIdx = 0; + + warningStep = NotificationParcelDeleteStepsEnum.warning; + confirmationStep = NotificationParcelDeleteStepsEnum.confirmation; + + constructor(private dialogRef: MatDialogRef) {} + + async next() { + this.stepIdx += 1; + } + + async back() { + this.stepIdx -= 1; + } + + async onCancel(dialogResult: boolean = false) { + this.dialogRef.close(dialogResult); + } + + async onDelete() { + this.onCancel(true); + } +} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.html b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.html new file mode 100644 index 0000000000..a10babbf69 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.html @@ -0,0 +1,136 @@ +
+
+ +
+ The answer to the following question will change the rest of the notice of intent form. Do not change this answer + once selected. +
+ + Fee Simple + Crown + +
+ warning +
This field is required
+
+
+ +
Parcel Lookup
+
+ + +
+ +
Can be found on the parcel's Certificate of Title
+ + + +
+ warning +
This field is required
+
+
+ +
+ +
The area of the entire parcel in hectares, not just the area under application.
+ + + +
+ warning +
This field is required
+
+
+ +
+ +
A unique nine-digit number found on the parcel's Certificate of Title
+ + + +
+ warning +
This field is required
+
Invalid format
+
+
+ +
+ +
Unique numeric identifier for Crown land parcels
+ + + +
+ +
+ + + + +
+ warning +
This field is required
+
+
+
+
diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.scss b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.scss new file mode 100644 index 0000000000..223b120fa2 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.scss @@ -0,0 +1,96 @@ +@use '../../../../../../styles/functions' as *; +@use '../../../../../../styles/colors'; + +.owner-option { + display: flex; + justify-content: space-between; + align-items: center; +} + +.new-owner { + margin: rem(8) 0 !important; +} + +.link-text { + color: colors.$link-color; + text-decoration: underline; +} + +.lookup-pid-fields { + display: flex; + align-items: center; + flex-direction: column; + + @media screen and (min-width: $desktopBreakpoint) { + flex-direction: row; + } +} + +.lookup-search-by { + margin-top: rem(8); + + @media screen and (min-width: $desktopBreakpoint) { + width: unset !important; + flex-grow: 1; + } +} + +.lookup-input { + margin-top: rem(8); + + @media screen and (min-width: $desktopBreakpoint) { + width: unset !important; + flex-grow: 5; + } +} + +.lookup-search-button { + width: 100%; + margin-top: rem(8) !important; + + @media screen and (min-width: $desktopBreakpoint) { + height: rem(55); + margin-top: rem(7) !important; + width: rem(150); + } +} + +.lookup-bottom-row { + display: flex; + align-items: center; + flex-direction: column; + margin-top: rem(24); + + .reset-button { + width: 100%; + margin-bottom: rem(8); + } + + @media screen and (min-width: $desktopBreakpoint) { + flex-direction: row; + justify-content: space-between; + + .reset-button { + width: unset; + } + } +} + +.crown-owner-type { + display: block; + margin-bottom: rem(24); + + .mat-mdc-radio-button ~ .mat-mdc-radio-button { + margin-left: rem(16); + } +} + +mat-button-toggle-group#isFarm { + height: rem(55); + + .mat-button-toggle { + display: flex; + align-items: center; + height: 100%; + } +} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.spec.ts b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.spec.ts new file mode 100644 index 0000000000..304dfc245d --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.spec.ts @@ -0,0 +1,62 @@ +import { HttpClient } from '@angular/common/http'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; +import { MatDialog } from '@angular/material/dialog'; +import { createMock, DeepMocked } from '@golevelup/ts-jest'; +import { NotificationParcelDto } from '../../../../../services/notification-parcel/notification-parcel.dto'; +import { NotificationParcelService } from '../../../../../services/notification-parcel/notification-parcel.service'; +import { ParcelService } from '../../../../../services/parcel/parcel.service'; +import { ParcelEntryComponent } from './parcel-entry.component'; + +describe('ParcelEntryComponent', () => { + let component: ParcelEntryComponent; + let fixture: ComponentFixture; + let mockParcelService: DeepMocked; + let mockHttpClient: DeepMocked; + let mockNotificationParcelService: DeepMocked; + + let mockParcel: NotificationParcelDto = { + uuid: '', + }; + + beforeEach(async () => { + mockParcelService = createMock(); + mockHttpClient = createMock(); + mockNotificationParcelService = createMock(); + + await TestBed.configureTestingModule({ + imports: [MatAutocompleteModule], + declarations: [ParcelEntryComponent], + providers: [ + { + provide: ParcelService, + useValue: mockParcelService, + }, + { + provide: HttpClient, + useValue: mockHttpClient, + }, + { + provide: NotificationParcelService, + useValue: mockNotificationParcelService, + }, + { + provide: MatDialog, + useValue: {}, + }, + ], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + + fixture = TestBed.createComponent(ParcelEntryComponent); + component = fixture.componentInstance; + component.parcel = mockParcel; + + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.ts b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.ts new file mode 100644 index 0000000000..8107b14e6a --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/parcels/parcel-entry/parcel-entry.component.ts @@ -0,0 +1,247 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; +import { MatButtonToggleChange } from '@angular/material/button-toggle'; +import { MatDialog } from '@angular/material/dialog'; +import { PARCEL_OWNERSHIP_TYPE } from '../../../../../services/application-parcel/application-parcel.dto'; +import { NotificationParcelDto } from '../../../../../services/notification-parcel/notification-parcel.dto'; +import { NotificationParcelService } from '../../../../../services/notification-parcel/notification-parcel.service'; +import { ParcelService } from '../../../../../services/parcel/parcel.service'; +import { ParcelEntryConfirmationDialogComponent } from './parcel-entry-confirmation-dialog/parcel-entry-confirmation-dialog.component'; + +export interface ParcelEntryFormData { + uuid: string; + legalDescription: string | undefined | null; + mapArea: string | undefined | null; + pin: string | undefined | null; + pid: string | undefined | null; + civicAddress: string | undefined | null; + parcelType: string | undefined | null; + isFarm: string | undefined | null; + purchaseDate?: Date | null; + crownLandOwnerType?: string | null; + isConfirmedByApplicant: boolean; +} + +@Component({ + selector: 'app-notification-parcel-entry[parcel][fileId][submissionUuid]', + templateUrl: './parcel-entry.component.html', + styleUrls: ['./parcel-entry.component.scss'], +}) +export class ParcelEntryComponent implements OnInit { + @Input() parcel!: NotificationParcelDto; + @Input() fileId!: string; + @Input() submissionUuid!: string; + + @Input() showErrors = false; + @Input() _disabled = false; + @Input() isDraft = false; + + @Input() + public set disabled(disabled: boolean) { + this._disabled = disabled; + this.onFormDisabled(); + } + + @Output() private onFormGroupChange = new EventEmitter>(); + @Output() private onSaveProgress = new EventEmitter(); + + searchBy = new FormControl(null); + isCrownLand: boolean | null = null; + + pidPin = new FormControl(''); + legalDescription = new FormControl(null, [Validators.required]); + mapArea = new FormControl(null, [Validators.required]); + pid = new FormControl(null, [Validators.required]); + pin = new FormControl(null); + civicAddress = new FormControl(null, [Validators.required]); + parcelType = new FormControl(null, [Validators.required]); + parcelForm = new FormGroup({ + pidPin: this.pidPin, + legalDescription: this.legalDescription, + mapArea: this.mapArea, + pin: this.pin, + pid: this.pid, + civicAddress: this.civicAddress, + parcelType: this.parcelType, + searchBy: this.searchBy, + }); + pidPinPlaceholder = ''; + + ownerInput = new FormControl(null); + + PARCEL_OWNERSHIP_TYPES = PARCEL_OWNERSHIP_TYPE; + maxPurchasedDate = new Date(); + + constructor( + private parcelService: ParcelService, + private notificationParcelService: NotificationParcelService, + private dialog: MatDialog + ) {} + + ngOnInit(): void { + this.setupForm(); + } + + async onSearch() { + let result; + if (this.searchBy.getRawValue() === 'pin') { + result = await this.parcelService.getByPin(this.pidPin.getRawValue()!); + } else { + result = await this.parcelService.getByPid(this.pidPin.getRawValue()!); + } + + this.onReset(); + if (result) { + this.legalDescription.setValue(result.legalDescription); + this.mapArea.setValue(result.mapArea); + + if (result.pin) { + this.pin.setValue(result.pin); + } + + if (result.pid) { + this.pid.setValue(result.pid); + } + + this.emitFormChangeOnSearchActions(); + } + } + + onReset() { + this.parcelForm.controls.pidPin.reset(); + this.parcelForm.controls.pid.reset(); + this.parcelForm.controls.pin.reset(); + this.parcelForm.controls.legalDescription.reset(); + this.parcelForm.controls.mapArea.reset(); + this.parcelForm.controls.civicAddress.reset(); + + this.emitFormChangeOnSearchActions(); + + if (this.showErrors) { + this.parcelForm.markAllAsTouched(); + } + } + + private emitFormChangeOnSearchActions() { + this.onFormGroupChange.emit({ + uuid: this.parcel.uuid, + legalDescription: this.legalDescription.getRawValue(), + mapArea: this.mapArea.getRawValue(), + pin: this.pin.getRawValue(), + pid: this.pid.getRawValue(), + }); + } + + onChangeParcelType($event: MatButtonToggleChange) { + const dirtyForm = + this.legalDescription.value || this.mapArea.value || this.pid.value || this.pin.value || this.civicAddress.value; + + const changeParcelType = () => { + if ($event.value === this.PARCEL_OWNERSHIP_TYPES.CROWN) { + this.searchBy.setValue(null); + this.pidPinPlaceholder = ''; + this.isCrownLand = true; + this.pid.setValidators([]); + } else { + this.searchBy.setValue('pid'); + this.pidPinPlaceholder = 'Type 9 digit PID'; + this.isCrownLand = false; + this.pid.setValidators([Validators.required]); + } + + this.pid.updateValueAndValidity(); + }; + + if (dirtyForm && this.isCrownLand !== null) { + this.dialog + .open(ParcelEntryConfirmationDialogComponent, { + panelClass: 'no-padding', + disableClose: true, + }) + .beforeClosed() + .subscribe(async (result) => { + if (result) { + this.onReset(); + return changeParcelType(); + } else { + const newParcelType = this.parcelType.getRawValue(); + + const prevParcelType = + newParcelType === this.PARCEL_OWNERSHIP_TYPES.CROWN + ? this.PARCEL_OWNERSHIP_TYPES.FEE_SIMPLE + : this.PARCEL_OWNERSHIP_TYPES.CROWN; + + this.parcelType.setValue(prevParcelType); + } + }); + } else { + return changeParcelType(); + } + } + + private setupForm() { + this.parcelForm.patchValue({ + legalDescription: this.parcel.legalDescription, + mapArea: this.parcel.mapAreaHectares, + pid: this.parcel.pid, + pin: this.parcel.pin, + civicAddress: this.parcel.civicAddress, + parcelType: this.parcel.ownershipTypeCode, + }); + + this.isCrownLand = this.parcelType.value + ? this.parcelType.getRawValue() === this.PARCEL_OWNERSHIP_TYPES.CROWN + : null; + + if (this.isCrownLand) { + this.pidPin.disable(); + this.pid.setValidators([]); + this.pidPinPlaceholder = ''; + } else { + this.pidPinPlaceholder = 'Type 9 digit PID'; + } + + if (this.showErrors) { + this.parcelForm.markAllAsTouched(); + } + + this.parcelForm.valueChanges.subscribe((formData) => { + if (!this.parcelForm.dirty) { + return; + } + + if ((this.isCrownLand && !this.searchBy.getRawValue()) || this.disabled) { + this.pidPin.disable({ + emitEvent: false, + }); + } else { + this.pidPin.enable({ + emitEvent: false, + }); + } + + return this.onFormGroupChange.emit({ + ...formData, + uuid: this.parcel.uuid, + }); + }); + } + + private onFormDisabled() { + if (this._disabled) { + this.parcelForm.disable(); + this.ownerInput.disable(); + } else { + this.parcelForm.enable(); + this.ownerInput.enable(); + } + } + + onChangeSearchBy(value: string) { + if (value === 'pid') { + this.pidPinPlaceholder = 'Type 9 digit PID'; + } else { + this.pidPinPlaceholder = 'Type PIN'; + } + } +} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/step.partial.ts b/portal-frontend/src/app/features/notifications/edit-submission/step.partial.ts index c3d7d8a6ac..519bde91dd 100644 --- a/portal-frontend/src/app/features/notifications/edit-submission/step.partial.ts +++ b/portal-frontend/src/app/features/notifications/edit-submission/step.partial.ts @@ -1,6 +1,9 @@ import { Component, EventEmitter, Input, OnDestroy, Output } from '@angular/core'; import { BehaviorSubject, Subject } from 'rxjs'; -import { NotificationSubmissionDto } from '../../../services/notification-submission/notification-submission.dto'; +import { + NotificationSubmissionDetailedDto, + NotificationSubmissionDto, +} from '../../../services/notification-submission/notification-submission.dto'; @Component({ selector: 'app-step', @@ -10,10 +13,9 @@ import { NotificationSubmissionDto } from '../../../services/notification-submis export class StepComponent implements OnDestroy { protected $destroy = new Subject(); - @Input() $notificationSubmission!: BehaviorSubject; + @Input() $notificationSubmission!: BehaviorSubject; @Input() showErrors = false; - @Input() draftMode = false; @Output() navigateToStep = new EventEmitter(); @Output() exit = new EventEmitter(); diff --git a/portal-frontend/src/app/services/notification-parcel/notification-parcel.dto.ts b/portal-frontend/src/app/services/notification-parcel/notification-parcel.dto.ts index 0e7ec19785..922b4a3f8e 100644 --- a/portal-frontend/src/app/services/notification-parcel/notification-parcel.dto.ts +++ b/portal-frontend/src/app/services/notification-parcel/notification-parcel.dto.ts @@ -8,8 +8,6 @@ export interface NotificationParcelUpdateDto { legalDescription?: string | null; mapAreaHectares?: string | null; ownershipTypeCode?: string | null; - crownLandOwnerType?: string | null; - isConfirmedByApplicant: boolean; } export interface NotificationParcelDto extends Omit { diff --git a/portal-frontend/src/app/services/notification-parcel/notification-parcel.service.ts b/portal-frontend/src/app/services/notification-parcel/notification-parcel.service.ts index 8ad3bcd735..1c35d65a57 100644 --- a/portal-frontend/src/app/services/notification-parcel/notification-parcel.service.ts +++ b/portal-frontend/src/app/services/notification-parcel/notification-parcel.service.ts @@ -32,12 +32,11 @@ export class NotificationParcelService { return undefined; } - async create(notificationSubmissionUuid: string, ownerUuid?: string) { + async create(notificationSubmissionUuid: string) { try { return await firstValueFrom( this.httpClient.post(`${this.serviceUrl}`, { - noticeOfIntentSubmissionUuid: notificationSubmissionUuid, - ownerUuid, + notificationSubmissionUuid: notificationSubmissionUuid, }) ); } catch (e) { diff --git a/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.entity.ts b/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.entity.ts index aced2c8b95..db3e0522f0 100644 --- a/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.entity.ts +++ b/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.entity.ts @@ -58,20 +58,6 @@ export class NotificationParcel extends Base { }) mapAreaHectares?: number | null; - @AutoMap(() => Boolean) - @Column({ - type: 'boolean', - comment: - 'The Parcels indication whether applicant signed off provided data including the Certificate of Title', - nullable: false, - default: false, - }) - isConfirmedByApplicant: boolean; - - @IsString() - @IsOptional() - crownLandOwnerType?: string | null; - @AutoMap(() => String) @Column({ nullable: true }) ownershipTypeCode?: string | null; diff --git a/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.service.spec.ts b/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.service.spec.ts index 17a7c1c22e..0a031358a3 100644 --- a/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.service.spec.ts +++ b/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.service.spec.ts @@ -22,7 +22,6 @@ describe('NotificationParcelService', () => { pin: 'mock_pin', legalDescription: 'mock_legalDescription', mapAreaHectares: 1, - isConfirmedByApplicant: true, notificationSubmissionUuid: mockFileNumber, ownershipTypeCode: 'mock_ownershipTypeCode', }); diff --git a/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.service.ts b/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.service.ts index 8328997211..28f3dacc19 100644 --- a/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.service.ts +++ b/services/apps/alcs/src/portal/notification-submission/notification-parcel/notification-parcel.service.ts @@ -3,7 +3,6 @@ import { forwardRef, Inject, Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { In, Repository } from 'typeorm'; import { User } from '../../../user/user.entity'; -import { filterUndefined } from '../../../utils/undefined'; import { NotificationTransfereeService } from '../notification-transferee/notification-transferee.service'; import { NotificationParcelUpdateDto } from './notification-parcel.dto'; import { NotificationParcel } from './notification-parcel.entity'; @@ -58,11 +57,7 @@ export class NotificationParcelService { parcel.legalDescription = updateDto.legalDescription; parcel.mapAreaHectares = updateDto.mapAreaHectares; parcel.civicAddress = updateDto.civicAddress; - parcel.isConfirmedByApplicant = filterUndefined( - updateDto.isConfirmedByApplicant, - parcel.isConfirmedByApplicant, - ); - parcel.crownLandOwnerType = updateDto.crownLandOwnerType; + parcel.ownershipTypeCode = updateDto.ownershipTypeCode; updatedParcels.push(parcel); } diff --git a/services/apps/alcs/src/providers/typeorm/migrations/1693940144496-clean_up_notification_parcels.ts b/services/apps/alcs/src/providers/typeorm/migrations/1693940144496-clean_up_notification_parcels.ts new file mode 100644 index 0000000000..d2f098a09c --- /dev/null +++ b/services/apps/alcs/src/providers/typeorm/migrations/1693940144496-clean_up_notification_parcels.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class cleanUpNotificationParcels1693940144496 + implements MigrationInterface +{ + name = 'cleanUpNotificationParcels1693940144496'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "alcs"."notification_parcel" DROP COLUMN "is_confirmed_by_applicant"`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "alcs"."notification_parcel" ADD "is_confirmed_by_applicant" boolean NOT NULL DEFAULT false`, + ); + } +}