@ -199,7 +199,14 @@
/ >
< / button >
< / div >
< GiftedDialog ref = "customGiveDialog" / >
< GiftedDialog
ref = "customGiveDialog"
: to - project - id = "
detailsForGive ? . fulfillsPlanHandleId ||
detailsForOffer ? . fulfillsPlanHandleId ||
''
"
/ >
< div v-if ="libsUtil.isGiveAction(veriClaim)" >
< div class = "flex columns-3" >
@ -549,6 +556,12 @@ export default class ClaimView extends Vue {
fulfillsHandleId ? : string ;
} | null = null ;
detailsForOffer : { fulfillsPlanHandleId ? : string } | null = null ;
/ / P r o j e c t i n f o r m a t i o n f o r f u l f i l l s P l a n H a n d l e I d
projectInfo : {
name : string ;
imageUrl ? : string ;
issuer : string ;
} | null = null ;
fullClaim = null ;
fullClaimDump = "" ;
fullClaimMessage = "" ;
@ -674,6 +687,7 @@ export default class ClaimView extends Vue {
this . confsVisibleToIdList = [ ] ;
this . detailsForGive = null ;
this . detailsForOffer = null ;
this . projectInfo = null ;
this . fullClaim = null ;
this . fullClaimDump = "" ;
this . fullClaimMessage = "" ;
@ -851,6 +865,14 @@ export default class ClaimView extends Vue {
}
}
/ / L o a d p r o j e c t i n f o r m a t i o n i f t h e r e ' s a f u l f i l l s P l a n H a n d l e I d
const planHandleId =
this . detailsForGive ? . fulfillsPlanHandleId ||
this . detailsForOffer ? . fulfillsPlanHandleId ;
if ( planHandleId ) {
await this . loadProjectInfo ( planHandleId , userDid ) ;
}
/ / r e t r i e v e t h e l i s t o f c o n f i r m e r s
const confirmerInfo = await libsUtil . retrieveConfirmerIdList (
this . apiServer ,
@ -878,6 +900,33 @@ export default class ClaimView extends Vue {
}
}
async loadProjectInfo ( planHandleId : string , userDid : string ) {
const url =
this . apiServer +
"/api/claim/byHandle/" +
encodeURIComponent ( planHandleId ) ;
const headers = await serverUtil . getHeaders ( userDid ) ;
try {
const resp = await this . axios . get ( url , { headers } ) ;
if ( resp . status === 200 ) {
this . projectInfo = {
name : resp . data . claim ? . name || "(no name)" ,
imageUrl : resp . data . claim ? . image ,
issuer : resp . data . issuer ,
} ;
} else {
await this . $logError (
"Error getting project info: " + JSON . stringify ( resp ) ,
) ;
}
} catch ( error : unknown ) {
await this . $logError (
"Error retrieving project info: " + JSON . stringify ( error ) ,
) ;
}
}
async showFullClaim ( claimId : string ) {
const url =
this . apiServer + "/api/claim/full/" + encodeURIComponent ( claimId ) ;
@ -997,10 +1046,37 @@ export default class ClaimView extends Vue {
this . veriClaim as GenericCredWrapper < OfferClaim > ,
) ,
} ;
/ / U s e p r o j e c t i n f o a s r e c i p i e n t i f a v a i l a b l e , o t h e r w i s e u s e u n d e f i n e d
const recipient = this . projectInfo
? {
did :
this . detailsForGive ? . fulfillsPlanHandleId ||
this . detailsForOffer ? . fulfillsPlanHandleId ,
name : this . projectInfo . name ,
handleId :
this . detailsForGive ? . fulfillsPlanHandleId ||
this . detailsForOffer ? . fulfillsPlanHandleId ,
image : this . projectInfo . imageUrl ,
}
: undefined ;
/ / E x t r a c t o f f e r i n f o r m a t i o n f r o m t h e c l a i m
const offerClaim = this . veriClaim . claim as OfferClaim ;
const description =
offerClaim . itemOffered ? . description || offerClaim . description ;
const amount =
offerClaim . includesObject ? . amountOfThisGood ? . toString ( ) || "0" ;
const unitCode = offerClaim . includesObject ? . unitCode || "HUR" ;
( this . $refs . customGiveDialog as GiftedDialog ) . open (
giver ,
undefined ,
recipient ,
this . veriClaim . handleId ,
undefined , / / p r o m p t
description ,
amount ,
unitCode ,
) ;
}