Skip to content

Commit

Permalink
Merge pull request #1341 from bcgov/develop
Browse files Browse the repository at this point in the history
Deployment PR - 879
  • Loading branch information
dhaselhan authored Jan 29, 2024
2 parents 5f42516 + bd2e139 commit 9eae8cc
Show file tree
Hide file tree
Showing 57 changed files with 282 additions and 190 deletions.
3 changes: 1 addition & 2 deletions alcs-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ WORKDIR /app
COPY package.json .

# Install dependencies
# TODO: Replace with ci when fixed - https://github.com/ng-select/ng-select/issues/2111
RUN npm install --legacy-peer-deps
RUN npm install

# Copy the source code to the /app directory
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion alcs-frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This project was generated with [Angular CLI](https://github.com/angular/angular

## Run alcs

Run `npm install --legacy-peer-deps`
Run `npm install`
Run `npm run start`

## Code scaffolding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export class AuthenticationService {
} catch (e) {
if (e instanceof HttpErrorResponse && e.status === 401) {
//Take user to login
//TODO: Can we use something other than e.error?
const targetUrl = window.location.href;
localStorage.setItem('targetUrl', targetUrl);
window.location.href = e.error;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
WITH appl_components_grouped AS (
SELECT oaa.alr_application_id
SELECT *
FROM oats.alcs_etl_applications_nois oaa
WHERE oaa.application_class_code IN ('LOA', 'BLK', 'SCH', 'NAN')
and oaa.alr_change_code <> 'SRW'
Expand All @@ -26,5 +26,5 @@ SELECT oaa.alr_application_id,
oaa.legacy_application_nbr,
oaa.submitted_to_alc_date
FROM appl_components_grouped acg
JOIN oats.oats_alr_appl_components oaac ON oaac.alr_application_id = acg.alr_application_id
JOIN oats.oats_alr_appl_components oaac ON oaac.alr_appl_component_id = acg.alr_appl_component_id
JOIN oats.oats_alr_applications oaa ON oaa.alr_application_id = acg.alr_application_id
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def init_application_parcels(conn=None, batch_size=BATCH_UPLOAD_SIZE):
last_subject_property_id = 0

with open(
"applications/submissions/sql/parcels/application_parcels_insert.sql",
"applications/submissions/sql/parcels/application_parcels_insert.sql",
"r",
encoding="utf-8",
) as sql_file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ def _map_data(row):
def _get_name(row):
first_name = row.get("first_name", "")
middle_name = row.get("middle_name", "")
return f"{first_name} {middle_name}".strip()
name = f"{first_name} {middle_name}".strip()
if row.get("organization_name") and name == "None":
return None
return name


@inject_conn_pool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
WITH appl_components_grouped AS (
SELECT oaa.alr_application_id
SELECT *
FROM oats.alcs_etl_applications_nois oaa
WHERE oaa.application_class_code IN ('LOA', 'BLK', 'SCH', 'NAN')
and oaa.alr_change_code <> 'SRW'
Expand Down Expand Up @@ -36,7 +36,7 @@ SELECT aa.file_number,
oa.ministry_notice_ind
FROM appl_components_grouped acg
LEFT JOIN alcs.application aa ON aa.file_number = acg.alr_application_id::TEXT
JOIN oats.oats_alr_appl_components oc ON acg.alr_application_id = oc.alr_application_id
JOIN oats.oats_alr_appl_components oc ON acg.alr_appl_component_id = oc.alr_appl_component_id
JOIN oats.oats_alr_applications oa ON acg.alr_application_id = oa.alr_application_id
LEFT JOIN alcs."user" au ON oa.created_guid = au.bceid_guid
WHERE aa.type_code <> 'SRW'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- this script selects difference between fields that do not require mapping
WITH apps_with_one_or_zero_component_only AS (
SELECT oaa.alr_application_id
SELECT *
FROM oats.alcs_etl_applications_nois oaa
WHERE oaa.application_class_code IN ('LOA', 'BLK', 'SCH', 'NAN')
and oaa.alr_change_code <> 'SRW'
Expand Down Expand Up @@ -30,7 +30,7 @@ oats_app_data AS (
JOIN oats.oats_alr_applications oaa ON oaa.alr_application_id = oats_asub.alr_application_id
AND oaa.application_class_code in ('LOA', 'BLK', 'SCH', 'NAN')
AND oaac.alr_change_code <> 'SRW'
JOIN oats.oats_alr_appl_components oaac ON oaac.alr_application_id = oats_asub.alr_application_id
JOIN oats.oats_alr_appl_components oaac ON oaac.alr_appl_component_id = oats_asub.alr_appl_component_id
)
SELECT oats_app.alr_application_id,
as2.purpose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ def _map_data(row):
def _get_name(row):
first_name = row.get("first_name", "")
middle_name = row.get("middle_name", "")
return f"{first_name} {middle_name}".strip()
name = f"{first_name} {middle_name}".strip()
if row.get("organization_name") and name == "None":
return None
return name


@inject_conn_pool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
WITH nois_with_one_or_zero_component_only AS (
SELECT oaa.alr_application_id
SELECT *
FROM oats.alcs_etl_applications_nois oaa
WHERE oaa.application_class_code = 'NOI'
and oaa.alr_change_code <> 'SRW'
Expand All @@ -9,4 +9,4 @@ FROM alcs.notice_of_intent noi
JOIN nois_with_one_or_zero_component_only oats_noi ON oats_noi.alr_application_id::TEXT = noi.file_number
JOIN oats.oats_alr_applications oaa ON oaa.alr_application_id = oats_noi.alr_application_id
AND oaa.application_class_code = 'NOI'
JOIN oats.oats_alr_appl_components oaac ON oaac.alr_application_id = oats_noi.alr_application_id;
JOIN oats.oats_alr_appl_components oaac ON oaac.alr_appl_component_id = oats_noi.alr_appl_component_id;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
WITH nois_with_one_or_zero_component_only AS (
SELECT oaa.alr_application_id
SELECT *
FROM oats.alcs_etl_applications_nois oaa
WHERE oaa.application_class_code = 'NOI'
and oaa.alr_change_code <> 'SRW'
Expand All @@ -25,4 +25,4 @@ FROM alcs.notice_of_intent noi
JOIN nois_with_one_or_zero_component_only oats_noi ON oats_noi.alr_application_id::TEXT = noi.file_number
JOIN oats.oats_alr_applications oaa ON oaa.alr_application_id = oats_noi.alr_application_id
AND oaa.application_class_code = 'NOI'
JOIN oats.oats_alr_appl_components oaac ON oaac.alr_application_id = oats_noi.alr_application_id
JOIN oats.oats_alr_appl_components oaac ON oaac.alr_appl_component_id = oats_noi.alr_appl_component_id
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- this script selects difference between fields that do not require mapping
WITH nois_with_one_or_zero_component_only AS (
SELECT oaa.alr_application_id
SELECT *
FROM oats.alcs_etl_applications_nois oaa
WHERE oaa.application_class_code = 'NOI'
and oaa.alr_change_code <> 'SRW'
Expand All @@ -23,7 +23,7 @@ oats_noi_data AS (
JOIN nois_with_one_or_zero_component_only oats_noi ON oats_noi.alr_application_id::TEXT = noi.file_number
JOIN oats.oats_alr_applications oaa ON oaa.alr_application_id = oats_noi.alr_application_id
AND oaa.application_class_code = 'NOI'
JOIN oats.oats_alr_appl_components oaac ON oaac.alr_application_id = oats_noi.alr_application_id
JOIN oats.oats_alr_appl_components oaac ON oaac.alr_appl_component_id = oats_noi.alr_appl_component_id
)
SELECT oats_noi.alr_application_id,
noi.alr_area,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
WITH noi_components_grouped AS (
SELECT oaa.alr_application_id
SELECT *
FROM oats.alcs_etl_applications_nois oaa
WHERE oaa.application_class_code = 'NOI'
and oaa.alr_change_code <> 'SRW'
Expand All @@ -14,4 +14,4 @@ SELECT noi.file_number,
oc.alr_appl_component_id
FROM noi_components_grouped noig
LEFT JOIN alcs.notice_of_intent noi ON noi.file_number = noig.alr_application_id::TEXT
JOIN oats.oats_alr_appl_components oc ON noig.alr_application_id = oc.alr_application_id
JOIN oats.oats_alr_appl_components oc ON noig.alr_appl_component_id = oc.alr_appl_component_id
1 change: 0 additions & 1 deletion portal-frontend/src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
margin: rem(12) rem(36) !important;
}

// TODO: this is just a placeholder and will be addressed later
@media screen and (min-width: $desktopBreakpoint) {
margin: rem(18) rem(80) !important;
}
Expand Down
1 change: 0 additions & 1 deletion portal-frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit {
// TODO: remove this dragon once deployment is done
title = 'portal-frontend';

showHeaderFooter = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div class="subheading2 grid-1">How many hectares are proposed for non-farm use?</div>
<div class="grid-double">
{{ applicationSubmission.nfuHectares }} <span *ngIf="applicationSubmission.nfuHectares">ha</span>
<app-no-data [showRequired]="showErrors" *ngIf="applicationSubmission.nfuHectares === null"></app-no-data>
</div>
<div class="subheading2 grid-1">What is the purpose of the proposal?</div>
<div class="grid-double">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@
</div>
</div>

<div class="subheading2 grid-1">Describe the type, origin and quality of fill proposed to be placed.</div>
<div class="grid-double">
{{ _applicationSubmission.soilFillTypeToPlace }}
<app-no-data [showRequired]="showErrors" *ngIf="!_applicationSubmission.soilFillTypeToPlace"></app-no-data>
</div>

<div class="subheading2 grid-1">
What alternative measures have you considered or attempted before proposing to place fill?
</div>
Expand All @@ -119,12 +125,6 @@
<app-no-data [showRequired]="showErrors" *ngIf="!_applicationSubmission.soilAlternativeMeasures"></app-no-data>
</div>

<div class="subheading2 grid-1">Describe the type, origin and quality of fill proposed to be placed.</div>
<div class="grid-double">
{{ _applicationSubmission.soilFillTypeToPlace }}
<app-no-data [showRequired]="showErrors" *ngIf="!_applicationSubmission.soilFillTypeToPlace"></app-no-data>
</div>

<div class="subheading2 grid-1">What steps will be taken to reduce impacts to surrounding agricultural land?</div>
<div class="grid-double">
{{ _applicationSubmission.soilReduceNegativeImpacts }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export class ParcelDetailsComponent extends StepComponent implements OnInit, Aft
});
}
await this.applicationParcelService.update(parcelsToUpdate);
//TODO: Do we need to reload submission?
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ <h3 *ngIf="selectedLocalGovernment">
<label for="authorization-letter" class="subheading2">Authorization Letters</label>
<p class="subtext">
For privately owned Fee Simple parcels, the letter must be signed by all individual landowners and the
majority of directors within the organization.For Crown parcels or Fee Simple parcels owned by a government,
majority of directors within the organization. For Crown parcels or Fee Simple parcels owned by a government,
the letter must be signed by senior level staff.
</p>
<app-info-banner>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ <h2>Proposal</h2>
<mat-form-field appearance="outline">
<textarea
formControlName="farmImpact"
#purposeText
#farmImpactText
maxlength="4000"
id="farmImpact"
matInput
Expand All @@ -158,7 +158,7 @@ <h2>Proposal</h2>
<mat-icon>warning</mat-icon>
<div *ngIf="farmImpact.errors?.['required']">This field is required</div>
</div>
<div class="subtext">Characters left: {{ 4000 - purposeText.textLength }}</div>
<div class="subtext">Characters left: {{ 4000 - farmImpactText.textLength }}</div>
</div>
<div class="full-row">
<mat-label class="subheading2" for="proposal-map">Proposal Map / Site Plan</mat-label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ <h3>Notification and Public Hearing Requirements</h3>
>
page on the ALC website for more information.
</app-info-banner>
<button mat-flat-button color="accent">Download PDF</button>
<button (click)="onDownloadPdf()" mat-flat-button color="accent">Download PDF</button>
<app-warning-banner>
You will not be able to complete the remaining portion of the application until the notification and public hearing
process is complete.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialog } from '@angular/material/dialog';
import { Router } from '@angular/router';
import { DeepMocked, createMock } from '@golevelup/ts-jest';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { BehaviorSubject } from 'rxjs';
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 { ApplicationSubmissionService } from '../../../../../services/application-submission/application-submission.service';
import { PdfGenerationService } from '../../../../../services/pdf-generation/pdf-generation.service';
import { ToastService } from '../../../../../services/toast/toast.service';

import { ExclProposalComponent } from './excl-proposal.component';
Expand All @@ -17,12 +17,12 @@ describe('ExclProposalComponent', () => {
let fixture: ComponentFixture<ExclProposalComponent>;
let mockApplicationService: DeepMocked<ApplicationSubmissionService>;
let mockAppDocumentService: DeepMocked<ApplicationDocumentService>;
let mockRouter: DeepMocked<Router>;
let mockPdfGenerationService: DeepMocked<PdfGenerationService>;

beforeEach(async () => {
mockApplicationService = createMock();
mockAppDocumentService = createMock();
mockRouter = createMock();
mockPdfGenerationService = createMock();

await TestBed.configureTestingModule({
providers: [
Expand All @@ -35,8 +35,8 @@ describe('ExclProposalComponent', () => {
useValue: mockAppDocumentService,
},
{
provide: Router,
useValue: mockRouter,
provide: PdfGenerationService,
useValue: mockPdfGenerationService,
},
{
provide: MatDialog,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { Router } from '@angular/router';
import { takeUntil } from 'rxjs';
import { ApplicationDocumentDto } from '../../../../../services/application-document/application-document.dto';
import { ApplicationDocumentService } from '../../../../../services/application-document/application-document.service';
import { ApplicationSubmissionUpdateDto } from '../../../../../services/application-submission/application-submission.dto';
import { ApplicationSubmissionService } from '../../../../../services/application-submission/application-submission.service';
import { PdfGenerationService } from '../../../../../services/pdf-generation/pdf-generation.service';
import { ToastService } from '../../../../../services/toast/toast.service';
import { DOCUMENT_TYPE } from '../../../../../shared/dto/document.dto';
import { FileHandle } from '../../../../../shared/file-drag-drop/drag-drop.directive';
Expand Down Expand Up @@ -48,8 +48,8 @@ export class ExclProposalComponent extends FilesStepComponent implements OnInit,
reportOfPublicHearing: ApplicationDocumentDto[] = [];

constructor(
private router: Router,
private applicationSubmissionService: ApplicationSubmissionService,
private pdfGenerationService: PdfGenerationService,
applicationDocumentService: ApplicationDocumentService,
dialog: MatDialog,
toastService: ToastService
Expand Down Expand Up @@ -116,6 +116,10 @@ export class ExclProposalComponent extends FilesStepComponent implements OnInit,
this.showReportOfPublicHearingVirus = !res;
}

async onDownloadPdf() {
await this.pdfGenerationService.generateAppSubmission(this.fileId);
}

protected async save() {
if (this.fileId && this.form.dirty) {
const inclExclHectares = this.hectares.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h2>Proposal</h2>
placeholder="Type comment"
></textarea>
</mat-form-field>
<span class="subtext">Characters left: {{ 4000 - purposeText.textLength }}</span>
<div class="subtext">Characters left: {{ 4000 - purposeText.textLength }}</div>
<div *ngIf="purpose.invalid && (purpose.dirty || purpose.touched)" class="field-error">
<mat-icon>warning</mat-icon>
<div *ngIf="purpose.errors?.['required']">This field is required</div>
Expand Down Expand Up @@ -403,6 +403,13 @@ <h2>Proposal</h2>
</mat-button-toggle>
</mat-button-toggle-group>
</div>
<div
*ngIf="isExtractionOrMining.invalid && (isExtractionOrMining.dirty || isExtractionOrMining.touched)"
class="field-error"
>
<mat-icon>warning</mat-icon>
<div *ngIf="isExtractionOrMining.errors?.['required']">This field is required</div>
</div>
</div>

<div class="full-row">
Expand Down Expand Up @@ -435,6 +442,13 @@ <h2>Proposal</h2>
</mat-button-toggle>
</mat-button-toggle-group>
</div>
<div
*ngIf="hasSubmittedNotice.invalid && (hasSubmittedNotice.dirty || hasSubmittedNotice.touched)"
class="field-error"
>
<mat-icon>warning</mat-icon>
<div *ngIf="hasSubmittedNotice.errors?.['required']">This field is required</div>
</div>
</div>

<div class="full-row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h2>Proposal</h2>
<div *ngIf="fillTypeToPlace.errors?.['required']">This field is required</div>
</div>
<mat-hint class="subtext">Example: Aggregate, topsoil, structural fill, sand, gravel, etc</mat-hint>
<span class="subtext">Characters left: {{ 4000 - fillTypeToPlaceText.textLength }}</span>
<div class="subtext">Characters left: {{ 4000 - fillTypeToPlaceText.textLength }}</div>
</div>
<div class="full-row">
<label for="alternativeMeasures">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ <h2>Proposal</h2>
/>
<span *ngIf="lotsProposed.value" matTextSuffix>lots</span>
</mat-form-field>
<div *ngIf="purpose.invalid && (purpose.dirty || purpose.touched)" class="field-error">
<div *ngIf="lotsProposed.invalid && (lotsProposed.dirty || lotsProposed.touched)" class="field-error">
<mat-icon>warning</mat-icon>
<div *ngIf="purpose.errors?.['required']">This field is required</div>
<div *ngIf="lotsProposed.errors?.['required']">This field is required</div>
</div>
<mat-hint class="subtext">
Example: If the proposal is to subdivide a 5 ha lot with road dedication from a 20 ha parcel, the total number
Expand Down
Loading

0 comments on commit 9eae8cc

Please sign in to comment.