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