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.7 KiB

2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 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 small @click="$emit('edit', item)">
  34. {{ mdiPencil }}
  35. </v-icon>
  36. </template>
  37. </v-data-table>
  38. </template>
  39. <script lang="ts">
  40. import Vue from 'vue'
  41. import { mdiMagnify, mdiPencil } from '@mdi/js'
  42. export default Vue.extend({
  43. props: {
  44. isLoading: {
  45. type: Boolean,
  46. default: false,
  47. required: true
  48. },
  49. items: {
  50. type: Array,
  51. default: () => [],
  52. required: true
  53. },
  54. value: {
  55. type: Array,
  56. default: () => [],
  57. required: true
  58. }
  59. },
  60. data() {
  61. return {
  62. search: '',
  63. mdiMagnify,
  64. mdiPencil
  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>