|
@ -1,5 +1,12 @@ |
|
|
<template> |
|
|
<template> |
|
|
<base-card title="Add Member"> |
|
|
|
|
|
|
|
|
<base-card |
|
|
|
|
|
title="Add Member" |
|
|
|
|
|
agree-text="Add" |
|
|
|
|
|
cancel-text="Cancel" |
|
|
|
|
|
:disabled="!valid" |
|
|
|
|
|
@agree="create" |
|
|
|
|
|
@cancel="cancel" |
|
|
|
|
|
> |
|
|
<template #content> |
|
|
<template #content> |
|
|
<v-form |
|
|
<v-form |
|
|
ref="form" |
|
|
ref="form" |
|
@ -10,6 +17,7 @@ |
|
|
:items="items" |
|
|
:items="items" |
|
|
:loading="isLoading" |
|
|
:loading="isLoading" |
|
|
:search-input.sync="username" |
|
|
:search-input.sync="username" |
|
|
|
|
|
:rules="userRules" |
|
|
color="white" |
|
|
color="white" |
|
|
hide-no-data |
|
|
hide-no-data |
|
|
hide-selected |
|
|
hide-selected |
|
@ -22,31 +30,12 @@ |
|
|
<v-select |
|
|
<v-select |
|
|
v-model="role" |
|
|
v-model="role" |
|
|
:items="roles" |
|
|
:items="roles" |
|
|
|
|
|
:rules="roleRules" |
|
|
label="Role" |
|
|
label="Role" |
|
|
prepend-icon="mdi-account-card-details-outline" |
|
|
prepend-icon="mdi-account-card-details-outline" |
|
|
/> |
|
|
/> |
|
|
</v-form> |
|
|
</v-form> |
|
|
</template> |
|
|
</template> |
|
|
<template #actions> |
|
|
|
|
|
<v-btn |
|
|
|
|
|
class="text-capitalize" |
|
|
|
|
|
text |
|
|
|
|
|
color="primary" |
|
|
|
|
|
data-test="cancel-button" |
|
|
|
|
|
@click="cancel" |
|
|
|
|
|
> |
|
|
|
|
|
Cancel |
|
|
|
|
|
</v-btn> |
|
|
|
|
|
<v-btn |
|
|
|
|
|
:disabled="!valid" |
|
|
|
|
|
class="text-none" |
|
|
|
|
|
text |
|
|
|
|
|
data-test="create-button" |
|
|
|
|
|
@click="create" |
|
|
|
|
|
> |
|
|
|
|
|
Add |
|
|
|
|
|
</v-btn> |
|
|
|
|
|
</template> |
|
|
|
|
|
</base-card> |
|
|
</base-card> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
@ -71,12 +60,18 @@ export default { |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
valid: true, |
|
|
|
|
|
|
|
|
valid: false, |
|
|
username: '', |
|
|
username: '', |
|
|
role: null, |
|
|
role: null, |
|
|
isLoading: false, |
|
|
isLoading: false, |
|
|
selectedUser: null, |
|
|
selectedUser: null, |
|
|
roles: ['Admin', 'Member'] |
|
|
|
|
|
|
|
|
roles: ['Admin', 'Member'], |
|
|
|
|
|
userRules: [ |
|
|
|
|
|
v => !!v || 'User is required' |
|
|
|
|
|
], |
|
|
|
|
|
roleRules: [ |
|
|
|
|
|
v => !!v || 'Role is required' |
|
|
|
|
|
] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|