description template editor > fix validity checks
This commit is contained in:
parent
15ec93a069
commit
e2f59cdcd2
|
@ -21,8 +21,17 @@
|
||||||
</mat-form-field> -->
|
</mat-form-field> -->
|
||||||
<div class="col pl-0">
|
<div class="col pl-0">
|
||||||
<mat-form-field class="w-100 field-title not-outlined-form-field" floatLabel="never">
|
<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('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>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -154,6 +154,9 @@ $blue-color-light: #5cf7f2;
|
||||||
|
|
||||||
.question-title {
|
.question-title {
|
||||||
font-size: 21px;
|
font-size: 21px;
|
||||||
|
&.error {
|
||||||
|
border-bottom: 1px solid #fd3434 !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::ng-deep .not-outlined-form-field > .mdc-text-field--outlined .mdc-notched-outline {
|
::ng-deep .not-outlined-form-field > .mdc-text-field--outlined .mdc-notched-outline {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<!-- SECTION INFO -->
|
<!-- SECTION INFO -->
|
||||||
<div class="col-9 p-0" style="margin-bottom:2em;">
|
<div class="col-9 p-0" style="margin-bottom:2em;">
|
||||||
<mat-card style="padding: 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>
|
<mat-card-content>
|
||||||
<app-description-template-editor-section-component [form]="form" [viewOnly]="viewOnly">
|
<app-description-template-editor-section-component [form]="form" [viewOnly]="viewOnly">
|
||||||
</app-description-template-editor-section-component>
|
</app-description-template-editor-section-component>
|
||||||
|
|
|
@ -188,13 +188,14 @@
|
||||||
<div class="col-12">
|
<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>
|
<button class="create-section-btn" (click)="addNewEntry({parent:selectedTocEntry, childType: tocEntryEnumValues.Section})">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.PAGE-INFO.ACTIONS.CREATE-SECTION' | translate}}</button>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</formGroup>
|
</formGroup>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12" *ngIf="(selectedTocEntry.type === tocEntryEnumValues.Section) || (selectedTocEntry.type === tocEntryEnumValues.FieldSet)">
|
<div class="col-12" *ngIf="(selectedTocEntry.type === tocEntryEnumValues.Section) || (selectedTocEntry.type === tocEntryEnumValues.FieldSet)">
|
||||||
|
|
||||||
<app-description-template-editor-section-fieldset-component
|
<app-description-template-editor-section-fieldset-component
|
||||||
[tocentry]="selectedTocEntry"
|
[tocentry]="selectedTocEntry"
|
||||||
[viewOnly]="viewOnly"
|
[viewOnly]="viewOnly"
|
||||||
|
|
|
@ -447,6 +447,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
||||||
validateStep(selectedIndex) {
|
validateStep(selectedIndex) {
|
||||||
|
|
||||||
if (this.formGroup.invalid) {
|
if (this.formGroup.invalid) {
|
||||||
|
this.formService.touchAllFormFields(this.formGroup);
|
||||||
this.checkFormValidation(selectedIndex);
|
this.checkFormValidation(selectedIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -629,7 +629,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "Gutxienez iturri bat eman behar da.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "Gutxienez iturri bat eman behar da.",
|
||||||
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "Gutxienez aukera 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.",
|
"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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Bat ere ez",
|
"NONE": "Bat ere ez",
|
||||||
|
|
|
@ -629,7 +629,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"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-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.",
|
"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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Keine",
|
"NONE": "Keine",
|
||||||
|
|
|
@ -627,7 +627,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"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-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.",
|
"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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "None",
|
"NONE": "None",
|
||||||
|
|
|
@ -629,7 +629,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "Debe proporcionar al menos una fuente.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "Debe proporcionar al menos una fuente.",
|
||||||
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "Debe proporcionar al menos una opción.",
|
"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.",
|
"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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Ninguno",
|
"NONE": "Ninguno",
|
||||||
|
|
|
@ -629,7 +629,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"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-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.",
|
"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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Κανένα",
|
"NONE": "Κανένα",
|
||||||
|
|
|
@ -629,7 +629,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "Mora biti naveden barem jedan izvor.",
|
"FIELD-OTHER-SOURCES-REQUIRED": "Mora biti naveden barem jedan izvor.",
|
||||||
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "Mora biti navedena barem jedna opcija.",
|
"FIELD-RADIO-AT-LEAST-ONE-REQUIRED": "Mora biti navedena barem jedna opcija.",
|
||||||
"FIELD-SELECT-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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Niti jedan",
|
"NONE": "Niti jedan",
|
||||||
|
|
|
@ -629,7 +629,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "Należy podać co najmniej jedno źródło.",
|
"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-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ę.",
|
"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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Brak",
|
"NONE": "Brak",
|
||||||
|
|
|
@ -629,7 +629,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "Deve ser fornecida pelo menos uma fonte.",
|
"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-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.",
|
"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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Nenhum",
|
"NONE": "Nenhum",
|
||||||
|
|
|
@ -629,7 +629,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"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-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.",
|
"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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Žiadny",
|
"NONE": "Žiadny",
|
||||||
|
|
|
@ -629,7 +629,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"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-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.",
|
"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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Nijedan",
|
"NONE": "Nijedan",
|
||||||
|
|
|
@ -629,7 +629,8 @@
|
||||||
"FIELD-OTHER-SOURCES-REQUIRED": "At least one source must be provided.",
|
"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-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.",
|
"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": {
|
"DEFAULT-VALUES": {
|
||||||
"NONE": "Hiç",
|
"NONE": "Hiç",
|
||||||
|
|
Loading…
Reference in New Issue