|
|
@ -27,7 +27,7 @@ |
|
|
|
</h1> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div v-if="detailsForGive"> |
|
|
|
<div v-if="giveDetails"> |
|
|
|
<div class="flex justify-center"> |
|
|
|
<button |
|
|
|
class="col-span-1 bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-4 py-2 rounded-md" |
|
|
@ -69,19 +69,19 @@ |
|
|
|
{{ giverName }} |
|
|
|
</div> |
|
|
|
<div class="ml-6">gave</div> |
|
|
|
<div v-if="veriClaim.claim?.object"> |
|
|
|
<div v-if="giveDetails.amount"> |
|
|
|
<fa icon="hand-holding-dollar" class="fa-fw text-slate-400" /> |
|
|
|
{{ |
|
|
|
displayAmount( |
|
|
|
veriClaim.claim.object.unitCode, |
|
|
|
veriClaim.claim.object.amountOfThisGood, |
|
|
|
giveDetails.unit, |
|
|
|
giveDetails.amount, |
|
|
|
) |
|
|
|
}} |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<div v-if="giveDetails.description"> |
|
|
|
<fa icon="message" class="fa-fw text-slate-400" /> |
|
|
|
{{ veriClaim.claim?.object ? "and:" : "" }} |
|
|
|
{{ veriClaim.claim?.description }} |
|
|
|
{{ giveDetails.amount ? "and:" : "" }} |
|
|
|
{{ giveDetails.description }} |
|
|
|
</div> |
|
|
|
<div class="ml-6">to</div> |
|
|
|
<div> |
|
|
@ -91,17 +91,17 @@ |
|
|
|
<div> |
|
|
|
<fa icon="calendar" class="fa-fw text-slate-400" /> |
|
|
|
on |
|
|
|
{{ veriClaim.issuedAt?.substring(0, 10) }} |
|
|
|
{{ giveDetails.issuedAt.substring(0, 10) }} |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- Fullfills Links --> |
|
|
|
|
|
|
|
<!-- fullfills links for a give --> |
|
|
|
<div class="mt-2" v-if="detailsForGive?.fulfillsPlanHandleId"> |
|
|
|
<div class="mt-2" v-if="giveDetails?.fulfillsPlanHandleId"> |
|
|
|
<router-link |
|
|
|
:to=" |
|
|
|
'/project/' + |
|
|
|
encodeURIComponent(detailsForGive?.fulfillsPlanHandleId) |
|
|
|
encodeURIComponent(giveDetails?.fulfillsPlanHandleId) |
|
|
|
" |
|
|
|
class="text-blue-500 mt-2 cursor-pointer" |
|
|
|
target="_blank" |
|
|
@ -113,16 +113,16 @@ |
|
|
|
<!-- if there's another, it's probably fulfilling an offer, too --> |
|
|
|
<div |
|
|
|
v-if=" |
|
|
|
detailsForGive?.fulfillsType && |
|
|
|
detailsForGive?.fulfillsType !== 'PlanAction' && |
|
|
|
detailsForGive?.fulfillsHandleId |
|
|
|
giveDetails?.fulfillsType && |
|
|
|
giveDetails?.fulfillsType !== 'PlanAction' && |
|
|
|
giveDetails?.fulfillsHandleId |
|
|
|
" |
|
|
|
> |
|
|
|
<!-- router-link to /claim/ only changes URL path --> |
|
|
|
<router-link |
|
|
|
:to=" |
|
|
|
'/claim/' + |
|
|
|
encodeURIComponent(detailsForGive?.fulfillsHandleId) |
|
|
|
encodeURIComponent(giveDetails?.fulfillsHandleId) |
|
|
|
" |
|
|
|
class="text-blue-500 mt-2 cursor-pointer" |
|
|
|
target="_blank" |
|
|
@ -130,7 +130,7 @@ |
|
|
|
This fulfills |
|
|
|
{{ |
|
|
|
capitalizeAndInsertSpacesBeforeCapsWithAPrefix( |
|
|
|
detailsForGive.fulfillsType, |
|
|
|
giveDetails.fulfillsType, |
|
|
|
) |
|
|
|
}} |
|
|
|
<fa icon="arrow-up-right-from-square" class="fa-fw" /> |
|
|
@ -254,7 +254,7 @@ |
|
|
|
<div v-if="confirmerIdList.includes(activeDid)"> |
|
|
|
You have confirmed this claim. |
|
|
|
</div> |
|
|
|
<div v-else-if="veriClaim.issuer == activeDid"> |
|
|
|
<div v-else-if="giveDetails.agentDid == activeDid"> |
|
|
|
You cannot confirm this because you issued this claim, so you already |
|
|
|
count as confirming it. |
|
|
|
</div> |
|
|
@ -428,7 +428,7 @@ export default class ClaimView extends Vue { |
|
|
|
confirmerIdList: string[] = []; // list of DIDs that have confirmed this claim excluding the issuer |
|
|
|
confsVisibleErrorMessage = ""; |
|
|
|
confsVisibleToIdList: string[] = []; // list of DIDs that can see any confirmer |
|
|
|
detailsForGive = null; |
|
|
|
giveDetails = null; |
|
|
|
giverName = ""; |
|
|
|
issuerName = ""; |
|
|
|
numConfsNotVisible = 0; // number of hidden DIDs in the confirmerIdList, minus the issuer if they aren't visible |
|
|
@ -449,7 +449,7 @@ export default class ClaimView extends Vue { |
|
|
|
this.confirmerIdList = []; |
|
|
|
this.confsVisibleErrorMessage = ""; |
|
|
|
this.confsVisibleToIdList = []; |
|
|
|
this.detailsForGive = null; |
|
|
|
this.giveDetails = null; |
|
|
|
this.numConfsNotVisible = 0; |
|
|
|
this.urlForNewGive = ""; |
|
|
|
this.veriClaim = serverUtil.BLANK_GENERIC_SERVER_RECORD; |
|
|
@ -603,64 +603,7 @@ export default class ClaimView extends Vue { |
|
|
|
|
|
|
|
this.issuerName = this.didInfo(this.veriClaim.issuer); |
|
|
|
|
|
|
|
this.urlForNewGive = "/gifted-details?"; |
|
|
|
if (this.veriClaim.claim.object) { |
|
|
|
if (this.veriClaim.claim.object.amountOfThisGood) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&amountInput=" + |
|
|
|
encodeURIComponent( |
|
|
|
String(this.veriClaim.claim.object.amountOfThisGood), |
|
|
|
); |
|
|
|
} |
|
|
|
if (this.veriClaim.claim.object.unitCode) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&unitCode=" + |
|
|
|
encodeURIComponent(this.veriClaim.claim.object.unitCode as string); |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.veriClaim.claim.description) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&description=" + |
|
|
|
encodeURIComponent(this.veriClaim.claim.description as string); |
|
|
|
} |
|
|
|
this.giverName = this.didInfo( |
|
|
|
this.veriClaim.claim.agent?.identifier as string, |
|
|
|
); |
|
|
|
if (this.veriClaim.claim.agent) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&giverDid=" + |
|
|
|
encodeURIComponent(this.veriClaim.claim.agent.identifier as string) + |
|
|
|
"&giverName=" + |
|
|
|
encodeURIComponent(this.giverName); |
|
|
|
} |
|
|
|
this.recipientName = this.didInfo( |
|
|
|
this.veriClaim.claim.recipient?.identifier as string, |
|
|
|
); |
|
|
|
if (this.veriClaim.claim.recipient) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&recipientDid=" + |
|
|
|
encodeURIComponent( |
|
|
|
this.veriClaim.claim.recipient.identifier as string, |
|
|
|
) + |
|
|
|
"&recipientName=" + |
|
|
|
encodeURIComponent(this.recipientName); |
|
|
|
} |
|
|
|
if (this.veriClaim.claim.image) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&image=" + encodeURIComponent(this.veriClaim.claim.image as string); |
|
|
|
} |
|
|
|
if (this.veriClaim.claim.fulfills) { |
|
|
|
this.urlForNewGive += this.fulfillsUrlSnippet( |
|
|
|
this.veriClaim.claim.fulfills, |
|
|
|
); |
|
|
|
if (Array.isArray(this.veriClaim.claim.fulfills)) { |
|
|
|
for (const fulfills of this.veriClaim.claim.fulfills) { |
|
|
|
console.log("adding fulfills:", fulfills); |
|
|
|
this.urlForNewGive += this.fulfillsUrlSnippet(fulfills); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// use give record when possible since it may include edits |
|
|
|
const giveUrl = |
|
|
|
this.apiServer + |
|
|
|
"/api/v2/report/gives?handleId=" + |
|
|
@ -671,7 +614,7 @@ export default class ClaimView extends Vue { |
|
|
|
}); |
|
|
|
// giveResp.data is a Give from https://api.endorser.ch/api-docs/ |
|
|
|
if (giveResp.status === 200) { |
|
|
|
this.detailsForGive = giveResp.data.data[0]; |
|
|
|
this.giveDetails = giveResp.data.data[0]; |
|
|
|
} else { |
|
|
|
console.error("Error getting detailed give info:", giveResp); |
|
|
|
this.$notify( |
|
|
@ -685,6 +628,52 @@ export default class ClaimView extends Vue { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
this.urlForNewGive = "/gifted-details?"; |
|
|
|
if (this.giveDetails.amount) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&amountInput=" + encodeURIComponent(String(this.giveDetails.amount)); |
|
|
|
} |
|
|
|
if (this.giveDetails.unit) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&unitCode=" + encodeURIComponent(this.giveDetails.unit); |
|
|
|
} |
|
|
|
if (this.giveDetails.description) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&description=" + encodeURIComponent(this.giveDetails.description); |
|
|
|
} |
|
|
|
this.giverName = this.didInfo(this.giveDetails.agentDid); |
|
|
|
if (this.giveDetails.agentDid) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&giverDid=" + |
|
|
|
encodeURIComponent(this.giveDetails.agentDid) + |
|
|
|
"&giverName=" + |
|
|
|
encodeURIComponent(this.giverName); |
|
|
|
} |
|
|
|
this.recipientName = this.didInfo(this.giveDetails.recipientDid); |
|
|
|
if (this.giveDetails.recipientDid) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&recipientDid=" + |
|
|
|
encodeURIComponent(this.giveDetails.recipientDid) + |
|
|
|
"&recipientName=" + |
|
|
|
encodeURIComponent(this.recipientName); |
|
|
|
} |
|
|
|
if (this.giveDetails.fullClaim.image) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&image=" + encodeURIComponent(this.giveDetails.fullClaim.image); |
|
|
|
} |
|
|
|
if ( |
|
|
|
this.giveDetails.type == "Offer" && |
|
|
|
this.giveDetails.fulfillsHandleId |
|
|
|
) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&offerId=" + encodeURIComponent(this.giveDetails.fulfillsHandleId); |
|
|
|
} |
|
|
|
if (this.giveDetails.fulfillsPlanHandleId) { |
|
|
|
this.urlForNewGive += |
|
|
|
"&projectId=" + |
|
|
|
encodeURIComponent(this.giveDetails.fulfillsPlanHandleId); |
|
|
|
} |
|
|
|
|
|
|
|
// retrieve the list of confirmers |
|
|
|
const confirmUrl = |
|
|
|
this.apiServer + |
|
|
@ -698,7 +687,7 @@ export default class ClaimView extends Vue { |
|
|
|
const resultList1 = response.data.result || []; |
|
|
|
const resultList2 = R.reject(serverUtil.isHiddenDid, resultList1); |
|
|
|
const resultList3 = R.reject( |
|
|
|
(did: string) => did === this.veriClaim.issuer, |
|
|
|
(did: string) => did === this.giveDetails.agentDid, |
|
|
|
resultList2, |
|
|
|
); |
|
|
|
this.confirmerIdList = resultList3; |
|
|
@ -729,16 +718,6 @@ export default class ClaimView extends Vue { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
fulfillsUrlSnippet(object) { |
|
|
|
if (object["@type"] === "PlanAction") { |
|
|
|
return "&projectId=" + encodeURIComponent(object.identifier); |
|
|
|
} else if (object["@type"] === "OfferAction") { |
|
|
|
return "&offerId=" + encodeURIComponent(object.identifier); |
|
|
|
} else { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
confirmConfirmClaim() { |
|
|
|
this.$notify( |
|
|
|
{ |
|
|
@ -785,7 +764,7 @@ export default class ClaimView extends Vue { |
|
|
|
title: "Success", |
|
|
|
text: "Confirmation submitted.", |
|
|
|
}, |
|
|
|
5000, |
|
|
|
3000, |
|
|
|
); |
|
|
|
} else { |
|
|
|
console.error("Got error submitting the confirmation:", result); |
|
|
@ -818,7 +797,7 @@ export default class ClaimView extends Vue { |
|
|
|
(this.$refs.customGiveDialog as GiftedDialog).open( |
|
|
|
giver, |
|
|
|
undefined, |
|
|
|
this.veriClaim.handleId, |
|
|
|
this.giveDetails.handleId, |
|
|
|
"Offer fulfilled by " + (giver?.name || "someone not named"), |
|
|
|
); |
|
|
|
} |
|
|
@ -860,7 +839,7 @@ export default class ClaimView extends Vue { |
|
|
|
}, |
|
|
|
3000, |
|
|
|
); |
|
|
|
} else if (this.veriClaim.issuer == this.activeDid) { |
|
|
|
} else if (this.giveDetails.agentDid == this.activeDid) { |
|
|
|
this.$notify( |
|
|
|
{ |
|
|
|
group: "alert", |
|
|
@ -870,7 +849,7 @@ export default class ClaimView extends Vue { |
|
|
|
}, |
|
|
|
3000, |
|
|
|
); |
|
|
|
} else if (serverUtil.containsHiddenDid(this.veriClaim.claim)) { |
|
|
|
} else if (serverUtil.containsHiddenDid(this.giveDetails.fullClaim)) { |
|
|
|
this.$notify( |
|
|
|
{ |
|
|
|
group: "alert", |
|
|
|