You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.3 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <base-modal
  3. :is-create="true"
  4. :text="$t('generic.add')"
  5. >
  6. <template v-slot="slotProps">
  7. <member-addition-form
  8. :add-member="addMember"
  9. :items="items"
  10. :roles="getTranslatedRoles(roles, $t('members.roles'))"
  11. @close="slotProps.close"
  12. @search-user="searchUser"
  13. />
  14. </template>
  15. </base-modal>
  16. </template>
  17. <script>
  18. import { mapActions, mapGetters } from 'vuex'
  19. import BaseModal from '@/components/molecules/BaseModal'
  20. import MemberAdditionForm from '@/components/organisms/members/MemberAdditionForm'
  21. import UserService from '@/services/user.service'
  22. import { translatedRoles } from '~/plugins/utils'
  23. export default {
  24. components: {
  25. BaseModal,
  26. MemberAdditionForm
  27. },
  28. data() {
  29. return {
  30. items: []
  31. }
  32. },
  33. computed: {
  34. ...mapGetters('roles', ['roles'])
  35. },
  36. created() {
  37. this.getRoleList()
  38. },
  39. methods: {
  40. ...mapActions('members', ['addMember']),
  41. ...mapActions('roles', ['getRoleList']),
  42. searchUser(username) {
  43. UserService.getUserList(username)
  44. .then((response) => {
  45. this.items = response.data
  46. })
  47. .catch((error) => {
  48. alert(error)
  49. })
  50. },
  51. getTranslatedRoles(roles, mappings) {
  52. return translatedRoles(roles, mappings)
  53. }
  54. }
  55. }
  56. </script>