

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import * as Sentry from '@sentry/browser';
import * as Integrations from '@sentry/integrations';

Vue.config.errorHandler = function (err, vm, info)  {
  console.log('[Error Global]:  Error: '+ err + ' [información]: ' + info);
}; 

 Sentry.init({
  dsn: 'https://ef9f8060706f4e609a23a4643f9b21f3@sentry.io/1807657',
  integrations: [new Integrations.Vue({Vue, attachProps: true})],
});

import VueSweetalert2 from 'vue-sweetalert2';
import "sweetalert2/dist/sweetalert2.css";

import 'bootstrap'
import 'bootstrap/dist/css/bootstrap.min.css'
import 'material-icons/iconfont/material-icons.css'

import axios from 'axios'
import Toasted from 'vue-toasted'

import vueTopprogress from 'vue-top-progress'

import es from 'vee-validate/dist/locale/es'
import VeeValidate, { Validator } from 'vee-validate'

import AirbnbStyleDatepicker from 'vue-airbnb-style-datepicker'
import 'vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.min.css'

import VueLazyload from 'vue-lazyload'

const optionsAlert = {
  confirmButtonColor: '#ff6674',
  cancelButtonColor: '#c2c2c2',
};
Vue.use(VueSweetalert2,optionsAlert);

const datepickerOptions = {
  colors: {
    selected: '#dd0302',
    inRange: '#ff6674',
    selectedText: '#fff',
    text: '#565a5c',
    inRangeBorder: '#fff',
    disabled: '#fff',
    hoveredInRange: '#ff6674'
  },
  days: ['Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado', 'Domingo'],
  daysShort: ['Lun', 'Mar', 'Mier', 'Jue', 'Vier', 'Sab', 'Dom'],
  monthNames: [
    'Enero',
    'Febrero',
    'Marzo',
    'Abril',
    'Mayo',
    'Junio',
    'Julio',
    'Agosto',
    'Septiembre',
    'Octubre',
    'Noviembre',
    'Diciembre'
  ],
  texts: {
    apply: 'Aplicar',
    cancel: 'Cancelar',
    keyboardShortcuts: 'Keyboard Shortcuts'
  }

}
// Date picker config
Vue.use(AirbnbStyleDatepicker, datepickerOptions)
Vue.use(VeeValidate, {
  inject: true,
  fieldsBagName: 'veeFields'
})

Validator.localize('es', es)

Vue.use(vueTopprogress)

Vue.prototype.$http = axios
Vue.use(Toasted)
Vue.prototype.$toast_success = {
  theme: 'bubble',
  type: 'success',
  icon: 'check_circle',
  iconPack: 'material',
  position: 'top-right',
  duration: 5000
}
Vue.prototype.$toast_error = {
  theme: 'bubble',
  type: 'error',
  icon: 'report_problem',
  iconPack: 'material',
  position: 'top-right',
  duration: null,
  action: {
    icon: 'close',
    onClick: (e, toastObject) => {
      toastObject.goAway(0);
    }
  }
}

Vue.prototype.URL_SOLER = store.state.url_api+'acceso.php'
Vue.prototype.url_api = store.state.url_api+'api/v1/quiosco'

Vue.use(VueLazyload, {
  preLoad: 1.9,
  error: require('@/assets/images/loading-error.png'),
  loading: require('@/assets/images/loading2.gif'),
  attempt: 1
})
Vue.config.productionTip = false
new Vue({
  router,
  store,
  render: function (h) { return h(App) }
}).$mount('#app')
