Merge remote-tracking branch 'origin/dmp-refactoring' into accessibility-refactor

This commit is contained in:
mchouliara 2024-09-24 11:48:36 +03:00
commit 88903a0ee8
5 changed files with 11 additions and 10 deletions

View File

@ -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());

View File

@ -31,13 +31,13 @@
<input matInput [formControl]="form.get('data').get('options').get(''+i).get('value')" (change)="applyNewVisibilityValueListener()">
<mat-error *ngIf="form.get('data').get('options').get(''+i).get('value').hasError('backendError')">{{form.get('data').get('options').get(''+i).get('value').getError('backendError').message}}</mat-error>
</mat-form-field>
<button mat-icon-button class="col-auto" (click)="deleteRow(i)" type="button" [disabled]="this.form.disabled">
<button mat-icon-button class="col-auto" (click)="deleteRow(i)" type="button" [disabled]="this.form.disabled || viewOnly">
<mat-icon>delete</mat-icon>
</button>
</div>
</div>
<mat-error *ngIf="form.get('data').get('options').hasError('backendError')">{{form.get('data').get('options').getError('backendError').message}}</mat-error>
<div class="col-auto"><button mat-icon-button [disabled]="this.form.disabled" (click)="addNewRow()">
<div class="col-auto"><button mat-icon-button [disabled]="this.form.disabled || viewOnly" (click)="addNewRow()">
<mat-icon>add</mat-icon>
</button></div>
</div>

View File

@ -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;

View File

@ -6,12 +6,12 @@
<div class="col-auto">
<ul class="list-unstyled list-inline d-flex align-items-center">
<li class="list-inline-item">
<mat-slide-toggle class="field-toggler" [checked]="isRequired" (change)="toggleRequired($event)" labelPosition="before" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELD.MAKE-IT-REQUIRED' | translate" [disabled]="!fieldType || form.disabled">
<mat-slide-toggle class="field-toggler" [checked]="isRequired" (change)="toggleRequired($event)" labelPosition="before" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELD.MAKE-IT-REQUIRED' | translate" [disabled]="!fieldType || form.disabled || viewOnly">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-slide-toggle>
</li>
<li *ngIf="fieldType === descriptionTemplateFieldTypeEnum.FREE_TEXT" class="list-inline-item">
<mat-slide-toggle class="field-toggler" [checked]="isURL" (change)="toggleURL($event)" labelPosition="before" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELD.MAKE-IT-REQUIRED' | translate" [disabled]="!fieldType || form.disabled">
<mat-slide-toggle class="field-toggler" [checked]="isURL" (change)="toggleURL($event)" labelPosition="before" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELD.MAKE-IT-REQUIRED' | translate" [disabled]="!fieldType || form.disabled || viewOnly">
{{'GENERAL.VALIDATION.URL.LABEL' | translate}}
</mat-slide-toggle>
</li>
@ -161,7 +161,7 @@
<div class="row" [ngSwitch]="form.get('data')?.get('fieldType')?.value">
<app-description-template-editor-reference-type-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.REFERENCE_TYPES" class="col-12" [form]="form" [validationErrorModel]="validationErrorModel" [validationRootPath]="validationRootPath"></app-description-template-editor-reference-type-field-component>
<app-description-template-editor-select-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12" [form]="form" [validationErrorModel]="validationErrorModel" [validationRootPath]="validationRootPath"></app-description-template-editor-select-field-component>
<app-description-template-editor-select-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12" [form]="form" [viewOnly]="viewOnly" [validationErrorModel]="validationErrorModel" [validationRootPath]="validationRootPath"></app-description-template-editor-select-field-component>
<app-description-template-editor-radio-box-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.RADIO_BOX" class="col-12" [form]="form" [validationErrorModel]="validationErrorModel" [validationRootPath]="validationRootPath"></app-description-template-editor-radio-box-field-component>
<app-description-template-editor-upload-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.UPLOAD" class="col-12" [form]="form" [validationErrorModel]="validationErrorModel" [validationRootPath]="validationRootPath"></app-description-template-editor-upload-field-component>

View File

@ -136,23 +136,23 @@ export class PlanEditorComponent extends BaseEditor<PlanEditorModel, Plan> 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 {
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 {