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.

83 lines
1.7 KiB

3 years ago
3 years ago
3 years ago
  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 #top>
  20. <v-text-field
  21. v-model="search"
  22. :prepend-inner-icon="mdiMagnify"
  23. :label="$t('generic.search')"
  24. single-line
  25. hide-details
  26. filled
  27. />
  28. </template>
  29. <template #[`item.rolename`]="{ item }">
  30. {{ $translateRole(item.rolename, $t('members.roles')) }}
  31. </template>
  32. <template #[`item.actions`]="{ item }">
  33. <v-icon
  34. small
  35. @click="$emit('edit', item)"
  36. >
  37. {{ mdiPencil }}
  38. </v-icon>
  39. </template>
  40. </v-data-table>
  41. </template>
  42. <script lang="ts">
  43. import Vue from 'vue'
  44. import { mdiMagnify, mdiPencil } from '@mdi/js'
  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. mdiMagnify,
  67. mdiPencil
  68. }
  69. },
  70. computed: {
  71. headers() {
  72. return [
  73. { text: this.$t('generic.name'), value: 'username' },
  74. { text: this.$t('members.role'), value: 'rolename' },
  75. { text: 'Actions', value: 'actions', sortable: false }
  76. ]
  77. }
  78. }
  79. })
  80. </script>