Commit 33d1aa74 authored by Florent POITTEVIN's avatar Florent POITTEVIN
Browse files

feat: 1332 display source in research domain multiselect component

parent dae86021
......@@ -221,6 +221,7 @@
[formControl]="fd"
[required]="formValidationHelper.hasRequiredField(fd)"
[labelKey]="'name'"
[labelCallback]="researchDomainLabelCallback"
[extraInfoLabelKey]="'code'"
[searchKey]="'nameOrCode'"
[valueKey]="'resId'"
......
......@@ -112,6 +112,7 @@ export class AdminOrgunitFormPresentational extends SharedAbstractFormPresentati
extraSearchParameterSource: MappingObject = {};
licenceCallback: (value: License) => string = (value: License) => value.openLicenseId + " (" + value.title + ")";
researchDomainLabelCallback: (value: ResearchDomain) => string = (value: ResearchDomain) => `[${value.source}] ${value.name}`;
get personOrgUnitRoleMode(): typeof PersonOrgUnitRoleMode {
return PersonOrgUnitRoleMode;
......
......@@ -154,6 +154,7 @@
[formControl]="fd"
[required]="formValidationHelper.hasRequiredField(fd)"
[labelKey]="'name'"
[labelCallback]="researchDomainLabelCallback"
[extraInfoLabelKey]="'code'"
[valueKey]="'resId'"
[searchKey]="'nameOrCode'"
......
......@@ -12,9 +12,6 @@ import {
Validators,
} from "@angular/forms";
import {NotificationHelper} from "@app/features/preservation-space/notification/helper/notification.helper";
import {SharedAbstractFormPresentational} from "@shared/components/presentationals/shared-abstract-form/shared-abstract-form.presentational";
import {BaseFormDefinition} from "@shared/models/base-form-definition.model";
import {sharedResearchDomainActionNameSpace} from "@shared/stores/research-domain/shared-research-domain.action";
import {environment} from "@environments/environment";
import {
OrganizationalUnit,
......@@ -24,14 +21,17 @@ import {
SubmissionPolicy,
} from "@models";
import {Navigate} from "@ngxs/router-plugin";
import {SharedAbstractFormPresentational} from "@shared/components/presentationals/shared-abstract-form/shared-abstract-form.presentational";
import {PersonOrgUnitRoleMode} from "@shared/components/presentationals/shared-person-orgunit-role/shared-person-orgunit-role.presentational";
import {LocalModelAttributeEnum} from "@shared/enums/model-attribute.enum";
import {
HomePageRoutesEnum,
RoutesEnum,
} from "@shared/enums/routes.enum";
import {BaseFormDefinition} from "@shared/models/base-form-definition.model";
import {BreakpointService} from "@shared/services/breakpoint.service";
import {SecurityService} from "@shared/services/security.service";
import {sharedResearchDomainActionNameSpace} from "@shared/stores/research-domain/shared-research-domain.action";
import {SharedResearchDomainState} from "@shared/stores/research-domain/shared-research-domain.state";
import {RegexpUtil} from "@shared/utils/regexp.util";
import _ from "lodash";
......@@ -80,6 +80,8 @@ export class OrgunitFormPresentational extends SharedAbstractFormPresentational<
@Input()
isManager: boolean;
researchDomainLabelCallback: (value: ResearchDomain) => string = (value: ResearchDomain) => `[${value.source}] ${value.name}`;
protected readonly _requestToBeMemberBS: BehaviorSubject<void> = new BehaviorSubject<void>(undefined);
@Output("requestToBeMemberChange")
readonly requestToBeMemberObs: Observable<void> = ObservableUtil.asObservable(this._requestToBeMemberBS);
......
......@@ -68,6 +68,9 @@ export abstract class SharedAbstractMultiSelectPresentational<TResource extends
@Input()
labelKey: string;
@Input()
labelCallback: (value: TResource) => string = (value => value[this.labelKey]);
@Input()
extraInfoLabelKey: string;
......@@ -314,7 +317,7 @@ export abstract class SharedAbstractMultiSelectPresentational<TResource extends
if (!isNullOrUndefined(this.extraInfoLabelKey) && !isNullOrUndefined(value[this.extraInfoLabelKey])) {
extraInfo = " - " + value[this.extraInfoLabelKey];
}
return value[this.labelKey] + extraInfo;
return this.labelCallback(value) + extraInfo;
}
navigateTo(value: TResource): void {
......
......@@ -28,7 +28,7 @@
[matTooltipShowDelay]="500"
[matTooltip]="getTooltip(value)"
>
{{value[labelKey]}}
{{labelCallback(value)}}
</span>
<img *ngIf="extraInfoImage && value[extraInfoLabelKey]"
class="extra-icon"
......
......@@ -33,7 +33,7 @@
[class.is-active]="isActive(value)"
(click)="select(value)"
>
<span class="label">{{value[host.labelKey]}}</span>
<span class="label">{{host.labelCallback(value)}}</span>
<span *ngIf="value[host.extraInfoLabelKey] | isNonEmptyString"
class="extra-info"
><img *ngIf="host.extraInfoImage"
......
......@@ -29,7 +29,7 @@
[matTooltipShowDelay]="500"
[matTooltip]="getTooltip(value)"
>
{{value[labelKey]}}
{{labelCallback(value)}}
</span>
<img *ngIf="extraInfoImage && value[extraInfoLabelKey]"
class="extra-icon"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment