bug fixes
This commit is contained in:
parent
c99267d6cc
commit
2f4e123ac9
|
@ -3,4 +3,14 @@ package eu.eudat.data.dao.criteria;
|
||||||
import eu.eudat.data.entities.DMPProfile;
|
import eu.eudat.data.entities.DMPProfile;
|
||||||
|
|
||||||
public class DataManagementPlanBlueprintCriteria extends Criteria<DMPProfile> {
|
public class DataManagementPlanBlueprintCriteria extends Criteria<DMPProfile> {
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
public void setStatus(Integer status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,13 @@ public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMP
|
||||||
QueryableList<DMPProfile> query = getDatabaseService().getQueryable(DMPProfile.class);
|
QueryableList<DMPProfile> query = getDatabaseService().getQueryable(DMPProfile.class);
|
||||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
||||||
|
if (criteria.getStatus() != null) {
|
||||||
|
if (criteria.getStatus() == DMPProfile.Status.FINALIZED.getValue()) {
|
||||||
|
query.where((builder, root) -> builder.equal(root.get("status"), DMPProfile.Status.FINALIZED.getValue()));
|
||||||
|
} else if (criteria.getStatus() == DMPProfile.Status.SAVED.getValue()) {
|
||||||
|
query.where((builder, root) -> builder.equal(root.get("status"), DMPProfile.Status.SAVED.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
query.where(((builder, root) -> builder.notEqual(root.get("status"), DMPProfile.Status.DELETED.getValue())));
|
query.where(((builder, root) -> builder.notEqual(root.get("status"), DMPProfile.Status.DELETED.getValue())));
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,19 @@ public class DmpRDAMapper {
|
||||||
rda.getCost().add(CostRDAMapper.toRDA((Map)costl));
|
rda.getCost().add(CostRDAMapper.toRDA((Map)costl));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
UserInfo contact = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(UUID.fromString((String) extraProperties.get("contact")));
|
UserInfo contactDb = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(UUID.fromString((String) extraProperties.get("contact")));
|
||||||
|
UserInfo contact = new UserInfo();
|
||||||
|
contact.setId(contactDb.getId());
|
||||||
|
contact.setName(contactDb.getName());
|
||||||
|
contact.setEmail(contactDb.getEmail());
|
||||||
|
if(contact.getEmail() == null){
|
||||||
|
for(UserDMP userDMP: dmp.getUsers()){
|
||||||
|
if(userDMP.getDmp().getId() == dmp.getId() && userDMP.getUser().getEmail() != null){
|
||||||
|
contact.setEmail(userDMP.getUser().getEmail());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
rda.setContact(ContactRDAMapper.toRDA(contact));
|
rda.setContact(ContactRDAMapper.toRDA(contact));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BaseCriteria } from "../base-criteria";
|
import { BaseCriteria } from "../base-criteria";
|
||||||
|
|
||||||
export class DmpBlueprintCriteria extends BaseCriteria {
|
export class DmpBlueprintCriteria extends BaseCriteria {
|
||||||
|
public status?: number;
|
||||||
}
|
}
|
|
@ -402,8 +402,18 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
|
||||||
formSubmit(): void {
|
formSubmit(): void {
|
||||||
this.formService.touchAllFormFields(this.formGroup);
|
this.formService.touchAllFormFields(this.formGroup);
|
||||||
if (!this.isFormValid()) { return; }
|
if (!this.isFormValid()) { return; }
|
||||||
|
let errorMessages = [];
|
||||||
|
if(!this.hasTitle()) {
|
||||||
|
errorMessages.push("Title should be set.");
|
||||||
|
}
|
||||||
|
if(!this.hasDescription()) {
|
||||||
|
errorMessages.push("Description should be set.");
|
||||||
|
}
|
||||||
if(!this.hasDescriptionTemplates()) {
|
if(!this.hasDescriptionTemplates()) {
|
||||||
this.showValidationErrorsDialog(undefined, ["At least one section should have description templates."]);
|
errorMessages.push("At least one section should have description templates.");
|
||||||
|
}
|
||||||
|
if(errorMessages.length > 0) {
|
||||||
|
this.showValidationErrorsDialog(undefined, errorMessages);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.onSubmit();
|
this.onSubmit();
|
||||||
|
@ -413,9 +423,19 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
|
||||||
return this.formGroup.valid;
|
return this.formGroup.valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasTitle(): boolean {
|
||||||
|
const dmpBlueprint: DmpBlueprint = this.formGroup.value;
|
||||||
|
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => field.category === FieldCategory.SYSTEM && field.type === SystemFieldType.TEXT));
|
||||||
|
}
|
||||||
|
|
||||||
|
hasDescription(): boolean {
|
||||||
|
const dmpBlueprint: DmpBlueprint = this.formGroup.value;
|
||||||
|
return dmpBlueprint.definition.sections.some(section => section.fields.some(field => field.category === FieldCategory.SYSTEM && field.type === SystemFieldType.HTML_TEXT));
|
||||||
|
}
|
||||||
|
|
||||||
hasDescriptionTemplates(): boolean {
|
hasDescriptionTemplates(): boolean {
|
||||||
const dmpBlueprint: DmpBlueprint = this.formGroup.value;
|
const dmpBlueprint: DmpBlueprint = this.formGroup.value;
|
||||||
return (dmpBlueprint.definition.sections.filter(s => s.hasTemplates == true).length > 0) ? true : false;
|
return dmpBlueprint.definition.sections.some(section => section.hasTemplates == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private showValidationErrorsDialog(projectOnly?: boolean, errmess?: string[]) {
|
private showValidationErrorsDialog(projectOnly?: boolean, errmess?: string[]) {
|
||||||
|
@ -515,7 +535,7 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
|
||||||
confirmed =>{
|
confirmed =>{
|
||||||
if(confirmed){
|
if(confirmed){
|
||||||
this.formGroup.get('status').setValue(DmpProfileStatus.Deleted);
|
this.formGroup.get('status').setValue(DmpProfileStatus.Deleted);
|
||||||
this.dmpProfileService.createDmp(this.formGroup.value)
|
this.dmpProfileService.createBlueprint(this.formGroup.value)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
complete => this.onCallbackSuccess(),
|
complete => this.onCallbackSuccess(),
|
||||||
|
|
|
@ -143,15 +143,15 @@
|
||||||
<div *ngIf="field.type == 0">
|
<div *ngIf="field.type == 0">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" [formControl]="formGroup.get('label')" required>
|
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" [formControl]="formGroup.get('label')" required>
|
||||||
<!-- <mat-error *ngIf="formGroup.get('label').hasError('backendError')">
|
<mat-error *ngIf="formGroup.get('label').hasError('backendError')">
|
||||||
{{formGroup.get('label').getError('backendError').message}}</mat-error>
|
{{formGroup.get('label').getError('backendError').message}}</mat-error>
|
||||||
<mat-error *ngIf="formGroup.get('label').hasError('required')">
|
<mat-error *ngIf="formGroup.get('label').hasError('required')">
|
||||||
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> -->
|
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="field.type == 1">
|
<div *ngIf="field.type == 1">
|
||||||
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'"
|
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'"
|
||||||
[placeholder]="'DMP-EDITOR.PLACEHOLDER.DESCRIPTION'">
|
[placeholder]="'DMP-EDITOR.PLACEHOLDER.DESCRIPTION'" [required]="field.required">
|
||||||
</rich-text-editor-component>
|
</rich-text-editor-component>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="field.type == 2">
|
<div *ngIf="field.type == 2">
|
||||||
|
@ -218,13 +218,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="field.type == 6">
|
<div *ngIf="field.type == 6">
|
||||||
<funding-info [formGroup]="formGroup" [grantformGroup]="formGroup.get('grant')" [projectFormGroup]="formGroup.get('project')" [funderFormGroup]="formGroup.get('funder')" [isFinalized]="isFinalized" [isNew]="isNew" [isUserOwner]="isUserOwner" [type]="1" (onFormChanged)="formChanged()"></funding-info>
|
<funding-info [formGroup]="formGroup" [grantformGroup]="formGroup.get('grant')" [projectFormGroup]="formGroup.get('project')" [funderFormGroup]="formGroup.get('funder')" [isFinalized]="isFinalized" [isNew]="isNew" [isUserOwner]="isUserOwner" [isRequired]="field.required" [type]="1" (onFormChanged)="formChanged()"></funding-info>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="field.type == 7">
|
<div *ngIf="field.type == 7">
|
||||||
<funding-info [formGroup]="formGroup" [grantformGroup]="formGroup.get('grant')" [projectFormGroup]="formGroup.get('project')" [funderFormGroup]="formGroup.get('funder')" [isFinalized]="isFinalized" [isNew]="isNew" [isUserOwner]="isUserOwner" [type]="2" (onFormChanged)="formChanged()"></funding-info>
|
<funding-info [formGroup]="formGroup" [grantformGroup]="formGroup.get('grant')" [projectFormGroup]="formGroup.get('project')" [funderFormGroup]="formGroup.get('funder')" [isFinalized]="isFinalized" [isNew]="isNew" [isUserOwner]="isUserOwner" [isRequired]="field.required" [type]="2" (onFormChanged)="formChanged()"></funding-info>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="field.type == 8">
|
<div *ngIf="field.type == 8">
|
||||||
<funding-info [formGroup]="formGroup" [grantformGroup]="formGroup.get('grant')" [projectFormGroup]="formGroup.get('project')" [funderFormGroup]="formGroup.get('funder')" [isFinalized]="isFinalized" [isNew]="isNew" [isUserOwner]="isUserOwner" [type]="3" (onFormChanged)="formChanged()"></funding-info>
|
<funding-info [formGroup]="formGroup" [grantformGroup]="formGroup.get('grant')" [projectFormGroup]="formGroup.get('project')" [funderFormGroup]="formGroup.get('funder')" [isFinalized]="isFinalized" [isNew]="isNew" [isUserOwner]="isUserOwner" [isRequired]="field.required" [type]="3" (onFormChanged)="formChanged()"></funding-info>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="field.type == 9">
|
<div *ngIf="field.type == 9">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
@ -274,11 +274,17 @@
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="field.type === extraFieldTypesEnum.RICH_TEXT">
|
<div *ngIf="field.type === extraFieldTypesEnum.RICH_TEXT">
|
||||||
<mat-form-field>
|
<ng-container formArrayName="extraFields">
|
||||||
<!-- <rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'label'"
|
<ng-container *ngFor="let control of extraFieldsArray().controls; let extraFieldIndex = index;">
|
||||||
[placeholder]="field.placeholder">
|
<ng-container [formGroupName]="extraFieldIndex">
|
||||||
</rich-text-editor-component> -->
|
<ng-container *ngIf="control.get('id').value === field.id">
|
||||||
</mat-form-field>
|
<rich-text-editor-component [parentFormGroup]="control" [controlName]="'value'"
|
||||||
|
[placeholder]="field.placeholder" [required]="field.required">
|
||||||
|
</rich-text-editor-component>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="field.type === extraFieldTypesEnum.DATE">
|
<div *ngIf="field.type === extraFieldTypesEnum.DATE">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
|
|
@ -55,6 +55,7 @@ import { Guid } from '@common/types/guid';
|
||||||
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
|
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
|
||||||
import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model';
|
import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model';
|
||||||
import { CheckDeactivateBaseComponent } from '@app/library/deactivate/deactivate.component';
|
import { CheckDeactivateBaseComponent } from '@app/library/deactivate/deactivate.component';
|
||||||
|
import { DmpProfileStatus } from '@app/core/common/enum/dmp-profile-status';
|
||||||
|
|
||||||
interface Visible {
|
interface Visible {
|
||||||
value: boolean;
|
value: boolean;
|
||||||
|
@ -305,6 +306,10 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extraFieldsArray(): FormArray {
|
||||||
|
return this.formGroup.get('extraFields') as FormArray;
|
||||||
|
}
|
||||||
|
|
||||||
setIsUserOwner() {
|
setIsUserOwner() {
|
||||||
if (this.dmp) {
|
if (this.dmp) {
|
||||||
const principal: Principal = this.authService.current();
|
const principal: Principal = this.authService.current();
|
||||||
|
@ -450,7 +455,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
||||||
}
|
}
|
||||||
|
|
||||||
previousStep() {
|
previousStep() {
|
||||||
this.step = this.step !== 0 ? this.step - 1 : this.step;
|
this.step = this.step !== 1 ? this.step - 1 : this.step;
|
||||||
this.resetScroll();
|
this.resetScroll();
|
||||||
// if (this.step >= this.stepsBeforeDatasets) {
|
// if (this.step >= this.stepsBeforeDatasets) {
|
||||||
// this.datasetId = this.datasets.at(this.step - this.stepsBeforeDatasets).get('id').value;
|
// this.datasetId = this.datasets.at(this.step - this.stepsBeforeDatasets).get('id').value;
|
||||||
|
@ -813,7 +818,10 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
||||||
let extraField = new DmpExtraFieldEditorModel();
|
let extraField = new DmpExtraFieldEditorModel();
|
||||||
extraField.id = field.id;
|
extraField.id = field.id;
|
||||||
if (!isNullOrUndefined(this.dmp.extraFields)) {
|
if (!isNullOrUndefined(this.dmp.extraFields)) {
|
||||||
extraField.value = this.dmp.extraFields.find(f => f.id === field.id).value;
|
let found = this.dmp.extraFields.find(f => f.id === field.id);
|
||||||
|
if(found !== undefined) {
|
||||||
|
extraField.value = found.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
extraFields.push(extraField.buildForm());
|
extraFields.push(extraField.buildForm());
|
||||||
}
|
}
|
||||||
|
@ -925,6 +933,7 @@ export class DmpEditorBlueprintComponent extends CheckDeactivateBaseComponent im
|
||||||
let fields: Array<string> = new Array();
|
let fields: Array<string> = new Array();
|
||||||
var request = new DataTableRequest<DmpBlueprintCriteria>(0, 10, { fields: fields });
|
var request = new DataTableRequest<DmpBlueprintCriteria>(0, 10, { fields: fields });
|
||||||
request.criteria = new DmpBlueprintCriteria();
|
request.criteria = new DmpBlueprintCriteria();
|
||||||
|
request.criteria.status = DmpProfileStatus.Finalized;
|
||||||
return this.dmpProfileService.getPagedBlueprint(request).pipe(map(x => x.data));
|
return this.dmpProfileService.getPagedBlueprint(request).pipe(map(x => x.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ export class DmpEditorModel {
|
||||||
baseContext.validation.push({ key: 'groupId', validators: [BackendErrorValidator(this.validationErrorModel, 'groupId')] });
|
baseContext.validation.push({ key: 'groupId', validators: [BackendErrorValidator(this.validationErrorModel, 'groupId')] });
|
||||||
baseContext.validation.push({ key: 'version', validators: [BackendErrorValidator(this.validationErrorModel, 'version')] });
|
baseContext.validation.push({ key: 'version', validators: [BackendErrorValidator(this.validationErrorModel, 'version')] });
|
||||||
baseContext.validation.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'status')] });
|
baseContext.validation.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'status')] });
|
||||||
baseContext.validation.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] });
|
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'description')] });
|
||||||
baseContext.validation.push({ key: 'grant', validators: [BackendErrorValidator(this.validationErrorModel, 'grant')] });
|
baseContext.validation.push({ key: 'grant', validators: [BackendErrorValidator(this.validationErrorModel, 'grant')] });
|
||||||
baseContext.validation.push({ key: 'project', validators: [BackendErrorValidator(this.validationErrorModel, 'project')] });
|
baseContext.validation.push({ key: 'project', validators: [BackendErrorValidator(this.validationErrorModel, 'project')] });
|
||||||
baseContext.validation.push({ key: 'funder', validators: [BackendErrorValidator(this.validationErrorModel, 'funder')] });
|
baseContext.validation.push({ key: 'funder', validators: [BackendErrorValidator(this.validationErrorModel, 'funder')] });
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<div class="funder-form" *ngIf="type == 1">
|
<div class="funder-form" *ngIf="type == 1">
|
||||||
<div *ngIf="!isCreateNewFunder">
|
<div *ngIf="!isCreateNewFunder">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<app-single-auto-complete required='true' [formControl]="funderFormGroup.get('existFunder')" placeholder="{{'DMP-EDITOR.FIELDS.FUNDER' | translate}}" [configuration]="funderAutoCompleteConfiguration">
|
<app-single-auto-complete [required]="isRequired" [formControl]="funderFormGroup.get('existFunder')" placeholder="{{'DMP-EDITOR.FIELDS.FUNDER' | translate}}" [configuration]="funderAutoCompleteConfiguration">
|
||||||
</app-single-auto-complete>
|
</app-single-auto-complete>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<mat-icon *ngIf="!isFunderPending && funderFormGroup.get('reference').dirty && funderFormGroup.get('reference').invalid" class="text-danger" matSuffix>clear</mat-icon>
|
<mat-icon *ngIf="!isFunderPending && funderFormGroup.get('reference').dirty && funderFormGroup.get('reference').invalid" class="text-danger" matSuffix>clear</mat-icon>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<input matInput placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.FUNDER-LABEL' | translate}}" type="text" name="label" [formControl]="funderFormGroup.get('label')" required>
|
<input matInput placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.FUNDER-LABEL' | translate}}" type="text" name="label" [formControl]="funderFormGroup.get('label')">
|
||||||
<mat-error *ngIf="funderFormGroup.get('label').hasError('backendError')">
|
<mat-error *ngIf="funderFormGroup.get('label').hasError('backendError')">
|
||||||
{{funderFormGroup.get('label').getError('backendError').message}}</mat-error>
|
{{funderFormGroup.get('label').getError('backendError').message}}</mat-error>
|
||||||
<mat-error *ngIf="funderFormGroup.get('label').hasError('required')">
|
<mat-error *ngIf="funderFormGroup.get('label').hasError('required')">
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
<div class="grant-form" *ngIf="type == 2">
|
<div class="grant-form" *ngIf="type == 2">
|
||||||
<div *ngIf="!isCreateNew">
|
<div *ngIf="!isCreateNew">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<app-single-auto-complete required='true' [formControl]="grantformGroup.get('existGrant')" placeholder="{{'DMP-EDITOR.FIELDS.GRANT' | translate}}" [configuration]="grantAutoCompleteConfiguration">
|
<app-single-auto-complete [required]="isRequired" [formControl]="grantformGroup.get('existGrant')" placeholder="{{'DMP-EDITOR.FIELDS.GRANT' | translate}}" [configuration]="grantAutoCompleteConfiguration">
|
||||||
</app-single-auto-complete>
|
</app-single-auto-complete>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
@ -81,14 +81,14 @@
|
||||||
<mat-icon *ngIf="!isGrantPending && grantformGroup.get('reference').dirty && grantformGroup.get('reference').invalid" class="text-danger" matSuffix>clear</mat-icon>
|
<mat-icon *ngIf="!isGrantPending && grantformGroup.get('reference').dirty && grantformGroup.get('reference').invalid" class="text-danger" matSuffix>clear</mat-icon>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<input matInput placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.GRANT-LABEL' | translate}}" type="text" name="label" [formControl]="grantformGroup.get('label')" required>
|
<input matInput placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.GRANT-LABEL' | translate}}" type="text" name="label" [formControl]="grantformGroup.get('label')">
|
||||||
<mat-error *ngIf="grantformGroup.get('label').hasError('backendError')">
|
<mat-error *ngIf="grantformGroup.get('label').hasError('backendError')">
|
||||||
{{grantformGroup.get('label').getError('backendError').message}}</mat-error>
|
{{grantformGroup.get('label').getError('backendError').message}}</mat-error>
|
||||||
<mat-error *ngIf="grantformGroup.get('label').hasError('required')">
|
<mat-error *ngIf="grantformGroup.get('label').hasError('required')">
|
||||||
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<textarea matInput class="description-area" placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.DESCRIPTION' | translate}}" [formControl]="grantformGroup.get('description')" [required]="true"></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')">
|
<mat-error *ngIf="grantformGroup.get('description').hasError('backendError')">
|
||||||
{{projectFormGroup.get('description').getError('backendError').message}}</mat-error>
|
{{projectFormGroup.get('description').getError('backendError').message}}</mat-error>
|
||||||
<mat-error *ngIf="grantformGroup.get('description').hasError('required')">
|
<mat-error *ngIf="grantformGroup.get('description').hasError('required')">
|
||||||
|
@ -122,14 +122,14 @@
|
||||||
<div class="project-form" *ngIf="type == 3">
|
<div class="project-form" *ngIf="type == 3">
|
||||||
<div *ngIf="!isCreateNewProject">
|
<div *ngIf="!isCreateNewProject">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<app-single-auto-complete [formControl]="projectFormGroup.get('existProject')" placeholder="{{'DMP-EDITOR.FIELDS.PROJECT' | translate}}" [configuration]="projectAutoCompleteConfiguration">
|
<app-single-auto-complete [formControl]="projectFormGroup.get('existProject')" placeholder="{{'DMP-EDITOR.FIELDS.PROJECT' | translate}}" [configuration]="projectAutoCompleteConfiguration" [required]="isRequired">
|
||||||
</app-single-auto-complete>
|
</app-single-auto-complete>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<!-- Create New Project -->
|
<!-- Create New Project -->
|
||||||
<div *ngIf="isCreateNewProject">
|
<div *ngIf="isCreateNewProject">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<input matInput [placeholder]="'DMP-EDITOR.FUNDING-INFO.UNIQUE-IDENTIFIER' | translate" type="text" [formControl]="projectFormGroup.get('reference')">
|
<input matInput [placeholder]="'DMP-EDITOR.FUNDING-INFO.UNIQUE-IDENTIFIER' | translate" type="text" [formControl]="projectFormGroup.get('reference')" [required]="isRequired">
|
||||||
<i matSuffix class="fa fa-spinner fa-spin" *ngIf="isProjectPending"></i>
|
<i matSuffix class="fa fa-spinner fa-spin" *ngIf="isProjectPending"></i>
|
||||||
<mat-error *ngIf="projectFormGroup.get('reference').hasError('projectIdentifierExists')">{{'DMP-EDITOR.FUNDING-INFO.IDENTIFIER-PROJECT-EXISTS' | translate}}</mat-error>
|
<mat-error *ngIf="projectFormGroup.get('reference').hasError('projectIdentifierExists')">{{'DMP-EDITOR.FUNDING-INFO.IDENTIFIER-PROJECT-EXISTS' | translate}}</mat-error>
|
||||||
<mat-icon *ngIf="!isProjectPending && projectFormGroup.get('reference').dirty && projectFormGroup.get('reference').valid" class="text-success" matSuffix>check</mat-icon>
|
<mat-icon *ngIf="!isProjectPending && projectFormGroup.get('reference').dirty && projectFormGroup.get('reference').valid" class="text-success" matSuffix>check</mat-icon>
|
||||||
|
|
|
@ -28,6 +28,7 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
||||||
@Input() isClone: boolean = false;
|
@Input() isClone: boolean = false;
|
||||||
@Input() isNewVersion: boolean;
|
@Input() isNewVersion: boolean;
|
||||||
|
|
||||||
|
@Input() isRequired: boolean;
|
||||||
@Input() type: number;
|
@Input() type: number;
|
||||||
|
|
||||||
@Input() formGroup: FormGroup;
|
@Input() formGroup: FormGroup;
|
||||||
|
@ -81,16 +82,24 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
this.initializeReferenceValidators();
|
this.initializeReferenceValidators();
|
||||||
|
|
||||||
this.isCreateNew = (this.grantformGroup.get('label').value != null && this.grantformGroup.get('label').value.length > 0);
|
if (this.grantformGroup != null) {
|
||||||
this.isCreateNewProject = (this.projectFormGroup.get('label').value != null && this.projectFormGroup.get('label').value.length > 0);
|
this.isCreateNew = (this.grantformGroup.get('label').value != null && this.grantformGroup.get('label').value.length > 0);
|
||||||
this.isCreateNewFunder = (this.funderFormGroup.get('label').value != null && this.funderFormGroup.get('label').value.length > 0);
|
this.setGrantValidators();
|
||||||
this.setGrantValidators();
|
}
|
||||||
this.setProjectValidators();
|
if (this.projectFormGroup != null) {
|
||||||
this.setFunderValidators();
|
this.isCreateNewProject = (this.projectFormGroup.get('label').value != null && this.projectFormGroup.get('label').value.length > 0);
|
||||||
|
this.setProjectValidators();
|
||||||
|
}
|
||||||
|
if (this.funderFormGroup != null) {
|
||||||
|
this.isCreateNewFunder = (this.funderFormGroup.get('label').value != null && this.funderFormGroup.get('label').value.length > 0);
|
||||||
|
this.setFunderValidators();
|
||||||
|
}
|
||||||
this.registerFormListeners();
|
this.registerFormListeners();
|
||||||
if (this.isNew && !this.isClone) {
|
if (this.isNew && !this.isClone) {
|
||||||
this.grantformGroup.reset();
|
if (this.grantformGroup != null && this.funderFormGroup != null) {
|
||||||
this.grantformGroup.disable();
|
this.grantformGroup.reset();
|
||||||
|
this.grantformGroup.disable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
|
this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
|
||||||
|
@ -101,108 +110,114 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
||||||
initializeReferenceValidators() {
|
initializeReferenceValidators() {
|
||||||
|
|
||||||
//Validator for funder
|
//Validator for funder
|
||||||
this.funderFormGroup.get('reference').valueChanges.pipe(
|
if (this.funderFormGroup != null) {
|
||||||
takeUntil(this._destroyed),
|
this.funderFormGroup.get('reference').valueChanges.pipe(
|
||||||
filter(value =>!isNullOrUndefined(value)),
|
takeUntil(this._destroyed),
|
||||||
tap(_=>this.isFunderPending = true),
|
filter(value =>!isNullOrUndefined(value)),
|
||||||
debounceTime(500),
|
tap(_=>this.isFunderPending = true),
|
||||||
switchMap(value=> {
|
debounceTime(500),
|
||||||
const requestItem = new RequestItem<FunderCriteria>();
|
switchMap(value=> {
|
||||||
requestItem.criteria = new FunderCriteria();
|
const requestItem = new RequestItem<FunderCriteria>();
|
||||||
requestItem.criteria.exactReference = this._FUNDER_PREFIX +value;
|
requestItem.criteria = new FunderCriteria();
|
||||||
return this.funderService.getWithExternal(requestItem).pipe(takeUntil(this._destroyed));
|
requestItem.criteria.exactReference = this._FUNDER_PREFIX +value;
|
||||||
}),
|
return this.funderService.getWithExternal(requestItem).pipe(takeUntil(this._destroyed));
|
||||||
map(response=>{
|
}),
|
||||||
if(response && response.length){
|
map(response=>{
|
||||||
const internalFunders = (response as Array<any>).filter(funder=> funder.key === this._KEY);
|
if(response && response.length){
|
||||||
|
const internalFunders = (response as Array<any>).filter(funder=> funder.key === this._KEY);
|
||||||
|
|
||||||
if(internalFunders && internalFunders.length){
|
if(internalFunders && internalFunders.length){
|
||||||
return {funderIdentifierExists:true};
|
return {funderIdentifierExists:true};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe(error=>{
|
||||||
|
this.isFunderPending = false;
|
||||||
|
this.funderFormGroup.get('reference').setErrors(error);
|
||||||
|
if(!error && this.funderFormGroup.get('reference').validator){
|
||||||
|
const validator = this.funderFormGroup.get('reference').validator({} as AbstractControl);
|
||||||
|
if(validator && validator.required && this.funderFormGroup.get('reference').touched && !this.funderFormGroup.get('reference').value){
|
||||||
|
this.funderFormGroup.get('reference').setErrors({required : true});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
});
|
||||||
})
|
}
|
||||||
)
|
|
||||||
.subscribe(error=>{
|
|
||||||
this.isFunderPending = false;
|
|
||||||
this.funderFormGroup.get('reference').setErrors(error);
|
|
||||||
if(!error && this.funderFormGroup.get('reference').validator){
|
|
||||||
const validator = this.funderFormGroup.get('reference').validator({} as AbstractControl);
|
|
||||||
if(validator && validator.required && this.funderFormGroup.get('reference').touched && !this.funderFormGroup.get('reference').value){
|
|
||||||
this.funderFormGroup.get('reference').setErrors({required : true});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//Validator for grants
|
//Validator for grants
|
||||||
this.grantformGroup.get('reference').valueChanges.pipe(
|
if (this.grantformGroup != null) {
|
||||||
takeUntil(this._destroyed),
|
this.grantformGroup.get('reference').valueChanges.pipe(
|
||||||
filter(value =>!isNullOrUndefined(value)),
|
takeUntil(this._destroyed),
|
||||||
tap(_=> this.isGrantPending = true),
|
filter(value =>!isNullOrUndefined(value)),
|
||||||
debounceTime(500),
|
tap(_=> this.isGrantPending = true),
|
||||||
switchMap(value=> {
|
debounceTime(500),
|
||||||
const requestItem = new RequestItem<GrantCriteria>();
|
switchMap(value=> {
|
||||||
requestItem.criteria = new GrantCriteria();
|
const requestItem = new RequestItem<GrantCriteria>();
|
||||||
requestItem.criteria.exactReference = this._GRANT_PREFIX + value;
|
requestItem.criteria = new GrantCriteria();
|
||||||
return this.grantService.getWithExternal(requestItem).pipe(takeUntil(this._destroyed));
|
requestItem.criteria.exactReference = this._GRANT_PREFIX + value;
|
||||||
}),
|
return this.grantService.getWithExternal(requestItem).pipe(takeUntil(this._destroyed));
|
||||||
map(response=>{
|
}),
|
||||||
if(response && response.length){
|
map(response=>{
|
||||||
const internalGrants = (response as Array<any>).filter(grant=> grant.key === this._KEY);
|
if(response && response.length){
|
||||||
|
const internalGrants = (response as Array<any>).filter(grant=> grant.key === this._KEY);
|
||||||
|
|
||||||
if(internalGrants && internalGrants.length){
|
if(internalGrants && internalGrants.length){
|
||||||
return {grantIdentifierExists:true};
|
return {grantIdentifierExists:true};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe(error=>{
|
||||||
|
this.isGrantPending = false;
|
||||||
|
this.grantformGroup.get('reference').setErrors(error);
|
||||||
|
if(!error && this.grantformGroup.get('reference').validator){
|
||||||
|
const validator = this.grantformGroup.get('reference').validator({} as AbstractControl);
|
||||||
|
if(validator && validator.required && this.grantformGroup.get('reference').touched && !this.grantformGroup.get('reference').value){
|
||||||
|
this.grantformGroup.get('reference').setErrors({required : true});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
});
|
||||||
})
|
}
|
||||||
)
|
|
||||||
.subscribe(error=>{
|
|
||||||
this.isGrantPending = false;
|
|
||||||
this.grantformGroup.get('reference').setErrors(error);
|
|
||||||
if(!error && this.grantformGroup.get('reference').validator){
|
|
||||||
const validator = this.grantformGroup.get('reference').validator({} as AbstractControl);
|
|
||||||
if(validator && validator.required && this.grantformGroup.get('reference').touched && !this.grantformGroup.get('reference').value){
|
|
||||||
this.grantformGroup.get('reference').setErrors({required : true});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//validator for projects
|
//validator for projects
|
||||||
this.projectFormGroup.get('reference').valueChanges.pipe(
|
if (this.projectFormGroup != null) {
|
||||||
takeUntil(this._destroyed),
|
this.projectFormGroup.get('reference').valueChanges.pipe(
|
||||||
filter(value =>!isNullOrUndefined(value)),
|
takeUntil(this._destroyed),
|
||||||
tap(_ => this.isProjectPending = true),
|
filter(value =>!isNullOrUndefined(value)),
|
||||||
debounceTime(500),
|
tap(_ => this.isProjectPending = true),
|
||||||
switchMap(value=> {
|
debounceTime(500),
|
||||||
const requestItem = new RequestItem<ProjectCriteria>();
|
switchMap(value=> {
|
||||||
requestItem.criteria = new ProjectCriteria();
|
const requestItem = new RequestItem<ProjectCriteria>();
|
||||||
requestItem.criteria.exactReference = this._PROJECT_PREFIX + value;
|
requestItem.criteria = new ProjectCriteria();
|
||||||
return this.projectService.getWithExternal(requestItem).pipe(takeUntil(this._destroyed));
|
requestItem.criteria.exactReference = this._PROJECT_PREFIX + value;
|
||||||
}),
|
return this.projectService.getWithExternal(requestItem).pipe(takeUntil(this._destroyed));
|
||||||
map(response=>{
|
}),
|
||||||
if(response && response.length){
|
map(response=>{
|
||||||
const internalProjects = (response as Array<any>).filter(project=> project.key === this._KEY);
|
if(response && response.length){
|
||||||
if(internalProjects && internalProjects.length){
|
const internalProjects = (response as Array<any>).filter(project=> project.key === this._KEY);
|
||||||
return {projectIdentifierExists:true};
|
if(internalProjects && internalProjects.length){
|
||||||
|
return {projectIdentifierExists:true};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe(error=>{
|
||||||
|
this.isProjectPending = false;
|
||||||
|
this.projectFormGroup.get('reference').setErrors(error);
|
||||||
|
if(!error && this.projectFormGroup.get('reference').validator){
|
||||||
|
const validator = this.projectFormGroup.get('reference').validator({} as AbstractControl);
|
||||||
|
if(validator && validator.required && this.projectFormGroup.get('reference').touched && !this.projectFormGroup.get('reference').value){
|
||||||
|
this.projectFormGroup.get('reference').setErrors({required : true});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
});
|
||||||
})
|
}
|
||||||
)
|
|
||||||
.subscribe(error=>{
|
|
||||||
this.isProjectPending = false;
|
|
||||||
this.projectFormGroup.get('reference').setErrors(error);
|
|
||||||
if(!error && this.projectFormGroup.get('reference').validator){
|
|
||||||
const validator = this.projectFormGroup.get('reference').validator({} as AbstractControl);
|
|
||||||
if(validator && validator.required && this.projectFormGroup.get('reference').touched && !this.projectFormGroup.get('reference').value){
|
|
||||||
this.projectFormGroup.get('reference').setErrors({required : true});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configureAutoCompletes(): void {
|
configureAutoCompletes(): void {
|
||||||
|
@ -283,7 +298,8 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
||||||
this.grantformGroup.get('description').enable();
|
this.grantformGroup.get('description').enable();
|
||||||
|
|
||||||
this.grantformGroup.get('reference').enable();
|
this.grantformGroup.get('reference').enable();
|
||||||
this.grantformGroup.get('reference').setValidators(Validators.required);
|
if(this.isRequired)
|
||||||
|
this.grantformGroup.get('reference').setValidators(Validators.required);
|
||||||
this.grantformGroup.get('reference').updateValueAndValidity();
|
this.grantformGroup.get('reference').updateValueAndValidity();
|
||||||
} else if (this.isClone && !this.isNewVersion) {
|
} else if (this.isClone && !this.isNewVersion) {
|
||||||
this.grantformGroup.get('existGrant').enable();
|
this.grantformGroup.get('existGrant').enable();
|
||||||
|
@ -326,7 +342,8 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
||||||
this.projectFormGroup.get('description').enable();
|
this.projectFormGroup.get('description').enable();
|
||||||
|
|
||||||
this.projectFormGroup.get('reference').enable()
|
this.projectFormGroup.get('reference').enable()
|
||||||
this.projectFormGroup.get('reference').setValidators(Validators.required);
|
if(this.isRequired)
|
||||||
|
this.projectFormGroup.get('reference').setValidators(Validators.required);
|
||||||
this.projectFormGroup.get('reference').updateValueAndValidity();
|
this.projectFormGroup.get('reference').updateValueAndValidity();
|
||||||
} else if (this.isClone && !this.isNewVersion) {
|
} else if (this.isClone && !this.isNewVersion) {
|
||||||
this.projectFormGroup.get('existProject').enable();
|
this.projectFormGroup.get('existProject').enable();
|
||||||
|
@ -368,7 +385,8 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
||||||
this.funderFormGroup.get('label').enable();
|
this.funderFormGroup.get('label').enable();
|
||||||
|
|
||||||
this.funderFormGroup.get('reference').enable();
|
this.funderFormGroup.get('reference').enable();
|
||||||
this.funderFormGroup.get('reference').setValidators(Validators.required);
|
if(this.isRequired)
|
||||||
|
this.funderFormGroup.get('reference').setValidators(Validators.required);
|
||||||
this.funderFormGroup.get('reference').updateValueAndValidity();
|
this.funderFormGroup.get('reference').updateValueAndValidity();
|
||||||
|
|
||||||
} else if (this.isClone && !this.isNewVersion) {
|
} else if (this.isClone && !this.isNewVersion) {
|
||||||
|
@ -383,7 +401,8 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
||||||
} else {
|
} else {
|
||||||
this.funderFormGroup.get('label').enable();
|
this.funderFormGroup.get('label').enable();
|
||||||
this.funderFormGroup.get('reference').enable();
|
this.funderFormGroup.get('reference').enable();
|
||||||
this.funderFormGroup.get('reference').setValidators(Validators.required);
|
if(this.isRequired)
|
||||||
|
this.funderFormGroup.get('reference').setValidators(Validators.required);
|
||||||
this.funderFormGroup.get('reference').updateValueAndValidity();
|
this.funderFormGroup.get('reference').updateValueAndValidity();
|
||||||
}
|
}
|
||||||
} else if (this.isFinalized || this.isNewVersion || !this.isUserOwner) {
|
} else if (this.isFinalized || this.isNewVersion || !this.isUserOwner) {
|
||||||
|
@ -407,11 +426,13 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
registerFormListeners() {
|
registerFormListeners() {
|
||||||
this.funderFormGroup.valueChanges
|
if (this.funderFormGroup != null) {
|
||||||
.pipe(takeUntil(this._destroyed))
|
this.funderFormGroup.valueChanges
|
||||||
.subscribe(x => {
|
.pipe(takeUntil(this._destroyed))
|
||||||
this.funderValueChanged(x);
|
.subscribe(x => {
|
||||||
})
|
this.funderValueChanged(x);
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
funderValueChanged(funder: any) {
|
funderValueChanged(funder: any) {
|
||||||
|
|
|
@ -36,9 +36,9 @@ export class FunderFormModel {
|
||||||
createValidationContext(): ValidationContext {
|
createValidationContext(): ValidationContext {
|
||||||
const baseContext: ValidationContext = new ValidationContext();
|
const baseContext: ValidationContext = new ValidationContext();
|
||||||
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: [BackendErrorValidator(this.validationErrorModel, 'label')] });
|
||||||
baseContext.validation.push({ key: 'status', validators: [] });
|
baseContext.validation.push({ key: 'status', validators: [] });
|
||||||
baseContext.validation.push({ key: 'existFunder', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'existFunder')] });
|
baseContext.validation.push({ key: 'existFunder', validators: [BackendErrorValidator(this.validationErrorModel, 'existFunder')] });
|
||||||
baseContext.validation.push({ key: 'reference', validators: [BackendErrorValidator(this.validationErrorModel, 'reference')] });
|
baseContext.validation.push({ key: 'reference', validators: [BackendErrorValidator(this.validationErrorModel, 'reference')] });
|
||||||
return baseContext;
|
return baseContext;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,10 +41,10 @@ export class GrantTabModel {
|
||||||
createValidationContext(): ValidationContext {
|
createValidationContext(): ValidationContext {
|
||||||
const baseContext: ValidationContext = new ValidationContext();
|
const baseContext: ValidationContext = new ValidationContext();
|
||||||
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: [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: [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')] });
|
||||||
baseContext.validation.push({ key: 'reference', validators: [BackendErrorValidator(this.validationErrorModel, 'reference')] });
|
baseContext.validation.push({ key: 'reference', validators: [BackendErrorValidator(this.validationErrorModel, 'reference')] });
|
||||||
return baseContext;
|
return baseContext;
|
||||||
|
|
Loading…
Reference in New Issue