2020-04-10 20:32:12 +02:00
|
|
|
import Vue from 'vue';
|
2022-11-17 20:56:46 +01:00
|
|
|
import {App as InertiaApp, plugin, Link as ILink} from '@inertiajs/inertia-vue';
|
2022-12-05 00:04:01 +01:00
|
|
|
import {Inertia} from '@inertiajs/inertia';
|
2022-12-04 23:40:35 +01:00
|
|
|
import PortalVue from 'portal-vue';
|
2023-02-26 20:51:59 +01:00
|
|
|
import axios from 'axios';
|
|
|
|
import VueAxios from 'vue-axios';
|
2023-03-04 12:02:17 +01:00
|
|
|
import Toasted from 'vue-toasted';
|
2023-05-19 01:06:46 +02:00
|
|
|
import VTooltip from 'v-tooltip';
|
2023-04-29 23:15:07 +02:00
|
|
|
import {createPinia, PiniaVuePlugin} from 'pinia';
|
2023-05-19 01:06:46 +02:00
|
|
|
import requireModules from './lib/requireModules.js';
|
2020-04-10 20:32:12 +02:00
|
|
|
|
2023-05-19 01:06:46 +02:00
|
|
|
import AppLayout from './layouts/AppLayout.vue';
|
|
|
|
import hasModule from './mixins/hasModule.js';
|
|
|
|
import hasFlash from './mixins/hasFlash.js';
|
|
|
|
|
2023-06-01 11:05:03 +02:00
|
|
|
import '../css/app.css';
|
|
|
|
|
|
|
|
// ---------------------------------- Assets -----------------------------------
|
|
|
|
import.meta.glob(['../img/**']);
|
|
|
|
|
2023-05-19 01:06:46 +02:00
|
|
|
// ---------------------------------- Plugins ----------------------------------
|
2022-02-12 01:31:01 +01:00
|
|
|
Vue.use(plugin);
|
2022-12-04 23:40:35 +01:00
|
|
|
Vue.use(PortalVue);
|
2021-08-22 16:49:38 +02:00
|
|
|
Vue.use(VTooltip);
|
2023-03-04 12:02:17 +01:00
|
|
|
Vue.use(Toasted);
|
2023-02-26 20:51:59 +01:00
|
|
|
Vue.use(VueAxios, axios);
|
2023-04-29 23:15:07 +02:00
|
|
|
Vue.use(PiniaVuePlugin);
|
2020-04-10 20:32:12 +02:00
|
|
|
|
2023-05-19 01:06:46 +02:00
|
|
|
Vue.component('SvgSprite', () => import('./components/SvgSprite.js'));
|
|
|
|
Vue.component('ILink', ILink);
|
2023-05-18 01:13:28 +02:00
|
|
|
|
2023-05-19 01:06:46 +02:00
|
|
|
// -------------------------------- Components ---------------------------------
|
2023-06-01 11:05:03 +02:00
|
|
|
requireModules(import.meta.glob('./components/form/*.vue'), Vue, 'f');
|
|
|
|
requireModules(import.meta.glob('./components/ui/*.vue'), Vue, 'ui');
|
|
|
|
requireModules(import.meta.glob('./components/page/*.vue', {eager: true}), Vue, 'page');
|
2023-05-20 00:57:05 +02:00
|
|
|
|
|
|
|
// ---------------------------------- mixins -----------------------------------
|
|
|
|
Vue.mixin(hasModule);
|
|
|
|
Vue.mixin(hasFlash);
|
2023-05-18 01:13:28 +02:00
|
|
|
|
|
|
|
// ----------------------------------- init ------------------------------------
|
2022-02-12 01:31:01 +01:00
|
|
|
const el = document.getElementById('app');
|
2023-04-29 23:15:07 +02:00
|
|
|
const pinia = createPinia();
|
2020-04-12 00:26:44 +02:00
|
|
|
|
2022-12-05 00:04:01 +01:00
|
|
|
Inertia.on('start', (event) => window.dispatchEvent(new Event('inertiaStart')));
|
|
|
|
|
2023-06-01 11:05:03 +02:00
|
|
|
let views = import.meta.glob('./views/**/*.vue');
|
2020-04-10 20:32:12 +02:00
|
|
|
new Vue({
|
2023-04-29 23:15:07 +02:00
|
|
|
pinia,
|
2022-11-17 20:56:46 +01:00
|
|
|
render: (h) =>
|
|
|
|
h(InertiaApp, {
|
|
|
|
props: {
|
|
|
|
initialPage: JSON.parse(el.dataset.page),
|
|
|
|
resolveComponent: async (name) => {
|
2023-06-01 11:05:03 +02:00
|
|
|
var page = (await views[`./views/${name}.vue`]()).default;
|
2021-04-11 11:19:55 +02:00
|
|
|
|
2022-11-17 20:56:46 +01:00
|
|
|
if (page.layout === undefined) {
|
|
|
|
page.layout = AppLayout;
|
|
|
|
}
|
|
|
|
return page;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
2021-04-10 19:45:11 +02:00
|
|
|
}).$mount(el);
|