<template>
  <div class="site--footer">
    <div class="container">
      <div class="row col1">
        <!--        <div class="col-12">-->
        <!--          <span class="logo">-->
        <!--            <img src="~/static/img/logo-re30-150x150.png" alt="">-->
        <!--          </span>-->
        <!--        </div>-->
        <div class="col-12 col-md-3 mb-5 logo">
          <img src="~/static/img/logo-re30-150x150.png" alt="استانداری مرکزی">
        </div>
        <div class="col-6 col-md-3 mb-3">
          <h3>دسترسی سریع</h3>
          <nuxt-link :to="{name: 'portal-info-page', params:{ portal: currentPortal, page: 'aboutus'}}" class="link-txt">درباره ما</nuxt-link>
          <nuxt-link :to="{name: 'portal-contact' ,params: {portal: currentPortal}}" class="link-txt">تماس با ما</nuxt-link>
          <nuxt-link :to="{name: 'portal-links' ,params: {portal: currentPortal}}" class="link-txt">پیوندها</nuxt-link>
          <nuxt-link :to="{name: 'portal-archive' ,params: {portal: currentPortal}, query: {flag:'all', page: 1}}" class="link-txt">آرشیو</nuxt-link>
        </div>
        <div class="col-6 col-md-3 mb-3">
          <h3>بخش های اصلی</h3>
          <!--          <nuxt-link-->
          <!--              v-for="item in header.categories"-->
          <!--              :key="item._id"-->
          <!--              :to="{name: 'portal-category-details',params: {portal: currentPortal,details: item.title},query: categoryURLQuery(item)}"-->
          <!--              class="link-txt"-->
          <!--          >-->
          <!--            {{ item.title }}-->
          <!--          </nuxt-link>-->
          <div v-if="header.categories.length">
            <nuxt-link
                v-for="(item, index) in header.categories[0].childs"
                :key="item._id"
                :to="{name: 'portal-category-details',params: {portal: currentPortal,details: item.title},query: categoryURLQuery(item)}"
                class="link-txt"
                v-if="index < 4"
            >
              {{ item.title }}
            </nuxt-link>
          </div>
        </div>
        <div class="col-6 col-md-3 mb-3">
          <h3>صفحات ویژه</h3>
          <nuxt-link :to="{name: 'portal-info-page', params:{portal: currentPortal,page: 'faq'}}" class="link-txt">سوالات متداول</nuxt-link>
          <nuxt-link :to="{name: 'portal-info-page', params:{portal: currentPortal,page: 'privacy'}}" class="link-txt">حفظ حریم خصوصی</nuxt-link>
          <nuxt-link :to="{name: 'portal-info-page', params:{portal: currentPortal,page: 'rules'}}" class="link-txt">قوانین و مقررات</nuxt-link>
          <!--          <nuxt-link :to="{name: 'portal-info-page', params:{portal: currentPortal,page: 'sitemap'}}" class="link-txt">نقشه سایت</nuxt-link>-->
        </div>
      </div>
      <div class="row">
        <div class="border"></div>
      </div>
      <div class="row view-copy-right">
        <div class="col-12 col-md-6 icon-field">
          <!--          <nuxt-link class="footer-link" to="/">صفحه اصلی</nuxt-link>-->
          <!--          <nuxt-link class="footer-link" :to="{name: 'portal-info-page', params:{portal: currentPortal,page: 'facilities'}}">امکانات</nuxt-link>-->
          <!--          <nuxt-link class="footer-link" :to="{name: 'portal-info-page', params:{portal: currentPortal,page: 'layout'}}">صفحه آرایی</nuxt-link>-->
          <!--          <nuxt-link class="footer-link" :to="{name: 'portal-info-page', params:{portal: currentPortal,page: 'pages'}}">صفحات</nuxt-link>-->
          <!--          <nuxt-link class="footer-link" :to="{name: 'portal-info-page', params:{portal: currentPortal,page: 'cookies'}}">کوکی ها</nuxt-link>-->

          <a href="tel:08633442222">
            <i class="fas fa-phone"></i>
          </a>
          <a v-if="yearBanner.hasEmail" :href="`mailto:${yearBanner.email}`" target="_blank">
            <i class="fas fa-envelope"></i>
          </a>
          <a v-if="yearBanner.hasInstagram" :href="yearBanner.instagram" target="_blank">
            <i class="fab fa-instagram"></i>
          </a>
        </div>
        <div class="col-12 col-md-6 copy-right-holder">
          <span class="copy-right">
            تمامی حقوق محفوظ است. طراحی و توسعه توسط:
            <a href="https://danakcorp.com/fa/products/%D9%BE%D9%88%D8%B1%D8%AA%D8%A7%D9%84%20%D8%AE%D8%A8%D8%B1%DB%8C" target="_blank">داناک</a>
          </span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "SiteFooter",
  computed: {
    currentPortal() {
      return this.$route.params.portal
    },
    header() {
      return this.$store.state.front.headerData
    },
    yearBanner() {
      return this.$store.state.front.yearBanner
    }
  },
  methods: {
    categoryURLQuery(item) {
      const query = {type: item.defaultPageType, id: item._id}
      if (item.defaultPageType === 'news') return {...query, page: 1}
      if (item.defaultPageType === 'gallery') return {...query, galleryType: 'image', page: 1}
      else return query
    },
  }
}
</script>
