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 e0a2f2987..83ac2b21a 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 @@ -435,6 +435,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC data: { formGroup: this.formGroup, dmp: this.dmp, + isWizard: false, message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.FINALIZE-ITEM'), confirmButton: this.language.instant('DMP-FINALISE-DIALOG.SUBMIT'), cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'), @@ -445,8 +446,6 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC } } }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { - - }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { }); } } diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html index a58de7fdf..a5f3d017d 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html @@ -50,8 +50,36 @@ | translate}} +
+ + + + + {{ 'DMP-FINALISE-DIALOG.DMP' | translate }} + + + {{ formGroup.get('dmp')?.get('label')?.value }} + + + {{ formGroup.get('dmp')?.get('description')?.value }} + + + + + {{ 'DMP-FINALISE-DIALOG.DATASETS' | translate }} + + + +
+ bookmark +

{{ label }}

+
+
+
+
+
- + {{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }}
diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.ts index 53d7d8cad..d8a76581b 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.ts @@ -26,6 +26,8 @@ export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit public datasetsFinalized: DatasetListingModel[]; public datasetsDraft: DatasetListingModel[]; public allDatasets: DatasetListingModel[] = []; + public allDatasetLabels: String[] = []; + public isWizard: boolean; constructor( public router: Router, public dialogRef: MatDialogRef, @@ -36,11 +38,18 @@ export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit this.submitFunction = data['submitFunction']; this.dmp = data['dmp']; this.formGroup = data['formGroup']; + this.isWizard = data['isWizard']; } ngOnInit(): void { - this.initialiseDatasetFinalizedRequest(); - this.initialiseDmpFinalizedRequest(); + if(!this.isWizard) { + this.initialiseDatasetFinalizedRequest(); + this.initialiseDmpFinalizedRequest(); + } else { + for (let value of (this.formGroup.get('datasets').get('datasetsList') as FormArray).value) { + this.allDatasetLabels.push(value.datasetLabel); + } + } } initialiseDatasetFinalizedRequest() { diff --git a/dmp-frontend/src/app/ui/quick-wizard/quick-wizard-editor/quick-wizard-editor.component.ts b/dmp-frontend/src/app/ui/quick-wizard/quick-wizard-editor/quick-wizard-editor.component.ts index 462212f43..5dd0ca08b 100644 --- a/dmp-frontend/src/app/ui/quick-wizard/quick-wizard-editor/quick-wizard-editor.component.ts +++ b/dmp-frontend/src/app/ui/quick-wizard/quick-wizard-editor/quick-wizard-editor.component.ts @@ -15,6 +15,7 @@ import { ProjectEditorWizardModel } from '../project-editor/project-editor-wizar import { QuickWizardEditorWizardModel } from './quick-wizard-editor.model'; import { DatasetEditorWizardComponent } from '../dataset-editor/dataset-editor-wizard.component'; import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component'; +import { DmpFinalizeDialogComponent } from '../../dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component'; @Component({ @@ -78,15 +79,31 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit, } saveFinalize() { - if (!this.isFormValid()) { return; } - if (this.formGroup.get('datasets') && this.formGroup.get('datasets').get('datasetsList') && (this.formGroup.get('datasets').get('datasetsList') as FormArray).length > 0) { - for (let control of (this.formGroup.get('datasets').get('datasetsList') as FormArray).controls) { - control.get('status').setValue('1'); + const dialogRef = this.dialog.open(DmpFinalizeDialogComponent, { + maxWidth: '500px', + data: { + formGroup: this.formGroup, + message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.FINALIZE-ITEM'), + isWizard: true, + confirmButton: this.language.instant('DMP-FINALISE-DIALOG.SUBMIT'), + cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'), + submitFunction: () => { + if (!this.isFormValid()) { return; } + if (this.formGroup.get('datasets') && this.formGroup.get('datasets').get('datasetsList') && (this.formGroup.get('datasets').get('datasetsList') as FormArray).length > 0) { + for (let control of (this.formGroup.get('datasets').get('datasetsList') as FormArray).controls) { + control.get('status').setValue('1'); + } + this.formGroup.get('dmp').get('status').setValue('1'); + this.onSubminSaveAndFinalize(); + } else { + return; + } + dialogRef.close(); + } } - this.onSubminSaveAndFinalize(); - } else { - return; - } + }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + }); } hasDatasets() { @@ -120,8 +137,8 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit, this.quickWizardService.createQuickWizard(this.formGroup.getRawValue()) .pipe(takeUntil(this._destroyed)) .subscribe( - complete => this.onCallbackSuccess(), - error => this.onCallbackError(error) + complete => this.onCallbackSuccess(), + error => this.onCallbackError(error) ); } @@ -140,7 +157,7 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit, this.quickWizardService.createQuickWizard(this.formGroup.value) .pipe(takeUntil(this._destroyed)) .subscribe( - complete => this.onCallbackSuccess() + complete => this.onCallbackSuccess() ) } }); diff --git a/dmp-frontend/src/app/ui/quick-wizard/quick-wizard.module.ts b/dmp-frontend/src/app/ui/quick-wizard/quick-wizard.module.ts index 098f3d490..94b4230dc 100644 --- a/dmp-frontend/src/app/ui/quick-wizard/quick-wizard.module.ts +++ b/dmp-frontend/src/app/ui/quick-wizard/quick-wizard.module.ts @@ -10,6 +10,7 @@ import { QuickWizardEditorComponent } from './quick-wizard-editor/quick-wizard-e import { AutoCompleteModule } from '../../library/auto-complete/auto-complete.module'; import { DatasetEditorWizardComponent } from './dataset-editor/dataset-editor-wizard.component'; import { DatasetDescriptionFormModule } from '../misc/dataset-description-form/dataset-description-form.module'; +import { DmpModule } from '../dmp/dmp.module'; @NgModule({ @@ -21,12 +22,13 @@ import { DatasetDescriptionFormModule } from '../misc/dataset-description-form/d ConfirmationDialogModule, QuickWizardRoutingModule, DatasetDescriptionFormModule, + DmpModule ], declarations: [ ProjectEditorWizardComponent, DmpEditorWizardComponent, QuickWizardEditorComponent, - DatasetEditorWizardComponent + DatasetEditorWizardComponent, ], exports: [ DatasetEditorWizardComponent,