1
1
<template >
2
+ <div >
3
+ <b-list-group-item class =" d-flex align-items-center" style =" min-height : 70px " >
4
+ <load-ing :active.sync =" isLoading" :can-cancel =" true" :is-full-page =" true" ></load-ing >
2
5
3
- <b-list-group-item class = " d-flex align-items-center " style = " min-height : 70 px " >
4
- < load-ing :active.sync = " isLoading " :can-cancel = " true " :is-full-page = " true " ></ load-ing >
6
+ <b-avatar variant = " secondary " :text = " email.charAt(0).toUpperCase() " class = " mr-2 " ></ b-avatar >
7
+ < span class = " mr-auto " >{{ email }}</ span >
5
8
6
- <b-avatar variant =" secondary" :text =" email.charAt(0).toUpperCase()" class =" mr-2" ></b-avatar >
7
- <span class =" mr-auto" >{{ email }}</span >
8
9
10
+ <span class =" mx-1" style =" color : grey " v-if =" createdAt" >
11
+ <b-icon icon =" clock" aria-hidden =" true" variant =" secondary" ></b-icon >
12
+ {{ createdAt }}
13
+ </span >
9
14
10
- <span class =" mx-1" style =" color : grey " v-if =" createdAt" >
11
- <b-icon icon =" clock" aria-hidden =" true" variant =" secondary" ></b-icon >
12
- {{ createdAt }}
13
- </span >
15
+ <span class =" mx-1" style =" color : grey " v-if =" twoFactor" ><b-icon icon =" check-circle" aria-hidden =" true"
16
+ variant =" success" ></b-icon >
17
+ 2FA</span >
18
+ <!-- <b-badge pill variant="info" class="mx-1">{{ numberOfTeams }} teams</b-badge> -->
19
+ <b-badge pill variant =" warning" class =" mx-1" v-if =" assignedRoleId && getAllRoles.length > 0" >
20
+ <span class =" mx-1" ><b-icon icon =" person-fill" variant =" light" ></b-icon > Role:{{
21
+ getYourRole().roleName
22
+ }}
23
+ </span >
24
+ </b-badge >
25
+ <b-badge pill variant =" warning" class =" mx-1" v-if =" assignedRoleId && getAllRoles.length > 0" >
26
+ {{
27
+ getYourRole().permissions.length
28
+ }} permissions
29
+ </b-badge >
14
30
15
- <span class =" mx-1" style =" color : grey " v-if =" twoFactor" ><b-icon icon =" check-circle" aria-hidden =" true"
16
- variant =" success" ></b-icon >
17
- 2FA</span >
18
- <!-- <b-badge pill variant="info" class="mx-1">{{ numberOfTeams }} teams</b-badge> -->
19
- <b-badge pill variant =" warning" class =" mx-1" v-if =" assignedRoleId && getAllRoles.length > 0" >
20
- <span class =" mx-1" ><b-icon icon =" person-fill" variant =" light" ></b-icon > Role:{{
21
- getYourRole().roleName
22
- }}
23
- </span >
24
- </b-badge >
25
- <b-badge pill variant =" warning" class =" mx-1" v-if =" assignedRoleId && getAllRoles.length > 0" >
26
- {{
27
- getYourRole().permissions.length
28
- }} permissions
29
- </b-badge >
31
+ <b-badge pill variant =" success" class =" mx-1" v-if =" invitationStatus" >
32
+ <span class =" mx-1" style =" color : white " ><b-icon icon =" check" variant =" light" ></b-icon >Accepted
33
+ </span ></b-badge >
34
+ <b-badge pill variant =" warning" class =" mx-1" v-else >
35
+ <span class =" mx-1" style =" color : white " >Pending </span ></b-badge >
36
+
37
+ <b-dropdown class =" m-2" size =" sm" variant =" link" toggle-class =" text-decoration-none" no-caret dropleft >
38
+ <template #button-content >
39
+ <b-icon style =" color : grey " icon =" list" aria-hidden =" true" ></b-icon >
40
+ </template >
41
+ <b-dropdown-group id =" dropdown-group-1" header =" Assign Role" style =" text-align : left ;"
42
+ v-if =" invitationStatus && mode == 'Member'" >
43
+ <b-dropdown-item-button style =" text-align : left " v-for =" eachRole in getAllRoles" v-bind:key =" eachRole"
44
+ @click =" assignRole(eachRole._id, userId)" >
45
+ <!-- <button type="submit" class="btn btn-outline-secondary"> -->
46
+ {{ eachRole.roleName }}
47
+ <b-badge pill variant =" warning" >{{ eachRole.permissions.length }}
48
+ permissions</b-badge >
49
+ <!-- </button> -->
50
+ </b-dropdown-item-button >
51
+ <b-dropdown-divider ></b-dropdown-divider >
52
+ </b-dropdown-group >
30
53
31
- <b-badge pill variant =" success" class =" mx-1" v-if =" invitationStatus" >
32
- <span class =" mx-1" style =" color : white " ><b-icon icon =" check" variant =" light" ></b-icon >Accepted
33
- </span ></b-badge >
34
- <b-badge pill variant =" warning" class =" mx-1" v-else >
35
- <span class =" mx-1" style =" color : white " >Pending </span ></b-badge >
36
-
37
- <b-dropdown class =" m-2" size =" sm" variant =" link" toggle-class =" text-decoration-none" no-caret dropleft >
38
- <template #button-content >
39
- <b-icon style =" color : grey " icon =" list" aria-hidden =" true" ></b-icon >
40
- </template >
41
- <b-dropdown-group id =" dropdown-group-1" header =" Assign Role" style =" text-align : left ;"
42
- v-if =" invitationStatus && mode == 'Member'" >
43
- <b-dropdown-item-button style =" text-align : left " v-for =" eachRole in getAllRoles" v-bind:key =" eachRole"
44
- @click =" assignRole(eachRole._id, userId)" >
45
- <!-- <button type="submit" class="btn btn-outline-secondary"> -->
46
- {{ eachRole.roleName }}
47
- <b-badge pill variant =" warning" >{{ eachRole.permissions.length }}
48
- permissions</b-badge >
49
- <!-- </button> -->
50
- </b-dropdown-item-button >
51
- <b-dropdown-divider ></b-dropdown-divider >
52
- </b-dropdown-group >
53
54
55
+ <b-dropdown-item-button style =" text-align : left " @click =" copyToClip(`${$config.app.url}/#/studio/settings?ref=invitions`, 'Invitation Url')" ><i
56
+ class =" far fa-copy mt-1" aria-hidden =" true" ></i > Invite Url
57
+ </b-dropdown-item-button >
58
+ <b-dropdown-item-button v-if =" deleteMemberMenu" style =" text-align : left " @click =" deleteAMember()" ><i
59
+ class =" fa fa-trash mt-1" ></i > Delete Member</b-dropdown-item-button >
60
+ <b-dropdown-item-button v-if =" mode == 'Admin'" style =" text-align : left " @click =" acceptedInvition()" ><b-icon
61
+ icon =" hand-thumbs-up" ></b-icon > Accept Invition</b-dropdown-item-button >
54
62
55
- <b-dropdown-item-button style =" text-align : left " @click =" copyToClip(inviteCode, 'Invition Code')" ><i
56
- class =" far fa-copy mt-1" aria-hidden =" true" ></i > Invition Code
57
- </b-dropdown-item-button >
58
- <b-dropdown-item-button v-if =" deleteMemberMenu" style =" text-align : left " @click =" deleteAMember()" ><i
59
- class =" fa fa-trash mt-1" ></i > Delete Member</b-dropdown-item-button >
60
- <b-dropdown-item-button v-if =" mode == 'Admin'" style =" text-align : left " @click =" acceptedInvition()" ><b-icon
61
- icon =" hand-thumbs-up" ></b-icon > Accept Invition</b-dropdown-item-button >
63
+ <b-dropdown-item-button v-if =" mode == 'Admin' && invitationStatus" style =" text-align :left "
64
+ @click =" switchToAdminAccount()" ><b-icon icon =" box-arrow-in-right" ></b-icon > Switch
65
+ Account</b-dropdown-item-button >
62
66
63
- <b-dropdown-item-button v-if =" mode == 'Admin' && invitationStatus" style =" text-align :left "
64
- @click =" switchToAdminAccount()" ><b-icon icon =" box-arrow-in-right" ></b-icon > Switch
65
- Account</b-dropdown-item-button >
67
+ </b-dropdown >
68
+ </b-list-group-item >
69
+ <hf-pop-up
70
+ v-show =" showDeleteConfirm"
71
+ id =" delete-member-confirm-popup"
72
+ Header =" Delete Member"
73
+ @hide =" resetDeleteMember"
74
+ :hideHeaderClose =" true" >
75
+ <div >
76
+ <span class =" warning-icon" >⚠️</span >
77
+ <span class =" warning-text" > Are you sure you want to delete this member? This action cannot be undone.</span >
78
+ <div class =" text-center mt-3" >
79
+
80
+ <hf-buttons
81
+ name =" Cancel"
82
+ class =" btn btn-light px-4 py-2 border rounded me-2"
83
+ iconClass =" fa fa-times"
84
+ @executeAction =" resetDeleteMember"
85
+ />
86
+ <hf-buttons
87
+ name =" Delete"
88
+ class =" btn btn-primary text-center"
89
+ customClass =" btn btn-danger"
90
+ iconClass =" fa fa-trash-alt"
91
+ @executeAction =" confirmDeleteMember" >
92
+ </hf-buttons >
66
93
67
- </b-dropdown >
68
- </b-list-group-item >
94
+ </div >
95
+ </div >
96
+ </hf-pop-up >
97
+ </div >
69
98
</template >
70
99
71
100
<script >
101
+ import HfPopUp from " ../../components/element/hfPopup.vue" ;
72
102
import UtilsMixin from " ../../mixins/utils" ;
73
103
import { mapActions , mapGetters } from " vuex/dist/vuex.common.js" ;
74
104
export default {
@@ -124,9 +154,13 @@ export default {
124
154
},
125
155
data () {
126
156
return {
127
- isLoading: false
157
+ isLoading: false ,
158
+ showDeleteConfirm: false ,
128
159
}
129
160
},
161
+ components: {
162
+ HfPopUp,
163
+ },
130
164
computed: {
131
165
... mapGetters (' mainStore' , [' getAllRoles' ])
132
166
},
@@ -144,24 +178,29 @@ export default {
144
178
});
145
179
}
146
180
},
147
- async deleteAMember () {
148
- try {
149
-
150
- const result = confirm (" Are you sure you want to delete this member?" )
151
-
152
- if (result) {
153
- this .isLoading = true ;
154
- await this .deleteMember (this .email )
155
- this .isLoading = false ;
156
- this .notifySuccess (` ${ this .email } successfully deleted` )
157
- }
158
-
159
-
160
- } catch (e) {
161
- this .notifyErr (e .message )
162
- }
163
- },
164
- async acceptedInvition () {
181
+ async deleteAMember () {
182
+ this .showDeleteConfirm = true ;
183
+ this .$root .$emit (" bv::show::modal" , " delete-member-confirm-popup" );
184
+ },
185
+ async confirmDeleteMember () {
186
+ try {
187
+ this .isLoading = true ;
188
+ await this .deleteMember (this .email );
189
+ this .notifySuccess (` ${ this .email } successfully deleted` );
190
+ this .$root .$emit (" bv::hide::modal" , " delete-member-confirm-popup" );
191
+ } catch (e) {
192
+ this .notifyErr (e .message );
193
+ } finally {
194
+ this .isLoading = false ;
195
+ this .showDeleteConfirm = false ;
196
+ }
197
+ },
198
+ resetDeleteMember (){
199
+ this .showDeleteConfirm = false ;
200
+ this .isLoading = false ;
201
+ this .$root .$emit (" bv::hide::modal" , " delete-member-confirm-popup" );
202
+ },
203
+ async acceptedInvition () {
165
204
try {
166
205
this .isLoading = true ;
167
206
await this .acceptInvition (this .inviteCode .trim ());
0 commit comments