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.

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