import AdmVue from '@assets/js/adm-vue';
import initVue from '@assets/js/initVue';
import copyContent from '@assets/js/copyContent';
import axios from "axios";


const vm = new AdmVue({
  components: {
    BaseCard: () => import(/* webpackChunkName: "BaseCard" */ '@elements/BaseCard/index.vue'),
    BaseTabs: () => import(/* webpackChunkName: "BaseTabs" */ '@components/BaseTabs/index.vue'),
  },
  data() {
    return {
      configurations: {},
      zones: [],
      tabs: [
        {text:'Geral'   , active:true},
        {text:'Remetente', active:false}
      ],
    };
  },
  computed: {},
  methods:  {
    changeUf() {
      this.cities = [{
        municipio: 'Carregando municipios...'
      }];

      const zoneCode = this.configurations.kangu_ufOrigem;
      const { zone_id } = this.zones.find(zone => zone.code == zoneCode);

      axios({
        headers: { 'content-type': 'application/x-www-form-urlencoded' },
        method: 'post',
        responseType: 'json',
        timeout: 10000,
        url: this.urlCities,
        data: 'zone_id=' + zone_id,
      }).then(({data: {cities}}) => {
        this.cities = cities.map(city => ({
          municipio: city.municipio
        }));
      });
    },


  },

});

initVue(vm);