@ -24,7 +24,9 @@
< div class = "flex columns-3" >
< div class = "flex columns-3" >
< h2 class = "text-md font-bold w-full" >
< h2 class = "text-md font-bold w-full" >
{ {
{ {
capitalizeAndInsertSpacesBeforeCaps ( veriClaim . claimType || "" )
serverUtil . capitalizeAndInsertSpacesBeforeCaps (
veriClaim . claimType || "" ,
)
} }
} }
< button
< button
v - if = "canEditClaim"
v - if = "canEditClaim"
@ -106,77 +108,91 @@
< / div >
< / div >
<!-- Fullfills Links -- >
<!-- Fullfills Links -- >
< div class = "mt-4 empty:hidden" >
<!-- fullfills links for a give -- >
< div v-if ="detailsForGive?.fulfillsPlanHandleId" >
< router -link
: to = "
'/project/' +
encodeURIComponent ( detailsForGive ? . fulfillsPlanHandleId )
"
class = "text-blue-500 mt-2"
>
This fulfills a bigger plan
< font -awesome
icon = "arrow-up-right-from-square"
class = "fa-fw"
/ >
< / r o u t e r - l i n k >
< / div >
<!-- fullfills links for a give -- >
<!-- Show offer fulfillment if this give fulfills an offer -- >
< div v-if ="detailsForGive?.fulfillsPlanHandleId" class="mt-4" >
< div v-if ="detailsForGiveOfferFulfillment?.offerHandleId" >
< router -link
<!-- router - link to / claim / only changes URL path -- >
: to = "
< a
'/project/' +
class = "text-blue-500 mt-4 cursor-pointer"
encodeURIComponent ( detailsForGive ? . fulfillsPlanHandleId )
@ click = "
"
showDifferentClaimPage (
class = "text-blue-500 mt-2"
detailsForGiveOfferFulfillment . offerHandleId ,
>
)
Fulfills a bigger plan ...
"
< / r o u t e r - l i n k >
>
< / div >
This fulfills
<!-- if there 's another, it' s probably fulfilling an offer , too -- >
{ {
< div
serverUtil . capitalizeAndInsertSpacesBeforeCapsWithAPrefix (
v - if = "
detailsForGiveOfferFulfillment . offerType || "Offer" ,
detailsForGive ? . fulfillsType &&
)
detailsForGive ? . fulfillsType !== 'PlanAction' &&
} }
detailsForGive ? . fulfillsHandleId
< font -awesome
"
icon = "arrow-up-right-from-square"
>
class = "fa-fw"
<!-- router - link to / claim / only changes URL path -- >
/ >
< a
< / a >
class = "text-blue-500 mt-4 cursor-pointer"
< / div >
@ click = "
showDifferentClaimPage ( detailsForGive ? . fulfillsHandleId )
"
>
Fulfills
{ {
capitalizeAndInsertSpacesBeforeCaps (
detailsForGive . fulfillsType ,
)
} } ...
< / a >
< / div >
<!-- fullfills links for an offer -- >
< div v-if ="detailsForOffer?.fulfillsPlanHandleId" >
< router -link
: to = "
'/project/' +
encodeURIComponent ( detailsForOffer ? . fulfillsPlanHandleId )
"
class = "text-blue-500 mt-4"
>
Offered to a bigger plan ...
< / r o u t e r - l i n k >
< / div >
<!-- Providers -- >
<!-- fullfills links for an offer -- >
< div v-if ="providersForGive?.length > 0" class="mt-4 " >
< div v-if ="detailsForOffer?.fulfillsPlanHandleId" >
< span > Other assistance provided by : < / span >
< router -link
< ul class = "ml-4" >
: to = "
< li
'/project/' +
v - for = "provider of providersForGive"
encodeURIComponent ( detailsForOffer ? . fulfillsPlanHandleId )
: key = "provider.identifier "
"
class = "list-disc ml -4"
class = "text-blue-500 mt-4"
>
>
< div class = "flex gap-4" >
Offered to a bigger plan
< div class = "grow overflow-hidden" >
< font -awesome
< a
icon = "arrow-up-right-from-square"
class = "text-blue-500 mt-4 cursor-pointer"
class = "fa-fw"
@ click = "handleProviderClick(provider)"
/ >
>
< / r o u t e r - l i n k >
an activity ...
< / div >
< / a >
<!-- Providers -- >
< div v-if ="providersForGive?.length > 0" >
< span > Other assistance provided by : < / span >
< ul class = "ml-4" >
< li
v - for = "provider of providersForGive"
: key = "provider.identifier"
class = "list-disc ml-4"
>
< div class = "flex gap-4" >
< div class = "grow overflow-hidden" >
< a
class = "text-blue-500 mt-4 cursor-pointer"
@ click = "handleProviderClick(provider)"
>
an activity
< font -awesome
icon = "arrow-up-right-from-square"
class = "fa-fw"
/ >
< / a >
< / div >
< / div >
< / div >
< / div >
< / li >
< / li >
< / u l>
< / ul >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
@ -556,6 +572,17 @@ export default class ClaimView extends Vue {
fulfillsPlanHandleId ? : string ;
fulfillsPlanHandleId ? : string ;
fulfillsType ? : string ;
fulfillsType ? : string ;
fulfillsHandleId ? : string ;
fulfillsHandleId ? : string ;
fullClaim ? : {
fulfills ? : Array < {
"@type" : string ;
identifier ? : string ;
} > ;
} ;
} | null = null ;
/ / A d d i t i o n a l o f f e r i n f o r m a t i o n e x t r a c t e d f r o m t h e f u l f i l l s a r r a y
detailsForGiveOfferFulfillment : {
offerHandleId ? : string ;
offerType ? : string ;
} | null = null ;
} | null = null ;
detailsForOffer : { fulfillsPlanHandleId ? : 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
/ / 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
@ -689,6 +716,7 @@ export default class ClaimView extends Vue {
this . confsVisibleToIdList = [ ] ;
this . confsVisibleToIdList = [ ] ;
this . detailsForGive = null ;
this . detailsForGive = null ;
this . detailsForOffer = null ;
this . detailsForOffer = null ;
this . detailsForGiveOfferFulfillment = null ;
this . projectInfo = null ;
this . projectInfo = null ;
this . fullClaim = null ;
this . fullClaim = null ;
this . fullClaimDump = "" ;
this . fullClaimDump = "" ;
@ -701,6 +729,33 @@ export default class ClaimView extends Vue {
this . veriClaimDidsVisible = { } ;
this . veriClaimDidsVisible = { } ;
}
}
/ * *
* Extract offer fulfillment information from the fulfills array
* /
extractOfferFulfillment ( ) {
if ( ! this . detailsForGive ? . fullClaim ? . fulfills ) {
this . detailsForGiveOfferFulfillment = null ;
return ;
}
const fulfills = this . detailsForGive . fullClaim . fulfills ;
if ( ! Array . isArray ( fulfills ) ) {
this . detailsForGiveOfferFulfillment = null ;
return ;
}
/ / F i n d t h e O f f e r i n t h e f u l f i l l s a r r a y
const offerFulfill = fulfills . find ( ( item ) => item [ "@type" ] === "Offer" ) ;
if ( offerFulfill ) {
this . detailsForGiveOfferFulfillment = {
offerHandleId : offerFulfill . identifier ,
offerType : offerFulfill [ "@type" ] ,
} ;
} else {
this . detailsForGiveOfferFulfillment = null ;
}
}
/ / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
/ / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
/ / U T I L I T Y M E T H O D S
/ / U T I L I T Y M E T H O D S
/ / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
/ / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
@ -758,13 +813,6 @@ export default class ClaimView extends Vue {
this . canShare = ! ! navigator . share ;
this . canShare = ! ! navigator . share ;
}
}
/ / i n s e r t a s p a c e b e f o r e a n y c a p i t a l l e t t e r s e x c e p t t h e i n i t i a l l e t t e r
/ / ( a n d c a p i t a l i z e i n i t i a l l e t t e r , j u s t i n c a s e )
capitalizeAndInsertSpacesBeforeCaps ( text : string ) : string {
if ( ! text ) return "" ;
return text [ 0 ] . toUpperCase ( ) + text . substr ( 1 ) . replace ( /([A-Z])/g , " $1" ) ;
}
totalConfirmers ( ) {
totalConfirmers ( ) {
return (
return (
this . numConfsNotVisible +
this . numConfsNotVisible +
@ -821,6 +869,8 @@ export default class ClaimView extends Vue {
} ) ;
} ) ;
if ( giveResp . status === 200 && giveResp . data . data ? . length > 0 ) {
if ( giveResp . status === 200 && giveResp . data . data ? . length > 0 ) {
this . detailsForGive = giveResp . data . data [ 0 ] ;
this . detailsForGive = giveResp . data . data [ 0 ] ;
/ / 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 f u l f i l l s a r r a y
this . extractOfferFulfillment ( ) ;
} else {
} else {
await this . $logError (
await this . $logError (
"Error getting detailed give info: " + JSON . stringify ( giveResp ) ,
"Error getting detailed give info: " + JSON . stringify ( giveResp ) ,
There is one more case here: the fullClaim.fulfills can potentially be a single claim object that is not in an array. (This is the case for most of the schema.org properties: they are defined with a particular type but they could be an array of that type.) So check for
fulfills["@type"]
of "Offer" to set otherfulfills
variables.What's a good way to recreate a claim object that has this particular structure? Gives that fulfill project offers always have
@type: PlanAction
,@type: Offer
and@type: DonateAction
. Gives that fulfill person offers always have@type: Offer
and@type: DonateAction
.