description editor > added error indicator for base infos

This commit is contained in:
Sofia Papacharalampous 2024-04-22 14:11:02 +03:00
parent fbbefdb59e
commit 218fab4fd1
2 changed files with 18 additions and 1 deletions

View File

@ -89,7 +89,7 @@
<div class="stepper-title">{{'DESCRIPTION-EDITOR.TOC.TITLE' | translate}}</div>
<div class="stepper-options" id="stepper-options">
<div class="col stepper-list">
<div (click)="table0fContents.onToCentrySelected()" *ngIf="!descriptionInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0, 'text-danger':hintErrors}">{{'DESCRIPTION-EDITOR.TOC.MAIN-INFO' | translate}} (2)</div>
<div (click)="table0fContents.onToCentrySelected()" *ngIf="!descriptionInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0, 'text-danger': countErrorsOfBaseInfoPage > 0}">{{'DESCRIPTION-EDITOR.TOC.MAIN-INFO' | translate}} ({{ countErrorsOfBaseInfoPage }})</div>
<div (click)="table0fContents.onToCentrySelected()" *ngIf="descriptionInfoValid()" class="main-info" [ngClass]="{'active': this.step === 0}">{{'DESCRIPTION-EDITOR.TOC.MAIN-INFO' | translate}} (<mat-icon class="done-icon">done</mat-icon>)</div>
<div class="row toc-pane-container" #boundary>
<div #spacer></div>

View File

@ -47,6 +47,7 @@ import { DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp
import { DescriptionTemplate, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplatePage, DescriptionTemplateSection } from '@app/core/model/description-template/description-template';
import { DmpDescriptionTemplate } from '@app/core/model/dmp/dmp';
import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type';
import { nameof } from 'ts-simple-nameof';
@Component({
selector: 'app-description-editor-component',
@ -822,6 +823,19 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
return fieldSets;
}
get countErrorsOfBaseInfoPage(): number {
if (this.formGroup == null) return 0;
let errorsCount: number = 0;
const baseInfoControlNames: string[] = [nameof<DescriptionEditorModel>(x => x.label), nameof<DescriptionEditorModel>(x => x.descriptionTemplateId)];
baseInfoControlNames.forEach((name: string) => {
if (!this.formGroup.get(name)?.valid) errorsCount += 1;
});
return errorsCount;
}
getEntryVisibleFieldSets(entry: ToCEntry): ToCEntry[] {
let fieldSets = [];
if (entry.type === ToCEntryType.FieldSet && !this.table0fContents.internalTable.hiddenEntries.find(hiddenEntry => hiddenEntry === entry.id.toString())) {
@ -911,6 +925,9 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
}
checkPagesForErrors(): void {
//this.baseInfoPage = ...
this.pageToFieldSetMap = this.mapPageToFieldSet(this.item.descriptionTemplate);
}