add description template editor validator (in progress)
This commit is contained in:
parent
c30f499f30
commit
b5c31590d3
|
@ -8,6 +8,7 @@
|
|||
</mat-form-field>
|
||||
<mat-form-field class="col field-title" 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')"></textarea>
|
||||
<mat-error *ngIf="this.form.get('title').hasError('backendError')">{{form.get('title').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -16,38 +17,43 @@
|
|||
<h5 style="font-weight: bold" class="row">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION' | translate}}</h5>
|
||||
<rich-text-editor-component [form]="form.get('description')" [id]="'editor1'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION'" [wrapperClasses]="'row'">
|
||||
</rich-text-editor-component>
|
||||
<mat-error *ngIf="this.form.get('description').hasError('backendError')">{{form.get('description').getError('backendError').message}}</mat-error>
|
||||
</div>
|
||||
<div *ngIf="showExtendedDescription" class="mb-4">
|
||||
<h5 style="font-weight: bold" class="row">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION' | translate}}</h5>
|
||||
<rich-text-editor-component [form]="form.get('extendedDescription')" [id]="'editor2'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION'" [wrapperClasses]="'row'">
|
||||
</rich-text-editor-component>
|
||||
<mat-error *ngIf="this.form.get('extendedDescription').hasError('backendError')">{{form.get('extendedDescription').getError('backendError').message}}</mat-error>
|
||||
</div>
|
||||
<div class="row" *ngIf="showAdditionalInfo">
|
||||
<mat-form-field class="col p-0 underline-line-field">
|
||||
<input matInput type="text" placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.ADDITIONAL-INFORMATION' | translate}}" [formControl]="this.form.get('additionalInformation')" />
|
||||
<mat-error *ngIf="this.form.get('additionalInformation').hasError('backendError')">{{form.get('additionalInformation').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<mat-form-field *ngIf="isMultiplicityEnabled" class="col pl-0 underline-line-field">
|
||||
<input matInput placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-MIN' | translate}}" type="number" [formControl]="form.get('multiplicity').get('min')" required>
|
||||
<mat-error *ngIf="form.get('multiplicity').get('min').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
|
||||
</mat-error>
|
||||
<mat-error *ngIf="form.get('multiplicity').get('min').hasError('backendError')">{{form.get('multiplicity').get('min').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="form.get('multiplicity').get('min').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="isMultiplicityEnabled" class="col pr-0 underline-line-field">
|
||||
<input matInput placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-MAX' | translate}}" type="number" [formControl]="this.form.get('multiplicity').get('max')" required>
|
||||
<mat-error *ngIf="form.get('multiplicity').get('max').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
|
||||
</mat-error>
|
||||
<mat-error *ngIf="form.get('multiplicity').get('max').hasError('backendError')">{{form.get('multiplicity').get('max').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="form.get('multiplicity').get('max').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="row">
|
||||
<mat-form-field *ngIf="isMultiplicityEnabled" class="col pl-0 underline-line-field">
|
||||
<input matInput placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-PLACEHOLDER' | translate}}" type="text" [formControl]="form.get('multiplicity').get('placeholder')">
|
||||
<input matInput placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-PLACEHOLDER' | translate}}" type="text" [formControl]="form.get('multiplicity').get('multiplicity')">
|
||||
<mat-error *ngIf="form.get('multiplicity').get('multiplicity').hasError('backendError')">{{form.get('multiplicity').get('multiplicity').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="row">
|
||||
<mat-checkbox *ngIf="isMultiplicityEnabled" class="col pl-0 underline-line-field fieldset-checkbox-action-description-template-editor" [formControl]="form.get('multiplicity').get('tableView')">
|
||||
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-TABLEVIEW' | translate}}
|
||||
<mat-error *ngIf="form.get('multiplicity').get('tableView').hasError('backendError')">{{form.get('multiplicity').get('tableView').getError('backendError').message}}</mat-error>
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -268,6 +274,7 @@
|
|||
|
||||
<li class="list-inline-item">
|
||||
<mat-checkbox class="fieldset-checkbox-action-description-template-editor" [formControl]="this.form.get('hasCommentField')" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELDSET.INCLUDE-COMMENT-FIELD' | translate">{{'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELDSET.COMMENT-FIELD' | translate}}</mat-checkbox>
|
||||
<mat-error *ngIf="form.get('hasCommentField').hasError('backendError')">{{form.get('hasCommentField').getError('backendError').message}}</mat-error>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<mat-checkbox class="fieldset-checkbox-action-description-template-editor" [(checked)]="isMultiplicityEnabled" (change)="onIsMultiplicityEnabledChange($event)" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELDSET.ENABLE-MULTIPLICITY' | translate" [disabled]="viewOnly">
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
<h5 style="font-weight: bold" class="col-auto">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5>
|
||||
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiAutoComplete')">
|
||||
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
|
||||
<mat-error *ngIf="form.get('data').get('multiAutoComplete').hasError('backendError')">{{form.get('data').get('multiAutoComplete').getError('backendError').message}}</mat-error>
|
||||
</mat-checkbox>
|
||||
|
||||
<mat-form-field class="col-12">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-PLACEHOLDER' | translate}}</mat-label>
|
||||
<input matInput type="string" [formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
|
@ -31,31 +33,37 @@
|
|||
<mat-select [formControl]="singleForm.get('method')">
|
||||
<mat-option *ngFor="let method of htmlMethods | keyvalue" [value]="method.value">{{method.value}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="singleForm.get('method').hasError('backendError')">{{singleForm.get('method').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="col-md-6">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-URL' | translate}}</mat-label>
|
||||
<input matInput [formControl]="singleForm.get('url')">
|
||||
<mat-error *ngIf="singleForm.get('url').hasError('backendError')">{{singleForm.get('url').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="singleForm.get('url').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-3">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-OPTIONS-ROOT' | translate}}</mat-label>
|
||||
<input matInput [formControl]="singleForm.get('optionsRoot')">
|
||||
<mat-error *ngIf="singleForm.get('optionsRoot').hasError('backendError')">{{singleForm.get('optionsRoot').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="singleForm.get('optionsRoot').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-3">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-LABEL' | translate}}</mat-label>
|
||||
<input matInput [formControl]="singleForm.get('autoCompleteOptions').get('label')">
|
||||
<mat-error *ngIf="singleForm.get('autoCompleteOptions').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('label').hasError('backendError')">{{singleForm.get('autoCompleteOptions').get('label').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-3">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-VALUE' | translate}}</mat-label>
|
||||
<input matInput [formControl]="singleForm.get('autoCompleteOptions').get('value')">
|
||||
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('value').hasError('backendError')">{{singleForm.get('autoCompleteOptions').get('value').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-3">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-SOURCE' | translate}}</mat-label>
|
||||
<input matInput [formControl]="singleForm.get('autoCompleteOptions').get('source')">
|
||||
<mat-error *ngIf="singleForm.get('autoCompleteOptions').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('source').hasError('backendError')">{{singleForm.get('autoCompleteOptions').get('source').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('source').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-checkbox class="col-12" [formControl]="singleForm.get('hasAuth')">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-HAS-AUTH' | translate}}</mat-checkbox>
|
||||
<div *ngIf="singleForm.get('hasAuth').value === true" class="col-12">
|
||||
|
@ -64,10 +72,12 @@
|
|||
<mat-select [formControl]="singleForm.get('auth').get('method')">
|
||||
<mat-option *ngFor="let method of htmlMethods | keyvalue" [value]="method.value">{{method.value}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="singleForm.get('auth').get('method').hasError('backendError')">{{singleForm.get('auth').get('method').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-6">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-URL' | translate}}</mat-label>
|
||||
<input matInput [formControl]="singleForm.get('auth').get('url')">
|
||||
<mat-error *ngIf="singleForm.get('auth').get('method').hasError('backendError')">{{singleForm.get('auth').get('method').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="singleForm.get('auth').get('url').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-6">
|
||||
|
@ -75,15 +85,18 @@
|
|||
<mat-select [formControl]="singleForm.get('auth').get('type')">
|
||||
<mat-option *ngFor="let type of authTypes | keyvalue" [value]="type.value">{{type.value}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="singleForm.get('auth').get('type').hasError('backendError')">{{singleForm.get('auth').get('type').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-6">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-OPTIONS-ROOT' | translate}}</mat-label>
|
||||
<input matInput [formControl]="singleForm.get('auth').get('path')">
|
||||
<mat-error *ngIf="singleForm.get('auth').get('path').hasError('backendError')">{{singleForm.get('auth').get('path').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="singleForm.get('auth').get('path').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-12">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-BODY' | translate}}</mat-label>
|
||||
<textarea matInput [formControl]="singleForm.get('auth').get('body')"></textarea>
|
||||
<mat-error *ngIf="singleForm.get('auth').get('body').hasError('backendError')">{{singleForm.get('auth').get('body').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="singleForm.get('auth').get('body').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATASET-IDENTIFIER-PLACEHOLDER' | translate}}</mat-label>
|
||||
<input matInput type="string"
|
||||
[formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
|
@ -9,5 +9,6 @@
|
|||
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATASETS-PLACEHOLDER' | translate}}</mat-label>
|
||||
<input matInput type="string"
|
||||
[formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
|
|
@ -9,5 +9,6 @@
|
|||
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DMPS-PLACEHOLDER' | translate}}</mat-label>
|
||||
<input matInput type="string"
|
||||
[formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
<mat-form-field class="col-12">
|
||||
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-PLACEHOLDER' | translate}}</mat-label>
|
||||
<input matInput type="string"
|
||||
[formControl]="form.get('data').get('label')">
|
||||
<input matInput type="string"[formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-6">
|
||||
<mat-label>
|
||||
|
@ -17,6 +17,6 @@
|
|||
<mat-select [formControl]="form.get('data').get('type')">
|
||||
<mat-option *ngFor="let type of externalDatasetTypes" [value]="type.value">{{type.label | translate}}</mat-option>
|
||||
</mat-select>
|
||||
|
||||
<mat-error *ngIf="form.get('data').get('type').hasError('backendError')">{{form.get('data').get('type').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
<mat-form-field class="col-12">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-LABEL' | translate}}</mat-label>
|
||||
<input matInput type="string" [formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
|
@ -5,5 +5,6 @@
|
|||
<mat-form-field class="col-12">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-LABEL' | translate}}</mat-label>
|
||||
<input matInput type="string" [formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
|
@ -18,13 +18,13 @@
|
|||
<div *ngFor="let option of form.get('data').get('options')['controls'] index as i" class="row">
|
||||
<mat-form-field class="col">
|
||||
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-LABEL' | translate}}</mat-label>
|
||||
<input matInput type="string"
|
||||
[formControl]="this.form.get('data').get('options').get(''+i).get('label')">
|
||||
<input matInput type="string" [formControl]="this.form.get('data').get('options').get(''+i).get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('options').get(''+i).get('label').hasError('backendError')">{{form.get('data').get('options').get(''+i).get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col">
|
||||
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-VALUE' | translate}}</mat-label>
|
||||
<input matInput type="string"
|
||||
[formControl]="this.form.get('data').get('options').get(''+i).get('value')">
|
||||
<input matInput type="string" [formControl]="this.form.get('data').get('options').get(''+i).get('value')">
|
||||
<mat-error *ngIf="form.get('data').get('options').get(''+i).get('value').hasError('backendError')">{{form.get('data').get('options').get(''+i).get('value').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<button mat-icon-button class="col-auto" (click)="deleteRow(i)" type="button"
|
||||
[disabled]="this.form.disabled">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<mat-form-field class="col-12">
|
||||
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RESEARCHERS-PLACEHOLDER' | translate}}</mat-label>
|
||||
<input matInput type="string"
|
||||
[formControl]="form.get('data').get('label')">
|
||||
<input matInput type="string" [formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</mat-checkbox>
|
||||
<mat-form-field class="col-12">
|
||||
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RESEARCHERS-PLACEHOLDER' | translate}}</mat-label>
|
||||
<input matInput type="string"
|
||||
[formControl]="form.get('data').get('label')">
|
||||
<input matInput type="string" [formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
| translate}}</h5>
|
||||
<mat-form-field class="col-12">
|
||||
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-TAGS-PLACEHOLDER' | translate}}</mat-label>
|
||||
<input matInput type="string"
|
||||
[formControl]="form.get('data').get('label')">
|
||||
<input matInput type="string" [formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
|
@ -8,6 +8,7 @@
|
|||
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-UPLOAD-PLACEHOLDER' | translate}}
|
||||
</mat-label>
|
||||
<input matInput type="string" [formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="col-12">
|
||||
|
@ -16,6 +17,7 @@
|
|||
translate: { maxfilesize: getConfiguration().maxFileSizeInMB.toString() } }}
|
||||
</mat-label>
|
||||
<input matInput type="number" min="1" [max]="getConfiguration().maxFileSizeInMB" [formControl]="form.get('data').get('maxFileSizeInMB')">
|
||||
<mat-error *ngIf="form.get('data').get('maxFileSizeInMB').hasError('backendError')">{{form.get('data').get('maxFileSizeInMB').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="col-12">
|
||||
|
@ -36,10 +38,12 @@
|
|||
<mat-form-field class="col">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-UPLOAD-LABEL' | translate}}</mat-label>
|
||||
<input matInput type="string" [formControl]="this.form.get('data').get('types').get(''+i).get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('types').get(''+i).get('label').hasError('backendError')">{{form.get('data').get('types').get(''+i).get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-UPLOAD-VALUE' | translate}}</mat-label>
|
||||
<input matInput type="string" [formControl]="this.form.get('data').get('types').get(''+i).get('value')">
|
||||
<mat-error *ngIf="form.get('data').get('types').get(''+i).get('value').hasError('backendError')">{{form.get('data').get('types').get(''+i).get('value').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<button mat-icon-button class="col-auto" (click)="deleteRow(i)" type="button" [disabled]="form.get('data').get('types').disabled">
|
||||
<mat-icon>delete</mat-icon>
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
</div>
|
||||
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiList')">
|
||||
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-WORDLIST' | translate}}
|
||||
<mat-error *ngIf="form.get('data').get('multiList').hasError('backendError')">{{form.get('data').get('multiList').getError('backendError').message}}</mat-error>
|
||||
</mat-checkbox>
|
||||
|
||||
<mat-form-field class="col-12">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-PLACEHOLDER' | translate}}</mat-label>
|
||||
<input matInput type="string" [formControl]="form.get('data').get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<div class="col-12">
|
||||
|
@ -22,10 +24,12 @@
|
|||
<mat-form-field class="col">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-LABEL' | translate}}</mat-label>
|
||||
<input matInput type="text" [formControl]="form.get('data').get('options').get(''+i).get('label')">
|
||||
<mat-error *ngIf="form.get('data').get('options').get(''+i).get('label').hasError('backendError')">{{form.get('data').get('options').get(''+i).get('label').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col">
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-VALUE' | translate}}</mat-label>
|
||||
<input matInput [formControl]="form.get('data').get('options').get(''+i).get('value')">
|
||||
<mat-error *ngIf="form.get('data').get('options').get(''+i).get('value').hasError('backendError')">{{form.get('data').get('options').get(''+i).get('value').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<button mat-icon-button class="col-auto" (click)="deleteRow(i)" type="button" [disabled]="this.form.disabled">
|
||||
<mat-icon>delete</mat-icon>
|
||||
|
|
|
@ -168,9 +168,12 @@
|
|||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.SEMANTICS' | translate}}</mat-label>
|
||||
<app-multiple-auto-complete placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.SEMANTICS' | translate}}" [hidePlaceholder]="true" required='false' [separatorKeysCodes]="separatorKeysCodes" [formControl]="this.form.get('schematics')" [configuration]="semanticsAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete>
|
||||
<mat-error *ngIf="form.get('schematics').hasError('backendError')">{{form.get('schematics').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-checkbox [formControl]="this.form.get('includeInExport')" class="col-6" [disabled]="viewOnly">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXPORT' | translate}}</mat-checkbox>
|
||||
<mat-checkbox [formControl]="this.form.get('includeInExport')" class="col-6" [disabled]="viewOnly">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXPORT' | translate}}
|
||||
<mat-error *ngIf="form.get('includeInExport').hasError('backendError')">{{form.get('includeInExport').getError('backendError').message}}</mat-error>
|
||||
</mat-checkbox>
|
||||
|
||||
<!-- Default Value -->
|
||||
<app-description-template-editor-default-value-component *ngIf="form.get('data')?.get('fieldType')?.value" class="col-6" [fieldType]="form.get('data').get('fieldType').value" [form]="this.form.get('defaultValue')" [formArrayOptions]="form.get('data')?.get('options')" [comboBoxType]="this.form.get('data')?.get('type')?.value" [internalDmpEntitiesType]="this.form.get('data')?.get('type')?.value" placeHolder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.DEFAULT-VALUE' | translate}}">
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<mat-form-field class="col">
|
||||
<input matInput type="text" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.PAGES.PAGE-INPUT-TITLE' | translate}}"
|
||||
[formControl]="pageControl.get('title')" required>
|
||||
<mat-error *ngIf="pageControl.get('title').hasError('backendError')">{{pageControl.get('title').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="pageControl.get('title').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<button mat-icon-button type="button" class="col-auto" (click)="removePage(i)" [disabled]="viewOnly">
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<div class="heading col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION-NAME' | translate}} *</div>
|
||||
<div class="hint col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION-NAME-HINT' | translate}}</div>
|
||||
<mat-form-field class="col-12">
|
||||
<input matInput type="text" [placeholder]="('DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.UNTITLED' | translate)+ ' '+ ('DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION' | translate)"
|
||||
formControlName="title">
|
||||
<mat-error >{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<input matInput type="text" [placeholder]="('DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.UNTITLED' | translate)+ ' '+ ('DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION' | translate)"formControlName="title">
|
||||
<mat-error *ngIf="form.get('title').hasError('backendError')">{{form.get('title').getError('backendError').message}}</mat-error>
|
||||
<mat-error >{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<div class="heading col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION-DESCRIPTION' | translate}} </div>
|
||||
<div class="hint col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION-DESCRIPTION-HINT' | translate}}</div>
|
||||
|
@ -13,5 +13,6 @@
|
|||
<rich-text-editor-component [form]="form.get('description')"
|
||||
[placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.SECTION.FIELDS.DESCRIPTION'">
|
||||
</rich-text-editor-component>
|
||||
<mat-error *ngIf="form.get('description').hasError('backendError')">{{form.get('description').getError('backendError').message}}</mat-error>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -66,9 +66,8 @@
|
|||
<div class="hint">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-NAME-HINT'| translate}}</div>
|
||||
<mat-form-field class="full-width basic-info-input">
|
||||
<input matInput [formControl]="formGroup.get('label')" placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.FIELDS.DATASET-TITLE' | translate}}">
|
||||
<mat-error *ngIf="formGroup.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' |
|
||||
translate}}
|
||||
</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('label').hasError('backendError')">{{formGroup.get('label').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
|
@ -79,9 +78,8 @@
|
|||
<rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'">
|
||||
</rich-text-editor-component>
|
||||
<div [class]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'visible' : 'invisible'" class="mat-form-field formGroup-field-subscript-wrapper">
|
||||
<mat-error>
|
||||
{{'GENERAL.VALIDATION.REQUIRED'| translate}}
|
||||
</mat-error>
|
||||
<mat-error>{{'GENERAL.VALIDATION.REQUIRED'| translate}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('description').hasError('backendError')">{{formGroup.get('description').getError('backendError').message}}</mat-error>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -93,6 +91,7 @@
|
|||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DESCRIPTION-TEMPLATE-SELECT-TYPE' | translate}}</mat-label>
|
||||
<app-single-auto-complete [required]="false" [formControl]="formGroup.get('type')" placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DESCRIPTION-TEMPLATE-SELECT-TYPE' | translate}}" [configuration]="descriptionTemplateTypeService.singleAutocompleteConfiguration">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="formGroup.get('type').hasError('backendError')">{{formGroup.get('type').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('type').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
@ -107,9 +106,8 @@
|
|||
{{ lang.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="formGroup.get('language').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' |
|
||||
translate}}
|
||||
</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('language').hasError('backendError')">{{formGroup.get('language').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('language').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' |translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
|
@ -297,7 +295,7 @@
|
|||
|
||||
<ng-template #actions>
|
||||
<div>
|
||||
<button mat-raised-button class="template_action_btn mr-3" (click)="discardChanges()">{{'DATASET-WIZARD.ACTIONS.CLOSE' | translate}}</button>
|
||||
<button mat-raised-button class="template_action_btn mr-3" (click)="cancel()">{{'DATASET-WIZARD.ACTIONS.CLOSE' | translate}}</button>
|
||||
<!-- <button *ngIf="!formGroup.disabled && formGroup.get('status').value!=1" [disabled]="!formGroup.valid" mat-raised-button class="template_action_btn save-btn" type="button"> -->
|
||||
<button *ngIf="!formGroup.disabled && formGroup.get('status').value!=1" mat-raised-button class="template_action_btn save-btn" type="button">
|
||||
<span class="d-flex flex-row row">
|
||||
|
@ -313,7 +311,11 @@
|
|||
<button [disabled]="!formGroup.valid" mat-menu-item (click)="onSubmit()" type="button">{{ 'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.SAVE-AND-CONTINUE' | translate }}</button>
|
||||
</mat-menu>
|
||||
|
||||
<button *ngIf="formGroup.disabled || formGroup.get('status').value==1" [@finalize_btn] mat-raised-button class="template_action_btn save-btn" [disabled]="!formGroup.valid" (click)="updateAndFinalize()">
|
||||
<!-- <button *ngIf="formGroup.disabled || formGroup.get('status').value==1" [@finalize_btn] mat-raised-button class="template_action_btn save-btn" [disabled]="!formGroup.valid" (click)="updateAndFinalize()">
|
||||
{{'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.UPDATE' |translate}}
|
||||
<mat-icon (click)="$event.stopPropagation();" style="width: 14px;" [matMenuTriggerFor]="menuUpdate">expand_more</mat-icon>
|
||||
</button> -->
|
||||
<button *ngIf="formGroup.disabled || formGroup.get('status').value==1" [@finalize_btn] mat-raised-button class="template_action_btn save-btn" (click)="formSubmit()">
|
||||
{{'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.UPDATE' |translate}}
|
||||
<mat-icon (click)="$event.stopPropagation();" style="width: 14px;" [matMenuTriggerFor]="menuUpdate">expand_more</mat-icon>
|
||||
</button>
|
||||
|
|
|
@ -171,6 +171,10 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditDescriptionTemplate));
|
||||
//this.selectedSystemFields = this.selectedSystemFieldDisabled();
|
||||
this.descriptionTemplateEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
|
||||
DescriptionTemplateEditorModel.reApplyDefinitionValidators({
|
||||
formGroup: this.formGroup,
|
||||
validationErrorModel: this.editorModel.validationErrorModel
|
||||
});
|
||||
if (this.editorModel.status == DescriptionTemplateStatus.Finalized) {
|
||||
this.formGroup.disable();
|
||||
}
|
||||
|
@ -207,9 +211,9 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
|
||||
formSubmit(): void {
|
||||
this.formService.touchAllFormFields(this.formGroup);
|
||||
if (!this.isFormValid()) {
|
||||
return;
|
||||
}
|
||||
// if (!this.isFormValid()) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
this.persistEntity();
|
||||
}
|
||||
|
@ -551,8 +555,16 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
return tocEntryFound ? tocEntryFound : null;
|
||||
}
|
||||
|
||||
addNewEntry(tce: NewEntryType) {
|
||||
private reaplyValidators(){
|
||||
DescriptionTemplateEditorModel.reApplyDefinitionValidators(
|
||||
{
|
||||
formGroup: this.formGroup,
|
||||
validationErrorModel: this.editorModel.validationErrorModel
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
addNewEntry(tce: NewEntryType) {
|
||||
const parent = tce.parent;
|
||||
|
||||
//define entry type
|
||||
|
@ -560,10 +572,10 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
case ToCEntryType.Page:
|
||||
const pagesArray = (this.formGroup.get('definition').get('pages') as UntypedFormArray);
|
||||
|
||||
const page: DescriptionTemplatePageEditorModel = new DescriptionTemplatePageEditorModel();
|
||||
const page: DescriptionTemplatePageEditorModel = new DescriptionTemplatePageEditorModel(this.editorModel.validationErrorModel);
|
||||
page.id = Guid.create().toString();
|
||||
if (isNaN(pagesArray.length)) { page.ordinal = 0; } else { page.ordinal = pagesArray.length; }
|
||||
const pageForm = page.buildForm();
|
||||
const pageForm = page.buildForm({ rootPath: 'definition.pages[' + pagesArray.length + '].' });
|
||||
// this.dataModel.pages.push(page);
|
||||
|
||||
pagesArray.push(pageForm);
|
||||
|
@ -574,7 +586,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
break;
|
||||
case ToCEntryType.Section:
|
||||
|
||||
const section: DescriptionTemplateSectionEditorModel = new DescriptionTemplateSectionEditorModel();
|
||||
const section: DescriptionTemplateSectionEditorModel = new DescriptionTemplateSectionEditorModel(this.editorModel.validationErrorModel);
|
||||
section.id = Guid.create().toString();
|
||||
let sectionsArray: UntypedFormArray;
|
||||
|
||||
|
@ -593,7 +605,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
section.ordinal = sectionsArray.length;
|
||||
|
||||
}
|
||||
sectionsArray.push(section.buildForm());
|
||||
sectionsArray.push(section.buildForm({ rootPath: 'definition.sections[' + sectionsArray.length + '].' }));
|
||||
// this.form.updateValueAndValidity();
|
||||
|
||||
} else if (parent.type == ToCEntryType.Section) { //SUBSECTION OF SECTION
|
||||
|
@ -608,7 +620,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
section.ordinal = sectionsArray.length;
|
||||
}
|
||||
|
||||
sectionsArray.push(section.buildForm());
|
||||
sectionsArray.push(section.buildForm({ rootPath: 'definition.sections[' + sectionsArray.length + '].' }));
|
||||
// (child.form.parent as FormArray).push(section.buildForm());
|
||||
|
||||
} else {
|
||||
|
@ -627,42 +639,56 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
break;
|
||||
case ToCEntryType.FieldSet:
|
||||
|
||||
//create one field form fieldset
|
||||
const field: DescriptionTemplateFieldEditorModel = new DescriptionTemplateFieldEditorModel();
|
||||
field.id = Guid.create().toString();
|
||||
field.ordinal = 0;//first filed in the fields list
|
||||
const fieldForm = field.buildForm();
|
||||
// fieldForm.setValidators(this.customFieldValidator());
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValidators(Validators.required);
|
||||
let sectionIndex = -1;
|
||||
const sections = (this.formGroup.get('definition').get('sections') as UntypedFormArray);
|
||||
|
||||
// fieldSet.fields.push(field);
|
||||
// field.ordinal = fieldSet.fields.length-1;
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
|
||||
const fieldSetsArray = parent.form.get('fieldSets') as UntypedFormArray
|
||||
let section = sections.at(i);
|
||||
|
||||
//give fieldset id and ordinal
|
||||
const fieldSet: DescriptionTemplateFieldSetEditorModel = new DescriptionTemplateFieldSetEditorModel();
|
||||
const fieldSetId = Guid.create().toString();
|
||||
fieldSet.id = fieldSetId;
|
||||
let sectionId = section.get('id').value;
|
||||
if (sectionId == parent.id) {
|
||||
sectionIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(sectionIndex > -1 ){
|
||||
//create one field form fieldset
|
||||
const field: DescriptionTemplateFieldEditorModel = new DescriptionTemplateFieldEditorModel(this.editorModel.validationErrorModel);
|
||||
field.id = Guid.create().toString();
|
||||
field.ordinal = 0;//first filed in the fields list
|
||||
// const fieldForm = field.buildForm();
|
||||
// fieldForm.setValidators(this.customFieldValidator());
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValidators(Validators.required);
|
||||
|
||||
try {
|
||||
const maxOrdinal = fieldSetsArray.controls.map(control => control.get('ordinal').value).reduce((a, b) => Math.max(a, b));
|
||||
fieldSet.ordinal = maxOrdinal + 1;
|
||||
} catch {
|
||||
fieldSet.ordinal = fieldSetsArray.length;
|
||||
}
|
||||
const fieldsetForm = fieldSet.buildForm();
|
||||
// fieldSet.fields.push(field);
|
||||
// field.ordinal = fieldSet.fields.length-1;
|
||||
|
||||
const fieldSetsArray = parent.form.get('fieldSets') as UntypedFormArray
|
||||
const fieldForm = field.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].fieldSets[' + fieldSetsArray.length + '].fields['+ 0 + '].'});
|
||||
|
||||
//give fieldset id and ordinal
|
||||
const fieldSet: DescriptionTemplateFieldSetEditorModel = new DescriptionTemplateFieldSetEditorModel(this.editorModel.validationErrorModel);
|
||||
const fieldSetId = Guid.create().toString();
|
||||
fieldSet.id = fieldSetId;
|
||||
|
||||
(fieldsetForm.get('fields') as UntypedFormArray).push(fieldForm);
|
||||
fieldSetsArray.push(fieldsetForm);
|
||||
try {
|
||||
const maxOrdinal = fieldSetsArray.controls.map(control => control.get('ordinal').value).reduce((a, b) => Math.max(a, b));
|
||||
fieldSet.ordinal = maxOrdinal + 1;
|
||||
} catch {
|
||||
fieldSet.ordinal = fieldSetsArray.length;
|
||||
}
|
||||
const fieldsetForm = fieldSet.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].fieldSets[' + fieldSetsArray.length + '].'});
|
||||
|
||||
this.refreshToCEntries();
|
||||
this.selectedTocEntry = this._findTocEntryById(fieldSetId.toString(), this.toCEntries);
|
||||
// fieldForm.updateValueAndValidity();
|
||||
(fieldsetForm.get('fields') as UntypedFormArray).push(fieldForm);
|
||||
fieldSetsArray.push(fieldsetForm);
|
||||
|
||||
break;
|
||||
this.refreshToCEntries();
|
||||
this.selectedTocEntry = this._findTocEntryById(fieldSetId.toString(), this.toCEntries);
|
||||
// fieldForm.updateValueAndValidity();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -734,6 +760,8 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
pages.at(i).get('ordinal').patchValue(i);
|
||||
}
|
||||
|
||||
this.reaplyValidators();
|
||||
|
||||
//update validity
|
||||
// this.form.controls.sections.updateValueAndValidity();
|
||||
}
|
||||
|
@ -796,6 +824,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
}
|
||||
|
||||
}
|
||||
this.reaplyValidators();
|
||||
|
||||
break;
|
||||
case ToCEntryType.FieldSet:
|
||||
|
@ -822,6 +851,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
|
|||
for (let i = 0; i < parentFormArray.length; i++) {
|
||||
parentFormArray.at(i).get('ordinal').patchValue(i);
|
||||
}
|
||||
this.reaplyValidators();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -17,7 +17,7 @@ export class DescriptionTemplateEditorModel extends BaseEditorModel implements D
|
|||
description: string;
|
||||
language: string;
|
||||
type: Guid;
|
||||
status: DescriptionTemplateStatus = DescriptionTemplateStatus.Finalized; //TODO CHANGE TO DRAFT
|
||||
status: DescriptionTemplateStatus = DescriptionTemplateStatus.Draft;
|
||||
definition: DescriptionTemplateDefinitionEditorModel = new DescriptionTemplateDefinitionEditorModel();
|
||||
users: UserDescriptionTemplateEditorModel[] = [];
|
||||
permissions: string[];
|
||||
|
@ -36,7 +36,7 @@ export class DescriptionTemplateEditorModel extends BaseEditorModel implements D
|
|||
this.type = item.type?.id;
|
||||
this.status = item.status;
|
||||
this.definition = new DescriptionTemplateDefinitionEditorModel(this.validationErrorModel).fromModel(item.definition);
|
||||
if (item.users) { item.users.map(x => this.users.push(new UserDescriptionTemplateEditorModel().fromModel(x))); }
|
||||
if (item.users) { item.users.map(x => this.users.push(new UserDescriptionTemplateEditorModel(this.validationErrorModel).fromModel(x))); }
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -84,6 +84,18 @@ export class DescriptionTemplateEditorModel extends BaseEditorModel implements D
|
|||
return baseContext;
|
||||
}
|
||||
|
||||
createChildPage(index: number, id: string): UntypedFormGroup {
|
||||
const page: DescriptionTemplatePageEditorModel = new DescriptionTemplatePageEditorModel(this.validationErrorModel);
|
||||
page.id = id;
|
||||
if (isNaN(index)) { page.ordinal = 0; } else { page.ordinal = index; }
|
||||
return page.buildForm({ rootPath: 'definition.pages[' + index + '].' });
|
||||
}
|
||||
|
||||
createChildSection(index: number): UntypedFormGroup {
|
||||
const section: DescriptionTemplateSectionEditorModel = new DescriptionTemplateSectionEditorModel(this.validationErrorModel);
|
||||
return section.buildForm({ rootPath: 'definition.sections[' + index + '].' });
|
||||
}
|
||||
|
||||
static reApplyDefinitionValidators(params: {
|
||||
formGroup: UntypedFormGroup,
|
||||
validationErrorModel: ValidationErrorModel,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div>
|
||||
<div class="col-md-13 offset-md-0">
|
||||
<div class="row notification-listing">
|
||||
<div class="col-md-8 offset-md-2">
|
||||
|
||||
<div class="row mb-6 mt-3">
|
||||
<div class="row mb-4 mt-3">
|
||||
<div class="col">
|
||||
<h4>{{'NOTIFICATION-SERVICE.NOTIFICATION-LISTING.TITLE' | translate}}</h4>
|
||||
<app-navigation-breadcrumb />
|
||||
|
|
Loading…
Reference in New Issue