description template editor > fix validity checks

This commit is contained in:
mchouliara 2024-08-28 17:52:45 +03:00
parent 15ec93a069
commit e2f59cdcd2
16 changed files with 39 additions and 13 deletions

View File

@ -21,8 +21,17 @@
</mat-form-field> -->
<div class="col pl-0">
<mat-form-field class="w-100 field-title not-outlined-form-field" floatLabel="never">
<textarea matInput type="text" [placeholder]="('DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.UNTITLED' | translate)+' '+('DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.QUESTION'| translate)" #titleControl="matInput" [formControl]="this.form.get('title')" class="question-title"></textarea>
<textarea
class="question-title"
[class.error]="this.form.get('title').hasError('backendError') || this.form.get('title').hasError('required')"
rows="1" matInput
type="text"
[placeholder]="('DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.UNTITLED' | translate)+' '+('DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.QUESTION'| translate)"
#titleControl="matInput"
[formControl]="this.form.get('title')"
></textarea>
<mat-error *ngIf="this.form.get('title').hasError('backendError')">{{form.get('title').getError('backendError').message}}</mat-error>
<mat-error *ngIf="this.form.get('title').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
</div>

View File

@ -154,6 +154,9 @@ $blue-color-light: #5cf7f2;
.question-title {
font-size: 21px;
&.error {
border-bottom: 1px solid #fd3434 !important;
}
}
::ng-deep .not-outlined-form-field > .mdc-text-field--outlined .mdc-notched-outline {

View File

@ -5,6 +5,7 @@
<!-- SECTION INFO -->
<div class="col-9 p-0" style="margin-bottom:2em;">
<mat-card style="padding: 2em;">
<mat-error *ngIf="form.touched && form.hasError('sectionMustHaveOneChild')">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.SECTION-CHILD-REQUIRED' | translate}}</mat-error>
<mat-card-content>
<app-description-template-editor-section-component [form]="form" [viewOnly]="viewOnly">
</app-description-template-editor-section-component>

View File

@ -188,13 +188,14 @@
<div class="col-12">
<button class="create-section-btn" (click)="addNewEntry({parent:selectedTocEntry, childType: tocEntryEnumValues.Section})">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.PAGE-INFO.ACTIONS.CREATE-SECTION' | translate}}</button>
</div>
<mat-error *ngIf="formGroup.invalid && showErrors">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-SELECT-AT-LEAST-ONE-REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="selectedTocEntry.form.invalid && showErrors">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-SELECT-AT-LEAST-ONE-REQUIRED' | translate}}</mat-error>
}
</div>
</formGroup>
</div>
<div class="col-12" *ngIf="(selectedTocEntry.type === tocEntryEnumValues.Section) || (selectedTocEntry.type === tocEntryEnumValues.FieldSet)">
<app-description-template-editor-section-fieldset-component
[tocentry]="selectedTocEntry"
[viewOnly]="viewOnly"

View File

@ -447,6 +447,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
validateStep(selectedIndex) {
if (this.formGroup.invalid) {
this.formService.touchAllFormFields(this.formGroup);
this.checkFormValidation(selectedIndex);
}
}

View File

@ -629,7 +629,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "Gutxienez iturri bat eman behar da.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "Gutxienez aukera bat eman behar da.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "Gutxienez aukera bat eman behar da.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "Bat ere ez",

View File

@ -629,7 +629,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "Keine",

View File

@ -627,7 +627,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "None",

View File

@ -629,7 +629,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "Debe proporcionar al menos una fuente.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "Debe proporcionar al menos una opción.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "Debe proporcionar al menos una opción.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "Ninguno",

View File

@ -629,7 +629,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "Κανένα",

View File

@ -629,7 +629,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "Mora biti naveden barem jedan izvor.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "Mora biti navedena barem jedna opcija.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "Mora biti navedena barem jedna opcija.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "Niti jedan",

View File

@ -629,7 +629,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "Należy podać co najmniej jedno źródło.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "Należy podać co najmniej jedną opcję.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "Należy podać co najmniej jedną opcję.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "Brak",

View File

@ -629,7 +629,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "Deve ser fornecida pelo menos uma fonte.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "Deve haver pelo menos uma opção fornecida.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "Deve haver pelo menos uma opção fornecida.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "Nenhum",

View File

@ -629,7 +629,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "Žiadny",

View File

@ -629,7 +629,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "Nijedan",

View File

@ -629,7 +629,8 @@
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"FIELD-SELECT-AT-LEAST-ONE-REQUIRED": "There must be at least one option provided.",
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided."
"SECTION-AT-LEAST-ONE-REQUIRED": "There must be at least one section provided.",
"SECTION-CHILD-REQUIRED": "Section must have at least one question"
},
"DEFAULT-VALUES": {
"NONE": "Hiç",