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.

92 lines
2.2 KiB

3 years ago
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.name`]="{ item }">
  30. <nuxt-link :to="localePath(`/projects/${item.id}`)">
  31. <span>{{ item.name }}</span>
  32. </nuxt-link>
  33. </template>
  34. <template #[`item.updatedAt`]="{ item }">
  35. <span>{{ item.updatedAt | dateParse('YYYY-MM-DDTHH:mm:ss') | dateFormat('DD/MM/YYYY HH:mm') }}</span>
  36. </template>
  37. <template #[`item.tags`]="{ item }">
  38. <v-chip
  39. v-for="tag in item.tags"
  40. :key="tag.id"
  41. outlined>{{tag.text}}
  42. </v-chip>
  43. </template>
  44. </v-data-table>
  45. </template>
  46. <script lang="ts">
  47. import Vue from 'vue'
  48. import { mdiMagnify } from '@mdi/js'
  49. import VueFilterDateFormat from '@vuejs-community/vue-filter-date-format'
  50. import VueFilterDateParse from '@vuejs-community/vue-filter-date-parse'
  51. Vue.use(VueFilterDateFormat)
  52. Vue.use(VueFilterDateParse)
  53. export default Vue.extend({
  54. props: {
  55. isLoading: {
  56. type: Boolean,
  57. default: false,
  58. required: true
  59. },
  60. items: {
  61. type: Array,
  62. default: () => [],
  63. required: true
  64. },
  65. value: {
  66. type: Array,
  67. default: () => [],
  68. required: true
  69. }
  70. },
  71. data() {
  72. return {
  73. search: '',
  74. mdiMagnify
  75. }
  76. },
  77. computed: {
  78. headers() {
  79. return [
  80. { text: this.$t('generic.name'), value: 'name' },
  81. { text: this.$t('generic.description'), value: 'description' },
  82. { text: this.$t('generic.type'), value: 'projectType' },
  83. { text: 'Updated', value: 'updatedAt' },
  84. { text: 'Tags', value: 'tags'}
  85. ]
  86. }
  87. }
  88. })
  89. </script>