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.

80 lines
1.6 KiB

  1. <template>
  2. <v-data-table
  3. :value="value"
  4. :headers="headers"
  5. :items="items"
  6. :search="search"
  7. :loading="isLoading"
  8. :loading-text="$t('generic.loading')"
  9. :no-data-text="$t('vuetify.noDataAvailable')"
  10. :footer-props="{
  11. 'showFirstLastPage': true,
  12. 'items-per-page-text': $t('vuetify.itemsPerPageText'),
  13. 'page-text': $t('dataset.pageText')
  14. }"
  15. item-key="id"
  16. show-select
  17. @input="$emit('input', $event)"
  18. >
  19. <template v-slot:top>
  20. <v-text-field
  21. v-model="search"
  22. prepend-inner-icon="search"
  23. :label="$t('generic.search')"
  24. single-line
  25. hide-details
  26. filled
  27. />
  28. </template>
  29. <template v-slot:[`item.rolename`]="{ item }">
  30. {{ $translateRole(item.rolename, $t('members.roles')) }}
  31. </template>
  32. <template v-slot:[`item.actions`]="{ item }">
  33. <v-icon
  34. small
  35. @click="$emit('edit', item)"
  36. >
  37. mdi-pencil
  38. </v-icon>
  39. </template>
  40. </v-data-table>
  41. </template>
  42. <script lang="ts">
  43. import Vue from 'vue'
  44. export default Vue.extend({
  45. props: {
  46. isLoading: {
  47. type: Boolean,
  48. default: false,
  49. required: true
  50. },
  51. items: {
  52. type: Array,
  53. default: () => [],
  54. required: true
  55. },
  56. value: {
  57. type: Array,
  58. default: () => [],
  59. required: true
  60. }
  61. },
  62. data() {
  63. return {
  64. search: ''
  65. }
  66. },
  67. computed: {
  68. headers() {
  69. return [
  70. { text: this.$t('generic.name'), value: 'username' },
  71. { text: this.$t('members.role'), value: 'rolename' },
  72. { text: 'Actions', value: 'actions', sortable: false }
  73. ]
  74. }
  75. }
  76. })
  77. </script>