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 932a741a8a..32d6dae0f4 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 @@ -1,6 +1,8 @@
-
Notice of Intent ID: {{ notificationSubmission.fileNumber }} | {{ notificationSubmission.type }}
+
+ Notification ID: {{ notificationSubmission.fileNumber }} | {{ notificationSubmission.type }} +
-
- - - help_outline - -
@@ -33,17 +26,26 @@
Notice of Intent ID: {{ notificationSubmissio
+ (exit)="onExit()" + >
-
+
+ + +
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 b4bdc31cde..9653d0b94b 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 @@ -1,6 +1,10 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; +import { MatButtonModule } from '@angular/material/button'; +import { MatIconModule } from '@angular/material/icon'; +import { MatTableModule } from '@angular/material/table'; import { RouterModule, Routes } from '@angular/router'; +import { NgxMaskPipe } from 'ngx-mask'; import { CanDeactivateGuard } from '../../../shared/guard/can-deactivate.guard'; import { SharedModule } from '../../../shared/shared.module'; import { EditSubmissionComponent } from './edit-submission.component'; @@ -9,6 +13,8 @@ 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'; +import { TransfereeDialogComponent } from './transferees/transferee-dialog/transferee-dialog.component'; +import { TransfereesComponent } from './transferees/transferees.component'; const routes: Routes = [ { @@ -30,7 +36,17 @@ const routes: Routes = [ ParcelEntryComponent, ParcelEntryConfirmationDialogComponent, DeleteParcelDialogComponent, + TransfereesComponent, + TransfereeDialogComponent, + ], + imports: [ + CommonModule, + SharedModule, + RouterModule.forChild(routes), + MatButtonModule, + MatIconModule, + MatTableModule, + NgxMaskPipe, ], - imports: [CommonModule, SharedModule, RouterModule.forChild(routes)], }) export class EditSubmissionModule {} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.html b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.html new file mode 100644 index 0000000000..74498dc2e2 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.html @@ -0,0 +1,84 @@ +
+

Add New Transferee

+

Edit Transferee

+
+
+
+
+
+ + + Individual + Organization + +
+
+ + + + +
+ warning +
This field is required
+
+
+

Organization Contact Info

+
+ + + + +
+ warning +
This field is required
+
+
+
+ + + + +
+ warning +
This field is required
+
+
+
+ + + + +
+ warning +
This field is required
+
Invalid format
+
+
+
+ + + + +
+ warning +
This field is required
+
Invalid format
+
+
+
+
+
+
+ + + +
diff --git a/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.scss b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.scss new file mode 100644 index 0000000000..2af88008a7 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.scss @@ -0,0 +1,19 @@ +@use '../../../../../../styles/functions' as *; +@use '../../../../../../styles/colors'; + +.actions { + button:not(:last-child) { + margin-right: rem(8) !important; + } +} + +:host::ng-deep { + .field-error { + color: colors.$error-color; + font-size: rem(15); + font-weight: 700; + display: flex; + align-items: center; + margin-top: rem(4); + } +} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.spec.ts b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.spec.ts new file mode 100644 index 0000000000..dacebfb382 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.spec.ts @@ -0,0 +1,48 @@ +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { createMock, DeepMocked } from '@golevelup/ts-jest'; +import { NotificationTransfereeService } from '../../../../../services/notification-transferee/notification-transferee.service'; + +import { TransfereeDialogComponent } from './transferee-dialog.component'; + +describe('TransfereeDialogComponent', () => { + let component: TransfereeDialogComponent; + let fixture: ComponentFixture; + let mockTransfereeService: DeepMocked; + + beforeEach(async () => { + mockTransfereeService = createMock(); + + await TestBed.configureTestingModule({ + providers: [ + { + provide: NotificationTransfereeService, + useValue: mockTransfereeService, + }, + { + provide: MatDialogRef, + useValue: {}, + }, + { + provide: MAT_DIALOG_DATA, + useValue: {}, + }, + { + provide: MatDialog, + useValue: {}, + }, + ], + declarations: [TransfereeDialogComponent], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + + fixture = TestBed.createComponent(TransfereeDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.ts b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.ts new file mode 100644 index 0000000000..2b9dca88b8 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferee-dialog/transferee-dialog.component.ts @@ -0,0 +1,110 @@ +import { Component, Inject } from '@angular/core'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; +import { MatButtonToggleChange } from '@angular/material/button-toggle'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { + NotificationTransfereeCreateDto, + NotificationTransfereeDto, + NotificationTransfereeUpdateDto, +} from '../../../../../services/notification-transferee/notification-transferee.dto'; +import { NotificationTransfereeService } from '../../../../../services/notification-transferee/notification-transferee.service'; +import { OWNER_TYPE } from '../../../../../shared/dto/owner.dto'; + +@Component({ + selector: 'app-transferee-dialog', + templateUrl: './transferee-dialog.component.html', + styleUrls: ['./transferee-dialog.component.scss'], +}) +export class TransfereeDialogComponent { + OWNER_TYPE = OWNER_TYPE; + type = new FormControl(OWNER_TYPE.INDIVIDUAL); + firstName = new FormControl('', [Validators.required]); + lastName = new FormControl('', [Validators.required]); + organizationName = new FormControl(''); + phoneNumber = new FormControl('', [Validators.required]); + email = new FormControl('', [Validators.required, Validators.email]); + + isEdit = false; + existingUuid: string | undefined; + + form = new FormGroup({ + type: this.type, + firstName: this.firstName, + lastName: this.lastName, + organizationName: this.organizationName, + phoneNumber: this.phoneNumber, + email: this.email, + }); + + constructor( + private dialogRef: MatDialogRef, + private transfereeService: NotificationTransfereeService, + @Inject(MAT_DIALOG_DATA) + public data: { + submissionUuid: string; + existingTransferee?: NotificationTransfereeDto; + } + ) { + if (data && data.existingTransferee) { + this.onChangeType({ + value: data.existingTransferee.type.code, + } as any); + this.isEdit = true; + this.type.setValue(data.existingTransferee.type.code); + this.firstName.setValue(data.existingTransferee.firstName); + this.lastName.setValue(data.existingTransferee.lastName); + this.organizationName.setValue(data.existingTransferee.organizationName); + this.phoneNumber.setValue(data.existingTransferee.phoneNumber); + this.email.setValue(data.existingTransferee.email); + this.existingUuid = data.existingTransferee.uuid; + } + } + + onChangeType($event: MatButtonToggleChange) { + if ($event.value === OWNER_TYPE.ORGANIZATION) { + this.organizationName.setValidators([Validators.required]); + } else { + this.organizationName.setValidators([]); + this.organizationName.reset(); + } + } + + async onCreate() { + if (!this.data.submissionUuid) { + console.error('TransfereeDialogComponent misconfigured, needs submissionUuid for create'); + return; + } + + const createDto: NotificationTransfereeCreateDto = { + organizationName: this.organizationName.getRawValue() || undefined, + firstName: this.firstName.getRawValue() || undefined, + lastName: this.lastName.getRawValue() || undefined, + email: this.email.getRawValue()!, + phoneNumber: this.phoneNumber.getRawValue()!, + typeCode: this.type.getRawValue()!, + notificationSubmissionUuid: this.data.submissionUuid, + }; + + await this.transfereeService.create(createDto); + this.dialogRef.close(true); + } + + async onClose() { + this.dialogRef.close(false); + } + + async onSave() { + const updateDto: NotificationTransfereeUpdateDto = { + organizationName: this.organizationName.getRawValue(), + firstName: this.firstName.getRawValue(), + lastName: this.lastName.getRawValue(), + email: this.email.getRawValue()!, + phoneNumber: this.phoneNumber.getRawValue()!, + typeCode: this.type.getRawValue()!, + }; + if (this.existingUuid) { + await this.transfereeService.update(this.existingUuid, updateDto); + this.dialogRef.close(true); + } + } +} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.html b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.html new file mode 100644 index 0000000000..318f8f0a10 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.html @@ -0,0 +1,89 @@ +
+

Identify Transferee(s)

+

Provide the name and contact information for all transferees who will be registered owners of the SRW.

+

*All fields are required unless stated optional.

+
+
+
+

All Transferees

+
+ + + At least one transferee is required + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type{{ element.type.code === 'INVD' ? 'Individual' : 'Organization' }}Full Name{{ element.displayName }}Organization Name + + {{ element.organizationName }} + + No Data + Phone + {{ element.phoneNumber | mask : '(000) 000-0000' }} + Email + {{ element.email }} + Actions + + +
+ No Transferee added. Use ‘Add New Transferee’ button to the right to add your first transferee. +
+
+
+
+ +
+ + +
+
diff --git a/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.scss b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.scss new file mode 100644 index 0000000000..b0180f9d5f --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.scss @@ -0,0 +1,38 @@ +@use '../../../../../styles/functions' as *; +@use '../../../../../styles/colors'; + +.no-data { + color: colors.$grey; + text-align: center; + padding: rem(8); +} + +.actions-cell { + button:not(:last-child) { + margin-right: rem(12) !important; + } +} + +.split { + margin-bottom: rem(16); +} + +@media screen and (max-width: $desktopBreakpoint) { + .table { + overflow-x: auto; + max-width: 100vw; + + table { + white-space: nowrap; + } + } + + .split { + flex-direction: column; + align-items: start; + + button { + width: 100%; + } + } +} diff --git a/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.spec.ts b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.spec.ts new file mode 100644 index 0000000000..4e99960555 --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.spec.ts @@ -0,0 +1,43 @@ +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 { NotificationSubmissionDetailedDto } from '../../../../services/notification-submission/notification-submission.dto'; +import { NotificationTransfereeService } from '../../../../services/notification-transferee/notification-transferee.service'; + +import { TransfereesComponent } from './transferees.component'; + +describe('TransfereesComponent', () => { + let component: TransfereesComponent; + let fixture: ComponentFixture; + let mockTransfereeService: DeepMocked; + + beforeEach(async () => { + mockTransfereeService = createMock(); + + await TestBed.configureTestingModule({ + providers: [ + { + provide: NotificationTransfereeService, + useValue: mockTransfereeService, + }, + { + provide: MatDialog, + useValue: {}, + }, + ], + declarations: [TransfereesComponent], + schemas: [NO_ERRORS_SCHEMA], + }).compileComponents(); + + fixture = TestBed.createComponent(TransfereesComponent); + component = fixture.componentInstance; + component.$notificationSubmission = new BehaviorSubject(undefined); + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.ts b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.ts new file mode 100644 index 0000000000..7988c8735a --- /dev/null +++ b/portal-frontend/src/app/features/notifications/edit-submission/transferees/transferees.component.ts @@ -0,0 +1,91 @@ +import { Component, OnDestroy, OnInit } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { Router } from '@angular/router'; +import { takeUntil } from 'rxjs'; +import { NotificationTransfereeDto } from '../../../../services/notification-transferee/notification-transferee.dto'; +import { NotificationTransfereeService } from '../../../../services/notification-transferee/notification-transferee.service'; +import { EditNotificationSteps } from '../edit-submission.component'; +import { StepComponent } from '../step.partial'; +import { TransfereeDialogComponent } from './transferee-dialog/transferee-dialog.component'; + +@Component({ + selector: 'app-transferees', + templateUrl: './transferees.component.html', + styleUrls: ['./transferees.component.scss'], +}) +export class TransfereesComponent extends StepComponent implements OnInit, OnDestroy { + currentStep = EditNotificationSteps.Transferees; + + transferees: NotificationTransfereeDto[] = []; + isDirty = false; + displayedColumns: string[] = ['type', 'fullName', 'organizationName', 'phone', 'email', 'actions']; + + private submissionUuid = ''; + + constructor( + private router: Router, + private notificationTransfereeService: NotificationTransfereeService, + private dialog: MatDialog + ) { + super(); + } + + ngOnInit(): void { + this.$notificationSubmission.pipe(takeUntil(this.$destroy)).subscribe((submission) => { + if (submission) { + this.submissionUuid = submission.uuid; + this.loadTransferees(submission.uuid); + } + }); + } + + protected async save() { + //Do Nothing + } + + private async loadTransferees(submissionUuid: string, primaryContactOwnerUuid?: string | null) { + const transferees = await this.notificationTransfereeService.fetchBySubmissionId(submissionUuid); + if (transferees) { + this.transferees = transferees; + } + } + + onAdd() { + this.dialog + .open(TransfereeDialogComponent, { + data: { + submissionUuid: this.submissionUuid, + }, + }) + .beforeClosed() + .subscribe((didCreate) => { + if (didCreate) { + this.loadTransferees(this.submissionUuid); + } + }); + } + + onEdit(uuid: string) { + const selectedTransferee = this.transferees.find((transferee) => transferee.uuid === uuid); + this.dialog + .open(TransfereeDialogComponent, { + data: { + submissionUuid: this.submissionUuid, + existingTransferee: selectedTransferee, + }, + }) + .beforeClosed() + .subscribe((didSave) => { + if (didSave) { + this.loadTransferees(this.submissionUuid); + } + }); + } + + async onDelete(uuid: string) { + await this.notificationTransfereeService.delete(uuid); + await this.loadTransferees(this.submissionUuid); + } + + protected readonly undefined = undefined; +} diff --git a/portal-frontend/src/app/services/notification-transferee/notification-transferee.dto.ts b/portal-frontend/src/app/services/notification-transferee/notification-transferee.dto.ts index 2f796b2fe2..a6e60023b3 100644 --- a/portal-frontend/src/app/services/notification-transferee/notification-transferee.dto.ts +++ b/portal-frontend/src/app/services/notification-transferee/notification-transferee.dto.ts @@ -3,9 +3,6 @@ import { BaseCodeDto } from '../../shared/dto/base.dto'; export enum OWNER_TYPE { INDIVIDUAL = 'INDV', ORGANIZATION = 'ORGZ', - AGENT = 'AGEN', - CROWN = 'CRWN', - GOVERNMENT = 'GOVR', } export interface OwnerTypeDto extends BaseCodeDto { @@ -24,27 +21,15 @@ export interface NotificationTransfereeDto { type: OwnerTypeDto; } -export interface NotificationOwnerUpdateDto { +export interface NotificationTransfereeUpdateDto { firstName?: string | null; lastName?: string | null; organizationName?: string | null; phoneNumber: string; email: string; typeCode: string; - corporateSummaryUuid?: string | null; } -export interface NotificationOwnerCreateDto extends NotificationOwnerUpdateDto { - noticeOfIntentSubmissionUuid: string; -} - -export interface SetPrimaryContactDto { - firstName?: string; - lastName?: string; - organization?: string; - phoneNumber?: string; - email?: string; - type?: OWNER_TYPE; - ownerUuid?: string; - noticeOfIntentSubmissionUuid: string; +export interface NotificationTransfereeCreateDto extends NotificationTransfereeUpdateDto { + notificationSubmissionUuid: string; } diff --git a/portal-frontend/src/app/services/notification-transferee/notification-transferee.service.spec.ts b/portal-frontend/src/app/services/notification-transferee/notification-transferee.service.spec.ts index bb8b61c98d..986e30a836 100644 --- a/portal-frontend/src/app/services/notification-transferee/notification-transferee.service.spec.ts +++ b/portal-frontend/src/app/services/notification-transferee/notification-transferee.service.spec.ts @@ -43,7 +43,7 @@ describe('NotificationTransfereeService', () => { expect(service).toBeTruthy(); }); - it('should make a get request for loading owners', async () => { + it('should make a get request for loading transferees', async () => { mockHttpClient.get.mockReturnValue(of({})); await service.fetchBySubmissionId(fileId); @@ -52,7 +52,7 @@ describe('NotificationTransfereeService', () => { expect(mockHttpClient.get.mock.calls[0][0]).toContain('notification-transferee'); }); - it('should show an error toast if getting owners fails', async () => { + it('should show an error toast if getting transferees fails', async () => { mockHttpClient.get.mockReturnValue(throwError(() => ({}))); await service.fetchBySubmissionId(fileId); @@ -65,7 +65,7 @@ describe('NotificationTransfereeService', () => { mockHttpClient.post.mockReturnValue(of({})); await service.create({ - noticeOfIntentSubmissionUuid: '', + notificationSubmissionUuid: '', email: '', phoneNumber: '', typeCode: '', @@ -75,11 +75,11 @@ describe('NotificationTransfereeService', () => { expect(mockHttpClient.post.mock.calls[0][0]).toContain('notification-transferee'); }); - it('should show an error toast if creating owner fails', async () => { + it('should show an error toast if creating transferee fails', async () => { mockHttpClient.post.mockReturnValue(throwError(() => ({}))); await service.create({ - noticeOfIntentSubmissionUuid: '', + notificationSubmissionUuid: '', email: '', phoneNumber: '', typeCode: '', @@ -102,7 +102,7 @@ describe('NotificationTransfereeService', () => { expect(mockHttpClient.patch.mock.calls[0][0]).toContain('notification-transferee'); }); - it('should show an error toast if updating owner fails', async () => { + it('should show an error toast if updating transferee fails', async () => { mockHttpClient.patch.mockReturnValue(throwError(() => ({}))); await service.update('', { @@ -124,7 +124,7 @@ describe('NotificationTransfereeService', () => { expect(mockHttpClient.delete.mock.calls[0][0]).toContain('notification-transferee'); }); - it('should show an error toast if delete owner fails', async () => { + it('should show an error toast if delete transferee fails', async () => { mockHttpClient.delete.mockReturnValue(throwError(() => ({}))); await service.delete(''); @@ -132,58 +132,4 @@ describe('NotificationTransfereeService', () => { expect(mockHttpClient.delete).toHaveBeenCalledTimes(1); expect(mockToastService.showErrorToast).toHaveBeenCalledTimes(1); }); - - it('should make a post request for removeFromParcel', async () => { - mockHttpClient.post.mockReturnValue(of({})); - - await service.removeFromParcel('', ''); - - expect(mockHttpClient.post).toHaveBeenCalledTimes(1); - expect(mockHttpClient.post.mock.calls[0][0]).toContain('notification-transferee'); - }); - - it('should show an error toast if removeFromParcel', async () => { - mockHttpClient.post.mockReturnValue(throwError(() => ({}))); - - await service.removeFromParcel('', ''); - - expect(mockHttpClient.post).toHaveBeenCalledTimes(1); - expect(mockToastService.showErrorToast).toHaveBeenCalledTimes(1); - }); - - it('should make a post request for linkToParcel', async () => { - mockHttpClient.post.mockReturnValue(of({})); - - await service.linkToParcel('', ''); - - expect(mockHttpClient.post).toHaveBeenCalledTimes(1); - expect(mockHttpClient.post.mock.calls[0][0]).toContain('notification-transferee'); - }); - - it('should show an error toast if linkToParcel', async () => { - mockHttpClient.post.mockReturnValue(throwError(() => ({}))); - - await service.linkToParcel('', ''); - - expect(mockHttpClient.post).toHaveBeenCalledTimes(1); - expect(mockToastService.showErrorToast).toHaveBeenCalledTimes(1); - }); - - it('should make a post request for setPrimaryContact', async () => { - mockHttpClient.post.mockReturnValue(of({})); - - await service.setPrimaryContact({ noticeOfIntentSubmissionUuid: '' }); - - expect(mockHttpClient.post).toHaveBeenCalledTimes(1); - expect(mockHttpClient.post.mock.calls[0][0]).toContain('notification-transferee'); - }); - - it('should show an error toast if setPrimaryContact', async () => { - mockHttpClient.post.mockReturnValue(throwError(() => ({}))); - - await service.setPrimaryContact({ noticeOfIntentSubmissionUuid: '' }); - - expect(mockHttpClient.post).toHaveBeenCalledTimes(1); - expect(mockToastService.showErrorToast).toHaveBeenCalledTimes(1); - }); }); diff --git a/portal-frontend/src/app/services/notification-transferee/notification-transferee.service.ts b/portal-frontend/src/app/services/notification-transferee/notification-transferee.service.ts index f5ea226734..6493cf3d0c 100644 --- a/portal-frontend/src/app/services/notification-transferee/notification-transferee.service.ts +++ b/portal-frontend/src/app/services/notification-transferee/notification-transferee.service.ts @@ -2,14 +2,11 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { firstValueFrom } from 'rxjs'; import { environment } from '../../../environments/environment'; -import { DOCUMENT_SOURCE, DOCUMENT_TYPE } from '../../shared/dto/document.dto'; -import { DocumentService } from '../document/document.service'; import { ToastService } from '../toast/toast.service'; import { - NotificationOwnerCreateDto, + NotificationTransfereeCreateDto, NotificationTransfereeDto, - NotificationOwnerUpdateDto, - SetPrimaryContactDto, + NotificationTransfereeUpdateDto, } from './notification-transferee.dto'; @Injectable({ @@ -18,11 +15,7 @@ import { export class NotificationTransfereeService { private serviceUrl = `${environment.apiUrl}/notification-transferee`; - constructor( - private httpClient: HttpClient, - private toastService: ToastService, - private documentService: DocumentService - ) {} + constructor(private httpClient: HttpClient, private toastService: ToastService) {} async fetchBySubmissionId(submissionUuid: string) { try { return await firstValueFrom( @@ -30,87 +23,44 @@ export class NotificationTransfereeService { ); } catch (e) { console.error(e); - this.toastService.showErrorToast('Failed to load Owners, please try again later'); + this.toastService.showErrorToast('Failed to load Transferees, please try again later'); } return undefined; } - async create(dto: NotificationOwnerCreateDto) { + async create(dto: NotificationTransfereeCreateDto) { try { const res = await firstValueFrom(this.httpClient.post(`${this.serviceUrl}`, dto)); - this.toastService.showSuccessToast('Owner created'); + this.toastService.showSuccessToast('Transferee created'); return res; } catch (e) { console.error(e); - this.toastService.showErrorToast('Failed to create Owner, please try again later'); + this.toastService.showErrorToast('Failed to create Transferee, please try again later'); return undefined; } } - async update(uuid: string, updateDto: NotificationOwnerUpdateDto) { + async update(uuid: string, updateDto: NotificationTransfereeUpdateDto) { try { const res = await firstValueFrom( this.httpClient.patch(`${this.serviceUrl}/${uuid}`, updateDto) ); - this.toastService.showSuccessToast('Owner saved'); + this.toastService.showSuccessToast('Transferee saved'); return res; } catch (e) { console.error(e); - this.toastService.showErrorToast('Failed to update Owner, please try again later'); + this.toastService.showErrorToast('Failed to update Transferee, please try again later'); return undefined; } } - - async setPrimaryContact(updateDto: SetPrimaryContactDto) { - try { - const res = await firstValueFrom( - this.httpClient.post(`${this.serviceUrl}/setPrimaryContact`, updateDto) - ); - this.toastService.showSuccessToast('Notice of Intent saved'); - return res; - } catch (e) { - console.error(e); - this.toastService.showErrorToast('Failed to update Notice of Intent, please try again later'); - return undefined; - } - } - async delete(uuid: string) { try { const result = await firstValueFrom(this.httpClient.delete(`${this.serviceUrl}/${uuid}`)); - this.toastService.showSuccessToast('Owner deleted'); + this.toastService.showSuccessToast('Transferees deleted'); return result; } catch (e) { console.error(e); - this.toastService.showErrorToast('Failed to delete Owner, please try again'); - } - return undefined; - } - - async removeFromParcel(ownerUuid: string, parcelUuid: string) { - try { - const result = await firstValueFrom( - this.httpClient.post(`${this.serviceUrl}/${ownerUuid}/unlink/${parcelUuid}`, {}) - ); - this.toastService.showSuccessToast('Owner removed from parcel'); - return result; - } catch (e) { - console.error(e); - this.toastService.showErrorToast('Failed to remove Owner, please try again'); - } - return undefined; - } - - async linkToParcel(ownerUuid: any, parcelUuid: string) { - try { - const result = await firstValueFrom( - this.httpClient.post(`${this.serviceUrl}/${ownerUuid}/link/${parcelUuid}`, {}) - ); - this.toastService.showSuccessToast('Owner linked to parcel'); - return result; - } catch (e) { - console.error(e); - this.toastService.showErrorToast('Failed to link Owner, please try again'); + this.toastService.showErrorToast('Failed to delete Transferee, please try again'); } return undefined; } @@ -124,20 +74,4 @@ export class NotificationTransfereeService { } return 0; } - - async uploadCorporateSummary(noticeOfIntentFileId: string, file: File) { - try { - return await this.documentService.uploadFile<{ uuid: string }>( - noticeOfIntentFileId, - file, - DOCUMENT_TYPE.CORPORATE_SUMMARY, - DOCUMENT_SOURCE.APPLICANT, - `${this.serviceUrl}/attachCorporateSummary` - ); - } catch (e) { - console.error(e); - this.toastService.showErrorToast('Failed to attach document to Owner, please try again'); - } - return undefined; - } } diff --git a/portal-frontend/src/styles.scss b/portal-frontend/src/styles.scss index 2ead013f21..4dfc2c171f 100644 --- a/portal-frontend/src/styles.scss +++ b/portal-frontend/src/styles.scss @@ -48,6 +48,13 @@ a { align-items: center; } +.split { + display: flex; + align-content: center; + justify-content: space-between; + align-items: center; +} + .no-padding .mat-dialog-container { padding: 0; } diff --git a/services/apps/alcs/src/portal/notification-submission/notification-transferee/notification-transferee.controller.ts b/services/apps/alcs/src/portal/notification-submission/notification-transferee/notification-transferee.controller.ts index 1262329846..bbac88444a 100644 --- a/services/apps/alcs/src/portal/notification-submission/notification-transferee/notification-transferee.controller.ts +++ b/services/apps/alcs/src/portal/notification-submission/notification-transferee/notification-transferee.controller.ts @@ -27,7 +27,7 @@ import { import { NotificationTransferee } from './notification-transferee.entity'; import { NotificationTransfereeService } from './notification-transferee.service'; -@Controller('srw-transferee') +@Controller('notification-transferee') @UseGuards(PortalAuthGuard) export class NotificationTransfereeController { constructor(