added finalize function for description template type
This commit is contained in:
parent
7ed9a59595
commit
f2cf61938d
|
@ -17,7 +17,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="col-auto" *ngIf="canFinalize">
|
||||
<button mat-button class="action-btn" (click)="finalize(); formSubmit()">
|
||||
<button mat-button class="action-btn" (click)="save(); finalize()">
|
||||
<mat-icon>save</mat-icon>
|
||||
{{'DESCRIPTION-TEMPLATE-TYPE-EDITOR.ACTIONS.FINALIZE' | translate}}
|
||||
</button>
|
||||
|
|
|
@ -25,6 +25,8 @@ import { DescriptionTemplateTypeEditorResolver } from './description-template-ty
|
|||
import { DescriptionTemplateTypeEditorService } from './description-template-type-editor.service';
|
||||
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
||||
import { LockService } from '@app/core/services/lock/lock.service';
|
||||
import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
|
||||
import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status';
|
||||
|
||||
@Component({
|
||||
templateUrl: './description-template-type-editor.component.html',
|
||||
|
@ -175,4 +177,33 @@ export class DescriptionTemplateTypeEditorComponent extends BaseEditor<Descripti
|
|||
this.editorModel.validationErrorModel.clear();
|
||||
this.formService.validateAllFormFields(this.formGroup);
|
||||
}
|
||||
|
||||
finalize(): void {
|
||||
this.formService.removeAllBackEndErrors(this.formGroup);
|
||||
this.formService.touchAllFormFields(this.formGroup);
|
||||
if (!this.isFormValid()) {
|
||||
this.dialog.open(FormValidationErrorsDialogComponent, {
|
||||
data: {
|
||||
errorMessages: [this.language.instant('DESCRIPTION-TEMPLATE-TYPE-EDITOR.MESSAGES.MISSING-FIELDS')]
|
||||
}
|
||||
})
|
||||
|
||||
this.formService.touchAllFormFields(this.formGroup);
|
||||
return;
|
||||
}
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
message: this.language.instant('DESCRIPTION-TEMPLATE-TYPE-EDITOR.FINALIZE-DIALOG.TITLE'),
|
||||
confirmButton: this.language.instant('DESCRIPTION-TEMPLATE-TYPE-EDITOR.FINALIZE-DIALOG.CONFIRM'),
|
||||
cancelButton: this.language.instant('DESCRIPTION-TEMPLATE-TYPE-EDITOR.FINALIZE-DIALOG.NEGATIVE'),
|
||||
isDeleteConfirmation: false
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (result) {
|
||||
this.formGroup.get('status').setValue(DescriptionTemplateTypeStatus.Finalized);
|
||||
this.persistEntity();
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1249,6 +1249,14 @@
|
|||
"FINALIZE": "Finalize",
|
||||
"CANCEL": "Cancel",
|
||||
"DELETE": "Delete"
|
||||
},
|
||||
"MESSAGES": {
|
||||
"MISSING-FIELDS": "There are some required fields left unfilled. Please check the Template and make sure that all required questions are answered and URLs are provided with valid input. (Missing fields are marked in red color)"
|
||||
},
|
||||
"FINALIZE-DIALOG": {
|
||||
"TITLE": "Finalize this item?",
|
||||
"CONFIRM": "Confirm",
|
||||
"NEGATIVE": "Cancel"
|
||||
}
|
||||
},
|
||||
"REFERENCE-TYPE-EDITOR": {
|
||||
|
|
|
@ -110,9 +110,6 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
|
|||
|
||||
|
||||
onCallbackSuccess(data?: any): void {
|
||||
|
||||
console.log("Success:", data);
|
||||
|
||||
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.refreshOnNavigateToData(data ? data.id : null);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue