generated from Flycro/laravel-nuxt
This commit is contained in:
@@ -71,6 +71,18 @@ function resolveStatus(status: string) {
|
||||
return bookRecommendationStore.statusOptions.find(option => option.value === status)
|
||||
}
|
||||
|
||||
const rows = computed(() => {
|
||||
// return all bookRecommendationStore.recommendations but add actions
|
||||
return bookRecommendationStore.recommendations.map((recommendation) => {
|
||||
return {
|
||||
...recommendation,
|
||||
actions: {
|
||||
class: 'max-w-96',
|
||||
},
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
$echo.private(`BookRecommendation`)
|
||||
.listen('.BookRecommendationUpdated', (e) => {
|
||||
@@ -86,7 +98,6 @@ onMounted(() => {
|
||||
|
||||
$echo.private(`Vote`)
|
||||
.listen('.VoteCreated', (e) => {
|
||||
console.log(e)
|
||||
bookRecommendationStore.createVoteWS(e.vote)
|
||||
})
|
||||
})
|
||||
@@ -95,18 +106,13 @@ onMounted(() => {
|
||||
<template>
|
||||
<div>
|
||||
<NewBookRecommendation />
|
||||
<UTable :sort="sort" :loading="bookRecommendationStore.fetchRecommendationsStatus === 'pending'" :columns="columns" :rows="bookRecommendationStore.recommendations">
|
||||
<UTable :ui="{ td: { base: 'max-w-[0] truncate' } }" :sort="sort" :loading="bookRecommendationStore.fetchRecommendationsStatus === 'pending'" :columns="columns" :rows="rows">
|
||||
<template #created_at-data="{ row }">
|
||||
<div>{{ dayjs(row.created_at).format('DD.MM.YYYY') }}</div>
|
||||
</template>
|
||||
<template #published_at-data="{ row }">
|
||||
<div>{{ dayjs(row.published_at).format('DD.MM.YYYY') }}</div>
|
||||
</template>
|
||||
<template #description-data="{ row }">
|
||||
<div v-if="row.description">
|
||||
{{ `${row.description.substring(0, 50)}...` }}
|
||||
</div>
|
||||
</template>
|
||||
<template #votes-data="{ row }">
|
||||
{{ row.votes.length }}
|
||||
</template>
|
||||
@@ -116,7 +122,7 @@ onMounted(() => {
|
||||
</UBadge>
|
||||
</template>
|
||||
<template #actions-data="{ row }">
|
||||
<div class="flex space-x-2">
|
||||
<div class="flex max-w-full space-x-2">
|
||||
<CastVote :row="row" />
|
||||
<EditBookRecommendation :row="row" />
|
||||
<DeleteBookRecommendation :row="row" />
|
||||
|
||||
Reference in New Issue
Block a user