<template>
  <CSidebar
      fixed
      :minimize="minimize"
      :show="show"
      @update:show="(value) => $store.commit('admin/set', ['sidebarShow', value])"
  >
    <CSidebarBrand class="d-md-down-none">
      <a href="/" target="_blank">
        <!--        <IconsLogo class="c-sidebar-brand-full" name="logo" style="width: 100%"/>-->
        <h2 class="c-sidebar-brand-full" name="logo" style="color: #fff;font-size: 30px;">OrisOxin</h2>
        <h2 class="c-sidebar-brand-minimized" name="logo" style="color: #fff;font-size: 14px;">OrisOxin</h2>
        <!--        <img src="/favicon.png" alt="logo" class="c-sidebar-brand-minimized" size="custom-size" :height="35" name="logo">-->
      </a>
    </CSidebarBrand>

    <!--    <CRenderFunction flat :content-to-render="$options.nav"/>-->

    <!-- sidebar content -->
    <CSidebarNav>
      <CSidebarNavItem name="صفحه اصلی" :to="{name: 'admin'}" icon="cil-speedometer"/>

      <CSidebarNavItem name="اسلایدر" :to="{name: 'admin-slider'}" fontIcon="far fa-images"/>

      <CSidebarNavDropdown name="رویدادها" fontIcon="fab fa-blogger">
        <CSidebarNavItem name="افزودن پست" :to="{name: 'admin-blog-posts-new'}"/>
        <CSidebarNavItem name="پست ها" :to="{name: 'admin-blog-posts'}"/>
        <CSidebarNavItem name="دسته بندی رویدادها" :to="{name: 'admin-blog-categories'}"/>
      </CSidebarNavDropdown>

      <CSidebarNavDropdown name="پروژه ها" fontIcon="fab fa-product-hunt">
        <CSidebarNavItem name="افزودن پروژه" :to="{name: 'admin-projects-new'}"/>
        <CSidebarNavItem name="لیست پروژه ها" :to="{name: 'admin-projects'}"/>
        <CSidebarNavItem name="دسته بندی پروژه ها" :to="{name: 'admin-projectCategories'}"/>
      </CSidebarNavDropdown>

      <CSidebarNavItem name="اعضای تیم" :to="{name: 'admin-team'}" fontIcon="fal fa-users-class"/>

      <CSidebarNavDropdown name="گالری" fontIcon="far fa-images">
        <CSidebarNavItem name="افزودن تصویر" :to="{name: 'admin-gallery-image',params: {image: 'new'}}"/>
        <CSidebarNavItem name="تصاویر" :to="{name: 'admin-gallery'}"/>
        <CSidebarNavItem name="دسته بندی گالری" :to="{name: 'admin-galleryCategories'}"/>
      </CSidebarNavDropdown>

      <CSidebarNavItem name="کاتالوگ ها" :to="{name: 'admin-catalogs'}" fontIcon="fas fa-file-pdf"/>

      <CSidebarNavItem name="نظرات مشتریان" :to="{name: 'admin-comments'}" fontIcon="fas fa-comment-lines"/>

      <CSidebarNavItem name="پیام های صفحه تماس با ما" :to="{name: 'admin-contact-us-messages'}" fontIcon="fal fa-envelope" :exact="false" :badge="unreadMessages ? {text: unreadMessages,color:'danger'} : null"/>

      <CSidebarNavItem name="کاور صفحات" :to="{name: 'admin-settings'}" fontIcon="fal fa-cog"/>

    </CSidebarNav>
    <!-- sidebar content -->

    <CSidebarMinimizer
        class="d-md-down-none"
        @click.native="$store.commit('admin/set', ['sidebarMinimize', !minimize])"
    />
  </CSidebar>
</template>

<script>
// import nav from './_nav'
import unreadMessagesCounter from "@/mixins/unreadMessagesCounter"

export default {
  name: 'TheSidebar',
  // nav,
  computed: {
    show() {
      return this.$store.state.admin.sidebarShow
    },
    minimize() {
      return this.$store.state.admin.sidebarMinimize
    },
    unreadMessages() {
      return this.$store.state.admin.unreadMessagesCount
    }
  },
  mixins: [unreadMessagesCounter],
  mounted() {
    this.checkMessages()
  }
}
</script>
