Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Local Government options for LG Users #799

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@ <h3>3. Primary Contact</h3>
<app-no-data [showRequired]="showErrors" *ngIf="!primaryContact?.lastName"></app-no-data>
</div>
<div class="subheading2 grid-1">
<span *ngIf="primaryContact?.type?.code !== APPLICATION_OWNER.CROWN">Organization (optional)</span>
<span
*ngIf="
primaryContact?.type?.code !== APPLICATION_OWNER.CROWN &&
primaryContact?.type?.code !== APPLICATION_OWNER.GOVERNMENT
"
>Organization (optional)</span
>
<span *ngIf="primaryContact?.type?.code === APPLICATION_OWNER.CROWN">Ministry/Department Responsible</span>
<span *ngIf="primaryContact?.type?.code === APPLICATION_OWNER.GOVERNMENT">Department</span>
</div>
<div class="grid-double">
{{ primaryContact?.organizationName }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ export class ApplicationDetailsComponent implements OnInit, OnDestroy {
if (app) {
this.primaryContact = app.owners.find((owner) => owner.uuid === app.primaryContactOwnerUuid);
this.populateLocalGovernment(app.localGovernmentUuid);
this.needsAuthorizationLetter = !(
app.owners.length === 1 && app.owners[0].type.code === APPLICATION_OWNER.INDIVIDUAL
);

this.needsAuthorizationLetter =
!(this.primaryContact?.type.code === APPLICATION_OWNER.GOVERNMENT) &&
!(
app.owners.length === 1 &&
(app.owners[0].type.code === APPLICATION_OWNER.INDIVIDUAL ||
app.owners[0].type.code === APPLICATION_OWNER.GOVERNMENT)
);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export class OtherParcelsComponent extends StepComponent implements OnInit, OnDe
this.application = application;
this.fileId = application.fileNumber;
this.submissionUuid = application.uuid;
const nonAgentOwners = application.owners.filter((owner) => owner.type.code !== APPLICATION_OWNER.AGENT);
const nonAgentOwners = application.owners.filter(
(owner) => ![APPLICATION_OWNER.AGENT, APPLICATION_OWNER.GOVERNMENT].includes(owner.type.code)
);
this.owners = nonAgentOwners.map((o) => ({
...o,
parcels: o.parcels.filter((p) => p.parcelType === PARCEL_TYPE.OTHER),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ApplicationOwnerDto, APPLICATION_OWNER } from '../../../../services/application-owner/application-owner.dto';
import { APPLICATION_OWNER, ApplicationOwnerDto } from '../../../../services/application-owner/application-owner.dto';
import { ApplicationOwnerService } from '../../../../services/application-owner/application-owner.service';

@Component({
Expand Down Expand Up @@ -31,7 +31,9 @@ export class ApplicationOwnersDialogComponent {
async onUpdated() {
const updatedOwners = await this.applicationOwnerService.fetchBySubmissionId(this.submissionUuid);
if (updatedOwners) {
this.owners = updatedOwners.filter((owner) => owner.type.code !== APPLICATION_OWNER.AGENT);
this.owners = updatedOwners.filter(
(owner) => ![APPLICATION_OWNER.AGENT, APPLICATION_OWNER.GOVERNMENT].includes(owner.type.code)
);
this.isDirty = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export class ParcelDetailsComponent extends StepComponent implements OnInit, Aft
this.fileId = applicationSubmission.fileNumber;
this.submissionUuid = applicationSubmission.uuid;
this.loadParcels();
const nonAgentOwners = applicationSubmission.owners.filter(
(owner) => owner.type.code !== APPLICATION_OWNER.AGENT
const parcelOwners = applicationSubmission.owners.filter(
(owner) => ![APPLICATION_OWNER.AGENT, APPLICATION_OWNER.GOVERNMENT].includes(owner.type.code)
);
this.$owners.next(nonAgentOwners);
this.$owners.next(parcelOwners);
}
});

Expand Down Expand Up @@ -159,8 +159,10 @@ export class ParcelDetailsComponent extends StepComponent implements OnInit, Aft
async onOwnersUpdated() {
const owners = await this.applicationOwnerService.fetchBySubmissionId(this.submissionUuid);
if (owners) {
const nonAgentOwners = owners.filter((owner) => owner.type.code !== APPLICATION_OWNER.AGENT);
this.$owners.next(nonAgentOwners);
const parcelOwners = owners.filter(
(owner) => ![APPLICATION_OWNER.AGENT, APPLICATION_OWNER.GOVERNMENT].includes(owner.type.code)
);
this.$owners.next(parcelOwners);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<div class="step-description">
<h2>Primary Contact</h2>
<p>Select from the listed parcel owners or identify a third party agent</p>
<p *ngIf="!isLocalGovernmentUser">Select from the listed parcel owners or identify a third party agent</p>
<p *ngIf="isLocalGovernmentUser">
Identify staff from the local or first nation government listed below or a third-party agent to act as the primary
contact.
</p>
<p>*All fields are required unless stated optional.</p>
<div class="step-documents">
<h6>Documents needed for this step:</h6>
<ul>
<li>Authorization Letter (if applicable)</li>
<li>Authorization Letters (if applicable)</li>
</ul>
</div>
</div>
<section>
<div class="contacts">
<ng-container *ngFor="let owner of nonAgentOwners">
<ng-container *ngFor="let owner of parcelOwners">
<h5>{{ owner.displayName }}</h5>
<button
(click)="onSelectOwner(owner.uuid)"
Expand All @@ -24,7 +28,20 @@ <h5>{{ owner.displayName }}</h5>
</button>
<div class="selected" *ngIf="owner.uuid === selectedOwnerUuid"><mat-icon>check</mat-icon>Primary Contact</div>
</ng-container>
<h5>Third Party Agent on behalf of Owner(s)</h5>
<ng-container *ngIf="isLocalGovernmentUser">
<h5>{{governmentName}} Staff</h5>
<button
(click)="onSelectGovernment()"
*ngIf="!selectedLocalGovernment"
color="primary"
[ngClass]="{ 'mat-error': !selectedOwnerUuid && showErrors }"
mat-stroked-button
>
Make Primary Contact
</button>
<div class="selected" *ngIf="selectedLocalGovernment"><mat-icon>check</mat-icon>Primary Contact</div>
</ng-container>
<h5>Third-Party Agent</h5>
<button
*ngIf="!selectedThirdPartyAgent"
color="primary"
Expand Down Expand Up @@ -66,8 +83,9 @@ <h4>Primary Contact Information</h4>
</div>
</div>
<div class="full-row">
<label *ngIf="!isCrownOwner" for="orgName">Organization Name (optional)</label>
<label *ngIf="!isCrownOwner && !selectedLocalGovernment" for="orgName">Organization Name (optional)</label>
<label *ngIf="isCrownOwner" for="orgName">Ministry or Department</label>
<label *ngIf="selectedLocalGovernment" for="orgName">Department</label>
<mat-form-field appearance="outline">
<input id="orgName" matInput placeholder="Enter Organization Name" formControlName="organizationName" />
</mat-form-field>
Expand Down Expand Up @@ -109,19 +127,25 @@ <h4>Primary Contact Information</h4>
<h4>Primary Contact Authorization Letters</h4>
<div>
An authorization letter must be provided if:
<ol>
<li>the parcel under application is owned by more than one person;</li>
<li>the parcel(s) is owned by an organization; or</li>
<li>the parcel(s) is owned by a corporation (private, Crown, local government, First Nations); or</li>
<li>the application is being submitted by a third-party agent on behalf of the land owner(s)</li>
</ol>
<p>
The authorization letter must be signed by all individual land owners and the majority of directors in
organization land owners listed in Step 1. Please consult the Supporting Documentation page of ALC website for
further instruction and an Authorization Letter template.
</p>
<ng-container *ngIf="!isLocalGovernmentUser">
<ol>
<li>the parcel under application is owned by more than one person;</li>
<li>the parcel(s) is owned by an organization; or</li>
<li>the parcel(s) is owned by a corporation (private, Crown, local government, First Nations); or</li>
<li>the application is being submitted by a third-party agent on behalf of the land owner(s)</li>
</ol>
<p>
The authorization letter must be signed by all individual land owners and the majority of directors in
organization land owners listed in Step 1. Please consult the Supporting Documentation page of ALC website for
further instruction and an Authorization Letter template.
</p>
</ng-container>
<ng-container *ngIf="isLocalGovernmentUser">
An authorization letter must be provided only if the application is being submitted by a third-party agent. Please
consult the Supporting Documentation page of the <a>TODO: FIX THIS: ALC website</a> for further instruction.
</ng-container>
</div>
<h6>Authorization Letters</h6>
<h6>Authorization Letters (if applicable)</h6>
<div class="uploader">
<app-file-drag-drop
[allowMultiple]="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { ApplicationDocumentService } from '../../../services/application-docume
import { ApplicationOwnerService } from '../../../services/application-owner/application-owner.service';
import { ApplicationSubmissionDetailedDto } from '../../../services/application-submission/application-submission.dto';
import { ApplicationSubmissionService } from '../../../services/application-submission/application-submission.service';
import { UserDto } from '../../../services/authentication/authentication.dto';
import { AuthenticationService } from '../../../services/authentication/authentication.service';

import { PrimaryContactComponent } from './primary-contact.component';

Expand All @@ -17,13 +19,17 @@ describe('PrimaryContactComponent', () => {
let mockAppService: DeepMocked<ApplicationSubmissionService>;
let mockAppDocumentService: DeepMocked<ApplicationDocumentService>;
let mockAppOwnerService: DeepMocked<ApplicationOwnerService>;
let mockAuthService: DeepMocked<AuthenticationService>;

let applicationDocumentPipe = new BehaviorSubject<ApplicationDocumentDto[]>([]);

beforeEach(async () => {
mockAppService = createMock();
mockAppDocumentService = createMock();
mockAppOwnerService = createMock();
mockAuthService = createMock();

mockAuthService.$currentProfile = new BehaviorSubject<UserDto | undefined>(undefined);

await TestBed.configureTestingModule({
providers: [
Expand All @@ -43,6 +49,10 @@ describe('PrimaryContactComponent', () => {
provide: MatDialog,
useValue: {},
},
{
provide: AuthenticationService,
useValue: mockAuthService,
},
],
declarations: [PrimaryContactComponent],
schemas: [NO_ERRORS_SCHEMA],
Expand Down
Loading