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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 "vuetify/dist/vuetify.min.css";
  12. import VueCurrencyInput from "vue-currency-input";
  13. Vue.use(EvaIcons);
  14. Vue.use(Vuetify);
  15. Vue.use(VueGoogleMaps, {
  16. load: {
  17. key: "AIzaSyD8k_Kwml_C8IDfs-gX8JFV8acli3L9cAE",
  18. libraries: "places,directions" // This is required if you use the Autocomplete plugin
  19. // OR: libraries: 'places,drawing'
  20. // OR: libraries: 'places,drawing,visualization'
  21. // (as you require)
  22. //// If you want to set the version, you can do so:
  23. // v: '3.26',
  24. }
  25. });
  26. const pluginOptions = {
  27. /* see config reference */
  28. globalOptions: { currency: ["ZAR", null, { prefix: "R" }][2], locale: "en-us" }
  29. };
  30. Vue.config.productionTip = false;
  31. //axios.defaults.baseURL = "http://localhost:57260";
  32. //axios.defaults.baseURL = "http://training.provision-sa.com:82";
  33. axios.defaults.baseURL = "http://localhost:8080/";
  34. Vue.prototype.$axios = axios;
  35. Vue.prototype.$http = axios;
  36. const token = localStorage.getItem("token");
  37. if (token) {
  38. Vue.prototype.$http.defaults.headers.common.Authorization = token;
  39. }
  40. Vue.use(VueCurrencyInput, pluginOptions);
  41. router.beforeEach((to, from, next) => {
  42. if (to.matched.some(record => record.meta.requiresAuth)) {
  43. if (store.getters.isLoggedIn) {
  44. next();
  45. return;
  46. }
  47. next("/users/login");
  48. } else {
  49. next();
  50. }
  51. });
  52. Vue.filter("toCurrency", value => {
  53. if (typeof value !== "number") {
  54. return value;
  55. }
  56. const formatter = new Intl.NumberFormat("en-US", {
  57. minimumFractionDigits: 2
  58. });
  59. return `R ${formatter.format(value)}`;
  60. });
  61. Vue.filter("toProper", value => {
  62. if (typeof value !== "string") {
  63. console.log(typeof value);
  64. return value;
  65. }
  66. value = value.replace(/([a-z])([A-Z])/g, "$1 $2");
  67. return value.charAt(0).toUpperCase() + value.slice(1);
  68. });
  69. Vue.filter("toDate", value => value.substring(0, value.length > 9 ? 10 : value.length));
  70. Vue.filter("toTime", value => moment(String(value)).format("hh:mm"));
  71. new Vue({
  72. render: h => h(App),
  73. router,
  74. store
  75. }).$mount("#app");