Skip to content
Snippets Groups Projects
Commit 319cf540 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

feat: add editor for the show’s internal notes

refs #146
parent db7dc49d
No related branches found
No related tags found
No related merge requests found
...@@ -74,6 +74,25 @@ ...@@ -74,6 +74,25 @@
<template v-else>-</template> <template v-else>-</template>
</FormGroup> </FormGroup>
<template v-if="isSuperuser">
<hr class="tw-col-span-3 tw-order-last tw-w-full" />
<FormGroup
:label="t('showMeta.internalNote')"
:errors="internalNoteErrors"
class="tw-col-span-2 tw-order-last"
>
<template #default="attrs">
<textarea
ref="internalNoteEl"
v-model="internalNote"
class="tw-min-h-[100px]"
v-bind="attrs"
@blur="save"
/>
</template>
</FormGroup>
</template>
<Teleport to="body"> <Teleport to="body">
<FallbackSelector ref="defaultPlaylistSelectorModal" /> <FallbackSelector ref="defaultPlaylistSelectorModal" />
</Teleport> </Teleport>
...@@ -82,18 +101,22 @@ ...@@ -82,18 +101,22 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { useStore } from 'vuex' import { useStore } from 'vuex'
import { useTextareaAutosize } from '@vueuse/core'
import { FundingCategory, Playlist, Show, Type } from '@/types' import { FundingCategory, Playlist, Show, Type } from '@/types'
import { useI18n } from '@/i18n' import { useI18n } from '@/i18n'
import { sanitizeHTML, useCopy, useSelectedShow } from '@/util' import { sanitizeHTML, useCopy, useSelectedShow } from '@/util'
import FormGroup from '@/components/generic/FormGroup.vue'
import { useAPIObject, useServerFieldErrors } from '@/api' import { useAPIObject, useServerFieldErrors } from '@/api'
import { usePlaylistStore } from '@/stores/playlists' import { usePlaylistStore } from '@/stores/playlists'
import FallbackSelector from '@/components/shows/FallbackSelector.vue'
import { APIError } from '@/store/api-helper' import { APIError } from '@/store/api-helper'
import { useAuthStore } from '@/stores/auth'
import FormGroup from '@/components/generic/FormGroup.vue'
import FallbackSelector from '@/components/shows/FallbackSelector.vue'
const { t } = useI18n() const { t } = useI18n()
const store = useStore() const store = useStore()
const selectedShow = useSelectedShow() const selectedShow = useSelectedShow()
const { isSuperuser } = useAuthStore()
const playlistStore = usePlaylistStore() const playlistStore = usePlaylistStore()
const shows = computed<Show[]>(() => store.state.shows.shows) const shows = computed<Show[]>(() => store.state.shows.shows)
const types = computed<Type[]>(() => store.state.shows.types) const types = computed<Type[]>(() => store.state.shows.types)
...@@ -102,6 +125,7 @@ const defaultPlaylistSelectorModal = ref() ...@@ -102,6 +125,7 @@ const defaultPlaylistSelectorModal = ref()
const email = useCopy(computed(() => selectedShow.value.email ?? '')) const email = useCopy(computed(() => selectedShow.value.email ?? ''))
const cbaSeriesId = useCopy(computed(() => selectedShow.value.cbaSeriesId)) const cbaSeriesId = useCopy(computed(() => selectedShow.value.cbaSeriesId))
const internalNote = useCopy(computed(() => selectedShow.value.internalNote))
const predecessorId = useCopy(computed(() => selectedShow.value.predecessorId)) const predecessorId = useCopy(computed(() => selectedShow.value.predecessorId))
const typeId = useCopy(computed(() => selectedShow.value.typeId)) const typeId = useCopy(computed(() => selectedShow.value.typeId))
const fundingCategoryId = useCopy(computed(() => selectedShow.value.fundingCategoryId)) const fundingCategoryId = useCopy(computed(() => selectedShow.value.fundingCategoryId))
...@@ -119,6 +143,7 @@ const [ ...@@ -119,6 +143,7 @@ const [
typeIdErrors, typeIdErrors,
fundingCategoryIdErrors, fundingCategoryIdErrors,
defaultPlaylistIdErrors, defaultPlaylistIdErrors,
internalNoteErrors,
] = useServerFieldErrors( ] = useServerFieldErrors(
error, error,
'email', 'email',
...@@ -127,8 +152,11 @@ const [ ...@@ -127,8 +152,11 @@ const [
'typeId', 'typeId',
'fundingCategoryId', 'fundingCategoryId',
'defaultPlaylistId', 'defaultPlaylistId',
'internalNote',
) )
const { textarea: internalNoteEl } = useTextareaAutosize({ input: internalNote })
function openDefaultPlaylistSelectorModal() { function openDefaultPlaylistSelectorModal() {
defaultPlaylistSelectorModal.value.open(async (id: number | null) => { defaultPlaylistSelectorModal.value.open(async (id: number | null) => {
defaultPlaylistId.value = id defaultPlaylistId.value = id
...@@ -146,6 +174,7 @@ async function save() { ...@@ -146,6 +174,7 @@ async function save() {
typeId: typeId.value, typeId: typeId.value,
fundingCategoryId: fundingCategoryId.value, fundingCategoryId: fundingCategoryId.value,
defaultPlaylistId: defaultPlaylistId.value, defaultPlaylistId: defaultPlaylistId.value,
internalNote: internalNote.value,
} }
try { try {
......
...@@ -256,6 +256,8 @@ export default { ...@@ -256,6 +256,8 @@ export default {
shortDescriptionPlaceholder: 'Gib eine Kurzbeschreibung der Sendereihe ein', shortDescriptionPlaceholder: 'Gib eine Kurzbeschreibung der Sendereihe ein',
editShortDescription: 'Kurzbeschreibung bearbeiten', editShortDescription: 'Kurzbeschreibung bearbeiten',
internalNote: 'Interne Notiz',
website: 'Webseite', website: 'Webseite',
websitePlaceholder: 'Gib eine Webseite für die Sendereihe an', websitePlaceholder: 'Gib eine Webseite für die Sendereihe an',
editWebsite: 'Webseite bearbeiten', editWebsite: 'Webseite bearbeiten',
......
...@@ -256,6 +256,8 @@ export default { ...@@ -256,6 +256,8 @@ export default {
shortDescriptionPlaceholder: 'Enter a short description of this show', shortDescriptionPlaceholder: 'Enter a short description of this show',
editShortDescription: 'Edit short description', editShortDescription: 'Edit short description',
internalNote: 'Internal note',
website: 'Website', website: 'Website',
websitePlaceholder: 'Enter a website for this show', websitePlaceholder: 'Enter a website for this show',
editWebsite: 'Edit website', editWebsite: 'Edit website',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment