-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1040 from bcgov/feature/ALCS-1176
Add Public Notification View
- Loading branch information
Showing
50 changed files
with
1,779 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
portal-frontend/src/app/features/public/notification/alc-review/alc-review.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div> | ||
<div class="header"> | ||
<h3>ALC Review and Decision</h3> | ||
</div> | ||
<div> | ||
<app-submission-documents [documents]="documents"></app-submission-documents> | ||
</div> | ||
</div> |
8 changes: 8 additions & 0 deletions
8
portal-frontend/src/app/features/public/notification/alc-review/alc-review.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
25 changes: 25 additions & 0 deletions
25
portal-frontend/src/app/features/public/notification/alc-review/alc-review.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { NO_ERRORS_SCHEMA } from '@angular/core'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { PublicAlcReviewComponent } from './alc-review.component'; | ||
|
||
describe('PublicAlcReviewComponent', () => { | ||
let component: PublicAlcReviewComponent; | ||
let fixture: ComponentFixture<PublicAlcReviewComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
providers: [], | ||
declarations: [PublicAlcReviewComponent], | ||
schemas: [NO_ERRORS_SCHEMA], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(PublicAlcReviewComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
portal-frontend/src/app/features/public/notification/alc-review/alc-review.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { ApplicationPortalDecisionDto } from '../../../../services/application-decision/application-decision.dto'; | ||
import { PublicNoticeOfIntentSubmissionDto } from '../../../../services/public/public-notice-of-intent.dto'; | ||
import { PublicNotificationSubmissionDto } from '../../../../services/public/public-notification.dto'; | ||
import { PublicDocumentDto } from '../../../../services/public/public.dto'; | ||
|
||
@Component({ | ||
selector: 'app-public-alc-review', | ||
templateUrl: './alc-review.component.html', | ||
styleUrls: ['./alc-review.component.scss'], | ||
}) | ||
export class PublicAlcReviewComponent { | ||
@Input() documents!: PublicDocumentDto[]; | ||
|
||
constructor() {} | ||
} |
43 changes: 43 additions & 0 deletions
43
...s/public/notification/alc-review/submission-documents/submission-documents.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
25 changes: 25 additions & 0 deletions
25
...s/public/notification/alc-review/submission-documents/submission-documents.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
35 changes: 35 additions & 0 deletions
35
...ublic/notification/alc-review/submission-documents/submission-documents.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { PublicService } from '../../../../../services/public/public.service'; | ||
|
||
import { PublicSubmissionDocumentsComponent } from './submission-documents.component'; | ||
|
||
describe('PublicSubmissionDocumentsComponent', () => { | ||
let component: PublicSubmissionDocumentsComponent; | ||
let fixture: ComponentFixture<PublicSubmissionDocumentsComponent>; | ||
let mockPublicService: DeepMocked<PublicService>; | ||
|
||
beforeEach(async () => { | ||
mockPublicService = createMock(); | ||
|
||
await TestBed.configureTestingModule({ | ||
declarations: [PublicSubmissionDocumentsComponent], | ||
providers: [ | ||
{ | ||
provide: PublicService, | ||
useValue: mockPublicService, | ||
}, | ||
], | ||
schemas: [NO_ERRORS_SCHEMA], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(PublicSubmissionDocumentsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
56 changes: 56 additions & 0 deletions
56
...res/public/notification/alc-review/submission-documents/submission-documents.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; | ||
import { MatSort } from '@angular/material/sort'; | ||
import { MatTableDataSource } from '@angular/material/table'; | ||
import { Subject } from 'rxjs'; | ||
import { PublicNoticeOfIntentSubmissionDto } from '../../../../../services/public/public-notice-of-intent.dto'; | ||
import { PublicDocumentDto } from '../../../../../services/public/public.dto'; | ||
import { PublicService } from '../../../../../services/public/public.service'; | ||
|
||
@Component({ | ||
selector: 'app-submission-documents', | ||
templateUrl: './submission-documents.component.html', | ||
styleUrls: ['./submission-documents.component.scss'], | ||
}) | ||
export class PublicSubmissionDocumentsComponent implements OnInit, OnDestroy { | ||
private $destroy = new Subject<void>(); | ||
|
||
displayedColumns: string[] = ['type', 'fileName', 'source', 'uploadedAt', 'actions']; | ||
@Input() documents!: PublicDocumentDto[]; | ||
@Input() submission!: PublicNoticeOfIntentSubmissionDto; | ||
|
||
@ViewChild(MatSort) sort!: MatSort; | ||
dataSource: MatTableDataSource<PublicDocumentDto> = new MatTableDataSource<PublicDocumentDto>(); | ||
|
||
constructor(private publicService: PublicService) {} | ||
|
||
ngOnInit(): void { | ||
this.dataSource = new MatTableDataSource(this.documents); | ||
} | ||
|
||
async openFile(uuid: string) { | ||
const res = await this.publicService.getNoticeOfIntentOpenFileUrl(this.submission.fileNumber, uuid); | ||
if (res) { | ||
window.open(res.url, '_blank'); | ||
} | ||
} | ||
|
||
async downloadFile(uuid: string) { | ||
const res = await this.publicService.getNoticeOfIntentOpenFileUrl(this.submission.fileNumber, uuid); | ||
if (res) { | ||
const downloadLink = document.createElement('a'); | ||
downloadLink.href = res.url; | ||
downloadLink.download = res.url.split('/').pop()!; | ||
if (window.webkitURL == null) { | ||
downloadLink.onclick = (event: MouseEvent) => document.body.removeChild(<Node>event.target); | ||
downloadLink.style.display = 'none'; | ||
document.body.appendChild(downloadLink); | ||
} | ||
downloadLink.click(); | ||
} | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.$destroy.next(); | ||
this.$destroy.complete(); | ||
} | ||
} |
Oops, something went wrong.