From b27b85f876eb71c0338637786495cea3077099ea Mon Sep 17 00:00:00 2001 From: "CITE\\amentis" Date: Tue, 24 Sep 2024 10:52:44 +0300 Subject: [PATCH 1/3] plan ui can edit section fix --- .../service/description/DescriptionServiceImpl.java | 2 +- .../ui/plan/plan-editor-blueprint/plan-editor.component.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java index 81a216a51..c327ffe74 100644 --- a/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/description/DescriptionServiceImpl.java @@ -254,7 +254,7 @@ public class DescriptionServiceImpl implements DescriptionService { PlanEntity plan = this.entityManager.find(PlanEntity.class, data.getPlanId(), true); if (plan == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{data.getPlanId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (plan.getStatus().equals(PlanStatus.Finalized) && isUpdate) throw new MyValidationException(this.errors.getPlanIsFinalized().getCode(), this.errors.getPlanIsFinalized().getMessage()); + if (plan.getStatus().equals(PlanStatus.Finalized)) throw new MyValidationException(this.errors.getPlanIsFinalized().getCode(), this.errors.getPlanIsFinalized().getMessage()); data.setLabel(model.getLabel()); data.setStatus(model.getStatus()); diff --git a/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts b/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts index 6959e9f2e..aec96ad1e 100644 --- a/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts +++ b/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts @@ -140,19 +140,19 @@ export class PlanEditorComponent extends BaseEditor imple } protected canEditSection(id: Guid): boolean { - return !this.isDeleted && (this.hasPermission(this.authService.permissionEnum.EditDescription) || this.item?.authorizationFlags?.some(x => x === AppPermission.EditDescription) || ( + return !this.isDeleted && !this.isFinalized && (this.hasPermission(this.authService.permissionEnum.EditDescription) || this.item?.authorizationFlags?.some(x => x === AppPermission.EditDescription) || ( this.permissionPerSection && this.permissionPerSection[id.toString()] && this.permissionPerSection[id.toString()].some(x => x === AppPermission.EditDescription) )); } protected canDeleteSection(id: Guid): boolean { - return !this.isDeleted && (this.hasPermission(this.authService.permissionEnum.DeleteDescription) || this.item?.authorizationFlags?.some(x => x === AppPermission.DeleteDescription) || ( + return !this.isDeleted && !this.isFinalized && (this.hasPermission(this.authService.permissionEnum.DeleteDescription) || this.item?.authorizationFlags?.some(x => x === AppPermission.DeleteDescription) || ( this.permissionPerSection && this.permissionPerSection[id.toString()] && this.permissionPerSection[id.toString()].some(x => x === AppPermission.DeleteDescription) )); } get canEdit(): boolean { - return !this.isDeleted && (this.isNew ? this.authService.hasPermission(AppPermission.NewPlan) : this.item.authorizationFlags?.some(x => x === AppPermission.EditPlan) || this.authService.hasPermission(AppPermission.EditPlan)); + return !this.isDeleted && !this.isFinalized &&(this.isNew ? this.authService.hasPermission(AppPermission.NewPlan) : this.item.authorizationFlags?.some(x => x === AppPermission.EditPlan) || this.authService.hasPermission(AppPermission.EditPlan)); } protected canAnnotate(id: Guid): boolean { From 14c0598384821790adae500948619560c1167846 Mon Sep 17 00:00:00 2001 From: "CITE\\amentis" Date: Tue, 24 Sep 2024 11:20:06 +0300 Subject: [PATCH 2/3] description template ui fixes --- .../description-template-editor-select-field.component.html | 4 ++-- .../description-template-editor-select-field.component.ts | 1 + .../field/description-template-editor-field.component.html | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.html b/frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.html index d54eea9b9..df87753ab 100644 --- a/frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.html +++ b/frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.html @@ -31,13 +31,13 @@ {{form.get('data').get('options').get(''+i).get('value').getError('backendError').message}} - {{form.get('data').get('options').getError('backendError').message}} -
\ No newline at end of file diff --git a/frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.ts b/frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.ts index c47d97be5..17b0f044d 100644 --- a/frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.ts +++ b/frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.ts @@ -13,6 +13,7 @@ import { BaseComponent } from '@common/base/base.component'; export class DescriptionTemplateEditorSelectFieldComponent extends BaseComponent implements OnInit { @Input() form: UntypedFormGroup; + @Input() viewOnly: boolean = false; @Input() validationErrorModel: ValidationErrorModel; @Input() validationRootPath: string; diff --git a/frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.html b/frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.html index 4583a70e4..930eb6a4b 100644 --- a/frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.html +++ b/frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.html @@ -6,12 +6,12 @@
  • - + {{'GENERAL.VALIDATION.REQUIRED' | translate}}
  • - + {{'GENERAL.VALIDATION.URL.LABEL' | translate}}
  • @@ -161,7 +161,7 @@
    - + From d774254a1f484f58e68cfdb3f2b5f7fa4ba47609 Mon Sep 17 00:00:00 2001 From: "CITE\\amentis" Date: Tue, 24 Sep 2024 11:26:35 +0300 Subject: [PATCH 3/3] small ui fix --- .../app/ui/plan/plan-editor-blueprint/plan-editor.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts b/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts index aec96ad1e..927ea50d1 100644 --- a/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts +++ b/frontend/src/app/ui/plan/plan-editor-blueprint/plan-editor.component.ts @@ -136,7 +136,7 @@ export class PlanEditorComponent extends BaseEditor imple } protected get canReverseFinalize(): boolean { - return !this.isDeleted && !this.isNew && this.canEdit && this.isLockedByUser && this.item.status == PlanStatusEnum.Finalized && (this.hasPermission(this.authService.permissionEnum.EditPlan) || this.item?.authorizationFlags?.some(x => x === AppPermission.EditPlan)); + return !this.isDeleted && !this.isNew && this.isLockedByUser && this.item.status == PlanStatusEnum.Finalized && (this.hasPermission(this.authService.permissionEnum.EditPlan) || this.item?.authorizationFlags?.some(x => x === AppPermission.EditPlan)); } protected canEditSection(id: Guid): boolean {