import Vue from 'vue';
import initVue from '@assets/js/initVue';

const vm = new Vue({
  components: {
    BaseContent: () => import(/* webpackChunkName: "BaseContent" */ '@elements/BaseContent/index.vue'),
    BaseButton: () => import(/* webpackChunkName: "BaseButton" */ '@elements/BaseButton/index.vue'),
    BaseRadio: () => import(/* webpackChunkName: "BaseRadio" */ '@elements/BaseRadio/index.vue'),
  },
  data() {
    return {
      extracts: {},
      isMob: false,
      loader: false,
      resgate: 1,
      acumulo: 1,
      todos: 'todos',
      allResults: 0,
      dates: [
        {
          id: 0,
          name: 'Todos os períodos',
        },
        {
          id: 1,
          name: 'Somente este mês',
        },
        {
          id: 3,
          name: 'Últimos 3 meses',
        },
        {
          id: 6,
          name: 'Últimos 6 meses',
        },
        {
          id: 9,
          name: 'Últimos 9 meses',
        },
        {
          id: 12,
          name: 'Útimos 12 meses',
        },
      ],
    };
  },
  methods: {
    setData({ extracts, total_points }) {
      console.log('extracts', extracts);
      this.extracts = extracts;
      this.allResults = total_points;
    },
    resize() {
      if (window.innerWidth < 992) this.isMob = true;
      window.addEventListener('resize', () => {
        if (window.innerWidth < 992) this.isMob = true;
        else this.isMob = false;
      });
    },
    inputListeners(value){
      if(value === "resgate") this.acumulo = false, this.todos = false; 
      if(value === "todos") this.acumulo = false, this.resgate = false; 
      if(value === "acumulo") this.todos = false, this.resgate = false;
    }
  },
  watch: {},
  mounted() {
    this.resize();
  },
});

initVue(vm);
