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