fixed description template type editor on finalized status
This commit is contained in:
parent
3af2642583
commit
0d0e23d240
|
@ -37,6 +37,7 @@ export class DescriptionTemplateTypeEditorComponent extends BaseEditor<Descripti
|
|||
|
||||
isNew = true;
|
||||
isDeleted = false;
|
||||
isFinalized = false;
|
||||
formGroup: UntypedFormGroup = null;
|
||||
showInactiveDetails = false;
|
||||
|
||||
|
@ -46,11 +47,11 @@ export class DescriptionTemplateTypeEditorComponent extends BaseEditor<Descripti
|
|||
}
|
||||
|
||||
protected get canSave(): boolean {
|
||||
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditDescriptionTemplateType) && this.editorModel.belongsToCurrentTenant != false;
|
||||
return !this.isDeleted && !this.isFinalized && this.hasPermission(this.authService.permissionEnum.EditDescriptionTemplateType) && this.editorModel.belongsToCurrentTenant != false;
|
||||
}
|
||||
|
||||
protected get canFinalize(): boolean {
|
||||
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditDescriptionTemplateType) && this.editorModel.belongsToCurrentTenant != false;
|
||||
return !this.isDeleted && !this.isFinalized && this.hasPermission(this.authService.permissionEnum.EditDescriptionTemplateType) && this.editorModel.belongsToCurrentTenant != false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,6 +100,7 @@ export class DescriptionTemplateTypeEditorComponent extends BaseEditor<Descripti
|
|||
try {
|
||||
this.editorModel = data ? new DescriptionTemplateTypeEditorModel().fromModel(data) : new DescriptionTemplateTypeEditorModel();
|
||||
this.isDeleted = data ? data.isActive === IsActive.Inactive : false;
|
||||
this.isFinalized = data ? data.status === DescriptionTemplateTypeStatus.Finalized : false;
|
||||
this.buildForm();
|
||||
} catch (error) {
|
||||
this.logger.error('Could not parse descriptionTemplateType item: ' + data + error);
|
||||
|
@ -109,6 +111,10 @@ export class DescriptionTemplateTypeEditorComponent extends BaseEditor<Descripti
|
|||
buildForm() {
|
||||
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditDescriptionTemplateType));
|
||||
this.descriptionTemplateTypeEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
|
||||
|
||||
if (this.isFinalized) {
|
||||
this.formGroup.disable();
|
||||
}
|
||||
}
|
||||
|
||||
refreshData(): void {
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
<mat-icon>more_horiz</mat-icon>
|
||||
</button>
|
||||
<mat-menu #actionsMenu="matMenu">
|
||||
<button mat-menu-item [routerLink]="['/description-template-type/' + row.id]">
|
||||
<button *ngIf="!isFinalized(row)" mat-menu-item [routerLink]="['/description-template-type/' + row.id]">
|
||||
<mat-icon>edit</mat-icon>{{'DESCRIPTION-TEMPLATE-TYPE-LISTING.ACTIONS.EDIT' | translate}}
|
||||
</button>
|
||||
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item (click)="deleteType(row.id)">
|
||||
|
|
|
@ -130,6 +130,11 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen
|
|||
//
|
||||
// Listing Component functions
|
||||
//
|
||||
|
||||
isFinalized(item: DescriptionTemplateType): boolean {
|
||||
return item.status === DescriptionTemplateTypeStatus.Finalized
|
||||
}
|
||||
|
||||
onColumnsChanged(event: ColumnsChangedEvent) {
|
||||
super.onColumnsChanged(event);
|
||||
this.onColumnsChangedInternal(event.properties.map(x => x.toString()));
|
||||
|
|
Loading…
Reference in New Issue