diff --git a/src/components/entity/EntityResult.vue b/src/components/entity/EntityResult.vue
index 536fc23..c209263 100644
--- a/src/components/entity/EntityResult.vue
+++ b/src/components/entity/EntityResult.vue
@@ -814,12 +814,15 @@ export default class EntityResult extends Vue {
get entityBusinessNumber(): string | undefined {
return selectFirstAttrItem(
{ key: "type", value: "business_number" },
- this.entityCredentials?.map((cred) => {
- return {
- type: cred.type,
- text: cred.value,
- };
- })
+ // find the latest business number
+ this.entityCredentials
+ ?.filter((cred) => cred.latest)
+ ?.map((cred) => {
+ return {
+ type: cred.type,
+ text: cred.value,
+ };
+ })
)?.text as string;
}
@@ -858,7 +861,7 @@ export default class EntityResult extends Vue {
var fullCredentials: ICredentialDisplayType[] = [];
this.selectedTopicFullCredentialSet.forEach((credSet) => {
- //filter out all the raltionship credentials
+ //filter out all the relationship credentials
fullCredentials.push(
...credSet.credentials
.filter((cred) => !this.isRelationshipCred(cred))
diff --git a/src/components/entity/filter/EntityFilterFacetPanel.vue b/src/components/entity/filter/EntityFilterFacetPanel.vue
index 1a24cb1..ae4a008 100644
--- a/src/components/entity/filter/EntityFilterFacetPanel.vue
+++ b/src/components/entity/filter/EntityFilterFacetPanel.vue
@@ -4,7 +4,11 @@
{{ title }}
-
+
-
+
{{ field.count }}
diff --git a/src/i18n/translate.ts b/src/i18n/translate.ts
index 2570517..d6aee28 100644
--- a/src/i18n/translate.ts
+++ b/src/i18n/translate.ts
@@ -1,37 +1,43 @@
import { DirectiveFunction } from "vue";
import { DirectiveBinding } from "vue/types/options";
-import VueI18n from "."
+import VueI18n from ".";
-export const translate: DirectiveFunction = (el: Element, binding: DirectiveBinding) => {
- el.textContent = $translate(binding.value)
-}
+export const translate: DirectiveFunction = (
+ el: Element,
+ binding: DirectiveBinding
+) => {
+ el.textContent = $translate(binding.value);
+};
// Uses the entity_type as well as the registration description to lookup translations for entries from the LEAR database
export const $translate = (value: string): string => {
- const messages = VueI18n.messages
- const locale = VueI18n.locale
- const bindingValues = value.split(".")
- let transReturn
- // try old translation first
- if (bindingValues.length >= 2) {
- const translationAttempt = (messages[locale][bindingValues[0]] as { [key: string]: string | any })?.[bindingValues[1]]
- if (typeof (translationAttempt) === "string") {
- transReturn = translationAttempt
+ const messages = VueI18n.messages;
+ const locale = VueI18n.locale;
+ const bindingValues = value.split(".");
+ let transReturn;
+ // try old translation first
+ if (bindingValues.length >= 2) {
+ const translationAttempt = (
+ messages[locale][bindingValues[0]] as { [key: string]: string | any }
+ )?.[bindingValues[1]];
+ if (typeof translationAttempt === "string") {
+ transReturn = translationAttempt;
+ } else {
+ // we know we're working with an entity from LEAR
+ const description =
+ translationAttempt?.displayName ?? translationAttempt?.title;
+ if (typeof description === "string") {
+ transReturn = description;
+ } else if (typeof description !== "undefined") {
+ // we are working with a description object, indexed by entity type: BC, SP, etc.
+ if (bindingValues.length >= 3) {
+ // if entity type is passed in as a binding value
+ transReturn = description[bindingValues[2]];
} else {
- // we know we're working with an entity from LEAR
- const description = translationAttempt?.displayName ?? translationAttempt?.title
- if (typeof (description) === "string") {
- transReturn = description
- } else if (typeof (description) !== "undefined") {
- // we are working with a description object, indexed by entity type: BC, SP, etc.
- if (bindingValues.length >= 3) {
- // if entity type is passed in as a binding value
- transReturn = description[bindingValues[2]]
- } else {
- transReturn = translationAttempt?.title
- }
- }
+ transReturn = translationAttempt?.title;
}
+ }
}
- return transReturn ?? value
-}
+ }
+ return transReturn ?? value;
+};
diff --git a/src/interfaces/api/v4/credential.interface.ts b/src/interfaces/api/v4/credential.interface.ts
index 762a229..331b15a 100644
--- a/src/interfaces/api/v4/credential.interface.ts
+++ b/src/interfaces/api/v4/credential.interface.ts
@@ -42,6 +42,7 @@ export interface ICredentialDisplayType {
id: number;
credential_type: string;
rel_id?: string;
+ latest?: boolean;
type: string;
authority: string;
authorityLink: string | URL;
diff --git a/src/utils/entity.ts b/src/utils/entity.ts
index 732f18f..9fc17a1 100644
--- a/src/utils/entity.ts
+++ b/src/utils/entity.ts
@@ -14,16 +14,16 @@ export function isCredential(item: ICredential | IRelationship): boolean {
return (item as ICredential)?.credential_type !== undefined;
}
-// Used to append entity_type to the suffix of the string. This is needed to work with
+// Used to append entity_type to the suffix of the string. This is needed to work with
// entries from the LEAR database
export function toTranslationFormat(base: string, entityType?: string): string {
if (entityType) {
- const entityTypeSplit = entityType.split('.')
+ const entityTypeSplit = entityType.split(".");
if (entityTypeSplit.length >= 2) {
- return base + "." + entityTypeSplit[1]
+ return base + "." + entityTypeSplit[1];
}
}
- return base
+ return base;
}
export function getHighlightedAttributes(
@@ -102,6 +102,7 @@ export function credOrRelationshipToDisplay(
if (isCredential(item)) {
const credItem = item as ICredential;
display.id = credItem.id;
+ display.latest = credItem.latest;
display.authority = credItem.credential_type.issuer.name;
display.authorityLink = credItem.credential_type.issuer.url;
display.type = credItem.names[0]?.type;