Skip to content

Commit

Permalink
Merge pull request #1987 from bcgov/develop
Browse files Browse the repository at this point in the history
Deployment PR - 1404
  • Loading branch information
trslater authored Dec 19, 2024
2 parents 1445455 + f54da40 commit 0097ba3
Show file tree
Hide file tree
Showing 188 changed files with 6,600 additions and 1,822 deletions.
4 changes: 2 additions & 2 deletions alcs-frontend/src/app/features/admin/admin.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BoardManagementComponent } from './board-management/board-management.co
import { CardStatusComponent } from './card-status/card-status.component';
import { CeoCriterionComponent } from './ceo-criterion/ceo-criterion.component';
import { ConfigurationComponent } from './configuration/configuration.component';
import { DecisionConditionTypesComponent } from './decision-condition-types/decision-condition-types.component';
import { DecisionConditionContainerComponent } from './decision-condition-types/decision-condition-container.component';
import { DecisionMakerComponent } from './decision-maker/decision-maker.component';
import { HolidayComponent } from './holiday/holiday.component';
import { LocalGovernmentComponent } from './local-government/local-government.component';
Expand Down Expand Up @@ -41,7 +41,7 @@ export const childRoutes = [
path: 'dct',
menuTitle: 'Decision Condition Types',
icon: 'hvac',
component: DecisionConditionTypesComponent,
component: DecisionConditionContainerComponent,
},
{
path: 'noi',
Expand Down
4 changes: 3 additions & 1 deletion alcs-frontend/src/app/features/admin/admin.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { CeoCriterionComponent } from './ceo-criterion/ceo-criterion.component';
import { ConfigurationComponent } from './configuration/configuration.component';
import { MaintenanceBannerConfirmationDialogComponent } from './configuration/maintenance-banner-confirmation-dialog/maintenance-banner-confirmation-dialog.component';
import { DecisionConditionTypesDialogComponent } from './decision-condition-types/decision-condition-types-dialog/decision-condition-types-dialog.component';
import { DecisionConditionContainerComponent } from './decision-condition-types/decision-condition-container.component';
import { DecisionConditionTypesComponent } from './decision-condition-types/decision-condition-types.component';
import { DecisionMakerDialogComponent } from './decision-maker/decision-maker-dialog/decision-maker-dialog.component';
import { DecisionMakerComponent } from './decision-maker/decision-maker.component';
Expand Down Expand Up @@ -54,8 +55,8 @@ const routes: Routes = [
UnarchiveComponent,
DecisionMakerComponent,
DecisionMakerDialogComponent,
DecisionConditionTypesComponent,
DecisionConditionTypesDialogComponent,
DecisionConditionTypesComponent,
CardStatusComponent,
CardStatusDialogComponent,
BoardManagementComponent,
Expand All @@ -67,6 +68,7 @@ const routes: Routes = [
TagComponent,
TagDialogComponent,
TagContainerComponent,
DecisionConditionContainerComponent,
],
imports: [
CommonModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ <h4>{{ isEdit ? 'Edit' : 'Create' }} Board</h4>
<mat-label>Code</mat-label>
<input [formControl]="code" required maxlength="4" minlength="4" matInput id="code" name="code" />
</mat-form-field>
<div *ngIf="form.get('code')?.hasError('codeExists')">
<app-error-message message="Code already in use, pick a different code."></app-error-message>
</div>
</div>

<div class="full-width">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { FormBuilder, FormControl, FormGroup, NgModel, Validators } from '@angular/forms';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { AdminBoardManagementService } from '../../../../services/admin-board-management/admin-board-management.service';
Expand All @@ -10,6 +10,7 @@ import { BoardService } from '../../../../services/board/board.service';
import { CardStatusService } from '../../../../services/card/card-status/card-status.service';
import { CardType } from '../../../../shared/card/card.component';
import { BaseCodeDto } from '../../../../shared/dto/base.dto';
import { codeExistsValidator } from '../../../../shared/validators/code-exists-validator';

const DISABLED_CREATE_CARD_TYPES = [
CardType.APP,
Expand Down Expand Up @@ -60,6 +61,7 @@ export class BoardManagementDialogComponent implements OnInit {
public data: {
board: MinimalBoardDto | undefined;
cardTypes: BaseCodeDto[];
existingCodes: string[];
},
private dialogRef: MatDialogRef<BoardManagementDialogComponent>,
private cardStatusService: CardStatusService,
Expand All @@ -76,6 +78,8 @@ export class BoardManagementDialogComponent implements OnInit {
for (const type of this.cardTypes) {
this.cardTypeMap[type.code] = type.label;
}

this.code.addValidators(codeExistsValidator(this.data?.existingCodes ? this.data.existingCodes : []));
}

async loadBoard(code: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class BoardManagementComponent implements OnInit, OnDestroy {
height: '80%',
data: {
cardTypes: this.cardTypes,
existingCodes: this.boards.map((b) => b.code.toLowerCase()),
},
});
dialog.beforeClosed().subscribe(async (result) => {
Expand All @@ -62,6 +63,7 @@ export class BoardManagementComponent implements OnInit, OnDestroy {
data: {
board: boardDto,
cardTypes: this.cardTypes,
existingCodes: this.boards.map((b) => b.code.toLowerCase()),
},
});
dialog.beforeClosed().subscribe(async (result) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ <h4>{{ isEdit ? 'Edit' : 'Create' }} Column</h4>
matInput
id="code"
[(ngModel)]="code"
#codeModel="ngModel"
name="code"
/>
</mat-form-field>
</div>

<div *ngIf="isCodeExisiting(codeModel) && !isEdit" class="full-width code-error-message">
<app-error-message message="Code already in use, pick a different code."></app-error-message>
</div>
<div>
<mat-form-field class="label" appearance="outline">
<mat-label>Label</mat-label>
Expand All @@ -37,7 +40,7 @@ <h4>{{ isEdit ? 'Edit' : 'Create' }} Column</h4>

<div class="split">
<div [matTooltip]="canDeleteReason" [matTooltipDisabled]="canDelete">
<button [disabled]="!canDelete" (click)='onDelete()' mat-stroked-button color="warn">Delete</button>
<button [disabled]="!canDelete" (click)="onDelete()" mat-stroked-button color="warn">Delete</button>
</div>
<div class="button-container">
<button mat-stroked-button color="primary" mat-dialog-close="false">Close</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
.mat-mdc-form-field {
width: 100%;
}

.code-error-message {
margin: -20px 0 -20px 0;
}

.code {
padding-top: 8px;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('CardStatusDialogComponent', () => {
imports: [ReactiveFormsModule, FormsModule],
declarations: [CardStatusDialogComponent],
providers: [
{ provide: MAT_DIALOG_DATA, useValue: undefined },
{ provide: MAT_DIALOG_DATA, useValue: { existingCodes: [] } },
{ provide: MatDialogRef, useValue: {} },
{
provide: CardStatusService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { CardStatusDto } from '../../../../services/application/application-code.dto';
import { CardStatusService } from '../../../../services/card/card-status/card-status.service';
import { NgModel } from '@angular/forms';
import { codeExistsDirectiveValidator } from '../../../../shared/validators/code-exists-validator';

@Component({
selector: 'app-decision-condition-types-dialog',
Expand All @@ -19,16 +21,20 @@ export class CardStatusDialogComponent implements OnInit {
canDeleteReason = '';

constructor(
@Inject(MAT_DIALOG_DATA) public data: CardStatusDto | undefined,
@Inject(MAT_DIALOG_DATA)
public data: {
cardStatus: CardStatusDto | undefined;
existingCodes: string[];
},
private dialogRef: MatDialogRef<CardStatusDialogComponent>,
private cardStatusService: CardStatusService
private cardStatusService: CardStatusService,
) {
if (data) {
this.description = data.description;
this.label = data.label;
this.code = data.code;
if (data.cardStatus) {
this.description = data.cardStatus.description;
this.label = data.cardStatus.label;
this.code = data.cardStatus.code;
}
this.isEdit = !!data;
this.isEdit = !!data.cardStatus;
}

async onSubmit() {
Expand Down Expand Up @@ -65,4 +71,8 @@ export class CardStatusDialogComponent implements OnInit {
await this.cardStatusService.delete(this.code);
this.dialogRef.close(true);
}

isCodeExisiting(model: NgModel) {
return codeExistsDirectiveValidator(model, this.data.existingCodes, this.code);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class CardStatusComponent implements OnInit {
constructor(
private cardStatusService: CardStatusService,
public dialog: MatDialog,
private confirmationDialogService: ConfirmationDialogService
private confirmationDialogService: ConfirmationDialogService,
) {}

ngOnInit(): void {
Expand All @@ -34,6 +34,7 @@ export class CardStatusComponent implements OnInit {
minWidth: '600px',
maxWidth: '800px',
width: '70%',
data: { existingCodes: this.cardStatusDtos.map((cs) => cs.code.toLowerCase()) },
});
dialog.beforeClosed().subscribe(async (result) => {
if (result) {
Expand All @@ -47,7 +48,7 @@ export class CardStatusComponent implements OnInit {
minWidth: '600px',
maxWidth: '800px',
width: '70%',
data: cardStatusDto,
data: { cardStatus: cardStatusDto, existingCodes: this.cardStatusDtos.map((cs) => cs.code.toLowerCase()) },
});
dialog.beforeClosed().subscribe(async (result) => {
if (result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ <h4>{{ isEdit ? 'Edit' : 'Create' }} CEO Criterion</h4>
matInput
id="code"
[(ngModel)]="code"
#codeModel="ngModel"
name="code"
/>
</mat-form-field>
<div *ngIf="isCodeExisting(codeModel) && !isEdit">
<app-error-message message="Code already in use or deteled, pick a different code."></app-error-message>
</div>
</div>

<div class="full-width">
Expand All @@ -50,7 +54,7 @@ <h4>{{ isEdit ? 'Edit' : 'Create' }} CEO Criterion</h4>
mat-flat-button
color="primary"
type="submit"
[disabled]="!form.form.valid"
[disabled]="!form.form.valid || (isCodeExisting(codeModel) && !isEdit)"
>
Save
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,13 @@
.mat-mdc-form-field {
width: 100%;
}

.code {
padding-top: 8px;
}

.number-input {
padding-top: 8px;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('CeoCriterionDialogComponent', () => {
imports: [ReactiveFormsModule, FormsModule],
declarations: [CeoCriterionDialogComponent],
providers: [
{ provide: MAT_DIALOG_DATA, useValue: undefined },
{ provide: MAT_DIALOG_DATA, useValue: { existingCodes: [] } },
{ provide: MatDialogRef, useValue: {} },
{
provide: CeoCriterionService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { CeoCriterionDto } from '../../../../services/application/decision/application-decision-v2/application-decision.dto';
import { CeoCriterionService } from '../../../../services/ceo-criterion/ceo-criterion.service';
import { NgModel } from '@angular/forms';
import { CeoCriterionDto } from '../../../../services/application/decision/application-decision-v2/application-decision.dto';
import { codeExistsDirectiveValidator } from '../../../../shared/validators/code-exists-validator';

@Component({
selector: 'app-ceo-criterion-dialog',
Expand All @@ -18,17 +20,21 @@ export class CeoCriterionDialogComponent {
isEdit = false;

constructor(
@Inject(MAT_DIALOG_DATA) public data: CeoCriterionDto | undefined,
@Inject(MAT_DIALOG_DATA)
public data: {
ceoCriterion: CeoCriterionDto | undefined;
existingCodes: string[];
},
private dialogRef: MatDialogRef<CeoCriterionDialogComponent>,
private ceoCriterionService: CeoCriterionService,
) {
if (data) {
this.description = data.description;
this.label = data.label;
this.code = data.code;
this.number = data.number.toString();
if (data?.ceoCriterion) {
this.description = data.ceoCriterion.description;
this.label = data.ceoCriterion.label;
this.code = data.ceoCriterion.code;
this.number = data.ceoCriterion.number.toString();
}
this.isEdit = !!data;
this.isEdit = !!data?.ceoCriterion;
}

async onSubmit() {
Expand All @@ -53,4 +59,8 @@ export class CeoCriterionDialogComponent {
this.isLoading = false;
this.dialogRef.close(true);
}

isCodeExisting(model: NgModel) {
return codeExistsDirectiveValidator(model, this.data.existingCodes, this.code);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export class CeoCriterionComponent implements OnInit {
minWidth: '600px',
maxWidth: '800px',
width: '70%',
data: {
existingCodes: this.ceoCriterion.map((cc) => cc.code.toLocaleLowerCase()),
},
});
dialog.beforeClosed().subscribe(async (result) => {
if (result) {
Expand All @@ -49,7 +52,7 @@ export class CeoCriterionComponent implements OnInit {
minWidth: '600px',
maxWidth: '800px',
width: '70%',
data: ceoCriterion,
data: { ceoCriterion: ceoCriterion, existingCodes: this.ceoCriterion.map((cc) => cc.code) },
});
dialog.beforeClosed().subscribe(async (result) => {
if (result) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<mat-tab-group id="conditions" mat-align-tabs="start">
<mat-tab>
<ng-template mat-tab-label>
<span class="tab-label">Application</span>
</ng-template>
<br />
<app-decision-condition-types [service]="applicationService" [conditionService]="applicationConditionService" />
</mat-tab>

<mat-tab>
<ng-template mat-tab-label>
<span class="tab-label">Notice of Intent</span>
</ng-template>
<br />
<app-decision-condition-types [service]="noiService" [conditionService]="noiConditionService" />
</mat-tab>
</mat-tab-group>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.tab-label {
font-weight: 700;
font-size: 16px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Component } from '@angular/core';
import { ApplicationDecisionConditionTypesService } from '../../../services/application/application-decision-condition-types/application-decision-condition-types.service';
import { NoticeofIntentDecisionConditionTypesService } from '../../../services/notice-of-intent/notice-of-intent-decision-condition-types/notice-of-intent-decision-condition-types.service';
import { NoticeOfIntentDecisionConditionService } from '../../../services/notice-of-intent/decision-v2/notice-of-intent-decision-condition/notice-of-intent-decision-condition.service';
import { ApplicationDecisionConditionService } from '../../../services/application/decision/application-decision-v2/application-decision-condition/application-decision-condition.service';

@Component({
selector: 'app-decision-condition-container',
templateUrl: './decision-condition-container.component.html',
styleUrls: ['./decision-condition-container.component.scss'],
})
export class DecisionConditionContainerComponent {
applicationService: ApplicationDecisionConditionTypesService;
applicationConditionService: ApplicationDecisionConditionService;
noiService: NoticeofIntentDecisionConditionTypesService;
noiConditionService: NoticeOfIntentDecisionConditionService;

constructor(
private aplicationDecisionConditionTypesService: ApplicationDecisionConditionTypesService,
private aplicationDecisionConditionService: ApplicationDecisionConditionService,
private noiDecisionConditionTypesService: NoticeofIntentDecisionConditionTypesService,
private noiDecisionConditionService: NoticeOfIntentDecisionConditionService,
) {
this.applicationService = this.aplicationDecisionConditionTypesService;
this.applicationConditionService = this.aplicationDecisionConditionService;
this.noiService = this.noiDecisionConditionTypesService;
this.noiConditionService = this.noiDecisionConditionService;
}
}
Loading

0 comments on commit 0097ba3

Please sign in to comment.