1. refactor description 2. translations

This commit is contained in:
CITE\spapacharalampous 2024-08-13 14:57:47 +03:00
parent af930d9c73
commit 3b1c5681e3
15 changed files with 69 additions and 47 deletions

View File

@ -34,7 +34,7 @@
</div>
<div *ngIf="isLocked" class="col-auto"><span>.</span></div>
<div class="col-auto d-flex mr-2" [class.deleted-item]="!isActive">
{{isActive ? 'DESCRIPTION-OVERVIEW.EDITED' : 'DESCRIPTION-OVERVIEW.DELETED' | translate}} :
{{(isActive ? 'DESCRIPTION-OVERVIEW.EDITED' : 'DESCRIPTION-OVERVIEW.DELETED') | translate}} :
{{description.updatedAt | dateTimeFormatter: "d MMMM y"}}
</div>
<div *ngIf="description.status === descriptionStatusEnum.Finalized" class="col-auto d-flex">

View File

@ -53,7 +53,7 @@ import { RouterUtilsService } from '@app/core/services/router/router-utils.servi
})
export class DescriptionOverviewComponent extends BaseComponent implements OnInit {
description: any | Description | PublicDescription;
description: Description | PublicDescription;
researchers: PlanReference[] = [];
isNew = true;
isFinalized = false;
@ -125,43 +125,43 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
this.descriptionService.getSingle(itemId, this.lookupFields())
.pipe(takeUntil(this._destroyed))
.subscribe(
{
next: (data) => {
this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label);
{
next: (data) => {
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.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) ||
this.description.authorizationFlags?.some(x => x === AppPermission.DeleteDescription)) && this.description.belongsToCurrentTenant != false;
this.description = data;
this.description.plan.planUsers = data.plan.planUsers.filter(x => x.isActive === IsActive.Active);
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) ||
this.description.authorizationFlags?.some(x => x === AppPermission.DeleteDescription)) && this.description.belongsToCurrentTenant != false;
this.canEdit = (this.authService.hasPermission(AppPermission.EditDescription) ||
this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false;
this.canEdit = (this.authService.hasPermission(AppPermission.EditDescription) ||
this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false;
this.canCopy = this.canEdit || (this.authService.hasPermission(AppPermission.PublicCloneDescription) && this.isPublicView);
this.canCopy = this.canEdit || (this.authService.hasPermission(AppPermission.PublicCloneDescription) && this.isPublicView);
this.canAnnotate = (this.authService.hasPermission(AppPermission.AnnotateDescription) ||
this.description.authorizationFlags?.some(x => x === AppPermission.AnnotateDescription)) && this.description.belongsToCurrentTenant != false;
this.canAnnotate = (this.authService.hasPermission(AppPermission.AnnotateDescription) ||
this.description.authorizationFlags?.some(x => x === AppPermission.AnnotateDescription)) && this.description.belongsToCurrentTenant != false;
this.canFinalize = this.isActive && (this.authService.hasPermission(AppPermission.FinalizeDescription) ||
this.description.authorizationFlags?.some(x => x === AppPermission.FinalizeDescription)) && this.description.belongsToCurrentTenant != false;
this.canFinalize = this.isActive && (this.authService.hasPermission(AppPermission.FinalizeDescription) ||
this.description.authorizationFlags?.some(x => x === AppPermission.FinalizeDescription)) && this.description.belongsToCurrentTenant != false;
this.canInvitePlanUsers = this.isActive && (this.authService.hasPermission(AppPermission.InvitePlanUsers) ||
this.description.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers)) && this.description.belongsToCurrentTenant != false;
this.canInvitePlanUsers = this.isActive && (this.authService.hasPermission(AppPermission.InvitePlanUsers) ||
this.description.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers)) && this.description.belongsToCurrentTenant != false;
},
error: (error: any) => {
this.httpErrorHandlingService.handleBackedRequestError(error);
},
error: (error: any) => {
this.httpErrorHandlingService.handleBackedRequestError(error);
if (error.status === 404) {
return this.onFetchingDeletedCallbackError('/descriptions/');
}
if (error.status === 403) {
return this.onFetchingForbiddenCallbackError('/descriptions/');
}
}
});
if (error.status === 404) {
return this.onFetchingDeletedCallbackError('/descriptions/');
}
if (error.status === 403) {
return this.onFetchingForbiddenCallbackError('/descriptions/');
}
}
});
}
else if (publicId != null) {
this.isNew = false;
@ -203,9 +203,9 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
}
}
get isActive(): boolean {
return this.description && this.description.isActive === IsActive.Active;
}
get isActive(): boolean {
return this.description && this.description.isActive != IsActive.Inactive;
}
get unauthorizedTootipText(): string {
return this.language.instant('DESCRIPTION-OVERVIEW.INFOS.UNAUTHORIZED-ORCID');
@ -276,7 +276,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
data: {
planId: this.description.plan.id,
planName: this.description.plan.label,
blueprint: this.description.plan.blueprint
blueprint: this.isPublicView ? null : (this.description?.plan as Plan)?.blueprint,
}
});
}
@ -362,7 +362,9 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
getSectionNameById(sectionId: Guid): string {
if (sectionId == null) return '';
let sections: PlanBlueprintDefinitionSection[] = this.description?.plan?.blueprint?.definition?.sections?.filter((section: PlanBlueprintDefinitionSection) => sectionId === section.id);
const blueprint = this.isPublicView ? null : (this.description?.plan as Plan)?.blueprint;
let sections: PlanBlueprintDefinitionSection[] = blueprint?.definition?.sections?.filter((section: PlanBlueprintDefinitionSection) => sectionId === section.id);
return sections == null ? '' : sections[0].label;
}

View File

@ -47,7 +47,7 @@
{{'PLAN-OVERVIEW.LOCKED' | translate}}
</div>
<div class="col-auto d-flex" [class.deleted-item]="!isActive">
{{(isActive ? 'PLAN-OVERVIEW.EDITED' : 'PLAN-OVERVIEW.DELETED') | translate}} :
{{(isActive ? 'PLAN-OVERVIEW.EDITED' : 'PLAN-OVERVIEW.DELETED') | translate}} :
{{plan.updatedAt | dateTimeFormatter: "d MMMM y"}}
</div>
<div class="col-auto d-flex">

View File

@ -603,7 +603,7 @@ export class PlanOverviewComponent extends BaseComponent implements OnInit {
getSectionNameById(sectionId: Guid): string {
if (sectionId == null) return '';
const blueprint = this.isPublicView ? null : (this.plan as Plan)?.blueprint;
const blueprint = this.isPublicView ? null : (this.plan as Plan)?.blueprint;
let sections: PlanBlueprintDefinitionSection[] = blueprint?.definition?.sections?.filter((section: PlanBlueprintDefinitionSection) => sectionId === section.id);
return sections == null ? '' : sections[0].label;

View File

@ -782,6 +782,7 @@
"LOCKED": "Blokeatuta",
"VERSION": "Version",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"GRANT": "Diru-laguntza",
"DESCRIPTION": "Description",
@ -833,6 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",

View File

@ -782,6 +782,7 @@
"LOCKED": "Locked",
"VERSION": "Version",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"GRANT": "Förderung",
"DESCRIPTION": "Description",
@ -833,6 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",

View File

@ -834,7 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",

View File

@ -782,6 +782,7 @@
"LOCKED": "Bloqueado",
"VERSION": "Version",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"GRANT": "Subvención",
"DESCRIPTION": "Description",
@ -833,6 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",

View File

@ -782,6 +782,7 @@
"LOCKED": "Κλειδωμένο",
"VERSION": "Version",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"GRANT": "Επιχορήγηση",
"DESCRIPTION": "Description",
@ -833,6 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",

View File

@ -782,6 +782,7 @@
"LOCKED": "Zaključano",
"VERSION": "Version",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"GRANT": "Potpora",
"DESCRIPTION": "Description",
@ -833,6 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",

View File

@ -782,6 +782,7 @@
"LOCKED": "Zablokowany",
"VERSION": "Version",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"GRANT": "Dotacja",
"DESCRIPTION": "Description",
@ -833,6 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",

View File

@ -782,6 +782,7 @@
"LOCKED": "Bloqueado",
"VERSION": "Version",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"GRANT": "Grant",
"DESCRIPTION": "Description",
@ -833,6 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",

View File

@ -782,6 +782,7 @@
"LOCKED": "Zamknuté",
"VERSION": "Version",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"GRANT": "Grant",
"DESCRIPTION": "Description",
@ -833,6 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",

View File

@ -782,6 +782,7 @@
"LOCKED": "Zaključano",
"VERSION": "Version",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"GRANT": "Grant",
"DESCRIPTION": "Description",
@ -833,6 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",

View File

@ -782,6 +782,7 @@
"LOCKED": "Kilitli",
"VERSION": "Version",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"GRANT": "Hibe",
"DESCRIPTION": "Description",
@ -833,6 +834,7 @@
"PUBLIC": "Public",
"LOCKED": "Locked",
"EDITED": "Edited",
"DELETED": "Deleted",
"FINALISED": "Finalized",
"PART-OF": "Part of",
"GRANT": "Grant",