Skip to content

Commit 8a0dddb

Browse files
committed
fix(dashboard): Role: keep invite user button and dialog
1 parent e45e165 commit 8a0dddb

2 files changed

Lines changed: 48 additions & 2 deletions

File tree

dashboard/src/components/settings/Role.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@
6868
<RoleMembers
6969
v-if="tab === 'members'"
7070
:users="role.doc?.users"
71+
@add="
72+
(id: string) => {
73+
role.add_user.submit({
74+
user: id,
75+
});
76+
}
77+
"
7178
@remove="
7279
(id: string) => {
7380
role.remove_user.submit({

dashboard/src/components/settings/RoleMembers.vue

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,46 @@
4545
>
4646
No members to show
4747
</div>
48+
49+
<div>
50+
<Button label="Invite" icon-left="user" @click="open = !open" />
51+
</div>
52+
<Dialog
53+
v-model="open"
54+
:options="{
55+
title: 'Invite',
56+
size: 'lg',
57+
actions: [
58+
{
59+
label: 'Submit',
60+
variant: 'solid',
61+
onClick: () => {
62+
$emit('add', userForInvite);
63+
open = false;
64+
},
65+
},
66+
],
67+
}"
68+
>
69+
<template #body-content>
70+
<div class="mb-2 text-base">Invite a team member to this role.</div>
71+
<Select
72+
:options="usersForInvite"
73+
v-model="userForInvite"
74+
placeholder="User"
75+
/>
76+
</template>
77+
</Dialog>
4878
</div>
4979
</template>
5080

5181
<script setup lang="ts">
52-
import { Button } from 'frappe-ui'
82+
import { Button, Dialog, Select } from 'frappe-ui'
83+
import { computed, ref } from 'vue'
5384
import { dayjsLocal } from '../../utils/dayjs'
85+
import { teamMembers } from './data'
5486
55-
withDefaults(
87+
const props = withDefaults(
5688
defineProps<{
5789
users?: Array<any>
5890
}>(),
@@ -62,6 +94,13 @@ withDefaults(
6294
)
6395
6496
defineEmits<{
97+
add: [id: string]
6598
remove: [id: string]
6699
}>()
100+
101+
const open = ref(false)
102+
const userForInvite = ref<string>('')
103+
const usersForInvite = computed(() =>
104+
teamMembers(props.users.map((u) => u.user)),
105+
)
67106
</script>

0 commit comments

Comments
 (0)