import { defineComponent, onMounted, ref } from 'vue'
import { tools } from '@tools'
import { useUserStore } from '@store/UserStore'
import { useRouter } from 'vue-router'
import { useGlobalStore } from '@store/globalStore'
import { useProducts } from '@store/Products'
import { useI18n } from 'vue-i18n'
import { toolsext } from '@store/Modules/toolsext'
import { useQuasar } from 'quasar'
import { costanti } from '@costanti'

import { CProductCard } from '@src/components/CProductCard'

export default defineComponent({
  name: 'CartList',
  components: { CProductCard },
  filters: {
    capitalize(value: any) {
      if (!value) {
        return ''
      }
      value = value.toString()
      return value.charAt(0).toUpperCase() + value.slice(1)
    }
  },
  props: {},
  setup() {
    const userStore = useUserStore()
    const globalStore = useGlobalStore()
    const productStore = useProducts()
    const $router = useRouter()
    const $q = useQuasar()
    const { t } = useI18n();

    function getCart() {
      return productStore.getCart()
    }

    function getProducts() {
      return productStore.getProducts()
    }

    function mounted() {
      // Inizializza

    }

    onMounted(mounted)

    return {
      userStore,
      costanti,
      tools,
      toolsext,
      getCart,
      getProducts,
    }
  }
})
