change pop up description finalize dialog
This commit is contained in:
parent
65d62b2849
commit
f71bc64ce5
|
@ -181,6 +181,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
|
||||
data.setLabel(model.getLabel());
|
||||
data.setStatus(model.getStatus());
|
||||
if (model.getStatus() == DescriptionStatus.Finalized) data.setFinalizedAt(Instant.now());
|
||||
data.setDescription(model.getDescription());
|
||||
data.setDescriptionTemplateId(model.getDescriptionTemplateId());
|
||||
data.setUpdatedAt(Instant.now());
|
||||
|
@ -355,6 +356,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
}
|
||||
|
||||
data.setStatus(model.getStatus());
|
||||
if (model.getStatus() == DescriptionStatus.Finalized) data.setFinalizedAt(Instant.now());
|
||||
data.setUpdatedAt(Instant.now());
|
||||
this.entityManager.merge(data);
|
||||
|
||||
|
|
|
@ -666,6 +666,10 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
this.formService.validateAllFormFields(this.formGroup);
|
||||
}
|
||||
|
||||
backToDmp() {
|
||||
this.router.navigate(['/plans', 'edit', this.formGroup.get('dmpId').value]);
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// Misc
|
||||
|
@ -977,9 +981,9 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.FINALIZE-ITEM'),
|
||||
confirmButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.AFFIRMATIVE'),
|
||||
cancelButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.NEGATIVE'),
|
||||
message: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.TITLE'),
|
||||
confirmButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.CONFIRM'),
|
||||
cancelButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.NEGATIVE'),
|
||||
isDeleteConfirmation: false
|
||||
}
|
||||
});
|
||||
|
|
|
@ -34,6 +34,7 @@ import { nameof } from 'ts-simple-nameof';
|
|||
import { DescriptionCopyDialogComponent } from '../description-copy-dialog/description-copy-dialog.component';
|
||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||
import { DescriptionValidationOutput } from '@app/ui/dmp/dmp-finalize-dialog/dmp-finalize-dialog.component';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -391,22 +392,37 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
|
|||
|
||||
finalize(description: Description) {
|
||||
|
||||
this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
message: this.language.instant('DESCRIPTION-OVERVIEW.FINALISE-POPUP.MESSAGE'),
|
||||
confirmButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALISE-POPUP.CONFIRM'),
|
||||
cancelButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALISE-POPUP.CANCEL'),
|
||||
},
|
||||
maxWidth: '30em'
|
||||
})
|
||||
.afterClosed()
|
||||
.pipe(
|
||||
filter(x => x),
|
||||
takeUntil(this._destroyed)
|
||||
)
|
||||
.subscribe(_ => {
|
||||
this.router.navigate(['descriptions/edit/' + description.id + '/finalize']);
|
||||
})
|
||||
this.descriptionService.validate([description.id]).pipe(takeUntil(this._destroyed)
|
||||
).subscribe(result => {
|
||||
if (result[0].result == DescriptionValidationOutput.Invalid){
|
||||
this.router.navigate(['descriptions/edit/' + description.id + '/finalize']);
|
||||
}else{
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
message: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.TITLE'),
|
||||
confirmButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.CONFIRM'),
|
||||
cancelButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.NEGATIVE'),
|
||||
isDeleteConfirmation: false
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (result) {
|
||||
const descriptionStatusPersist: DescriptionStatusPersist = {
|
||||
id: description.id,
|
||||
status: DescriptionStatus.Finalized,
|
||||
hash: description.hash
|
||||
};
|
||||
this.descriptionService.persistStatus(descriptionStatusPersist).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.reloadPage();
|
||||
this.onUpdateCallbackSuccess()
|
||||
}, (error: any) => {
|
||||
this.onUpdateCallbackError(error)
|
||||
});
|
||||
}});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
hasReversableStatus(description: Description): boolean {
|
||||
|
|
|
@ -1028,6 +1028,11 @@
|
|||
"COPY": "Copy",
|
||||
"CANCEL": "Cancel"
|
||||
},
|
||||
"FINALIZE-DIALOG": {
|
||||
"TITLE": "Finalize this item?",
|
||||
"CONFIRM": "Confirm",
|
||||
"NEGATIVE": "Cancel"
|
||||
},
|
||||
"UNDO-FINALIZATION-DIALOG": {
|
||||
"TITLE": "Undo Finalization?",
|
||||
"CONFIRM": "Yes",
|
||||
|
|
Loading…
Reference in New Issue