Skip to content
Snippets Groups Projects
ShowBasicData.vue 4.72 KiB
Newer Older
  • Learn to ignore specific revisions
  •     <PageHeader
          :title="t('navigation.show.basicData')"
          :lead="show.name"
          :editing-metadata="show"
        />
    
    
        <div class="tw-grid tw-gap-x-6 tw-grid-cols-1 md:tw-grid-cols-2 lg:tw-grid-cols-3">
    
          <FormGroup
            v-slot="attrs"
            :label="t('show.fields.name')"
            :is-saving="name.isSaving"
            :errors="name.errors"
            class="tw-col-span-2"
          >
    
            <input v-bind="attrs" v-model="name.value" type="text" @blur="name.save" />
    
            <ADescription class="tw-text-xs">
              <span>{{ t('show.slugDetail.title') }}: </span>
              <code class="tw-text-inherit tw-bg-gray-200 tw-px-2 tw-py-1 tw-rounded tw-text-gray-500">
                {{ show.slug }}
              </code>
              <br />
              <SafeHTML
                :html="
                  t('show.slugDetail.editRemark', {
                    dangerZone: t('show.housekeeping.title'),
                    dangerZoneId: 'danger-zone',
                  })
                "
                sanitize-preset="safe-html"
              />
            </ADescription>
    
            :label="t('show.fields.shortDescription')"
            :is-saving="shortDescription.isSaving"
            :errors="shortDescription.errors"
            class="tw-col-span-2"
    
            <AHTMLEditor :id="id" v-model="shortDescription.value" @blur="shortDescription.save()" />
    
            :label="t('show.fields.description')"
            :is-saving="description.isSaving"
            :errors="description.errors"
            class="tw-col-span-2"
    
            <AHTMLEditor :id="id" v-model="description.value" @blur="shortDescription.save()" />
    
          </FormGroup>
    
          <hr class="tw-col-span-full tw-w-full" />
    
    
          <hr class="tw-col-span-full tw-w-full" />
    
          <hr class="tw-col-span-full tw-w-full" />
    
    
          <hr class="tw-col-span-full tw-w-full" />
    
          <FormGroup
            :label="t('show.fields.links')"
            :is-saving="links.isSaving"
            :errors="getFieldErrors(links.errors, 'links')"
            :has-error="links.errors.length > 0"
            custom-control
            class="tw-col-span-full tw-max-w-2xl"
          >
            <ALinkCollectionEditor
              v-model="links.value"
              :error-lists="getTreeFieldChildrenErrorsList(links.errors, 'links')"
              allow-add
              @save="links.save()"
            />
          </FormGroup>
    
    
        <p class="tw-text-sm">
          <ATimeEditInfo
            v-if="show.updatedAt"
            :edit-info="{ time: show.updatedAt, author: show.updatedBy }"
            type="modified"
          />
          <br />
          <ATimeEditInfo :edit-info="{ time: show.createdAt, author: show.createdBy }" type="created" />
        </p>
    
      </div>
    </template>
    
    <script lang="ts" setup>
    
    import { computed } from 'vue'
    
    
    import { useI18n } from '@/i18n'
    import { Show } from '@/types'
    
    import { getTreeFieldChildrenErrorsList, getFieldErrors, useAPIObjectFieldCopy } from '@/form'
    
    import { useShowStore } from '@/stores'
    import { useBreadcrumbs } from '@/stores/nav'
    
    
    import ShowMetaSimpleTypes from '../components/shows/MetaSimpleTypes.vue'
    import ShowMetaArrays from '../components/shows/MetaArrays.vue'
    import ShowMetaOwners from '../components/shows/MetaOwners.vue'
    import ShowMetaImages from '../components/shows/MetaImages.vue'
    import PageHeader from '@/components/PageHeader.vue'
    
    import ATimeEditInfo from '@/components/generic/ATimeEditInfo.vue'
    
    import FormGroup from '@/components/generic/FormGroup.vue'
    import AHousekeeping from '@/components/shows/AHousekeeping.vue'
    
    import ADescription from '@/components/generic/ADescription.vue'
    import SafeHTML from '@/components/generic/SafeHTML'
    
    import ALinkCollectionEditor from '@/components/generic/ALinkCollectionEditor.vue'
    
    import AHTMLEditor from '@/components/generic/AHTMLEditor.vue'
    
    const props = defineProps<{
    
      show: Show
    }>()
    
    const { t } = useI18n()
    
    const showStore = useShowStore()
    
    const show = computed(() => props.show)
    
    const name = useAPIObjectFieldCopy(showStore, show, 'name', { debounce: 2 })
    const shortDescription = useAPIObjectFieldCopy(showStore, show, 'shortDescription', { debounce: 2 })
    const description = useAPIObjectFieldCopy(showStore, show, 'description', { debounce: 2 })
    
    const links = useAPIObjectFieldCopy(showStore, show, 'links', { debounce: 2 })
    
    useBreadcrumbs(() => [
      { title: t('navigation.shows'), route: { name: 'shows' } },
      { title: props.show.name, route: { name: 'show', params: { showId: props.show.id.toString() } } },
      t('navigation.show.basicData'),
    ])