From 1d914f38c1311afd58b3da8abce31fa77407577b Mon Sep 17 00:00:00 2001 From: Daniel Haselhan Date: Tue, 15 Aug 2023 16:11:49 -0700 Subject: [PATCH] Add Proposal map to NFU Submissions * Add to Step 6 and Step 8 * Add to ALCS --- .../application-details.component.html | 1 + .../naru-details/naru-details.component.html | 8 +++-- .../naru-details/naru-details.component.ts | 2 +- .../nfu-details/nfu-details.component.html | 8 +++++ .../nfu-details/nfu-details.component.spec.ts | 12 ++++++-- .../nfu-details/nfu-details.component.ts | 17 ++++++++++- .../application-details.component.html | 6 ++-- .../naru-details.component.spec.ts | 7 ----- .../nfu-details/nfu-details.component.html | 7 +++++ .../nfu-details/nfu-details.component.spec.ts | 16 ++++++++-- .../nfu-details/nfu-details.component.ts | 15 +++++++++- .../edit-submission.component.html | 1 + .../nfu-proposal/nfu-proposal.component.html | 13 +++++++++ .../nfu-proposal.component.spec.ts | 12 ++++++++ .../nfu-proposal/nfu-proposal.component.ts | 29 ++++++++++++++----- ...pplication-submission-validator.service.ts | 18 +++++++++++- 16 files changed, 140 insertions(+), 32 deletions(-) diff --git a/alcs-frontend/src/app/features/application/applicant-info/application-details/application-details.component.html b/alcs-frontend/src/app/features/application/applicant-info/application-details/application-details.component.html index 56625b34d5..1777a072b9 100644 --- a/alcs-frontend/src/app/features/application/applicant-info/application-details/application-details.component.html +++ b/alcs-frontend/src/app/features/application/applicant-info/application-details/application-details.component.html @@ -149,6 +149,7 @@

Proposal

Proposal Map / Site Plan
diff --git a/alcs-frontend/src/app/features/application/applicant-info/application-details/naru-details/naru-details.component.ts b/alcs-frontend/src/app/features/application/applicant-info/application-details/naru-details/naru-details.component.ts index 23d8f536c5..94a33a8f5a 100644 --- a/alcs-frontend/src/app/features/application/applicant-info/application-details/naru-details/naru-details.component.ts +++ b/alcs-frontend/src/app/features/application/applicant-info/application-details/naru-details/naru-details.component.ts @@ -26,7 +26,7 @@ export class NaruDetailsComponent { proposalMap: ApplicationDocumentDto[] = []; - constructor(private router: Router, private applicationDocumentService: ApplicationDocumentService) {} + constructor(private applicationDocumentService: ApplicationDocumentService) {} async openFile(file: ApplicationDocumentDto) { await this.applicationDocumentService.download(file.uuid, file.fileName); diff --git a/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.html b/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.html index 97fbb7bff9..2e25f03054 100644 --- a/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.html +++ b/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.html @@ -18,6 +18,14 @@
{{ applicationSubmission.nfuAgricultureSupport }}
+
Proposal Map / Site Plan
+
Do you need to import any fill to construct or conduct the proposed Non-farm use? Fill is any material brought onto the property, including gravel for construction. diff --git a/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.spec.ts b/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.spec.ts index c89c5c5448..e20167bde4 100644 --- a/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.spec.ts +++ b/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.spec.ts @@ -1,4 +1,5 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ApplicationDocumentService } from '../../../../../services/application/application-document/application-document.service'; import { NfuDetailsComponent } from './nfu-details.component'; @@ -8,9 +9,14 @@ describe('NfuDetailsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ NfuDetailsComponent ] - }) - .compileComponents(); + providers: [ + { + provide: ApplicationDocumentService, + useValue: {}, + }, + ], + declarations: [NfuDetailsComponent], + }).compileComponents(); fixture = TestBed.createComponent(NfuDetailsComponent); component = fixture.componentInstance; diff --git a/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.ts b/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.ts index c7f3561504..6d878a899c 100644 --- a/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.ts +++ b/alcs-frontend/src/app/features/application/applicant-info/application-details/nfu-details/nfu-details.component.ts @@ -1,5 +1,8 @@ import { Component, Input } from '@angular/core'; +import { ApplicationDocumentDto } from '../../../../../services/application/application-document/application-document.dto'; +import { ApplicationDocumentService } from '../../../../../services/application/application-document/application-document.service'; import { ApplicationSubmissionDto } from '../../../../../services/application/application.dto'; +import { DOCUMENT_TYPE } from '../../../../../shared/document/document.dto'; @Component({ selector: 'app-nfu-details[applicationSubmission]', @@ -9,5 +12,17 @@ import { ApplicationSubmissionDto } from '../../../../../services/application/ap export class NfuDetailsComponent { @Input() applicationSubmission!: ApplicationSubmissionDto; - constructor() {} + @Input() set files(documents: ApplicationDocumentDto[] | undefined) { + if (documents) { + this.proposalMap = documents.filter((document) => document.type?.code === DOCUMENT_TYPE.PROPOSAL_MAP); + } + } + + proposalMap: ApplicationDocumentDto[] = []; + + constructor(private applicationDocumentService: ApplicationDocumentService) {} + + async openFile(file: ApplicationDocumentDto) { + await this.applicationDocumentService.download(file.uuid, file.fileName); + } } diff --git a/portal-frontend/src/app/features/applications/application-details/application-details.component.html b/portal-frontend/src/app/features/applications/application-details/application-details.component.html index de1ad9841b..20d8ac1cab 100644 --- a/portal-frontend/src/app/features/applications/application-details/application-details.component.html +++ b/portal-frontend/src/app/features/applications/application-details/application-details.component.html @@ -41,10 +41,7 @@

3. Primary Contact

Organization (optional) Ministry/Department Responsible @@ -242,6 +239,7 @@

6. Proposal

[showEdit]="showEdit" [draftMode]="draftMode" [applicationSubmission]="applicationSubmission" + [applicationDocuments]="appDocuments" [updatedFields]="updatedFields" > { let component: NaruDetailsComponent; let fixture: ComponentFixture; let mockAppDocumentService: DeepMocked; - let mockAppParcelService: DeepMocked; beforeEach(async () => { - mockAppParcelService = createMock(); mockAppDocumentService = createMock(); await TestBed.configureTestingModule({ @@ -22,10 +19,6 @@ describe('PofoDetailsComponent', () => { provide: ApplicationDocumentService, useValue: mockAppDocumentService, }, - { - provide: ApplicationParcelService, - useValue: mockAppParcelService, - }, ], }).compileComponents(); diff --git a/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.html b/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.html index 339409f445..5dcc330bc5 100644 --- a/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.html +++ b/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.html @@ -32,6 +32,13 @@ {{ applicationSubmission.nfuAgricultureSupport }}
+
Proposal Map / Site Plan
+
Do you need to import any fill to construct or conduct the proposed Non-farm use? Fill is any material brought onto the property, including gravel for construction. diff --git a/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.spec.ts b/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.spec.ts index c89c5c5448..0083d0c979 100644 --- a/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.spec.ts +++ b/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.spec.ts @@ -1,16 +1,26 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { createMock, DeepMocked } from '@golevelup/ts-jest'; +import { ApplicationDocumentService } from '../../../../services/application-document/application-document.service'; import { NfuDetailsComponent } from './nfu-details.component'; describe('NfuDetailsComponent', () => { let component: NfuDetailsComponent; let fixture: ComponentFixture; + let mockAppDocumentService: DeepMocked; beforeEach(async () => { + mockAppDocumentService = createMock(); + await TestBed.configureTestingModule({ - declarations: [ NfuDetailsComponent ] - }) - .compileComponents(); + declarations: [NfuDetailsComponent], + providers: [ + { + provide: ApplicationDocumentService, + useValue: mockAppDocumentService, + }, + ], + }).compileComponents(); fixture = TestBed.createComponent(NfuDetailsComponent); component = fixture.componentInstance; diff --git a/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.ts b/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.ts index 5a4f0a54d4..2479a231f3 100644 --- a/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.ts +++ b/portal-frontend/src/app/features/applications/application-details/nfu-details/nfu-details.component.ts @@ -1,6 +1,9 @@ import { Component, Input } from '@angular/core'; import { Router } from '@angular/router'; +import { ApplicationDocumentDto } from '../../../../services/application-document/application-document.dto'; +import { ApplicationDocumentService } from '../../../../services/application-document/application-document.service'; import { ApplicationSubmissionDetailedDto } from '../../../../services/application-submission/application-submission.dto'; +import { DOCUMENT_TYPE } from '../../../../shared/dto/document.dto'; @Component({ selector: 'app-nfu-details[applicationSubmission]', @@ -13,8 +16,13 @@ export class NfuDetailsComponent { @Input() showEdit = true; @Input() draftMode = false; @Input() updatedFields: string[] = []; + proposalMap: ApplicationDocumentDto[] = []; - constructor(private router: Router) {} + @Input() set applicationDocuments(documents: ApplicationDocumentDto[]) { + this.proposalMap = documents.filter((document) => document.type?.code === DOCUMENT_TYPE.PROPOSAL_MAP); + } + + constructor(private router: Router, private applicationDocumentService: ApplicationDocumentService) {} async onEditSection(step: number) { if (this.draftMode) { @@ -25,4 +33,9 @@ export class NfuDetailsComponent { await this.router.navigateByUrl(`application/${this.applicationSubmission?.fileNumber}/edit/${step}?errors=t`); } } + + async openFile(uuid: string) { + const res = await this.applicationDocumentService.openFile(uuid); + window.open(res?.url, '_blank'); + } } diff --git a/portal-frontend/src/app/features/applications/edit-submission/edit-submission.component.html b/portal-frontend/src/app/features/applications/edit-submission/edit-submission.component.html index 704d34ef5f..269d5d3ebb 100644 --- a/portal-frontend/src/app/features/applications/edit-submission/edit-submission.component.html +++ b/portal-frontend/src/app/features/applications/edit-submission/edit-submission.component.html @@ -96,6 +96,7 @@
Proposal
Characters left: {{ 4000 - agricultureSupportText.textLength }}
+
+ +
A visual representation of your proposal.
+ +