Skip to content

Commit

Permalink
Merge pull request #2057 from bcgov/feature/ALCS-2059-qa-fixes
Browse files Browse the repository at this point in the history
ALCS-2059 QA fixes
  • Loading branch information
fbarreta authored Jan 15, 2025
2 parents 25f34ae + de26f0a commit 0e65c1e
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,37 @@ <h5>Res #{{ decision.resolutionNumber }}/{{ decision.resolutionYear }}</h5>
{{ decision.date | momentFormat }}
<app-no-data *ngIf="decision.date === null || decision.date === undefined"></app-no-data>
</div>
<div>
<div class="align-right">
<span class="subheading2">Decision Maker: </span>
{{ decision.decisionMaker?.label }}
<app-no-data *ngIf="decision.decisionMaker === null || decision.decisionMaker === undefined"></app-no-data>
</div>

</div>
<div class="component-summary">
<div *ngIf="decision.ceoCriterion">
<span class="subheading2">CEO Criterion: </span>
{{ decision.ceoCriterion?.label }}
<ng-container *ngIf="decision.isTimeExtension || decision.isOther">&#32;-&#32;</ng-container>
<ng-container *ngIf="decision.isTimeExtension">Time extension</ng-container>
<ng-container *ngIf="decision.isTimeExtension && decision.isOther">,&#32;</ng-container>
<ng-container *ngIf="decision.isOther">Other</ng-container>
</div>
</div>
<div class="component-summary">
<div *ngIf="decision.outcome?.code === 'RESC'">
<span class="subheading2">Rescinded Date: </span>
<ng-container *ngIf="decision.rescindedDate">{{ decision.rescindedDate | momentFormat }}</ng-container>
<app-no-data *ngIf="decision.rescindedDate === null || decision.rescindedDate === undefined"></app-no-data>
</div>
</div>
<div class="component-summary">
<div *ngIf="decision.outcome?.code === 'RESC'">
<span class="subheading2">Rescinded Comment: </span>
{{ decision.rescindedComment }}
<app-no-data *ngIf="!decision.rescindedComment"></app-no-data>
</div>
</div>
<div class="component-summary">
<div class="full-width decision-description">
{{ decision.decisionDescription }}
<app-no-data
Expand All @@ -126,7 +151,7 @@ <h5>Res #{{ decision.resolutionNumber }}/{{ decision.resolutionYear }}</h5>
<ng-container *ngFor="let component of decision.components; let index = index">
<div class="component-summary">
<span class="subheading2">{{ component.applicationDecisionComponentType?.label }} </span>
{{ getDate(component.uuid) ? 'approved until ' + getDate(component.uuid) : 'approved'}}
{{ getDate(component.uuid) }}
<span class="subheading2">Conditions: </span>
<ng-container *ngFor="let condition of getConditions(component.uuid)">
<app-application-type-pill class="status-pill" *ngIf="condition !== null" [type]="condition"></app-application-type-pill>
Expand All @@ -146,6 +171,18 @@ <h5>Res #{{ decision.resolutionNumber }}/{{ decision.resolutionYear }}</h5>
</div>
</section>
</ng-container>
<div class="full-width">
<div class="document split" *ngFor="let document of decision.documents">
<div>
<a (click)="openFile(decision.uuid, document.uuid, document.fileName)">{{ document.fileName }}</a>
&nbsp;({{ document.fileSize ? (document.fileSize | filesize) : '' }})
</div>
<button class="center" mat-button (click)="openFile(decision.uuid, document.uuid, document.fileName)">
<mat-icon>file_download</mat-icon>
Download
</button>
</div>
</div>
</section>
<ng-container *ngIf="isSummary">
<!-- Components -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ section {
}

h4 {
padding-top: 15px;
margin-bottom: 12px !important;
}

Expand Down Expand Up @@ -122,6 +123,19 @@ hr {
position: absolute;
}

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

.align-right {
display: flex;
justify-content: flex-end;
}

:host ::ng-deep {
.grid-2 {
margin-top: 18px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ApplicationDto } from '../../../../services/application/application.dto
import { ApplicationDecisionComponentService } from '../../../../services/application/decision/application-decision-v2/application-decision-component/application-decision-component.service';
import {
APPLICATION_DECISION_COMPONENT_TYPE,
ApplicationDecisionDocumentDto,
ApplicationDecisionWithLinkedResolutionDto,
CeoCriterionDto,
DecisionMakerDto,
Expand All @@ -29,6 +30,7 @@ import { ConfirmationDialogService } from '../../../../shared/confirmation-dialo
import { formatDateForApi } from '../../../../shared/utils/api-date-formatter';
import { RevertToDraftDialogComponent } from './revert-to-draft-dialog/revert-to-draft-dialog.component';
import { ApplicationConditionWithStatus, getEndDate } from '../../../../shared/utils/decision-methods';
import { openFileInline } from '../../../../shared/utils/file';

type LoadingDecision = ApplicationDecisionWithLinkedResolutionDto & {
loading: boolean;
Expand Down Expand Up @@ -302,6 +304,10 @@ export class DecisionV2Component implements OnInit, OnDestroy {
return getEndDate(uuid, this.conditions);
}

async openFile(decisionUuid: string, fileUuid: string, fileName: string) {
await this.decisionService.downloadFile(decisionUuid, fileUuid, fileName);
}

private getPillLabel(status: string) {
switch (status) {
case 'ONGOING':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,27 @@ <h4>Resolution</h4>
{{ decision.date ? (decision.date | momentFormat) : undefined }}
<app-no-data *ngIf="decision.date === null || decision.date === undefined"></app-no-data>
</div>
<div>
<div class="align-right">
<span class="subheading2">Decision Maker: </span>
{{ decision.decisionMaker }}
<app-no-data *ngIf="decision.decisionMaker === null || decision.decisionMaker === undefined"></app-no-data>
</div>

<div class="component-summary">
<div *ngIf="decision.outcome?.code === 'RESC'">
<span class="subheading2">Rescinded Date: </span>
<ng-container *ngIf="decision.rescindedDate">{{ decision.rescindedDate | momentFormat }}</ng-container>
<app-no-data *ngIf="decision.rescindedDate === null || decision.rescindedDate === undefined"></app-no-data>
</div>
</div>
<div class="component-summary">
<div *ngIf="decision.outcome?.code === 'RESC'">
<span class="subheading2">Rescinded Comment: </span>
{{ decision.rescindedComment }}
<app-no-data *ngIf="!decision.rescindedComment"></app-no-data>
</div>
</div>

<div class="full-width decision-description">
{{ decision.decisionDescription }}
<app-no-data
Expand All @@ -119,7 +134,7 @@ <h4>Resolution</h4>
<ng-container *ngFor="let component of decision.components; let index = index">
<div class="component-summary">
<span class="subheading2">{{ component.noticeOfIntentDecisionComponentType?.label }} </span>
{{ getDate(component.uuid) ? 'approved until ' + getDate(component.uuid) : 'approved'}}
{{ getDate(component.uuid) }}
<span class="subheading2">Conditions: </span>
<ng-container *ngFor="let condition of getConditions(component.uuid)">
<app-application-type-pill class="status-pill" *ngIf="condition !== null" [type]="condition"></app-application-type-pill>
Expand All @@ -139,6 +154,18 @@ <h4>Resolution</h4>
</div>
</section>
</ng-container>
<div class="full-width">
<div class="document split" *ngFor="let document of decision.documents">
<div>
<a (click)="openFile(decision.uuid, document.uuid, document.fileName)">{{ document.fileName }}</a>
&nbsp;({{ document.fileSize ? (document.fileSize | filesize) : '' }})
</div>
<button class="center" mat-button (click)="openFile(decision.uuid, document.uuid, document.fileName)">
<mat-icon>file_download</mat-icon>
Download
</button>
</div>
</div>
</section>
<ng-container *ngIf="isSummary">
<!-- Components -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ section {
}

h4 {
padding-top: 15px;
margin-bottom: 12px !important;
}

Expand Down Expand Up @@ -122,6 +123,19 @@ hr {
position: absolute;
}

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

.align-right {
display: flex;
justify-content: flex-end;
}

:host ::ng-deep {
.grid-2 {
margin-top: 18px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ export class DecisionV2Component implements OnInit, OnDestroy {
return getEndDate(uuid, this.conditions);
}

async openFile(decisionUuid: string, fileUuid: string, fileName: string) {
await this.decisionService.downloadFile(decisionUuid, fileUuid, fileName);
}

private getPillLabel(status: string) {
switch (status) {
case 'ONGOING':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export interface ApplicationDecisionDocumentDto {
mimeType: string;
uploadedBy: string;
uploadedAt: number;
fileSize?: number;
}

export interface DecisionMakerDto extends BaseCodeDto {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface NoticeOfIntentDecisionDocumentDto {
mimeType: string;
uploadedBy: string;
uploadedAt: number;
fileSize: number | null;
}

export interface NoticeOfIntentDecisionOutcomeCodeDto extends BaseCodeDto {}
Expand Down
4 changes: 2 additions & 2 deletions alcs-frontend/src/app/shared/utils/decision-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export function getEndDate(uuid: string | undefined, conditions: Record<string,
.map((x) => x.dates?.map((x) => x.date))
: [];
if (dates.length === 0) {
return null;
return 'approved';
}
const reducedDates = dates
.reduce((pre, cur) => pre?.concat(cur))
?.filter((x) => x !== null)
.sort().reverse();
const lastDate = reducedDates && reducedDates.length > 0 ? reducedDates[0] : null;
return lastDate ? moment(lastDate).format('YYYY-MMM-DD') : null;
return lastDate ? `approved until: ${moment(lastDate).format('YYYY-MMM-DD')}` : 'approved until: No Data';
}

0 comments on commit 0e65c1e

Please sign in to comment.