diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html index f24deada3..5a7032899 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html @@ -2,7 +2,7 @@
-
+
@@ -28,11 +28,11 @@
-
-
+
+
-
+
{{'DMP-EDITOR.TITLE.EDIT-DATASET' | translate}}
{{ dataset.get('label').value }} ({{'DMP-EDITOR.CHANGES' | translate}})
@@ -45,6 +45,9 @@
+
+
{{'DMP-EDITOR.TITLE.CREATE-DATASET' | translate}}
+
-
+
{{'DMP-EDITOR.STEPPER.USER-GUIDE' | translate}}
    -
  1. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (4)
  2. -
  3. {{'DMP-EDITOR.STEPPER.FUNDING-INFO' | translate}} (3)
  4. -
  5. {{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}}
  6. +
  7. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (4)
  8. +
  9. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (1)
  10. + +
  11. {{'DMP-EDITOR.STEPPER.FUNDING-INFO' | translate}} (3)
  12. +
  13. {{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}}
  14. + +
  15. {{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}}
  16. +
  17. {{'DMP-EDITOR.STEPPER.DATASET' | translate}}
      @@ -83,16 +91,23 @@ chevron_left
      {{'DMP-EDITOR.STEPPER.PREVIOUS' | translate}}
-
+
+ chevron_right +
{{'DMP-EDITOR.STEPPER.NEXT' | translate}}
+
+
chevron_right
{{'DMP-EDITOR.STEPPER.NEXT' | translate}}
- - - + + + + + +
diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss index 21814e149..2762c550f 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss @@ -376,13 +376,13 @@ a:hover { white-space: nowrap; } -::ng-deep .mat-tab-labels { - justify-content: space-between; -} +// ::ng-deep .mat-tab-labels { +// justify-content: space-between; +// } -::ng-deep .mat-tab-label-content { - text-transform: uppercase; -} +// ::ng-deep .mat-tab-label-content { +// text-transform: uppercase; +// } ::ng-deep .mat-ink-bar { background-color: #00b29f !important; diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts index ffaaa8608..02dd03184 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts @@ -42,6 +42,9 @@ import { Guid } from '@common/types/guid'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { ExtraPropertiesFormModel } from './general-tab/extra-properties-form.model'; import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model'; +import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; +import { DmpListingModel } from '@app/core/model/dmp/dmp-listing'; +import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria'; @Component({ selector: 'app-dmp-editor-component', @@ -57,25 +60,29 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC isNew = true; isPublic = false; isFinalized = false; + hasChanges = false; + isNewDataset = false; + isUserOwner: boolean = true; + dmp: DmpEditorModel; formGroup: FormGroup = null; formGroupRawValue: any; - hasChanges = false; - - selectedTab = 0; + datasetId: string = null; + datasets = new FormArray([]); createNewVersion; + associatedUsers: Array; people: Array; filteredOptions: DmpProfileListing[]; selectedDmpProfileDefinition: DmpProfileDefinition; + DynamicDmpFieldResolverComponent: any; - isUserOwner: boolean = true; lock: LockModel; lockStatus: Boolean; - datasets: FormArray; - datasetId: string = null; - stepsBeforeDatasets: number = 3; + + selectedTab = 0; step: number = 0; + stepsBeforeDatasets: number = 3; maxStep: number = 3; constructor( @@ -96,6 +103,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC } ngOnInit() { + if (this.router.url.toString().localeCompare('/new/dataset') === 0) { + this.isNewDataset = true; + this.stepsBeforeDatasets = 2; + this.maxStep = 2; + }; this.route.params .pipe(takeUntil(this._destroyed)) .subscribe((params: Params) => { @@ -146,10 +158,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.dmp.extraProperties = new ExtraPropertiesFormModel(); this.dmp.fromModel(data); this.formGroup = this.dmp.buildForm(); - this.datasets = new FormArray([]); - // this.formGroup.get('datasets')['controls'].forEach(element => { - // this.datasets.push(element); - // }); + this.datasets = this.formGroup.get('datasets') as FormArray; this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue())); this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep; @@ -216,11 +225,10 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.dmp.fromModel(data); this.formGroup = this.dmp.buildForm(); - this.datasets = new FormArray([]); - this.formGroup.get('datasets')['controls'].forEach(element => { - this.datasets.push(element); - }); - + // this.formGroup.get('datasets')['controls'].forEach(element => { + // this.datasets.push(element); + // }); + this.datasets = this.formGroup.get('datasets') as FormArray; this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue())); this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep; @@ -251,6 +259,24 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC // } // }) }); + } else if (this.isNewDataset) { + this.dmp = new DmpEditorModel(); + this.dmp.grant = new GrantTabModel(); + this.dmp.project = new ProjectFormModel(); + this.dmp.funder = new FunderFormModel(); + this.dmp.extraProperties = new ExtraPropertiesFormModel(); + this.dmp.extraProperties.visible = false; + this.dmp.extraProperties.contact = this.authService.current().id; + const datasetWizardEditorModel = new DatasetWizardEditorModel(); + this.dmp.datasets.push(datasetWizardEditorModel); + this.formGroup = this.dmp.buildForm(); + + this.datasets = this.formGroup.get('datasets') as FormArray; + + this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue())); + this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep; + + this.registerFormEventsForNewItem(); } else { this.dmp = new DmpEditorModel(); this.dmp.grant = new GrantTabModel(); @@ -261,11 +287,6 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.dmp.extraProperties.contact = this.authService.current().id; this.formGroup = this.dmp.buildForm(); - this.datasets = new FormArray([]); - this.formGroup.get('datasets')['controls'].forEach(element => { - this.datasets.push(element); - }); - this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue())); this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep;