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.

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