@ -39,7 +39,7 @@
: from - project - id = "fromProjectId"
: from - project - id = "fromProjectId"
: to - project - id = "toProjectId"
: to - project - id = "toProjectId"
@ update : description = "description = $event"
@ update : description = "description = $event"
@ update : amount = "amountInput = $event.toString() "
@ update : amount = "handleAmountUpdate "
@ update : unit - code = "unitCode = $event"
@ update : unit - code = "unitCode = $event"
@ edit - entity = "handleEditEntity"
@ edit - entity = "handleEditEntity"
@ explain - data = "explainData"
@ explain - data = "explainData"
@ -138,12 +138,19 @@ export default class GiftedDialog extends Vue {
/ / C o m p u t e d p r o p e r t y t o c h e c k i f c u r r e n t s e l e c t i o n w o u l d c r e a t e a c o n f l i c t
/ / C o m p u t e d p r o p e r t y t o c h e c k i f c u r r e n t s e l e c t i o n w o u l d c r e a t e a c o n f l i c t
get hasPersonConflict ( ) {
get hasPersonConflict ( ) {
/ / O n l y c h e c k f o r c o n f l i c t s w h e n b o t h e n t i t i e s a r e p e r s o n s
/ / O n l y c h e c k f o r c o n f l i c t s w h e n b o t h e n t i t i e s a r e p e r s o n s
if ( this . giverEntityType !== "person" || this . recipientEntityType !== "person" ) {
if (
this . giverEntityType !== "person" ||
this . recipientEntityType !== "person"
) {
return false ;
return false ;
}
}
/ / C h e c k i f g i v e r a n d r e c i p i e n t a r e t h e s a m e p e r s o n
/ / C h e c k i f g i v e r a n d r e c i p i e n t a r e t h e s a m e p e r s o n
if ( this . giver ? . did && this . receiver ? . did && this . giver . did === this . receiver . did ) {
if (
this . giver ? . did &&
this . receiver ? . did &&
this . giver . did === this . receiver . did
) {
return true ;
return true ;
}
}
@ -153,7 +160,10 @@ export default class GiftedDialog extends Vue {
/ / C o m p u t e d p r o p e r t y t o c h e c k i f a c o n t a c t w o u l d c r e a t e a c o n f l i c t w h e n s e l e c t e d
/ / C o m p u t e d p r o p e r t y t o c h e c k i f a c o n t a c t w o u l d c r e a t e a c o n f l i c t w h e n s e l e c t e d
wouldCreateConflict ( contactDid : string ) {
wouldCreateConflict ( contactDid : string ) {
/ / O n l y c h e c k f o r c o n f l i c t s w h e n b o t h e n t i t i e s a r e p e r s o n s
/ / O n l y c h e c k f o r c o n f l i c t s w h e n b o t h e n t i t i e s a r e p e r s o n s
if ( this . giverEntityType !== "person" || this . recipientEntityType !== "person" ) {
if (
this . giverEntityType !== "person" ||
this . recipientEntityType !== "person"
) {
return false ;
return false ;
}
}
@ -407,13 +417,19 @@ export default class GiftedDialog extends Vue {
let fulfillsProjectHandleId : string | undefined ;
let fulfillsProjectHandleId : string | undefined ;
let providerPlanHandleId : string | undefined ;
let providerPlanHandleId : string | undefined ;
if ( this . giverEntityType === "project" && this . recipientEntityType === "person" ) {
if (
this . giverEntityType === "project" &&
this . recipientEntityType === "person"
) {
/ / P r o j e c t - t o - p e r s o n g i f t
/ / P r o j e c t - t o - p e r s o n g i f t
fromDid = undefined ; / / N o p e r s o n g i v e r
fromDid = undefined ; / / N o p e r s o n g i v e r
toDid = recipientDid as string ; / / P e r s o n r e c i p i e n t
toDid = recipientDid as string ; / / P e r s o n r e c i p i e n t
fulfillsProjectHandleId = undefined ; / / N o p r o j e c t r e c i p i e n t
fulfillsProjectHandleId = undefined ; / / N o p r o j e c t r e c i p i e n t
providerPlanHandleId = this . giver ? . handleId ; / / P r o j e c t g i v e r
providerPlanHandleId = this . giver ? . handleId ; / / P r o j e c t g i v e r
} else if ( this . giverEntityType === "person" && this . recipientEntityType === "project" ) {
} else if (
this . giverEntityType === "person" &&
this . recipientEntityType === "project"
) {
/ / P e r s o n - t o - p r o j e c t g i f t
/ / P e r s o n - t o - p r o j e c t g i f t
fromDid = giverDid as string ; / / P e r s o n g i v e r
fromDid = giverDid as string ; / / P e r s o n g i v e r
toDid = undefined ; / / N o p e r s o n r e c i p i e n t
toDid = undefined ; / / N o p e r s o n r e c i p i e n t
@ -611,10 +627,14 @@ export default class GiftedDialog extends Vue {
giverDid : this . giverEntityType === "person" ? this . giver ? . did : undefined ,
giverDid : this . giverEntityType === "person" ? this . giver ? . did : undefined ,
giverName : this . giver ? . name ,
giverName : this . giver ? . name ,
offerId : this . offerId ,
offerId : this . offerId ,
fulfillsProjectId : this . giverEntityType === "person" && this . recipientEntityType === "project"
fulfillsProjectId :
this . giverEntityType === "person" &&
this . recipientEntityType === "project"
? this . toProjectId
? this . toProjectId
: undefined ,
: undefined ,
providerProjectId : this . giverEntityType === "project" && this . recipientEntityType === "person"
providerProjectId :
this . giverEntityType === "project" &&
this . recipientEntityType === "person"
? this . giver ? . handleId
? this . giver ? . handleId
: this . fromProjectId ,
: this . fromProjectId ,
recipientDid : this . receiver ? . did ,
recipientDid : this . receiver ? . did ,
@ -629,17 +649,20 @@ export default class GiftedDialog extends Vue {
* Handle entity selection from EntitySelectionStep
* Handle entity selection from EntitySelectionStep
* @ param entity - The selected entity ( person or project )
* @ param entity - The selected entity ( person or project )
* /
* /
handleEntitySelected ( entity : { type : 'person' | 'project' , data : Contact | PlanData } ) {
handleEntitySelected ( entity : {
if ( entity . type === 'person' ) {
type : "person" | "project" ;
data : Contact | PlanData ;
} ) {
if ( entity . type === "person" ) {
const contact = entity . data as Contact ;
const contact = entity . data as Contact ;
if ( this . stepType === 'giver' ) {
if ( this . stepType === "giver" ) {
this . selectGiver ( contact ) ;
this . selectGiver ( contact ) ;
} else {
} else {
this . selectRecipient ( contact ) ;
this . selectRecipient ( contact ) ;
}
}
} else {
} else {
const project = entity . data as PlanData ;
const project = entity . data as PlanData ;
if ( this . stepType === 'giver' ) {
if ( this . stepType === "giver" ) {
this . selectProject ( project ) ;
this . selectProject ( project ) ;
} else {
} else {
this . selectRecipientProject ( project ) ;
this . selectRecipientProject ( project ) ;
@ -651,7 +674,7 @@ export default class GiftedDialog extends Vue {
* Handle edit entity request from GiftDetailsStep
* Handle edit entity request from GiftDetailsStep
* @ param entityType - 'giver' or 'recipient'
* @ param entityType - 'giver' or 'recipient'
* /
* /
handleEditEntity ( entityType : 'giver' | 'recipient' ) {
handleEditEntity ( entityType : "giver" | "recipient" ) {
this . goBackToStep1 ( entityType ) ;
this . goBackToStep1 ( entityType ) ;
}
}
@ -661,6 +684,19 @@ export default class GiftedDialog extends Vue {
handleSubmit ( ) {
handleSubmit ( ) {
this . confirm ( ) ;
this . confirm ( ) ;
}
}
/ * *
* Handle amount update from GiftDetailsStep
* /
handleAmountUpdate ( newAmount : number ) {
console . log (
` [GiftedDialog] handleAmountUpdate() called - oldAmount: ${ this . amountInput } , newAmount: ${ newAmount } ` ,
) ;
this . amountInput = newAmount . toString ( ) ;
console . log (
` [GiftedDialog] handleAmountUpdate() - amountInput updated to: ${ this . amountInput } ` ,
) ;
}
}
}
< / script >
< / script >