2021-09-08 16:15:54 +02:00
|
|
|
<template>
|
|
|
|
<div class="w-full h-full overflow-y-auto overflow-x-hidden px-4 py-6">
|
2022-03-26 17:59:34 +01:00
|
|
|
<div class="w-full mb-4">
|
2024-05-04 00:25:30 +02:00
|
|
|
<tables-chapters-table v-if="chapters.length" :library-item="libraryItem" keep-open @close="closeModal" />
|
2022-05-11 00:03:41 +02:00
|
|
|
<div v-if="!chapters.length" class="py-4 text-center">
|
2022-11-08 01:27:17 +01:00
|
|
|
<p class="mb-8 text-xl">{{ $strings.MessageNoChapters }}</p>
|
2024-05-04 00:25:30 +02:00
|
|
|
<ui-btn v-if="userCanUpdate" :to="`/audiobook/${libraryItem.id}/chapters`" @click="clickAddChapters">{{ $strings.ButtonAddChapters }}</ui-btn>
|
2022-03-17 18:25:12 +01:00
|
|
|
</div>
|
2022-03-26 17:59:34 +01:00
|
|
|
</div>
|
2021-09-08 16:15:54 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
2022-03-11 01:45:02 +01:00
|
|
|
libraryItem: {
|
2021-09-08 16:15:54 +02:00
|
|
|
type: Object,
|
|
|
|
default: () => {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
2022-03-17 18:25:12 +01:00
|
|
|
return {}
|
2021-09-08 16:15:54 +02:00
|
|
|
},
|
2022-03-17 18:25:12 +01:00
|
|
|
computed: {
|
|
|
|
media() {
|
2024-05-04 00:25:30 +02:00
|
|
|
return this.libraryItem?.media || {}
|
2022-03-17 18:25:12 +01:00
|
|
|
},
|
2022-03-26 17:59:34 +01:00
|
|
|
chapters() {
|
|
|
|
return this.media.chapters || []
|
2022-05-11 00:03:41 +02:00
|
|
|
},
|
|
|
|
userCanUpdate() {
|
|
|
|
return this.$store.getters['user/getUserCanUpdate']
|
2021-09-08 16:15:54 +02:00
|
|
|
}
|
|
|
|
},
|
2024-05-04 00:25:30 +02:00
|
|
|
methods: {
|
|
|
|
closeModal() {
|
|
|
|
this.$emit('close')
|
|
|
|
},
|
|
|
|
clickAddChapters() {
|
|
|
|
if (this.$route.name === 'audiobook-id-chapters' && this.$route.params?.id === this.libraryItem?.id) {
|
|
|
|
this.closeModal()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-09-08 16:15:54 +02:00
|
|
|
}
|
2024-05-04 00:25:30 +02:00
|
|
|
</script>
|