Skip to content

Commit

Permalink
View Public App Submissions
Browse files Browse the repository at this point in the history
* Viewing of Public App Submissions and Documents
* New Module and Pages Created
  • Loading branch information
Daniel Haselhan committed Oct 4, 2023
1 parent b348604 commit 905890e
Show file tree
Hide file tree
Showing 79 changed files with 4,321 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
</section>
<section>
<h3>3. Primary Contact</h3>
<app-warning-banner *ngIf="draftMode" class="full-row">
Changes made to this section will not be flagged as
</app-warning-banner>
<div *ngIf="applicationSubmission" class="review-table">
<div class="subheading2 grid-1">Type</div>
<div class="grid-double">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ApplicationDocumentService } from '../../../../services/application-doc

import { NaruDetailsComponent } from './naru-details.component';

describe('PofoDetailsComponent', () => {
describe('NaruDetailsComponent', () => {
let component: NaruDetailsComponent;
let fixture: ComponentFixture<NaruDetailsComponent>;
let mockAppDocumentService: DeepMocked<ApplicationDocumentService>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ApplicationDocumentService } from '../../../../services/application-doc

import { TurDetailsComponent } from './tur-details.component';

describe('NfuDetailsComponent', () => {
describe('TurDetailsComponent', () => {
let component: TurDetailsComponent;
let fixture: ComponentFixture<TurDetailsComponent>;
let mockAppDocumentService: DeepMocked<ApplicationDocumentService>;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<div *ngIf="application">
<div class="header">
<h3>ALC Review and Decision</h3>
<div>
<button
[routerLink]="'/application/' + application.fileNumber + '/edit'"
*ngIf="application.canEdit"
mat-flat-button
color="primary"
>
Edit Application
</button>
<button *ngIf="application.canReview" (click)="onReview(application.fileNumber)" mat-flat-button color="primary">
Review Application
</button>
</div>
</div>
<div
*ngIf="
application.status.code === SUBMISSION_STATUS.IN_PROGRESS ||
application.status.code === SUBMISSION_STATUS.IN_REVIEW_BY_LG ||
application.status.code === SUBMISSION_STATUS.INCOMPLETE ||
application.status.code === SUBMISSION_STATUS.WRONG_GOV ||
application.status.code === SUBMISSION_STATUS.SUBMITTED_TO_LG
"
class="warning"
>
This section will update after the application is submitted to the ALC.
</div>
<div *ngIf="application.status.code === SUBMISSION_STATUS.REFUSED_TO_FORWARD_LG" class="warning">
Application not subject to Agricultural Land Commission review.
</div>
<div
*ngIf="
application.status.code === SUBMISSION_STATUS.SUBMITTED_TO_ALC ||
application.status.code === SUBMISSION_STATUS.SUBMITTED_TO_ALC_INCOMPLETE ||
application.status.code === SUBMISSION_STATUS.RECEIVED_BY_ALC ||
application.status.code === SUBMISSION_STATUS.IN_REVIEW_BY_ALC ||
application.status.code === SUBMISSION_STATUS.ALC_DECISION
"
>
<app-decisions [fileNumber]="application.fileNumber"></app-decisions>
<app-submission-documents [$applicationDocuments]="$applicationDocuments"></app-submission-documents>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@use '../../../../../styles/functions' as *;
@use '../../../../../styles/colors';

.warning {
background-color: rgba(colors.$accent-color-light, 0.5);
padding: rem(16);
margin-bottom: rem(24);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { ApplicationSubmissionReviewService } from '../../../../services/application-submission-review/application-submission-review.service';

import { AlcReviewComponent } from './alc-review.component';

describe('AlcsReviewComponent', () => {
let component: AlcReviewComponent;
let fixture: ComponentFixture<AlcReviewComponent>;
let mockAppReviewService: DeepMocked<ApplicationSubmissionReviewService>;

beforeEach(async () => {
mockAppReviewService = createMock();

await TestBed.configureTestingModule({
providers: [
{
provide: ApplicationSubmissionReviewService,
useValue: mockAppReviewService,
},
],
declarations: [AlcReviewComponent],
}).compileComponents();

fixture = TestBed.createComponent(AlcReviewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { BehaviorSubject, Subject, takeUntil } from 'rxjs';
import { ApplicationDocumentDto } from '../../../../services/application-document/application-document.dto';
import { ApplicationSubmissionReviewService } from '../../../../services/application-submission-review/application-submission-review.service';
import {
SUBMISSION_STATUS,
ApplicationSubmissionDetailedDto,
} from '../../../../services/application-submission/application-submission.dto';

@Component({
selector: 'app-alc-review',
templateUrl: './alc-review.component.html',
styleUrls: ['./alc-review.component.scss'],
})
export class AlcReviewComponent implements OnInit, OnDestroy {
private $destroy = new Subject<void>();

@Input() $application = new BehaviorSubject<ApplicationSubmissionDetailedDto | undefined>(undefined);
@Input() $applicationDocuments = new BehaviorSubject<ApplicationDocumentDto[]>([]);

application: ApplicationSubmissionDetailedDto | undefined;
SUBMISSION_STATUS = SUBMISSION_STATUS;

constructor(private applicationReviewService: ApplicationSubmissionReviewService, private router: Router) {}

ngOnInit(): void {
this.$application.pipe(takeUntil(this.$destroy)).subscribe((application) => {
this.application = application;
});
}

ngOnDestroy(): void {
this.$destroy.next();
this.$destroy.complete();
}

async onReview(fileId: string) {
if (this.application?.status.code === SUBMISSION_STATUS.SUBMITTED_TO_LG) {
const review = await this.applicationReviewService.startReview(fileId);
if (!review) {
return;
}
}
await this.router.navigateByUrl(`application/${fileId}/review`);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div *ngFor="let decision of decisions; let index = index">
<h4>Decision #{{ decisions.length - index }}</h4>
<div class="decision-table">
<div>
<div class="subheading2">Decision Date</div>
{{ decision.date | momentFormat }}
</div>

<div>
<div class="subheading2">Resolution Number</div>
#{{ decision.resolutionNumber }}/{{ decision.resolutionYear }}
</div>

<div>
<div class="subheading2">Decision Outcome</div>
{{ decision.outcome.label }} {{ decision.isSubjectToConditions ? '- Subject to Conditions' : '' }}
</div>

<div>
<div class="subheading2">Decision Document</div>
<div *ngFor="let document of decision.documents">
<a (click)="openFile(document.uuid)">{{ document.fileName }}</a>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@use '../../../../../../styles/functions' as *;
@use '../../../../../../styles/colors';

.decision-table {
padding: rem(8);
margin: rem(12) 0 rem(20) 0;
background-color: colors.$grey-light;
display: grid;
grid-row-gap: rem(24);
grid-column-gap: rem(16);
grid-template-columns: 100%;
word-wrap: break-word;
hyphens: auto;

@media screen and (min-width: $tabletBreakpoint) {
padding: rem(16);
margin: rem(24) 0 rem(40) 0;
grid-template-columns: 50% 50%;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createMock } from '@golevelup/ts-jest';
import { ApplicationDecisionService } from '../../../../../services/application-decision/application-decision.service';

import { DecisionsComponent } from './decisions.component';

describe('DecisionsComponent', () => {
let component: DecisionsComponent;
let fixture: ComponentFixture<DecisionsComponent>;
let mockDecisionService: ApplicationDecisionService;

beforeEach(async () => {
mockDecisionService = createMock();

await TestBed.configureTestingModule({
declarations: [DecisionsComponent],
providers: [
{
provide: ApplicationDecisionService,
useValue: mockDecisionService,
},
],
}).compileComponents();

fixture = TestBed.createComponent(DecisionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { ApplicationPortalDecisionDto } from '../../../../../services/application-decision/application-decision.dto';
import { ApplicationDecisionService } from '../../../../../services/application-decision/application-decision.service';

@Component({
selector: 'app-decisions[fileNumber]',
templateUrl: './decisions.component.html',
styleUrls: ['./decisions.component.scss'],
})
export class DecisionsComponent implements OnInit, OnChanges {
@Input() fileNumber = '';
decisions: ApplicationPortalDecisionDto[] = [];

constructor(private decisionService: ApplicationDecisionService) {}

ngOnInit(): void {
this.loadDecisions();
}

ngOnChanges(changes: SimpleChanges): void {
this.loadDecisions();
}

async openFile(uuid: string) {
const res = await this.decisionService.openFile(uuid);
if (res) {
window.open(res.url, '_blank');
}
}

private async loadDecisions() {
if (this.fileNumber) {
const decisions = await this.decisionService.getByFileId(this.fileNumber);
if (decisions) {
this.decisions = decisions;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<h4>Application Documents</h4>
<div class='table-container'>
<table mat-table [dataSource]='dataSource' matSort class='mat-elevation-z3 documents'>
<ng-container matColumnDef='type'>
<th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription='Sort by type'>Type</th>
<td mat-cell *matCellDef='let element'>
{{ element.type?.label }}
</td>
</ng-container>

<ng-container matColumnDef='fileName'>
<th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription='Sort by name'>Document Name</th>
<td mat-cell *matCellDef='let element'>
<a (click)='openFile(element.uuid)'>{{ element.fileName }}</a>
</td>
</ng-container>

<ng-container matColumnDef='source'>
<th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription='Sort by source'>Source</th>
<td mat-cell *matCellDef='let element'>{{ element.source }}</td>
</ng-container>

<ng-container matColumnDef='uploadedAt'>
<th mat-header-cell *matHeaderCellDef mat-sort-header sortActionDescription='Sort by date'>Upload Date</th>
<td mat-cell *matCellDef='let element'>{{ element.uploadedAt | date }}</td>
</ng-container>

<ng-container matColumnDef='actions'>
<th mat-header-cell *matHeaderCellDef>Actions</th>
<td mat-cell *matCellDef='let element'>
<button mat-icon-button (click)='downloadFile(element.uuid)'>
<mat-icon>file_download</mat-icon>
</button>
</td>
</ng-container>

<tr mat-header-row *matHeaderRowDef='displayedColumns'></tr>
<tr mat-row *matRowDef='let row; columns: displayedColumns'></tr>
<tr class='mat-row' *matNoDataRow>
<td class='text-center' colspan='6'>Documents will be visible here once provided by ALC</td>
</tr>
</table>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@use '../../../../../../styles/colors';
@use '../../../../../../styles/functions' as *;

.header {
display: flex;
justify-content: space-between;
}

.table-container {
margin: rem(4);
overflow-x: auto;
}

.documents {
margin-top: rem(12);
}

.mat-mdc-no-data-row {
height: rem(56);
color: colors.$grey-dark;
}

a {
word-break: break-all;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { ApplicationDocumentService } from '../../../../../services/application-document/application-document.service';

import { SubmissionDocumentsComponent } from './submission-documents.component';

describe('SubmissionDocumentsComponent', () => {
let component: SubmissionDocumentsComponent;
let fixture: ComponentFixture<SubmissionDocumentsComponent>;
let mockAppDocService: DeepMocked<ApplicationDocumentService>;

beforeEach(async () => {
mockAppDocService = createMock();

await TestBed.configureTestingModule({
declarations: [SubmissionDocumentsComponent],
providers: [
{
provide: ApplicationDocumentService,
useValue: mockAppDocService,
},
],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents();

fixture = TestBed.createComponent(SubmissionDocumentsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit 905890e

Please sign in to comment.