plan ui can edit section fix

This commit is contained in:
CITE\amentis 2024-09-24 10:52:44 +03:00
parent 7262df32e1
commit b27b85f876
2 changed files with 4 additions and 4 deletions

View File

@ -254,7 +254,7 @@ public class DescriptionServiceImpl implements DescriptionService {
PlanEntity plan = this.entityManager.find(PlanEntity.class, data.getPlanId(), true); 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 == 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.setLabel(model.getLabel());
data.setStatus(model.getStatus()); data.setStatus(model.getStatus());

View File

@ -140,19 +140,19 @@ export class PlanEditorComponent extends BaseEditor<PlanEditorModel, Plan> imple
} }
protected canEditSection(id: Guid): boolean { 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) this.permissionPerSection && this.permissionPerSection[id.toString()] && this.permissionPerSection[id.toString()].some(x => x === AppPermission.EditDescription)
)); ));
} }
protected canDeleteSection(id: Guid): boolean { 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) this.permissionPerSection && this.permissionPerSection[id.toString()] && this.permissionPerSection[id.toString()].some(x => x === AppPermission.DeleteDescription)
)); ));
} }
get canEdit(): boolean { 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 { protected canAnnotate(id: Guid): boolean {