Adds error notification on failure email sent, removes funderFormGroup input and get it through grantFormGroup

This commit is contained in:
apapachristou 2019-08-23 18:27:58 +03:00
parent 6ac737e68d
commit 73d776cdc3
5 changed files with 18 additions and 16 deletions

View File

@ -49,7 +49,7 @@
<mat-icon class="mr-2">work_outline</mat-icon>
{{ 'DMP-LISTING.COLUMNS.GRANT' | translate }}
</ng-template>
<app-grant-tab [formGroup]="formGroup.get('grant')" [projectFormGroup]="formGroup.get('project')" [funderFormGroup]="formGroup.get('grant').get('funder')" [isNew]="isNew" [isFinalized]="isFinalized"></app-grant-tab>
<app-grant-tab [formGroup]="formGroup.get('grant')" [projectFormGroup]="formGroup.get('project')" [isNew]="isNew" [isFinalized]="isFinalized"></app-grant-tab>
</mat-tab>
<mat-tab *ngIf="!isNew">
<ng-template mat-tab-label>

View File

@ -5,7 +5,7 @@
<div class="row">
<div class="col-6 pb-2 pl-4 pt-4" *ngIf="!isCreateNewFunder">
<mat-form-field>
<app-single-auto-complete [formControl]="funderFormGroup.get('existFunder')" placeholder="{{'DMP-EDITOR.FIELDS.FUNDER' | translate}}" [configuration]="funderAutoCompleteConfiguration">
<app-single-auto-complete [formControl]="formGroup.get('funder').get('existFunder')" placeholder="{{'DMP-EDITOR.FIELDS.FUNDER' | translate}}" [configuration]="funderAutoCompleteConfiguration">
</app-single-auto-complete>
</mat-form-field>
</div>
@ -13,10 +13,10 @@
<!-- Create New Funder -->
<div class="col-6 pl-4 pt-4" *ngIf="isCreateNewFunder">
<mat-form-field>
<input matInput placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.FUNDER-LABEL' | translate}}" type="text" name="label" [formControl]="funderFormGroup.get('label')" required>
<mat-error *ngIf="funderFormGroup.get('label').hasError('backendError')">
{{funderFormGroup.get('label').getError('backendError').message}}</mat-error>
<mat-error *ngIf="funderFormGroup.get('label').hasError('required')">
<input matInput placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.FUNDER-LABEL' | translate}}" type="text" name="label" [formControl]="formGroup.get('funder').get('label')" required>
<mat-error *ngIf="formGroup.get('funder').get('label').hasError('backendError')">
{{formGroup.get('funder').get('label').getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.get('funder').get('label').hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>

View File

@ -20,7 +20,7 @@ export class GrantTabComponent implements OnInit {
@Input() formGroup: FormGroup;
@Input() projectFormGroup: FormGroup;
@Input() funderFormGroup: FormGroup;
// @Input() funderFormGroup: FormGroup;
@Input() isNew: boolean;
@Input() isFinalized: boolean;
isCreateNew = false;
@ -67,7 +67,7 @@ export class GrantTabComponent implements OnInit {
this.isCreateNew = (this.formGroup.get('label').value != null && this.formGroup.get('label').value.length > 0);
this.isCreateNewProject = (this.projectFormGroup.get('label').value != null && this.projectFormGroup.get('label').value.length > 0);
this.isCreateNewFunder = (this.funderFormGroup.get('label').value != null && this.funderFormGroup.get('label').value.length > 0);
this.isCreateNewFunder = (this.formGroup.get('funder').get('label').value != null && this.formGroup.get('funder').get('label').value.length > 0);
this.setValidators();
this.setProjectValidators();
this.setFunderValidators();
@ -149,16 +149,16 @@ export class GrantTabComponent implements OnInit {
setFunderValidators() {
if (this.isCreateNewFunder) {
this.funderFormGroup.get('existFunder').disable();
this.funderFormGroup.get('label').enable();
this.formGroup.get('funder').get('existFunder').disable();
this.formGroup.get('funder').get('label').enable();
} else if (this.isFinalized) {
this.funderFormGroup.get('existFunder').disable();
this.funderFormGroup.get('label').disable();
this.formGroup.get('funder').get('existFunder').disable();
this.formGroup.get('funder').get('label').disable();
}
else {
this.funderFormGroup.get('existFunder').enable();
this.funderFormGroup.get('label').disable();
this.funderFormGroup.get('label').reset();
this.formGroup.get('funder').enable();
this.formGroup.get('funder').get('label').disable();
this.formGroup.get('funder').get('label').reset();
}
}

View File

@ -68,6 +68,7 @@ export class SidebarFooterComponent extends BaseComponent implements OnInit {
onCallbackError(errorResponse: any) {
this.setErrorModel(errorResponse.error);
this.validateAllFormFields(this.formGroup);
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-EMAIL-SEND'), SnackBarNotificationLevel.Error);
}
public setErrorModel(validationErrorModel: ValidationErrorModel) {

View File

@ -21,7 +21,8 @@
"UNSUCCESSFUL-LOGIN": "Unsuccessful Login",
"SUCCESSFUL-DATASET-PROFILE-DELETE": "Successful Delete",
"UNSUCCESSFUL-DATASET-PROFILE-DELETE": "This template can not deleted, because Dataset Descriptions are associated with it",
"UNSUCCESSFUL-DELETE": "Unsuccessful Delete"
"UNSUCCESSFUL-DELETE": "Unsuccessful Delete",
"UNSUCCESSFUL-EMAIL-SEND": "Failed sending email"
},
"ERRORS": {
"HTTP-REQUEST-ERROR": "An Unexpected Error Has Occurred"