Fixes bug on grant description input, makes field not required

This commit is contained in:
apapachristou 2019-09-02 13:29:22 +03:00
parent 433c28c510
commit 3fb82c65ea
2 changed files with 2 additions and 7 deletions

View File

@ -5,7 +5,6 @@ import { ValidationContext } from "../../../../common/forms/validation/validatio
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { BackendErrorValidator } from "../../../../common/forms/validation/custom-validator"; import { BackendErrorValidator } from "../../../../common/forms/validation/custom-validator";
import { ValidJsonValidator } from "../../../../library/auto-complete/auto-complete-custom-validator"; import { ValidJsonValidator } from "../../../../library/auto-complete/auto-complete-custom-validator";
import { FunderFormModel } from "./funder-form-model";
export class GrantTabModel { export class GrantTabModel {
public id: string; public id: string;
@ -41,7 +40,7 @@ export class GrantTabModel {
baseContext.validation.push({ key: 'id', validators: [] }); baseContext.validation.push({ key: 'id', validators: [] });
baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] }); baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] });
baseContext.validation.push({ key: 'status', validators: [] }); baseContext.validation.push({ key: 'status', validators: [] });
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'description')] }); baseContext.validation.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] });
baseContext.validation.push({ key: 'existGrant', validators: [Validators.required, ValidJsonValidator, BackendErrorValidator(this.validationErrorModel, 'existGrant')] }); baseContext.validation.push({ key: 'existGrant', validators: [Validators.required, ValidJsonValidator, BackendErrorValidator(this.validationErrorModel, 'existGrant')] });
baseContext.validation.push({ key: 'funderId', validators: [ValidJsonValidator, BackendErrorValidator(this.validationErrorModel, 'funderId')] }); baseContext.validation.push({ key: 'funderId', validators: [ValidJsonValidator, BackendErrorValidator(this.validationErrorModel, 'funderId')] });
return baseContext; return baseContext;

View File

@ -55,11 +55,7 @@
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> {{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<textarea matInput class="description-area" placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.DESCRIPTION' | translate}}" [formControl]="grantformGroup.get('description')" required></textarea> <textarea matInput class="description-area" placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.DESCRIPTION' | translate}}" [formControl]="grantformGroup.get('description')"></textarea>
<mat-error *ngIf="grantformGroup.get('description').hasError('backendError')">
{{grantformGroup.get('description').getError('backendError').message}}</mat-error>
<mat-error *ngIf="grantformGroup.get('description').hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>