Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
</div>
</div>

<div class="dates-container" *ngIf="condition.dates !== undefined && condition.type?.isDateChecked">
<div class="dates-container" *ngIf="dates !== undefined && condition.type?.isDateChecked">
<ng-container *ngIf="showSingleDateField; else showMultipleDateTable">
<ng-container *ngIf="singleDateLabel === 'Due Date'; else showEndDateContainer">
<div class="single-table">
Expand All @@ -99,20 +99,20 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<div class="single-table-row">
<div class="single-column single-due">
<app-inline-datepicker
[value]="condition.dates[0].date ?? undefined"
(save)="updateDate(condition.dates[0].uuid!, 'date', $event)"
[value]="dates[0]?.date ?? undefined"
(save)="updateDate(dates[0]?.uuid, 'date', $event)"
></app-inline-datepicker>
</div>
<div class="single-column single-completed">
<app-inline-datepicker
[value]="condition.dates[0].completedDate ?? undefined"
(save)="updateDate(condition.dates[0].uuid!, 'completedDate', $event)"
[value]="dates[0]?.completedDate ?? undefined"
(save)="updateDate(dates[0]?.uuid, 'completedDate', $event)"
></app-inline-datepicker>
</div>
<div class="single-column single-comment">
<app-inline-textarea
[value]="condition.dates[0].comment ?? undefined"
(save)="updateDate(condition.dates[0].uuid!, 'comment', $event)"
[value]="dates[0]?.comment ?? undefined"
(save)="updateDate(dates[0]?.uuid, 'comment', $event)"
></app-inline-textarea>
</div>
</div>
Expand All @@ -132,8 +132,8 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<div class="single-table-row">
<div class="single-column single-end">
<app-inline-datepicker
[value]="condition.dates[0].date ?? undefined"
(save)="updateDate(condition.dates[0].uuid!, 'date', $event)"
[value]="dates[0]?.date ?? undefined"
(save)="updateDate(dates[0]?.uuid, 'date', $event)"
></app-inline-datepicker>
</div>
</div>
Expand All @@ -153,8 +153,8 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<th mat-header-cell *matHeaderCellDef class="multiple-due">Due</th>
<td mat-cell *matCellDef="let element">
<app-inline-datepicker
[value]="condition.dates[element.index - 1].date ?? undefined"
(save)="updateDate(condition.dates[element.index - 1].uuid!, 'date', $event)"
[value]="dates[element.index - 1]?.date ?? undefined"
(save)="updateDate(dates[element.index - 1]?.uuid, 'date', $event)"
></app-inline-datepicker>
</td>
</ng-container>
Expand All @@ -163,8 +163,8 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<th mat-header-cell *matHeaderCellDef class="multiple-completed">Completed</th>
<td mat-cell *matCellDef="let element">
<app-inline-datepicker
[value]="condition.dates[element.index - 1].completedDate ?? undefined"
(save)="updateDate(condition.dates[element.index - 1].uuid!, 'completedDate', $event)"
[value]="dates[element.index - 1]?.completedDate ?? undefined"
(save)="updateDate(dates[element.index - 1]?.uuid, 'completedDate', $event)"
></app-inline-datepicker>
</td>
</ng-container>
Expand All @@ -173,8 +173,8 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<th mat-header-cell *matHeaderCellDef class="multiple-comment">Comment</th>
<td mat-cell *matCellDef="let element" class="wrap-text">
<app-inline-textarea
[value]="condition.dates[element.index - 1].comment ?? undefined"
(save)="updateDate(condition.dates[element.index - 1].uuid!, 'comment', $event)"
[value]="dates[element.index - 1]?.comment ?? undefined"
(save)="updateDate(dates[element.index - 1]?.uuid, 'comment', $event)"
></app-inline-textarea>
</td>
</ng-container>
Expand All @@ -200,7 +200,7 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>

<div
class="full-width"
[ngClass]="{ 'description-no-date-container': !(condition.dates !== undefined && condition.type?.isDateChecked) }"
[ngClass]="{ 'description-no-date-container': !(dates !== undefined && condition.type?.isDateChecked) }"
>
<div class="subheading2">Description</div>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,14 @@ export class ConditionComponent implements OnInit, AfterViewInit {
}

async updateDate(
dateUuid: string,
dateUuid: string | undefined,
fieldName: keyof ApplicationDecisionConditionDateDto,
newValue: number | string | null,
) {
if (dateUuid === undefined) {
return;
}

const index = this.dates.findIndex((dto) => dto.uuid === dateUuid);

if (index !== -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<app-no-data *ngIf="condition.securityAmount === null || condition.securityAmount === undefined"></app-no-data>
</div>
</div>
<div class="dates-container" *ngIf="condition.dates !== undefined && condition.type?.isDateChecked">
<div class="dates-container" *ngIf="dates !== undefined && condition.type?.isDateChecked">
<ng-container *ngIf="showSingleDateField; else showMultipleDateTable">
<ng-container *ngIf="singleDateLabel === 'Due Date'; else showEndDateContainer">
<div class="single-table">
Expand All @@ -44,20 +44,20 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<div class="single-table-row">
<div class="single-column single-due">
<app-inline-datepicker
[value]="condition.dates[0].date ?? undefined"
(save)="updateDate(condition.dates[0].uuid!, 'date', $event)"
[value]="dates[0]?.date ?? undefined"
(save)="updateDate(dates[0]?.uuid, 'date', $event)"
></app-inline-datepicker>
</div>
<div class="single-column single-completed">
<app-inline-datepicker
[value]="condition.dates[0].completedDate ?? undefined"
(save)="updateDate(condition.dates[0].uuid!, 'completedDate', $event)"
[value]="dates[0]?.completedDate ?? undefined"
(save)="updateDate(dates[0]?.uuid, 'completedDate', $event)"
></app-inline-datepicker>
</div>
<div class="single-column single-comment">
<app-inline-textarea
[value]="condition.dates[0].comment ?? undefined"
(save)="updateDate(condition.dates[0].uuid!, 'comment', $event)"
[value]="dates[0]?.comment ?? undefined"
(save)="updateDate(dates[0]?.uuid, 'comment', $event)"
></app-inline-textarea>
</div>
</div>
Expand All @@ -77,8 +77,8 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<div class="single-table-row">
<div class="single-column single-end">
<app-inline-datepicker
[value]="condition.dates[0].date ?? undefined"
(save)="updateDate(condition.dates[0].uuid!, 'date', $event)"
[value]="dates[0]?.date ?? undefined"
(save)="updateDate(dates[0]?.uuid, 'date', $event)"
></app-inline-datepicker>
</div>
</div>
Expand All @@ -98,8 +98,8 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<th mat-header-cell *matHeaderCellDef class="multiple-due">Due</th>
<td mat-cell *matCellDef="let element">
<app-inline-datepicker
[value]="condition.dates[element.index - 1].date ?? undefined"
(save)="updateDate(condition.dates[element.index - 1].uuid!, 'date', $event)"
[value]="dates[element.index - 1]?.date ?? undefined"
(save)="updateDate(dates[element.index - 1]?.uuid, 'date', $event)"
></app-inline-datepicker>
</td>
</ng-container>
Expand All @@ -108,8 +108,8 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<th mat-header-cell *matHeaderCellDef class="multiple-completed">Completed</th>
<td mat-cell *matCellDef="let element">
<app-inline-datepicker
[value]="condition.dates[element.index - 1].completedDate ?? undefined"
(save)="updateDate(condition.dates[element.index - 1].uuid!, 'completedDate', $event)"
[value]="dates[element.index - 1]?.completedDate ?? undefined"
(save)="updateDate(dates[element.index - 1]?.uuid, 'completedDate', $event)"
></app-inline-datepicker>
</td>
</ng-container>
Expand All @@ -118,8 +118,8 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>
<th mat-header-cell *matHeaderCellDef class="multiple-comment">Comment</th>
<td mat-cell *matCellDef="let element" class="wrap-text">
<app-inline-textarea
[value]="condition.dates[element.index - 1].comment ?? undefined"
(save)="updateDate(condition.dates[element.index - 1].uuid!, 'comment', $event)"
[value]="dates[element.index - 1]?.comment ?? undefined"
(save)="updateDate(dates[element.index - 1]?.uuid, 'comment', $event)"
></app-inline-textarea>
</td>
</ng-container>
Expand All @@ -145,7 +145,7 @@ <h4 *ngIf="condition.type">{{ condition.type.label }}</h4>

<div
class="full-width"
[ngClass]="{ 'description-no-date-container': !(condition.dates !== undefined && condition.type.isDateChecked) }"
[ngClass]="{ 'description-no-date-container': !(dates !== undefined && condition.type?.isDateChecked) }"
>
<div class="subheading2">Description</div>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,14 @@ export class ConditionComponent implements OnInit, AfterViewInit {
}

async updateDate(
dateUuid: string,
dateUuid: string | undefined,
fieldName: keyof NoticeOfIntentDecisionConditionDateDto,
newValue: number | string | null,
) {
if (dateUuid === undefined) {
return;
}

const index = this.dates.findIndex((dto) => dto.uuid === dateUuid);

if (index !== -1) {
Expand Down
Loading