diff --git a/ayanova/src/App.vue b/ayanova/src/App.vue index 5982ba1b..b5c52b55 100644 --- a/ayanova/src/App.vue +++ b/ayanova/src/App.vue @@ -38,7 +38,7 @@ v-if="item.surface" :key="item.key" :disabled="item.disabled" - @click="$gzevent.$emit('menu-click', item)" + @click="window.$gz.eventbus.$emit('menu-click', item)" > {{ "fa-" + item.icon }} @@ -66,7 +66,7 @@ v-else :key="item.key" :disabled="item.disabled" - @click="$gzevent.$emit('menu-click', item)" + @click="window.$gz.eventbus.$emit('menu-click', item)" v-bind:class="{ 'hidden-sm-and-up': item.surface }" > @@ -136,12 +136,12 @@ export default { // ON GZEVENTBUS // // - this.$gzmenu.wireUpEventHandlers(this); + window.$gz.menu.wireUpEventHandlers(this); this.$gzdialog.wireUpEventHandlers(this); }, beforeDestroy() { //UNWIRE ALL EVENT HANDLERS FROM GZEVENTBUS - this.$gzevent.$off(); + this.window.$gz.eventbus.$off(); }, mounted() { //redirect to login if not authenticated diff --git a/ayanova/src/api/gzdialog.js b/ayanova/src/api/gzdialog.js index 6e52b39d..6216d904 100644 --- a/ayanova/src/api/gzdialog.js +++ b/ayanova/src/api/gzdialog.js @@ -17,7 +17,7 @@ export default { /////////// //ERROR - vm.$gzevent.$on("notify-error", function handleNotifyWarn(msg) { + window.$gz.eventbus.$on("notify-error", function handleNotifyWarn(msg) { vm.$dialog.notify.info(msg, { position: "bottom-right", icon: "fa-exclamation-triangle", @@ -27,7 +27,7 @@ export default { /////////// //WARNING - vm.$gzevent.$on("notify-warning", function handleNotifyWarn(msg) { + window.$gz.eventbus.$on("notify-warning", function handleNotifyWarn(msg) { vm.$dialog.notify.warning(msg, { position: "bottom-right", icon: "fa-exclamation", @@ -37,7 +37,7 @@ export default { /////////// //INFO - vm.$gzevent.$on("notify-info", function handleNotifyWarn(msg) { + window.$gz.eventbus.$on("notify-info", function handleNotifyWarn(msg) { vm.$dialog.notify.info(msg, { position: "bottom-right", icon: "fa-info-circle", @@ -47,7 +47,7 @@ export default { /////////// //SUCCESS - vm.$gzevent.$on("notify-success", function handleNotifyWarn(msg) { + window.$gz.eventbus.$on("notify-success", function handleNotifyWarn(msg) { vm.$dialog.notify.success(msg, { position: "bottom-right", icon: "fa-check-circle ", diff --git a/ayanova/src/api/gzmenu.js b/ayanova/src/api/gzmenu.js index e7aff201..5caebae4 100644 --- a/ayanova/src/api/gzmenu.js +++ b/ayanova/src/api/gzmenu.js @@ -155,7 +155,7 @@ export default { vm.$router.push({ name: item.data }); break; default: - vm.$gzevent.$emit( + window.$gz.eventbus.$emit( "notify-warning", "gzmenu:handleAppClick - unrecognized command [" + menuItem.key + @@ -189,25 +189,29 @@ export default { // wireUpEventHandlers(vm) { var self = this; - vm.$gzevent.$on("menu-change", function handleMenuChange(ctx) { + window.$gz.eventbus.$on("menu-change", function handleMenuChange(ctx) { self.handleMenuChange(vm, ctx); }); - vm.$gzevent.$on("menu-replace-item", function handleReplaceMenuItem( + window.$gz.eventbus.$on("menu-replace-item", function handleReplaceMenuItem( newItem ) { self.handleReplaceMenuItem(vm, newItem); }); - vm.$gzevent.$on("menu-disable-item", function handleDisableMenuItem(key) { + window.$gz.eventbus.$on("menu-disable-item", function handleDisableMenuItem( + key + ) { self.handleDisableMenuItem(vm, key, true); }); - vm.$gzevent.$on("menu-enable-item", function handleDisableMenuItem(key) { + window.$gz.eventbus.$on("menu-enable-item", function handleDisableMenuItem( + key + ) { self.handleDisableMenuItem(vm, key, false); }); - vm.$gzevent.$on("menu-click", function handleMenuClick(menuitem) { + window.$gz.eventbus.$on("menu-click", function handleMenuClick(menuitem) { self.handleAppClick(vm, menuitem); }); } diff --git a/ayanova/src/components/inventorywidgetlist.vue b/ayanova/src/components/inventorywidgetlist.vue index 8d67a0be..aea9bc44 100644 --- a/ayanova/src/components/inventorywidgetlist.vue +++ b/ayanova/src/components/inventorywidgetlist.vue @@ -201,7 +201,7 @@ export default { }); }, filterMe() { - this.$gzevent.$emit( + window.$gz.eventbus.$emit( "notify-info", "inventoryWidgetList::filterMe -> STUB (selected items count=" + this.selected.length + diff --git a/ayanova/src/main.js b/ayanova/src/main.js index a9ff7f35..a5d8b280 100644 --- a/ayanova/src/main.js +++ b/ayanova/src/main.js @@ -61,9 +61,9 @@ window.$gz = { }; window.$gzlocale = locale; window.$gzformcustomtemplate = gzformcustomtemplate; -Object.defineProperty(Vue.prototype, "$gztype", { value: gztype }); -Object.defineProperty(Vue.prototype, "$gzrole", { value: roles }); -Object.defineProperty(Vue.prototype, "$gzevent", { value: gzeventbus }); +//Object.defineProperty(Vue.prototype, "$gztype", { value: gztype }); +//Object.defineProperty(Vue.prototype, "$gzrole", { value: roles }); +//Object.defineProperty(Vue.prototype, "$gzevent", { value: gzeventbus }); Object.defineProperty(Vue.prototype, "$gzmenu", { value: gzmenu }); Object.defineProperty(Vue.prototype, "$gzdialog", { value: gzdialog }); Object.defineProperty(Vue.prototype, "$gzutil", { value: gzutil }); diff --git a/ayanova/src/views/About.vue b/ayanova/src/views/About.vue index 4d764a78..f796f9d8 100644 --- a/ayanova/src/views/About.vue +++ b/ayanova/src/views/About.vue @@ -178,7 +178,7 @@ function clickHandler(menuItem) { if (!menuItem) { return; } - var m = this.$gzmenu.parseMenuItem(menuItem); + var m = window.$gz.menu.parseMenuItem(menuItem); if (m.owner == "about" && !m.disabled) { switch (m.key) { case "copysupportinfo": @@ -195,7 +195,7 @@ function clickHandler(menuItem) { this.$gzutil.copyToClipboard(text + "\nCLIENT LOG\n" + logText); break; default: - m.vm.$gzevent.$emit( + window.$gz.eventbus.$emit( "notify-warning", "About.vue::context click: [" + m.key + "]" ); @@ -236,7 +236,7 @@ export default { .then(function() { vm.formState.ready = true; - vm.$gzevent.$emit("menu-change", { + window.$gz.eventbus.$emit("menu-change", { isMain: false, icon: "fa-info-circle", title: vm.$gzlocale.get("HelpAboutAyaNova"), @@ -257,7 +257,7 @@ export default { } ] }); - vm.$gzevent.$on("menu-click", clickHandler); + window.$gz.eventbus.$on("menu-click", clickHandler); }) .catch(err => { vm.formState.ready = true; @@ -274,9 +274,7 @@ export default { throw error; }); }, - beforeDestroy() { - // this.$gzevent.$off("menu-click", clickHandler); - }, + beforeDestroy() {}, mounted() { this.clientInfo = {}; this.clientInfo = aboutInfo; diff --git a/ayanova/src/views/Home.vue b/ayanova/src/views/Home.vue index 25fb3c84..88625657 100644 --- a/ayanova/src/views/Home.vue +++ b/ayanova/src/views/Home.vue @@ -10,7 +10,7 @@ export default { HelloWorld }, beforeCreate() { - this.$gzevent.$emit("menu-change", { + window.$gz.eventbus.$emit("menu-change", { isMain: true, icon: "fa-home", title: this.$gzlocale.get("Home") diff --git a/ayanova/src/views/accounting.vue b/ayanova/src/views/accounting.vue index 4b9ed3ef..af32a7b2 100644 --- a/ayanova/src/views/accounting.vue +++ b/ayanova/src/views/accounting.vue @@ -10,7 +10,7 @@ export default { UnderConstruction }, beforeCreate() { - this.$gzevent.$emit("menu-change", { + window.$gz.eventbus.$emit("menu-change", { isMain: true, icon: "fa-file-invoice-dollar", title: this.$gzlocale.get("Accounting") diff --git a/ayanova/src/views/administration.vue b/ayanova/src/views/administration.vue index b8fc8a3d..69a2f93b 100644 --- a/ayanova/src/views/administration.vue +++ b/ayanova/src/views/administration.vue @@ -10,7 +10,7 @@ export default { UnderConstruction }, beforeCreate() { - this.$gzevent.$emit("menu-change", { + window.$gz.eventbus.$emit("menu-change", { isMain: true, icon: "fa-user-tie", title: this.$gzlocale.get("Administration") diff --git a/ayanova/src/views/customize.vue b/ayanova/src/views/customize.vue index faba3c65..7707f5e2 100644 --- a/ayanova/src/views/customize.vue +++ b/ayanova/src/views/customize.vue @@ -10,7 +10,7 @@ export default { UnderConstruction }, beforeCreate() { - this.$gzevent.$emit("menu-change", { + window.$gz.eventbus.$emit("menu-change", { isMain: true, icon: "sliders-h", title: this.$gzlocale.get("Customize") diff --git a/ayanova/src/views/dispatch.vue b/ayanova/src/views/dispatch.vue index 3920d2e8..06ab60e3 100644 --- a/ayanova/src/views/dispatch.vue +++ b/ayanova/src/views/dispatch.vue @@ -10,7 +10,7 @@ export default { UnderConstruction }, beforeCreate() { - this.$gzevent.$emit("menu-change", { + window.$gz.eventbus.$emit("menu-change", { isMain: true, icon: "fa-shipping-fast", title: this.$gzlocale.get("Dispatch") diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index d2e2bd97..c52304a2 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -262,7 +262,7 @@ export default { created() { this.rights = window.$gz.role.getRights(this, window.$gz.type.Widget); - this.$gzevent.$on("menu-click", clickHandler); + window.$gz.eventbus.$on("menu-click", clickHandler); //id 0 means create a new record don't load one if (this.$route.params.id != 0) { this.getDataFromApi(this.$route.params.id); @@ -309,7 +309,7 @@ export default { } }, beforeDestroy() { - this.$gzevent.$off("menu-click", clickHandler); + window.$gz.eventbus.$off("menu-click", clickHandler); }, components: {}, data() { @@ -358,17 +358,23 @@ export default { //enable / disable save button var canSave = val.dirty && val.valid && !val.readOnly; if (canSave) { - this.$gzevent.$emit("menu-enable-item", FORM_KEY + ":save"); + window.$gz.eventbus.$emit("menu-enable-item", FORM_KEY + ":save"); } else { - this.$gzevent.$emit("menu-disable-item", FORM_KEY + ":save"); + window.$gz.eventbus.$emit("menu-disable-item", FORM_KEY + ":save"); } //enable / disable duplicate button var canDuplicate = !val.dirty && val.valid && !val.readOnly; if (canDuplicate) { - this.$gzevent.$emit("menu-enable-item", FORM_KEY + ":duplicate"); + window.$gz.eventbus.$emit( + "menu-enable-item", + FORM_KEY + ":duplicate" + ); } else { - this.$gzevent.$emit("menu-disable-item", FORM_KEY + ":duplicate"); + window.$gz.eventbus.$emit( + "menu-disable-item", + FORM_KEY + ":duplicate" + ); } }, deep: true @@ -563,7 +569,7 @@ function clickHandler(menuItem) { if (!menuItem) { return; } - var m = this.$gzmenu.parseMenuItem(menuItem); + var m = window.$gz.menu.parseMenuItem(menuItem); if (m.owner == FORM_KEY && !m.disabled) { switch (m.key) { case "save": @@ -582,7 +588,7 @@ function clickHandler(menuItem) { .getReportChoice(m.vm, reportList, selectedItem) .then(res => { if (res) { - m.vm.$gzevent.$emit( + window.$gz.eventbus.$emit( "notify-success", FORM_KEY + "::report click, selected is: [" + res + "]" ); @@ -591,7 +597,7 @@ function clickHandler(menuItem) { break; default: - m.vm.$gzevent.$emit( + window.$gz.eventbus.$emit( "notify-warning", FORM_KEY + "::context click: [" + m.key + "]" ); @@ -650,7 +656,7 @@ function generateMenu(vm) { vm: vm }); - vm.$gzevent.$emit("menu-change", menuOptions); + window.$gz.eventbus.$emit("menu-change", menuOptions); } var JUST_DELETED = false; diff --git a/ayanova/src/views/inventory.vue b/ayanova/src/views/inventory.vue index d189abf0..3c3145ef 100644 --- a/ayanova/src/views/inventory.vue +++ b/ayanova/src/views/inventory.vue @@ -60,7 +60,7 @@ export default { }); }, created() { - this.$gzevent.$emit("menu-change", { + window.$gz.eventbus.$emit("menu-change", { isMain: true, icon: "fa-dolly", title: this.$gzlocale.get("Inventory") diff --git a/ayanova/src/views/log.vue b/ayanova/src/views/log.vue index 8f8a2ee7..e89e6dfa 100644 --- a/ayanova/src/views/log.vue +++ b/ayanova/src/views/log.vue @@ -23,7 +23,7 @@ /* Xeslint-disable */ export default { created() { - this.$gzevent.$emit("menu-change", { + window.$gz.eventbus.$emit("menu-change", { isMain: false, icon: "fa-info-circle", title: this.$gzlocale.get("Log"), diff --git a/ayanova/src/views/login.vue b/ayanova/src/views/login.vue index e5df6cc3..0682e309 100644 --- a/ayanova/src/views/login.vue +++ b/ayanova/src/views/login.vue @@ -73,7 +73,7 @@ export default { }; }, created() { - this.$gzevent.$emit("menu-change", { + window.$gz.eventbus.$emit("menu-change", { isMain: true, icon: "", title: "" diff --git a/ayanova/src/views/notfound.vue b/ayanova/src/views/notfound.vue index 247aa5a2..58417052 100644 --- a/ayanova/src/views/notfound.vue +++ b/ayanova/src/views/notfound.vue @@ -16,7 +16,7 @@