Finalize Dialog on New DMP (Wizard)
This commit is contained in:
parent
425a64e60a
commit
742dd5015f
|
@ -435,6 +435,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
||||||
data: {
|
data: {
|
||||||
formGroup: this.formGroup,
|
formGroup: this.formGroup,
|
||||||
dmp: this.dmp,
|
dmp: this.dmp,
|
||||||
|
isWizard: false,
|
||||||
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.FINALIZE-ITEM'),
|
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.FINALIZE-ITEM'),
|
||||||
confirmButton: this.language.instant('DMP-FINALISE-DIALOG.SUBMIT'),
|
confirmButton: this.language.instant('DMP-FINALISE-DIALOG.SUBMIT'),
|
||||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
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 => { });
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,36 @@
|
||||||
| translate}}</mat-error>
|
| translate}}</mat-error>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div mat-dialog-content *ngIf="isWizard" class="pt-2 pb-2">
|
||||||
|
<mat-accordion [multi]="true">
|
||||||
|
<mat-expansion-panel>
|
||||||
|
<mat-expansion-panel-header>
|
||||||
|
<mat-panel-title>
|
||||||
|
{{ 'DMP-FINALISE-DIALOG.DMP' | translate }}
|
||||||
|
</mat-panel-title>
|
||||||
|
<mat-panel-description class="dmp-title">
|
||||||
|
{{ formGroup.get('dmp')?.get('label')?.value }}
|
||||||
|
</mat-panel-description>
|
||||||
|
</mat-expansion-panel-header>
|
||||||
|
{{ formGroup.get('dmp')?.get('description')?.value }}
|
||||||
|
</mat-expansion-panel>
|
||||||
|
<mat-expansion-panel [expanded]="true">
|
||||||
|
<mat-expansion-panel-header>
|
||||||
|
<mat-panel-title>
|
||||||
|
{{ 'DMP-FINALISE-DIALOG.DATASETS' | translate }}
|
||||||
|
</mat-panel-title>
|
||||||
|
<mat-panel-description></mat-panel-description>
|
||||||
|
</mat-expansion-panel-header>
|
||||||
|
<div *ngFor="let label of allDatasetLabels" class="row pl-3 datasets">
|
||||||
|
<mat-icon class="col-1 finalized-bookmark">bookmark</mat-icon>
|
||||||
|
<h4 class="col-11 ml-auto mt-1 mb-4">{{ label }}</h4>
|
||||||
|
</div>
|
||||||
|
</mat-expansion-panel>
|
||||||
|
</mat-accordion>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<mat-error class="row pt-2 pb-2 pl-4 pr-4" >
|
<mat-error class="row pt-2 pb-2 pl-4 pr-4">
|
||||||
{{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }}
|
{{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
<div class="row pl-4 pr-4">
|
<div class="row pl-4 pr-4">
|
||||||
|
|
|
@ -26,6 +26,8 @@ export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit
|
||||||
public datasetsFinalized: DatasetListingModel[];
|
public datasetsFinalized: DatasetListingModel[];
|
||||||
public datasetsDraft: DatasetListingModel[];
|
public datasetsDraft: DatasetListingModel[];
|
||||||
public allDatasets: DatasetListingModel[] = [];
|
public allDatasets: DatasetListingModel[] = [];
|
||||||
|
public allDatasetLabels: String[] = [];
|
||||||
|
public isWizard: boolean;
|
||||||
constructor(
|
constructor(
|
||||||
public router: Router,
|
public router: Router,
|
||||||
public dialogRef: MatDialogRef<DmpFinalizeDialogComponent>,
|
public dialogRef: MatDialogRef<DmpFinalizeDialogComponent>,
|
||||||
|
@ -36,11 +38,18 @@ export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit
|
||||||
this.submitFunction = data['submitFunction'];
|
this.submitFunction = data['submitFunction'];
|
||||||
this.dmp = data['dmp'];
|
this.dmp = data['dmp'];
|
||||||
this.formGroup = data['formGroup'];
|
this.formGroup = data['formGroup'];
|
||||||
|
this.isWizard = data['isWizard'];
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.initialiseDatasetFinalizedRequest();
|
if(!this.isWizard) {
|
||||||
this.initialiseDmpFinalizedRequest();
|
this.initialiseDatasetFinalizedRequest();
|
||||||
|
this.initialiseDmpFinalizedRequest();
|
||||||
|
} else {
|
||||||
|
for (let value of (this.formGroup.get('datasets').get('datasetsList') as FormArray).value) {
|
||||||
|
this.allDatasetLabels.push(value.datasetLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initialiseDatasetFinalizedRequest() {
|
initialiseDatasetFinalizedRequest() {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { ProjectEditorWizardModel } from '../project-editor/project-editor-wizar
|
||||||
import { QuickWizardEditorWizardModel } from './quick-wizard-editor.model';
|
import { QuickWizardEditorWizardModel } from './quick-wizard-editor.model';
|
||||||
import { DatasetEditorWizardComponent } from '../dataset-editor/dataset-editor-wizard.component';
|
import { DatasetEditorWizardComponent } from '../dataset-editor/dataset-editor-wizard.component';
|
||||||
import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component';
|
||||||
|
import { DmpFinalizeDialogComponent } from '../../dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -78,15 +79,31 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
||||||
}
|
}
|
||||||
|
|
||||||
saveFinalize() {
|
saveFinalize() {
|
||||||
if (!this.isFormValid()) { return; }
|
const dialogRef = this.dialog.open(DmpFinalizeDialogComponent, {
|
||||||
if (this.formGroup.get('datasets') && this.formGroup.get('datasets').get('datasetsList') && (this.formGroup.get('datasets').get('datasetsList') as FormArray).length > 0) {
|
maxWidth: '500px',
|
||||||
for (let control of (this.formGroup.get('datasets').get('datasetsList') as FormArray).controls) {
|
data: {
|
||||||
control.get('status').setValue('1');
|
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 {
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||||
return;
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hasDatasets() {
|
hasDatasets() {
|
||||||
|
@ -120,8 +137,8 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
||||||
this.quickWizardService.createQuickWizard(this.formGroup.getRawValue())
|
this.quickWizardService.createQuickWizard(this.formGroup.getRawValue())
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
complete => this.onCallbackSuccess(),
|
complete => this.onCallbackSuccess(),
|
||||||
error => this.onCallbackError(error)
|
error => this.onCallbackError(error)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +157,7 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
||||||
this.quickWizardService.createQuickWizard(this.formGroup.value)
|
this.quickWizardService.createQuickWizard(this.formGroup.value)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
complete => this.onCallbackSuccess()
|
complete => this.onCallbackSuccess()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { QuickWizardEditorComponent } from './quick-wizard-editor/quick-wizard-e
|
||||||
import { AutoCompleteModule } from '../../library/auto-complete/auto-complete.module';
|
import { AutoCompleteModule } from '../../library/auto-complete/auto-complete.module';
|
||||||
import { DatasetEditorWizardComponent } from './dataset-editor/dataset-editor-wizard.component';
|
import { DatasetEditorWizardComponent } from './dataset-editor/dataset-editor-wizard.component';
|
||||||
import { DatasetDescriptionFormModule } from '../misc/dataset-description-form/dataset-description-form.module';
|
import { DatasetDescriptionFormModule } from '../misc/dataset-description-form/dataset-description-form.module';
|
||||||
|
import { DmpModule } from '../dmp/dmp.module';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -21,12 +22,13 @@ import { DatasetDescriptionFormModule } from '../misc/dataset-description-form/d
|
||||||
ConfirmationDialogModule,
|
ConfirmationDialogModule,
|
||||||
QuickWizardRoutingModule,
|
QuickWizardRoutingModule,
|
||||||
DatasetDescriptionFormModule,
|
DatasetDescriptionFormModule,
|
||||||
|
DmpModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ProjectEditorWizardComponent,
|
ProjectEditorWizardComponent,
|
||||||
DmpEditorWizardComponent,
|
DmpEditorWizardComponent,
|
||||||
QuickWizardEditorComponent,
|
QuickWizardEditorComponent,
|
||||||
DatasetEditorWizardComponent
|
DatasetEditorWizardComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
DatasetEditorWizardComponent,
|
DatasetEditorWizardComponent,
|
||||||
|
|
Loading…
Reference in New Issue