1 import { createApp } from "vue";
2 import { createWebHistory, createRouter } from "vue-router";
3 import { createPinia } from "pinia";
5 import { library } from "@fortawesome/fontawesome-svg-core";
12 } from "@fortawesome/free-solid-svg-icons";
13 import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
14 import vSelect from "vue-select";
16 library.add(faPlus, faMinus, faPencil, faTrash, faSpinner);
18 import App from "../components/ERM/Main.vue";
20 import { routes as routesDef } from "../routes/erm";
22 import { useMainStore } from "../stores/main";
23 import { useVendorStore } from "../stores/vendors";
24 import { useAVStore } from "../stores/authorised-values";
25 import { useERMStore } from "../stores/erm";
26 import { useNavigationStore } from "../stores/navigation";
27 import i18n from "../i18n";
29 const pinia = createPinia();
31 const mainStore = useMainStore(pinia);
32 const AVStore = useAVStore(pinia);
33 const navigationStore = useNavigationStore(pinia);
34 const routes = navigationStore.setRoutes(routesDef);
36 const router = createRouter({
37 history: createWebHistory(),
38 linkExactActiveClass: "current",
42 const app = createApp(App);
44 const rootComponent = app
48 .component("font-awesome-icon", FontAwesomeIcon)
49 .component("v-select", vSelect);
51 app.config.unwrapInjectedRef = true;
52 app.provide("vendorStore", useVendorStore(pinia));
53 app.provide("mainStore", mainStore);
54 app.provide("AVStore", AVStore);
55 app.provide("navigationStore", navigationStore);
56 const ERMStore = useERMStore(pinia);
57 app.provide("ERMStore", ERMStore);
61 const { removeMessages } = mainStore;
62 router.beforeEach((to, from) => {
63 navigationStore.$patch({ current: to.matched, params: to.params || {} });
64 removeMessages(); // This will actually flag the messages as displayed already
66 router.afterEach((to, from) => {
67 let tab_id = "agreement"; // Agreements
69 if (to.path.match(/\/erm\/licenses/)) {
71 } else if (to.path.match(/\/erm\/eholdings\/local\/packages/)) {
73 } else if (to.path.match(/\/erm\/eholdings\/local\/titles/)) {
76 let node = document.getElementById(`${tab_id}_search_tab`);