view inactive users on deleted plan/description, fix wording, small ui fixes, RECOMMIT

This commit is contained in:
mchouliara 2024-08-13 16:02:27 +03:00
parent b602fa997a
commit b655669b61
9 changed files with 40 additions and 36 deletions

View File

@ -7,14 +7,15 @@
<div class="col-12">
<div class="row">
<div class="col info">
<ng-container *ngIf="!viewOnly else viewOnlyTemplate">
@if(!viewOnly){
<div *ngIf="isNew" class="description-title">{{'DESCRIPTION-EDITOR.TITLE-ADD-DESCRIPTION' | translate}}</div>
<div *ngIf="!isNew" class="description-title">{{'DESCRIPTION-EDITOR.TITLE-EDIT-DESCRIPTION' | translate}}</div>
<div class="description-subtitle">{{ formGroup.get('label').value }} <span *ngIf="isDirty()" class="description-changes">{{'DESCRIPTION-EDITOR.UNSAVED-CHANGES' | translate}}</span></div>
</ng-container>
<ng-template #viewOnlyTemplate>
<div class="description-title">{{'DESCRIPTION-EDITOR.TITLE-PREVIEW-DESCRIPTION' | translate}}</div>
</ng-template>
<div class="description-subtitle">
{{ formGroup.get('label').value }} <span *ngIf="isDirty()" class="description-changes">{{'DESCRIPTION-EDITOR.UNSAVED-CHANGES' | translate}}</span>
</div>
}@else {
<div class="description-title">{{'DESCRIPTION-EDITOR.TITLE-PREVIEW-DESCRIPTION' | translate}}</div>
}
<div *ngIf="item?.plan?.id" class="d-flex flex-direction-row plan-info">
<div class="col-auto description-to-plan">{{'DESCRIPTION-EDITOR.TO-PLAN' | translate}}</div>
<div class="plan-title p-0">:&nbsp;{{ item?.plan?.label }}</div>

View File

@ -148,7 +148,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
if (copyPlanId && !planId && planSectionId) this.isCopy = true;
this.viewOnly = isPublicDescription;
this.viewOnly = this.viewOnly || isPublicDescription;
//Regular Editor case
if (itemId != null && newPlanId == null) {

View File

@ -45,18 +45,19 @@
</div>
</div>
<div class="row mb-4 pb-3">
<div *ngIf="(canEdit || canAnnotate) && isDraftDescription(description) && !isLocked; else previewButton" class="col-auto pr-0">
<button (click)="editClicked(description)" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
</div>
<ng-template #previewButton>
<div *ngIf="!isPublicView" class="col-auto pr-0">
<button (click)="editClicked(description)" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.PREVIEW' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">visibility</mat-icon>
</button>
</div>
</ng-template>
<div class="col-auto pr-0">
@if(isActive && (canEdit || canAnnotate) && isDraftDescription(description) && !isLocked){
<button (click)="editClicked(description)" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
}@else {
@if(!isPublicView){
<button (click)="editClicked(description)" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.PREVIEW' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">visibility</mat-icon>
</button>
}
}
</div>
<div *ngIf="canCopy" class="col-auto pr-0">
<button (click)="openCopyToPlanDialog()" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>

View File

@ -130,7 +130,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label);
this.description = data;
this.description.plan.planUsers = data.plan.planUsers.filter(x => x.isActive === IsActive.Active);
this.description.plan.planUsers = this.isActive ? data.plan.planUsers.filter(x => x.isActive === IsActive.Active) : data.plan.planUsers;
this.researchers = this.referenceService.getReferencesForTypes(this.description?.plan?.planReferences, [this.referenceTypeService.getResearcherReferenceType()]);
this.checkLockStatus(this.description.id);
this.canDelete = this.isActive && (this.authService.hasPermission(AppPermission.DeleteDescription) ||

View File

@ -58,18 +58,19 @@
</div>
</div>
<div class="row" *ngIf="!lockStatus || canClonePlan() || (canDeletePlan() && !isLocked)">
<div *ngIf="canEditPlan(plan) && !lockStatus; else previewButton" class="col-auto pr-0">
<button (click)="editClicked()" mat-mini-fab class="d-flex justify-content-center align-items-center" matTooltip="{{'PLAN-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
</div>
<ng-template #previewButton>
<div *ngIf="!isPublicView" class="col-auto pr-0">
<button (click)="editClicked()" mat-mini-fab class="d-flex justify-content-center align-items-center" matTooltip="{{'PLAN-OVERVIEW.ACTIONS.PREVIEW' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">visibility</mat-icon>
</button>
</div>
</ng-template>
<div class="col-auto pr-0">
@if(isActive && canEditPlan(plan) && !lockStatus){
<button (click)="editClicked()" mat-mini-fab class="d-flex justify-content-center align-items-center" matTooltip="{{'PLAN-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
} @else {
@if(!isPublicView){
<button (click)="editClicked()" mat-mini-fab class="d-flex justify-content-center align-items-center" matTooltip="{{'PLAN-OVERVIEW.ACTIONS.PREVIEW' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">visibility</mat-icon>
</button>
}
}
</div>
<div *ngIf="canClonePlan()" class="col-auto pr-0">
<button (click)="cloneClicked()" mat-mini-fab class="d-flex justify-content-center align-items-center" matTooltip="{{'PLAN-OVERVIEW.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>

View File

@ -129,7 +129,7 @@ export class PlanOverviewComponent extends BaseComponent implements OnInit {
this.breadcrumbService.addIdResolvedValue(data.id?.toString(), data.label);
this.plan = data;
this.plan.planUsers = data.planUsers.filter(x => x.isActive === IsActive.Active);
this.plan.planUsers = this.isActive ? data?.planUsers?.filter((x) => x.isActive === IsActive.Active) : data?.planUsers;
this.plan.otherPlanVersions = data.otherPlanVersions?.filter(x => x.isActive === IsActive.Active) || null;
if (this.plan.descriptions) {
if (this.plan.status == PlanStatus.Finalized) {

View File

@ -6,7 +6,7 @@
<div class="col">
<div class="row">
<div class="col-auto info">
<div class="title">{{'PLAN-EDITOR.TITLE-EDIT' | translate}}</div>
<div class="title">{{(canEdit ? 'PLAN-EDITOR.TITLE-EDIT' : 'PLAN-EDITOR.TITLE-PREVIEW') | translate}}</div>
<div class="subtitle">{{ formGroup.get('label').value }} <span *ngIf="isDirty()" class="changes">({{'PLAN-EDITOR.UNSAVED-CHANGES' | translate}})</span></div>
</div>
<div *ngIf="step > 0" class="ml-auto d-flex flex-row">

View File

@ -139,7 +139,7 @@ export class PlanEditorComponent extends BaseEditor<PlanEditorModel, Plan> 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.canEdit && (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)
));
}
@ -151,7 +151,7 @@ export class PlanEditorComponent extends BaseEditor<PlanEditorModel, Plan> imple
}
get canEdit(): boolean {
return this.isNew ? this.authService.hasPermission(AppPermission.NewPlan) : this.item.authorizationFlags?.some(x => x === AppPermission.EditPlan) || this.authService.hasPermission(AppPermission.EditPlan);
return !this.isDeleted && (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 {

View File

@ -1713,6 +1713,7 @@
"PLAN-EDITOR": {
"TITLE-NEW": "New Plan",
"TITLE-EDIT": "Editing Plan",
"TITLE-PREVIEW": "Previewing Plan",
"TITLE": "Plan Template",
"UNSAVED-CHANGES": "unsaved changes",
"LOCKED": "Locked",