Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #305 from hyperledger-labs/feature/241
Browse files Browse the repository at this point in the history
feature/241 Address Information to Partner List
  • Loading branch information
Dominic Wörner authored Jan 6, 2021
2 parents 15c70f8 + 11b6bbe commit 17949e1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
31 changes: 31 additions & 0 deletions frontend/src/components/PartnerList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
</span>
</template>

<template v-slot:[`item.address`]="{ item }">
<span text-truncate>
{{ item.address }}
</span>
</template>

<template v-slot:[`item.createdAt`]="{ item }">
{{ item.createdAt | moment("YYYY-MM-DD HH:mm") }}
</template>
Expand All @@ -51,6 +57,7 @@ import { EventBus } from "../main";
import { getPartnerName } from "../utils/partnerUtils";
import PartnerStateIndicator from "@/components/PartnerStateIndicator";
import NewMessageIcon from "@/components/NewMessageIcon";
import { CredentialTypes } from "../constants";

export default {
name: "PartnerList",
Expand Down Expand Up @@ -132,6 +139,7 @@ export default {

this.data = result.data.map((partner) => {
partner.name = getPartnerName(partner);
partner.address = this.getProfileAddress(partner);
return partner;
});

Expand Down Expand Up @@ -159,6 +167,29 @@ export default {
}
return data;
},
getProfileAddress(credential) {
if (credential.credential && credential.credential.length > 0) {
const profile = credential.credential.find((item) => {
return item.type === CredentialTypes.PROFILE.type;
});
let address = "";
if (profile) {
const registeredSiteAddress =
profile.credentialData.registeredSite.address;
if (registeredSiteAddress.city !== "") {
address = registeredSiteAddress.city;
}
if (registeredSiteAddress.zipCode !== "") {
address = registeredSiteAddress.zipCode + " " + address;
}
if (registeredSiteAddress.streetAddress !== "") {
address = registeredSiteAddress.streetAddress + ", " + address;
}
}
return address;
}
return "";
},
},
};
</script>
4 changes: 2 additions & 2 deletions frontend/src/views/Partners.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export default {
value: "name",
},
{
text: "Created",
value: "createdAt",
text: "Address",
value: "address",
},
{
text: "Last Updated",
Expand Down

0 comments on commit 17949e1

Please sign in to comment.