@ -39,7 +39,7 @@ 
			
		
	
		
			
				
					        : from - project - id = "fromProjectId"  
			
		
	
		
			
				
					        : to - project - id = "toProjectId"  
			
		
	
		
			
				
					        @ update : description = "description = $event"  
			
		
	
		
			
				
					        @ update : amount = "amountInput = $event.toString() "  
			
		
	
		
			
				
					        @ update : amount = "handleAmountUpdate "  
			
		
	
		
			
				
					        @ update : unit - code = "unitCode = $event"  
			
		
	
		
			
				
					        @ edit - entity = "handleEditEntity"  
			
		
	
		
			
				
					        @ explain - data = "explainData"  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -138,25 +138,35 @@ 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  
			
		
	
		
			
				
					  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  
			
		
	
		
			
				
					    if  ( this . giverEntityType  !==  "person"  ||  this . recipientEntityType  !==  "person" )  {  
			
		
	
		
			
				
					    if  (  
			
		
	
		
			
				
					      this . giverEntityType  !==  "person"  ||  
			
		
	
		
			
				
					      this . recipientEntityType  !==  "person"  
			
		
	
		
			
				
					    )  {  
			
		
	
		
			
				
					      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  
			
		
	
		
			
				
					    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  false ;  
			
		
	
		
			
				
					  }  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					  / /   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 )  {  
			
		
	
		
			
				
					    / /   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 ;  
			
		
	
		
			
				
					    }  
			
		
	
		
			
				
					     
			
		
	
		
			
				
					
  
			
		
	
		
			
				
					    if  ( this . stepType  ===  "giver" )  {  
			
		
	
		
			
				
					      / /   I f   s e l e c t i n g   a s   g i v e r ,   c h e c k   i f   i t   c o n f l i c t s   w i t h   c u r r e n t   r e c i p i e n t  
			
		
	
		
			
				
					      return  this . receiver ? . did  ===  contactDid ;  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -164,7 +174,7 @@ export default class GiftedDialog extends Vue { 
			
		
	
		
			
				
					      / /   I f   s e l e c t i n g   a s   r e c i p i e n t ,   c h e c k   i f   i t   c o n f l i c t s   w i t h   c u r r e n t   g i v e r  
			
		
	
		
			
				
					      return  this . giver ? . did  ===  contactDid ;  
			
		
	
		
			
				
					    }  
			
		
	
		
			
				
					      
			
		
	
		
			
				
					
  
			
		
	
		
			
				
					    return  false ;  
			
		
	
		
			
				
					  }  
			
		
	
		
			
				
					
 
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -348,7 +358,7 @@ export default class GiftedDialog extends Vue { 
			
		
	
		
			
				
					      ) ;  
			
		
	
		
			
				
					      return ;  
			
		
	
		
			
				
					    }  
			
		
	
		
			
				
					      
			
		
	
		
			
				
					
  
			
		
	
		
			
				
					    / /   C h e c k   f o r   p e r s o n   c o n f l i c t  
			
		
	
		
			
				
					    if  ( this . hasPersonConflict )  {  
			
		
	
		
			
				
					      this . $notify (  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -407,13 +417,19 @@ export default class GiftedDialog extends Vue { 
			
		
	
		
			
				
					      let  fulfillsProjectHandleId :  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  
			
		
	
		
			
				
					        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  
			
		
	
		
			
				
					        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  
			
		
	
		
			
				
					      }  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  
			
		
	
		
			
				
					        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  
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -611,12 +627,16 @@ export default class GiftedDialog extends Vue { 
			
		
	
		
			
				
					      giverDid :  this . giverEntityType  ===  "person"  ?  this . giver ? . did  :  undefined ,  
			
		
	
		
			
				
					      giverName :  this . giver ? . name ,  
			
		
	
		
			
				
					      offerId :  this . offerId ,  
			
		
	
		
			
				
					      fulfillsProjectId :  this . giverEntityType  ===  "person"  &&  this . recipientEntityType  ===  "project"  
			
		
	
		
			
				
					        ?  this . toProjectId  
			
		
	
		
			
				
					        :  undefined ,  
			
		
	
		
			
				
					      providerProjectId :  this . giverEntityType  ===  "project"  &&  this . recipientEntityType  ===  "person"  
			
		
	
		
			
				
					        ?  this . giver ? . handleId  
			
		
	
		
			
				
					        :  this . fromProjectId ,  
			
		
	
		
			
				
					      fulfillsProjectId :  
			
		
	
		
			
				
					        this . giverEntityType  ===  "person"  &&  
			
		
	
		
			
				
					        this . recipientEntityType  ===  "project"  
			
		
	
		
			
				
					          ?  this . toProjectId  
			
		
	
		
			
				
					          :  undefined ,  
			
		
	
		
			
				
					      providerProjectId :  
			
		
	
		
			
				
					        this . giverEntityType  ===  "project"  &&  
			
		
	
		
			
				
					        this . recipientEntityType  ===  "person"  
			
		
	
		
			
				
					          ?  this . giver ? . handleId  
			
		
	
		
			
				
					          :  this . fromProjectId ,  
			
		
	
		
			
				
					      recipientDid :  this . receiver ? . did ,  
			
		
	
		
			
				
					      recipientName :  this . receiver ? . name ,  
			
		
	
		
			
				
					      unitCode :  this . unitCode ,  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -629,17 +649,20 @@ export default class GiftedDialog extends Vue { 
			
		
	
		
			
				
					   *  Handle  entity  selection  from  EntitySelectionStep  
			
		
	
		
			
				
					   *  @ param  entity  -  The  selected  entity  ( person  or  project )  
			
		
	
		
			
				
					   * /  
			
		
	
		
			
				
					  handleEntitySelected ( entity :  {  type :  'person'  |  'project' ,  data :  Contact  |  PlanData  } )  {  
			
		
	
		
			
				
					    if  ( entity . type  ===  'person' )  {  
			
		
	
		
			
				
					  handleEntitySelected ( entity :  {  
			
		
	
		
			
				
					    type :  "person"  |  "project" ;  
			
		
	
		
			
				
					    data :  Contact  |  PlanData ;  
			
		
	
		
			
				
					  } )  {  
			
		
	
		
			
				
					    if  ( entity . type  ===  "person" )  {  
			
		
	
		
			
				
					      const  contact  =  entity . data  as  Contact ;  
			
		
	
		
			
				
					      if  ( this . stepType  ===  'giver' )  {  
			
		
	
		
			
				
					      if  ( this . stepType  ===  "giver" )  {  
			
		
	
		
			
				
					        this . selectGiver ( contact ) ;  
			
		
	
		
			
				
					      }  else  {  
			
		
	
		
			
				
					        this . selectRecipient ( contact ) ;  
			
		
	
		
			
				
					      }  
			
		
	
		
			
				
					    }  else  {  
			
		
	
		
			
				
					      const  project  =  entity . data  as  PlanData ;  
			
		
	
		
			
				
					      if  ( this . stepType  ===  'giver' )  {  
			
		
	
		
			
				
					      if  ( this . stepType  ===  "giver" )  {  
			
		
	
		
			
				
					        this . selectProject ( project ) ;  
			
		
	
		
			
				
					      }  else  {  
			
		
	
		
			
				
					        this . selectRecipientProject ( project ) ;  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -651,7 +674,7 @@ export default class GiftedDialog extends Vue { 
			
		
	
		
			
				
					   *  Handle  edit  entity  request  from  GiftDetailsStep  
			
		
	
		
			
				
					   *  @ param  entityType  -  'giver'  or  'recipient'  
			
		
	
		
			
				
					   * /  
			
		
	
		
			
				
					  handleEditEntity ( entityType :  'giver'  |  'recipient' )  {  
			
		
	
		
			
				
					  handleEditEntity ( entityType :  "giver"  |  "recipient" )  {  
			
		
	
		
			
				
					    this . goBackToStep1 ( entityType ) ;  
			
		
	
		
			
				
					  }  
			
		
	
		
			
				
					
 
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -661,6 +684,19 @@ export default class GiftedDialog extends Vue { 
			
		
	
		
			
				
					  handleSubmit ( )  {  
			
		
	
		
			
				
					    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 >