|
1 | 1 | <template> |
2 | 2 | <div> |
3 | | - <h1>Comments Page</h1> |
| 3 | + <div class="h3 mb-4">{{ $t('Comments') }}</div> |
| 4 | + <VTableServer :items="comments" :itemsLength="comments.length" :is-loading="commentsIsLoading"> |
| 5 | + <VColumn :header="$t('Id')" field="id" /> |
| 6 | + <VColumn :header="$t('Name')" field="name" /> |
| 7 | + <VColumn :header="$t('Email')" field="email" /> |
| 8 | + <VColumn :header="$t('Post')" field="postId"> |
| 9 | + <template #body> |
| 10 | + <button class="btn btn-sm btn-outline-info" title="View Related Post"> |
| 11 | + <i class="bi-eye" /> |
| 12 | + </button> |
| 13 | + </template> |
| 14 | + </VColumn> |
| 15 | + <VColumn :header="$t('Body')" field="body" /> |
| 16 | + <VColumn :header="$t('Status')" field="id"> |
| 17 | + <template #body="{ item }"> |
| 18 | + <span v-if="item.status==='PENDING'"> |
| 19 | + {{ $t('Pending') }} |
| 20 | + </span> |
| 21 | + <span v-if="item.status==='CONFIRMED'"> |
| 22 | + {{$t('Confirmed')}} |
| 23 | + </span> |
| 24 | + <span v-if="item.status==='REJECTED'"> |
| 25 | + {{ $('Rejected') }} |
| 26 | + </span> |
| 27 | + </template> |
| 28 | + </VColumn> |
| 29 | + <VColumn :header="$t('Actions')" field="id"> |
| 30 | + <template #body> |
| 31 | + <div class="d-flex gap-2"> |
| 32 | + <button class="btn btn-danger btn-sm"> |
| 33 | + <i class="bi-ban" /> |
| 34 | + </button> |
| 35 | + <button class="btn btn-success btn-sm z-3" data-bs-toggle="tooltip" data-bs-placement="top" |
| 36 | + data-bs-title="Tooltip on top"> |
| 37 | + <i class="bi-check-circle" /> |
| 38 | + </button> |
| 39 | + </div> |
| 40 | + </template> |
| 41 | + </VColumn> |
| 42 | + </VTableServer> |
4 | 43 | </div> |
5 | 44 | </template> |
6 | 45 |
|
7 | 46 | <script> |
8 | | - export default { |
9 | | - name: 'CommentsView' |
| 47 | +import VColumn from '@/components/data-table/VColumn.vue'; |
| 48 | +import VTableServer from '@/components/data-table/VTableServer.vue'; |
| 49 | +import { useFetchComments } from '@/composables/comments.composable'; |
| 50 | +import { watch } from 'vue'; |
| 51 | +
|
| 52 | +export default { |
| 53 | + name: 'CommentsView', |
| 54 | + setup() { |
| 55 | + const { comments, commentsIsLoading, fetchComments } = useFetchComments() |
| 56 | +
|
| 57 | + function fetch() { |
| 58 | + const config = {} |
| 59 | + return fetchComments(config) |
| 60 | + } |
| 61 | + fetch() |
| 62 | + watch([], () => fetchComments()) |
| 63 | +
|
| 64 | + |
| 65 | + return { |
| 66 | + comments, |
| 67 | + commentsIsLoading |
| 68 | + } |
| 69 | + }, |
| 70 | + components: { |
| 71 | + VTableServer, |
| 72 | + VColumn |
10 | 73 | } |
| 74 | +} |
11 | 75 | </script> |
0 commit comments