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.

78 lines
2.1 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, 100],
  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:[`item.createdAt`]="{ item }">
  21. <span>{{ item.createdAt | dateParse('YYYY-MM-DDTHH:mm:ss') | dateFormat('DD/MM/YYYY HH:mm') }}</span>
  22. </template>
  23. <template v-slot:[`item.documentText`]="{ item }">
  24. {{ item.documentText | truncate(200) }}
  25. </template>
  26. <template v-slot:top>
  27. <v-text-field
  28. v-model="search"
  29. prepend-inner-icon="search"
  30. :label="$t('generic.search')"
  31. single-line
  32. hide-details
  33. filled
  34. />
  35. </template>
  36. </v-data-table>
  37. </template>
  38. <script lang="ts">
  39. import Vue, { PropType } from 'vue'
  40. import VueFilterDateFormat from '@vuejs-community/vue-filter-date-format'
  41. import VueFilterDateParse from '@vuejs-community/vue-filter-date-parse'
  42. import { CommentReadDTO } from '~/services/application/comment/commentData'
  43. Vue.use(VueFilterDateFormat)
  44. Vue.use(VueFilterDateParse)
  45. export default Vue.extend({
  46. props: {
  47. isLoading: {
  48. type: Boolean,
  49. default: false,
  50. required: true
  51. },
  52. items: {
  53. type: Array as PropType<CommentReadDTO[]>,
  54. default: () => [],
  55. required: true
  56. },
  57. value: {
  58. type: Array as PropType<CommentReadDTO[]>,
  59. default: () => [],
  60. required: true
  61. }
  62. },
  63. data() {
  64. return {
  65. search: '',
  66. headers: [
  67. { text: this.$t('dataset.text'), value: 'text' },
  68. { text: this.$t('user.username'), value: 'username' },
  69. { text: this.$t('comments.document'), value: 'documentText' },
  70. { text: this.$t('comments.created_at'), value: 'createdAt' }
  71. ]
  72. }
  73. }
  74. })
  75. </script>