Fixes bug on dmp-editor action "save changes"
This commit is contained in:
parent
230e7481b1
commit
218595c358
|
@ -76,7 +76,7 @@
|
|||
<mat-icon class="mr-2">settings</mat-icon>
|
||||
{{ 'DMP-LISTING.ACTIONS.SETTINGS' | translate }}
|
||||
</ng-template>
|
||||
</mat-tab> -->
|
||||
</mat-tab> -->
|
||||
</mat-tab-group>
|
||||
|
||||
<div *ngIf="!isFinalized" class="d-flex justify-content-end pt-2 pb-4 pl-2 pr-2">
|
||||
|
@ -91,15 +91,15 @@
|
|||
</button>
|
||||
</div>
|
||||
<div *ngIf="formGroup.enabled">
|
||||
<button *ngIf="!isNew" mat-raised-button type="submit" [disabled]="!formGroup.get('grant').valid" class="text-uppercase dark-theme mr-2" color="primary">
|
||||
<button *ngIf="!isNew" mat-raised-button type="submit" [disabled]="!isFormValid()" class="text-uppercase dark-theme mr-2" color="primary">
|
||||
{{'DMP-EDITOR.ACTIONS.SAVE-CHANGES' | translate}}
|
||||
</button>
|
||||
<button *ngIf="isNew" mat-raised-button type="button" (click)="addDataset()" [disabled]="!formGroup.get('grant').valid" class="text-uppercase dark-theme mr-2" color="primary">
|
||||
<button *ngIf="isNew" mat-raised-button type="button" (click)="addDataset()" [disabled]="!isFormValid()" class="text-uppercase dark-theme mr-2" color="primary">
|
||||
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
<div *ngIf="formGroup.enabled && !isNew">
|
||||
<button type="button" mat-raised-button color="primary" [disabled]="!formGroup.get('grant').valid" class="text-uppercase mr-2" (click)="saveAndFinalize()">{{'DMP-EDITOR.ACTIONS.FINALISE' | translate}}
|
||||
<button type="button" mat-raised-button color="primary" [disabled]="!isFormValid()" class="text-uppercase mr-2" (click)="saveAndFinalize()">{{'DMP-EDITOR.ACTIONS.FINALISE' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, OnInit, ViewContainerRef } from '@angular/core';
|
||||
import { FormGroup, FormControl, FormArray } from '@angular/forms';
|
||||
import { FormGroup, FormControl, FormArray, AbstractControl } from '@angular/forms';
|
||||
import { MatDialog, MatSnackBar } from '@angular/material';
|
||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
@ -170,7 +170,6 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
// }
|
||||
});
|
||||
} else {
|
||||
console.log('4');
|
||||
this.dmp = new DmpEditorModel();
|
||||
this.dmp.grant = new GrantTabModel();
|
||||
this.dmp.project = new ProjectFormModel();
|
||||
|
@ -239,7 +238,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
}
|
||||
|
||||
public isFormValid() {
|
||||
return this.formGroup.valid;
|
||||
return this.formGroup.get('label').valid && this.formGroup.get('profiles').valid && this.formGroup.get('grant').valid;
|
||||
}
|
||||
|
||||
onSubmit(showAddDatasetDialog?: boolean): void {
|
||||
|
|
Loading…
Reference in New Issue