@ -1,6 +1,10 @@
< template >
< div v-if ="visible" class="dialog-overlay" >
< div class = "dialog" >
< div
class = "dialog"
data - testid = "gifted-dialog"
: data - recipient - entity - type - override = "recipientEntityTypeOverride"
>
<!-- Step 1 : Entity Selection -- >
< EntitySelectionStep
v - show = "firstStep"
@ -103,6 +107,7 @@ export default class GiftedDialog extends Vue {
@ Prop ( ) toProjectId = "" ;
@ Prop ( { default : false } ) showProjects = false ;
@ Prop ( ) isFromProjectView = false ;
@ Prop ( ) recipientEntityTypeOverride ? : "person" | "project" ;
@ Watch ( "showProjects" )
onShowProjectsChange ( ) {
@ -119,6 +124,11 @@ export default class GiftedDialog extends Vue {
this . updateEntityTypes ( ) ;
}
@ Watch ( "recipientEntityTypeOverride" )
onRecipientEntityTypeOverrideChange ( ) {
this . updateEntityTypes ( ) ;
}
activeDid = "" ;
allContacts : Array < Contact > = [ ] ;
allMyDids : Array < string > = [ ] ;
@ -201,23 +211,40 @@ export default class GiftedDialog extends Vue {
this . giverEntityType = "person" ;
this . recipientEntityType = "person" ;
/ / I f r e c i p i e n t e n t i t y t y p e i s e x p l i c i t l y o v e r r i d d e n , u s e t h a t
if ( this . recipientEntityTypeOverride ) {
this . recipientEntityType = this . recipientEntityTypeOverride ;
}
/ / D e t e r m i n e e n t i t y t y p e s b a s e d o n c u r r e n t c o n t e x t
if ( this . showProjects ) {
/ / H o m e V i e w " P r o j e c t " b u t t o n o r P r o j e c t V i e w V i e w " G i v e n b y T h i s "
this . giverEntityType = "project" ;
this . recipientEntityType = "person" ;
/ / O n l y o v e r r i d e r e c i p i e n t i f n o t a l r e a d y s e t b y r e c i p i e n t E n t i t y T y p e O v e r r i d e
if ( ! this . recipientEntityTypeOverride ) {
this . recipientEntityType = "person" ;
}
} else if ( this . fromProjectId ) {
/ / P r o j e c t V i e w V i e w " G i v e n b y T h i s " b u t t o n ( p r o j e c t i s g i v e r )
this . giverEntityType = "project" ;
this . recipientEntityType = "person" ;
/ / O n l y o v e r r i d e r e c i p i e n t i f n o t a l r e a d y s e t b y r e c i p i e n t E n t i t y T y p e O v e r r i d e
if ( ! this . recipientEntityTypeOverride ) {
this . recipientEntityType = "person" ;
}
} else if ( this . toProjectId ) {
/ / P r o j e c t V i e w V i e w " G i v e n t o T h i s " b u t t o n ( p r o j e c t i s r e c i p i e n t )
this . giverEntityType = "person" ;
this . recipientEntityType = "project" ;
/ / O n l y o v e r r i d e r e c i p i e n t i f n o t a l r e a d y s e t b y r e c i p i e n t E n t i t y T y p e O v e r r i d e
if ( ! this . recipientEntityTypeOverride ) {
this . recipientEntityType = "project" ;
}
} else {
/ / H o m e V i e w " P e r s o n " b u t t o n
this . giverEntityType = "person" ;
this . recipientEntityType = "person" ;
/ / O n l y o v e r r i d e r e c i p i e n t i f n o t a l r e a d y s e t b y r e c i p i e n t E n t i t y T y p e O v e r r i d e
if ( ! this . recipientEntityTypeOverride ) {
this . recipientEntityType = "person" ;
}
}
}