Skip to content

Commit

Permalink
Merge pull request #1840 from bcgov/develop
Browse files Browse the repository at this point in the history
Deployment PR - 1295
  • Loading branch information
Abradat authored Sep 11, 2024
2 parents 6c4462c + 1a4301c commit e77b7ff
Show file tree
Hide file tree
Showing 84 changed files with 1,152 additions and 1,408 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<div class="application">
<app-details-header [application]="application" heading="Application" days="Business Days"></app-details-header>
<section class="content">
<app-commissioner-decisions
*ngIf="application?.decisions"
[applicationDecisions]="application?.decisions!"
></app-commissioner-decisions>
<app-document
*ngIf="fileNumber"
[fileNumber]="fileNumber"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<div *ngFor="let decision of applicationDecisions; let index = index">
<h4>Decision #{{ applicationDecisions.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 class="full-width">
<div class="subheading2">Decision Summary</div>
{{ decision.decisionDescription }}
</div>

<div class="full-width">
<div class="subheading2">Decision Document</div>
<div class="document split" *ngFor="let document of decision.documents">
<div>
<a (click)="openFile(decision, document)">{{ document.fileName }}</a>
&nbsp;({{ document.fileSize! | filesize }})
</div>
<button class="center" mat-button (click)="openFile(decision, document)">
<mat-icon>file_download</mat-icon>
Download
</button>
</div>
<div class="document responsive left" *ngFor="let document of decision.documents">
<div class="document-name">
<a (click)="openFile(decision, document)">{{ document.fileName }}</a>
</div>
<div class="split">
<div>{{ document.fileSize! | filesize }}</div>
<button class="center" mat-button (click)="openFile(decision, document)">
<mat-icon>file_download</mat-icon>
Download
</button>
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@use '../../../../../styles/colors.scss';

.decision-table {
padding: 16px;
margin: 24px 0 40px 0;
background-color: colors.$grey-light;
display: grid;
grid-row-gap: 24px;
grid-column-gap: 16px;
grid-template-columns: 100%;
word-wrap: break-word;
hyphens: auto;
grid-template-columns: 49% 49%;
.full-width {
grid-column: 1/3;
}
}

.document {
display: none;
padding: 9px 16px;
border-radius: 4px;
border: 1px solid colors.$grey;
background: colors.$white;
margin: 8px 0;
display: flex;
}

.responsive {
display: none;
}

.document-name {
padding: 6px 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component, Input, type OnInit } from '@angular/core';
import { CommissionerDecisionDto } from '../../../../services/commissioner/commissioner.dto';
import { ApplicationDocumentService } from '../../../../services/application/application-document/application-document.service';
import { ApplicationDecisionV2Service } from '../../../../services/application/decision/application-decision-v2/application-decision-v2.service';
import { ApplicationDocumentDto } from '../../../../services/application/application-document/application-document.dto';

@Component({
selector: 'app-commissioner-decisions',
templateUrl: './commissioner-decisions.component.html',
styleUrl: './commissioner-decisions.component.scss',
})
export class CommissionerDecisionsComponent {
@Input() applicationDecisions: CommissionerDecisionDto[] = [];
constructor(private decisionService: ApplicationDecisionV2Service) {}

async openFile(decision: CommissionerDecisionDto, file: ApplicationDocumentDto) {
const res = await this.decisionService.downloadFile(decision.uuid, file.uuid, file.fileName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SharedModule } from '../../shared/shared.module';
import { PlanningReviewModule } from '../planning-review/planning-review.module';
import { CommissionerApplicationComponent } from './application/commissioner-application.component';
import { CommissionerPlanningReviewComponent } from './planning-review/commissioner-planning-review.component';
import { CommissionerDecisionsComponent } from './application/commissioner-decisions/commissioner-decisions.component';

const routes: Routes = [
{
Expand All @@ -18,7 +19,7 @@ const routes: Routes = [
];

@NgModule({
declarations: [CommissionerApplicationComponent, CommissionerPlanningReviewComponent],
imports: [CommonModule, SharedModule, PlanningReviewModule, RouterModule.forChild(routes)],
declarations: [CommissionerApplicationComponent, CommissionerPlanningReviewComponent, CommissionerDecisionsComponent],
imports: [CommonModule, SharedModule, PlanningReviewModule, RouterModule.forChild(routes), SharedModule],
})
export class CommissionerModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
<ng-container matColumnDef="type">
<th class="type-cell" mat-header-cell *matHeaderCellDef>Type</th>
<td mat-cell class="type-cell" *matCellDef="let element">
<ng-container *ngIf="!element.appType" class="center">
-
</ng-container>
<ng-container *ngIf="!element.appType" class="center"> - </ng-container>
<app-application-type-pill [useShortLabel]="true" *ngIf="element.appType" [type]="element.appType">
</app-application-type-pill>
<app-application-type-pill
Expand Down Expand Up @@ -53,6 +51,11 @@
<td mat-cell *matCellDef="let element" [innerHTML]="element.card.status.label"></td>
</ng-container>

<ng-container matColumnDef="subtaskDays">
<th class="subtask-days-cell" mat-header-cell *matHeaderCellDef>Subtask Days</th>
<td mat-cell *matCellDef="let element" [innerHTML]="element.subtaskDays"></td>
</ng-container>

<ng-container matColumnDef="assignee">
<th class="assignee-header" mat-header-cell *matHeaderCellDef>Assignee</th>
<td class="assignee-column" mat-cell *matCellDef="let element">
Expand Down Expand Up @@ -91,7 +94,7 @@
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr
[ngClass]="{
paused: row.paused
paused: row.paused,
}"
mat-row
*matRowDef="let row; columns: displayedColumns"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
width: 25%;
}

.subtask-days-cell {
width: 10%;
}

.assignee-header {
padding: 0px 26px !important;
}
Expand Down Expand Up @@ -101,4 +105,4 @@
.ng-dropdown-panel-items .ng-option {
padding: 4px 16px !important;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Input } from '@angular/core';
import { Router } from '@angular/router';
import { NgSelectComponent } from '@ng-select/ng-select';
import { HomepageSubtaskDto } from '../../../../services/card/card-subtask/card-subtask.dto';
import { CARD_SUBTASK_TYPE, HomepageSubtaskDto } from '../../../../services/card/card-subtask/card-subtask.dto';
import { CardSubtaskService } from '../../../../services/card/card-subtask/card-subtask.service';
import { AssigneeDto, UserDto } from '../../../../services/user/user.dto';
import {
Expand Down Expand Up @@ -45,6 +45,11 @@ export class SubtaskTableComponent {
}
}

const isGIS = this.subtasks.some((task) => task.type.code === CARD_SUBTASK_TYPE.GIS);
if (isGIS) {
const index = columns.indexOf('stage');
columns.splice(index + 1, 0, 'subtaskDays');
}
return columns;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface ApplicationDocumentDto {
uploadedBy: string;
uploadedAt: number;
evidentiaryRecordSorting?: number;
fileSize?: number;
}

export interface UpdateDocumentDto {
Expand Down
14 changes: 14 additions & 0 deletions alcs-frontend/src/app/services/commissioner/commissioner.dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { BaseCodeDto } from 'src/app/shared/dto/base.dto';
import { ApplicationRegionDto, ApplicationTypeDto } from '../application/application-code.dto';
import { ApplicationLocalGovernmentDto } from '../application/application-local-government/application-local-government.dto';
import { PlanningReviewTypeDto } from '../planning-review/planning-review.dto';
import { ApplicationDocumentDto } from '../application/application-document/application-document.dto';

export interface CommissionerApplicationDto {
fileNumber: string;
Expand All @@ -14,6 +16,7 @@ export interface CommissionerApplicationDto {
hasRecons: boolean;
hasModifications: boolean;
legacyId?: string;
decisions?: CommissionerDecisionDto[];
}

export interface CommissionerPlanningReviewDto {
Expand All @@ -25,3 +28,14 @@ export interface CommissionerPlanningReviewDto {
localGovernment: ApplicationLocalGovernmentDto;
legacyId?: string;
}

export interface CommissionerDecisionDto {
uuid: string;
date: number;
outcome: BaseCodeDto;
decisionDescription: string;
resolutionNumber: number;
resolutionYear: number;
documents: ApplicationDocumentDto[];
isSubjectToConditions: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { IncomingFileService } from './incoming-file.service';
import { IncomingFileBoardMapDto } from './incomig-file.dto';
import { IncomingFileBoardMapDto } from './incoming-file.dto';
import { CardType } from '../../shared/card/card.component';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { HttpClient } from '@angular/common/http';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { environment } from '../../../environments/environment';
import { HttpClient } from '@angular/common/http';
import { ToastService } from '../toast/toast.service';
import { firstValueFrom } from 'rxjs';
import { IncomingFileBoardMapDto } from './incomig-file.dto';
import { IncomingFileBoardMapDto } from './incoming-file.dto';

@Injectable({
providedIn: 'root',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h5 class="detail-heading">
</div>
</button>
<button
*ngIf="isCommissioner && hasMeetings"
*ngIf="isCommissioner && (hasMeetings || isIncoming)"
class="menu-item"
mat-flat-button
color="accent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { AuthenticationService, ROLES } from '../../services/authentication/auth
import { BoardService } from '../../services/board/board.service';
import { DecisionMeetingService } from '../../services/decision-meeting/decision-meeting.service';
import { UpcomingMeetingBoardMapDto } from '../../services/decision-meeting/decision-meeting.dto';
import { IncomingFileService } from '../../services/incoming-file/incoming-file.service';
import { IncomingFileBoardMapDto } from 'src/app/services/incoming-file/incoming-file.dto';

@Component({
selector: 'app-details-header[application]',
Expand Down Expand Up @@ -133,19 +135,25 @@ export class DetailsHeaderComponent implements OnInit, OnDestroy {

isCommissioner: boolean = false;
hasMeetings: boolean = false;
isIncoming: boolean = false;

$meetingsByBoard = new Subject<UpcomingMeetingBoardMapDto>();
$incomingFilesByBoard = new Subject<IncomingFileBoardMapDto>();
$application = new Subject<ApplicationDto | CommissionerApplicationDto | NoticeOfIntentDto | NotificationDto>();

private incomingFiles: IncomingFileBoardMapDto | undefined;

constructor(
private router: Router,
private authService: AuthenticationService,
private boardService: BoardService,
private meetingService: DecisionMeetingService,
private incomingFileService: IncomingFileService,
) {}

ngOnInit(): void {
this.loadMeetings();
this.loadIncomingFiles();

this.authService.$currentUser.pipe(takeUntil(this.$destroy)).subscribe((currentUser) => {
this.isCommissioner =
Expand All @@ -156,19 +164,27 @@ export class DetailsHeaderComponent implements OnInit, OnDestroy {
});

this.boardService.$boards
.pipe(combineLatestWith(this.$meetingsByBoard, this.$application))
.pipe(combineLatestWith(this.$meetingsByBoard, this.$incomingFilesByBoard, this.$application))
.pipe(takeUntil(this.$destroy))
.subscribe(([boards, meetingsByBoard, application]) => {
.subscribe(([boards, meetingsByBoard, incomingFilesByBoard, application]) => {
if (boards && meetingsByBoard && application) {
const visibleBoardCodes = boards.filter((board) => board.showOnSchedule).map((board) => board.code);

const visibleBoardCodeMeetingPairs = Object.entries(meetingsByBoard).filter(([code, _]) =>
visibleBoardCodes.includes(code),
);

const visibleBoardCodeIncomingFilePairs = Object.entries(incomingFilesByBoard!).filter(([code, _]) =>
visibleBoardCodes.includes(code),
);

this.hasMeetings = visibleBoardCodeMeetingPairs.some(([_, meetings]) =>
meetings.some((meeting) => meeting.fileNumber === application?.fileNumber),
);

this.isIncoming = visibleBoardCodeIncomingFilePairs.some(([_, incomingFiles]) =>
incomingFiles.some((file) => file.fileNumber === application?.fileNumber),
);
}
});
}
Expand All @@ -181,6 +197,14 @@ export class DetailsHeaderComponent implements OnInit, OnDestroy {
}
}

async loadIncomingFiles() {
const incomingFilesByBoard = await this.incomingFileService.fetchAndSort();

if (incomingFilesByBoard !== undefined) {
this.$incomingFilesByBoard.next(incomingFilesByBoard);
}
}

async onGoToCard(card: CardDto) {
const boardCode = card.boardCode;
const cardUuid = card.uuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,4 @@ describe('MeetingOverviewComponent', () => {
await component.loadMeetings();
expect(component.viewData.length).toEqual(1);
});

it('should show an error toast if searched application is not found', async () => {
await sleep(1);

component.searchText = '5555';
component.onSearch();

expect(mockToastService.showErrorToast).toHaveBeenCalledTimes(1);
});
});
Loading

0 comments on commit e77b7ff

Please sign in to comment.