<template>
  <Page :fetched-data="fetchedData" :image-data="image">
    <template #extra-fields>
      <section class="main-section">
        <Title tag="h4">
          {{ $_tr('foldersHomepage.title') }}
        </Title>

        <div
          v-for="(lang, index) in availableLangs"
          :key="`folders-on-homepage-${index}`"
          class="mt-xxl"
        >
          <InputText
            :label="
              availableLangs.length > 1
                ? $_tc('foldersHomepage.foldersOnHomepage.labelMultilingual', [
                  lang
                ])
                : $_tr('foldersHomepage.foldersOnHomepage.labelMonolingual')
            "
            :default-value="fetchedData.homepage[`folders_on_${lang}_homepage`]"
            :model-name="`folders_on_${lang}_homepage`"
            form-id="advanced-settings-homepage"
          />
        </div>
      </section>
    </template>
  </Page>
</template>

<script>
import { Title } from 'inside-collection/atoms'

import Page from '@inside-administration/components/pages/advanced-settings/AdminAdvancedSettingsHomePage'

import InputText from '@inside-forms/displays/sub-components/fields/InputText'

export default {
  name: 'AdminAdvancedSettingsHomePage',
  $_i18nRootPath:
    'administration.PAGES.ADVANCED_SETTINGS.adminAdvancedSettingsHomePage',
  components: {
    Title,
    Page,
    InputText
  },
  props: {
    fetchedData: {
      type: Object
    }
  },
  computed: {
    availableLangs() {
      return this.$store.getters.getAvailablesLangs
    }
  }
}
</script>
