You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* eslint-disable */
  2. import Vue from 'vue'
  3. import EvaIcons from 'vue-eva-icons'
  4. import axios from 'axios'
  5. import moment from 'moment'
  6. import App from './App.vue'
  7. import router from './router'
  8. import store from './store'
  9. import * as VueGoogleMaps from 'vue2-google-maps'
  10. import Vuetify from 'vuetify'
  11. import VueSocialSharing from 'vue-social-sharing'
  12. import VueCurrencyInput from 'vue-currency-input'
  13. import VueFloatLabel from 'vue-float-label'
  14. import VueCryptojs from 'vue-cryptojs'
  15. import VueAnalytics from 'vue-analytics'
  16. import JsonExcel from 'vue-json-excel'
  17. import VModal from 'vue-js-modal'
  18. import vueFloatLabel from 'vue-float-label'
  19. import 'vue-loaders/dist/vue-loaders.css'
  20. import VueLoaders from 'vue-loaders'
  21. import VueQuillEditor from 'vue-quill-editor'
  22. import 'bootstrap/dist/css/bootstrap.css'
  23. import 'bootstrap-vue/dist/bootstrap-vue.css'
  24. import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
  25. import 'quill/dist/quill.core.css' // import styles
  26. import 'quill/dist/quill.snow.css' // for snow theme
  27. import 'quill/dist/quill.bubble.css' // for bubble theme
  28. Vue.use(VueQuillEditor /* { default global options } */ )
  29. Vue.use(VueLoaders)
  30. Vue.use(VueSocialSharing)
  31. Vue.use(EvaIcons)
  32. Vue.use(Vuetify)
  33. Vue.use(VueFloatLabel)
  34. Vue.use(VueCryptojs)
  35. Vue.component('downloadExcel', JsonExcel)
  36. Vue.use(BootstrapVue)
  37. Vue.use(IconsPlugin)
  38. Vue.use(VueGoogleMaps, {
  39. load: {
  40. key: 'AIzaSyBpubKVyM2HwrJreGsENtKbWd38AhNTC0w',
  41. libraries: 'places,directions', // This is required if you use the Autocomplete plugin
  42. // OR: libraries: 'places,drawing'
  43. // OR: libraries: 'places,drawing,visualization'
  44. // (as you require)
  45. //// If you want to set the version, you can do so:
  46. // v: '3.26',
  47. },
  48. })
  49. //More info @ https://webdeasy.de/en/vue-analytics-en/
  50. Vue.use(VueAnalytics, {
  51. id: 'UA-128891091-1',
  52. router,
  53. })
  54. Vue.config.productionTip = false
  55. axios.defaults.baseURL = 'http://localhost:57260'
  56. //axios.defaults.baseURL = "https://www.pvsl.co.za:86/";
  57. //axios.defaults.baseURL = 'http://training.provision-sa.com:120/'
  58. Vue.prototype.$axios = axios
  59. const pluginOptions = {
  60. /* see config reference */
  61. globalOptions: {
  62. currency: ['ZAR', null, { prefix: 'R' }][2],
  63. precision: 0,
  64. },
  65. }
  66. Vue.use(VueCurrencyInput, pluginOptions)
  67. Vue.prototype.$http = axios
  68. const token = localStorage.getItem('token')
  69. if (token) {
  70. Vue.prototype.$http.defaults.headers.common.Authorization = token
  71. }
  72. router.beforeEach((to, from, next) => {
  73. if (to.matched.some((record) => record.meta.requiresAuth)) {
  74. if (store.getters.isLoggedIn) {
  75. next()
  76. return
  77. }
  78. next('/users/login')
  79. } else {
  80. next()
  81. }
  82. })
  83. Vue.filter('toCurrency', (value) => {
  84. if (typeof value !== 'number') {
  85. return value
  86. }
  87. const formatter = new Intl.NumberFormat('en-US', {
  88. minimumFractionDigits: 0,
  89. })
  90. return `R ${formatter.format(value)}`
  91. })
  92. Vue.filter('toProper', (value) => {
  93. if (typeof value !== 'string') {
  94. console.log(typeof value)
  95. return value
  96. }
  97. value = value.replace(/([a-z])([A-Z])/g, '$1 $2')
  98. return value.charAt(0).toUpperCase() + value.slice(1)
  99. })
  100. Vue.filter('toDate', (value) =>
  101. value.substring(0, value.length > 9 ? 10 : value.length),
  102. )
  103. Vue.filter('toTime', (value) => moment(String(value)).format('hh:mm'))
  104. new Vue({
  105. render: (h) => h(App),
  106. router,
  107. store,
  108. }).$mount('#app')
  109. Vue.use(VModal)