diff --git a/ayanova/src/App.vue b/ayanova/src/App.vue index c224ba18..5c676ecb 100644 --- a/ayanova/src/App.vue +++ b/ayanova/src/App.vue @@ -141,7 +141,7 @@ export default { }, beforeDestroy() { //UNWIRE ALL EVENT HANDLERS FROM GZEVENTBUS - window.$gz.eventbus.$off(); + window.$gz.eventBus.$off(); }, mounted() { //redirect to login if not authenticated @@ -174,7 +174,7 @@ export default { this.$root.$emit("triggerScroll"); }, clickMenuItem(item) { - window.$gz.eventbus.$emit("menu-click", item); + window.$gz.eventBus.$emit("menu-click", item); } } }; diff --git a/ayanova/src/api/errorhandler.js b/ayanova/src/api/errorhandler.js index 9fa5237b..1fa5e2a5 100644 --- a/ayanova/src/api/errorhandler.js +++ b/ayanova/src/api/errorhandler.js @@ -20,7 +20,7 @@ function dealWithError(msg, vm) { msg; //eslint-disable-next-line console.log(errMsg); - window.$gz.eventbus.$emit("notify-error", errMsg); + window.$gz.eventBus.$emit("notify-error", errMsg); } //If a form instance was provided (vue instance) diff --git a/ayanova/src/api/gzdialog.js b/ayanova/src/api/gzdialog.js index 09743719..a967b611 100644 --- a/ayanova/src/api/gzdialog.js +++ b/ayanova/src/api/gzdialog.js @@ -17,7 +17,7 @@ export default { /////////// //ERROR - window.$gz.eventbus.$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 - window.$gz.eventbus.$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 - window.$gz.eventbus.$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 - window.$gz.eventbus.$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/gzform.js b/ayanova/src/api/gzform.js index 4aec11f5..4b13978c 100644 --- a/ayanova/src/api/gzform.js +++ b/ayanova/src/api/gzform.js @@ -320,7 +320,7 @@ export default { // serverErrors(vm, ref) { //CHECK PREREQUISITES IN DEV MODE TO ENSURE FORM ISN"T MISSING NEEDED DATA ATTRIBUTES ETC - if (window.$gz.window.$gz.errorHandler.devMode()) { + if (window.$gz.errorHandler.devMode()) { //make sure formState.serverErrors is defined on data if (!window.$gz._.has(vm, "formState.serverError")) { throw "DEV ERROR gzform::formState.serverErrors -> formState.serverError seems to be missing from form's vue data object"; diff --git a/ayanova/src/api/gzmenu.js b/ayanova/src/api/gzmenu.js index 6bd8ca8a..18be209b 100644 --- a/ayanova/src/api/gzmenu.js +++ b/ayanova/src/api/gzmenu.js @@ -1,5 +1,4 @@ /* XXXeslint-disable */ -//import { processLogout } from "./authutil"; ///////////////////////////////// // Menu utils and handlers @@ -155,7 +154,7 @@ export default { vm.$router.push({ name: item.data }); break; default: - window.$gz.eventbus.$emit( + window.$gz.eventBus.$emit( "notify-warning", "gzmenu:handleAppClick - unrecognized command [" + menuItem.key + @@ -189,29 +188,29 @@ export default { // wireUpEventHandlers(vm) { var self = this; - window.$gz.eventbus.$on("menu-change", function handleMenuChange(ctx) { + window.$gz.eventBus.$on("menu-change", function handleMenuChange(ctx) { self.handleMenuChange(vm, ctx); }); - window.$gz.eventbus.$on("menu-replace-item", function handleReplaceMenuItem( + window.$gz.eventBus.$on("menu-replace-item", function handleReplaceMenuItem( newItem ) { self.handleReplaceMenuItem(vm, newItem); }); - window.$gz.eventbus.$on("menu-disable-item", function handleDisableMenuItem( + window.$gz.eventBus.$on("menu-disable-item", function handleDisableMenuItem( key ) { self.handleDisableMenuItem(vm, key, true); }); - window.$gz.eventbus.$on("menu-enable-item", function handleDisableMenuItem( + window.$gz.eventBus.$on("menu-enable-item", function handleDisableMenuItem( key ) { self.handleDisableMenuItem(vm, key, false); }); - window.$gz.eventbus.$on("menu-click", function handleMenuClick(menuitem) { + window.$gz.eventBus.$on("menu-click", function handleMenuClick(menuitem) { self.handleAppClick(vm, menuitem); }); } diff --git a/ayanova/src/api/gzutil.js b/ayanova/src/api/gzutil.js index f0142894..dbfd8dba 100644 --- a/ayanova/src/api/gzutil.js +++ b/ayanova/src/api/gzutil.js @@ -1,7 +1,5 @@ /* Xeslint-disable */ -import _ from "../libs/lodash.min.js"; - ///////////////////////////////// // General utility library // @@ -78,7 +76,7 @@ export default { // normalizeTag: function(tagName) { //kebab case takes care of all the things we need for tags in one go - tagName = _.kebabCase(tagName); + tagName = window.$gz._.kebabCase(tagName); //No longer than 255 characters tagName = tagName.length > 255 ? tagName.substr(0, 255 - 1) : tagName; diff --git a/ayanova/src/api/initialize.js b/ayanova/src/api/initialize.js index 430909c0..fe7d6885 100644 --- a/ayanova/src/api/initialize.js +++ b/ayanova/src/api/initialize.js @@ -1,12 +1,7 @@ /* xeslint-disable */ -import store from "../store"; -import roles from "./authorizationroles"; -import locale from "./locale"; -import api from "./gzapi"; -import gzevent from "./eventbus"; function addNavItem(title, icon, route) { - store.commit("addNavItem", { + window.$gz.store.commit("addNavItem", { title, icon, route @@ -18,83 +13,127 @@ function addNavItem(title, icon, route) { // on change of authentication status export default function initialize() { var promise = new Promise(function(resolve) { - if (store.state.authenticated) { + if (window.$gz.store.state.authenticated) { //Fetch the core localized text keys that will always be required by user - locale - .fetch(locale.coreKeys) + window.$gz.locale + .fetch(window.$gz.locale.coreKeys) .then(function putFetchedNavItemsInStore() { //put nav items into store //Everyone has a home - addNavItem(locale.get("Home"), "home", "/"); + addNavItem(window.$gz.locale.get("Home"), "home", "/"); //NOTE: If a user has read full record or better then they should have access to that area if ( - roles.hasRole(roles.AUTHORIZATION_ROLES.TechLimited) || - roles.hasRole(roles.AUTHORIZATION_ROLES.TechFull) || - roles.hasRole(roles.AUTHORIZATION_ROLES.SubContractorLimited) || - roles.hasRole(roles.AUTHORIZATION_ROLES.SubContractorFull) + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.TechLimited + ) || + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.TechFull + ) || + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.SubContractorLimited + ) || + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.SubContractorFull + ) ) { - addNavItem(locale.get("Service"), "toolbox", "/service"); + addNavItem(window.$gz.locale.get("Service"), "toolbox", "/service"); } if ( - roles.hasRole(roles.AUTHORIZATION_ROLES.DispatchLimited) || - roles.hasRole(roles.AUTHORIZATION_ROLES.DispatchFull) + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited + ) || + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.DispatchFull + ) ) { - addNavItem(locale.get("Dispatch"), "shipping-fast", "/dispatch"); - } - - if ( - roles.hasRole(roles.AUTHORIZATION_ROLES.InventoryLimited) || - roles.hasRole(roles.AUTHORIZATION_ROLES.InventoryFull) || - roles.hasRole(roles.AUTHORIZATION_ROLES.BizAdminLimited) || - roles.hasRole(roles.AUTHORIZATION_ROLES.BizAdminFull) - ) { - addNavItem(locale.get("Inventory"), "dolly", "/inventory"); - } - - if (roles.hasRole(roles.AUTHORIZATION_ROLES.AccountingFull)) { addNavItem( - locale.get("Accounting"), + window.$gz.locale.get("Dispatch"), + "shipping-fast", + "/dispatch" + ); + } + + if ( + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.InventoryLimited + ) || + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.InventoryFull + ) || + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited + ) || + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull + ) + ) { + addNavItem( + window.$gz.locale.get("Inventory"), + "dolly", + "/inventory" + ); + } + + if ( + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.AccountingFull + ) + ) { + addNavItem( + window.$gz.locale.get("Accounting"), "file-invoice-dollar", "/accounting" ); } if ( - roles.hasRole(roles.AUTHORIZATION_ROLES.BizAdminLimited) || - roles.hasRole(roles.AUTHORIZATION_ROLES.BizAdminFull) + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited + ) || + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull + ) ) { - addNavItem(locale.get("Administration"), "user-tie", "/admin"); + addNavItem( + window.$gz.locale.get("Administration"), + "user-tie", + "/admin" + ); } if ( - roles.hasRole(roles.AUTHORIZATION_ROLES.OpsAdminFull) || - roles.hasRole(roles.AUTHORIZATION_ROLES.OpsAdminLimited) + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.OpsAdminFull + ) || + window.$gz.role.hasRole( + window.$gz.role.AUTHORIZATION_ROLES.OpsAdminLimited + ) ) { - addNavItem(locale.get("Operations"), "cogs", "ops"); + addNavItem(window.$gz.locale.get("Operations"), "cogs", "ops"); } //MOVED TO MENU OUT OF NAV //Everyone can see about and logout - // addNavItem(locale.get("HelpAboutAyaNova"), "info-circle", "/about"); - // addNavItem(locale.get("Logout"), "sign-out-alt", "/login"); + // addNavItem(window.$gz.locale.get("HelpAboutAyaNova"), "info-circle", "/about"); + // addNavItem(window.$gz.locale.get("Logout"), "sign-out-alt", "/login"); }) .then(() => { //CACHE LOCALE SETTINGS - api - .get("UserOptions/" + store.state.userId) + window.$gz.api + .get("UserOptions/" + window.$gz.store.state.userId) .then(res => { if (res.error != undefined) { //In a form this would trigger a bunch of validation or error display code but for here and now: //convert error to human readable string for display and popup a notification to user - var msg = api.apiErrorToHumanString(res.error); - store.commit( + var msg = window.$gz.api.apiErrorToHumanString(res.error); + window.$gz.store.commit( "logItem", "Initialize::() fetch useroptions -> error" + msg ); - gzevent.$emit("notify-error", msg); + window.$gz.eventBus.$emit("notify-error", msg); } else { //TODO: also need the other locale settings such as number and date formats etc var localOffset = new Date().getTimezoneOffset(); @@ -107,7 +146,7 @@ export default function initialize() { //so this should be a confirm prompt but for now will just show it //for now just show the message - gzevent.$emit( + window.$gz.eventBus.$emit( "notify-info", "Time zone offset for this account is set to " + res.data.timeZoneOffset + @@ -119,7 +158,7 @@ export default function initialize() { //Store offset in locale data //TODO: also need the other locale settings such as number and date formats etc to be added at server - store.commit("setLocale", { + window.$gz.store.commit("setLocale", { decimalSeparator: ".", currencySymbol: "$", shortDate: "YYYY-MM-DD", @@ -132,7 +171,7 @@ export default function initialize() { } }) .catch(function handleFetchUserOptionsError(error) { - store.commit( + window.$gz.store.commit( "logItem", "Initialize::() fetch useroptions -> error" + error ); @@ -140,7 +179,10 @@ export default function initialize() { }); }) .catch(function handleIntializeError(error) { - store.commit("logItem", "Initialize::() ltfetch -> error" + error); + window.$gz.store.commit( + "logItem", + "Initialize::() ltfetch -> error" + error + ); throw error; }); } diff --git a/ayanova/src/components/inventorywidgetlist.vue b/ayanova/src/components/inventorywidgetlist.vue index 6b2776f2..ba69afd9 100644 --- a/ayanova/src/components/inventorywidgetlist.vue +++ b/ayanova/src/components/inventorywidgetlist.vue @@ -207,7 +207,7 @@ export default { }); }, filterMe() { - window.$gz.eventbus.$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 f901af12..225d88e3 100644 --- a/ayanova/src/main.js +++ b/ayanova/src/main.js @@ -26,7 +26,7 @@ import gzapi from "./api/gzapi"; import gzreport from "./api/gzreport"; import gzform from "./api/gzform"; import gzformcustomtemplate from "./api/form-custom-template"; -import roles from "./api/authorizationroles"; +import authorizationroles from "./api/authorizationroles"; import gztype from "./api/ayatype"; import "@/assets/css/main.css"; @@ -47,8 +47,8 @@ window.$gz = { locale: locale, formCustomTemplate: gzformcustomtemplate, type: gztype, - role: roles, - eventbus: gzeventbus, + role: authorizationroles, + eventBus: gzeventbus, menu: gzmenu, dialog: gzdialog, util: gzutil, diff --git a/ayanova/src/views/About.vue b/ayanova/src/views/About.vue index 4c14f894..69b02825 100644 --- a/ayanova/src/views/About.vue +++ b/ayanova/src/views/About.vue @@ -161,7 +161,7 @@ function clickHandler(menuItem) { window.$gz.util.copyToClipboard(text + "\nCLIENT LOG\n" + logText); break; default: - window.$gz.eventbus.$emit( + window.$gz.eventBus.$emit( "notify-warning", "About.vue::context click: [" + m.key + "]" ); @@ -202,7 +202,7 @@ export default { .then(function() { vm.formState.ready = true; - window.$gz.eventbus.$emit("menu-change", { + window.$gz.eventBus.$emit("menu-change", { isMain: false, icon: "fa-info-circle", title: window.$gz.locale.get("HelpAboutAyaNova"), @@ -223,7 +223,7 @@ export default { } ] }); - window.$gz.eventbus.$on("menu-click", clickHandler); + window.$gz.eventBus.$on("menu-click", clickHandler); }) .catch(err => { vm.formState.ready = true; diff --git a/ayanova/src/views/Home.vue b/ayanova/src/views/Home.vue index d4f0ef8e..f08413a8 100644 --- a/ayanova/src/views/Home.vue +++ b/ayanova/src/views/Home.vue @@ -10,7 +10,7 @@ export default { HelloWorld }, beforeCreate() { - window.$gz.eventbus.$emit("menu-change", { + window.$gz.eventBus.$emit("menu-change", { isMain: true, icon: "fa-home", title: window.$gz.locale.get("Home") diff --git a/ayanova/src/views/accounting.vue b/ayanova/src/views/accounting.vue index dd064c83..c41cb162 100644 --- a/ayanova/src/views/accounting.vue +++ b/ayanova/src/views/accounting.vue @@ -10,7 +10,7 @@ export default { UnderConstruction }, beforeCreate() { - window.$gz.eventbus.$emit("menu-change", { + window.$gz.eventBus.$emit("menu-change", { isMain: true, icon: "fa-file-invoice-dollar", title: window.$gz.locale.get("Accounting") diff --git a/ayanova/src/views/administration.vue b/ayanova/src/views/administration.vue index 0dec29b7..e48d8025 100644 --- a/ayanova/src/views/administration.vue +++ b/ayanova/src/views/administration.vue @@ -10,7 +10,7 @@ export default { UnderConstruction }, beforeCreate() { - window.$gz.eventbus.$emit("menu-change", { + window.$gz.eventBus.$emit("menu-change", { isMain: true, icon: "fa-user-tie", title: window.$gz.locale.get("Administration") diff --git a/ayanova/src/views/customize.vue b/ayanova/src/views/customize.vue index ebea2607..9e9c72a7 100644 --- a/ayanova/src/views/customize.vue +++ b/ayanova/src/views/customize.vue @@ -10,7 +10,7 @@ export default { UnderConstruction }, beforeCreate() { - window.$gz.eventbus.$emit("menu-change", { + window.$gz.eventBus.$emit("menu-change", { isMain: true, icon: "sliders-h", title: window.$gz.locale.get("Customize") diff --git a/ayanova/src/views/dispatch.vue b/ayanova/src/views/dispatch.vue index 5949201e..d091915f 100644 --- a/ayanova/src/views/dispatch.vue +++ b/ayanova/src/views/dispatch.vue @@ -10,7 +10,7 @@ export default { UnderConstruction }, beforeCreate() { - window.$gz.eventbus.$emit("menu-change", { + window.$gz.eventBus.$emit("menu-change", { isMain: true, icon: "fa-shipping-fast", title: window.$gz.locale.get("Dispatch") diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index 61d0fbc0..76b9536e 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -260,7 +260,7 @@ export default { created() { this.rights = window.$gz.role.getRights(window.$gz.type.Widget); - window.$gz.eventbus.$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); @@ -307,7 +307,7 @@ export default { } }, beforeDestroy() { - window.$gz.eventbus.$off("menu-click", clickHandler); + window.$gz.eventBus.$off("menu-click", clickHandler); }, components: {}, data() { @@ -356,20 +356,20 @@ export default { //enable / disable save button var canSave = val.dirty && val.valid && !val.readOnly; if (canSave) { - window.$gz.eventbus.$emit("menu-enable-item", FORM_KEY + ":save"); + window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save"); } else { - window.$gz.eventbus.$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) { - window.$gz.eventbus.$emit( + window.$gz.eventBus.$emit( "menu-enable-item", FORM_KEY + ":duplicate" ); } else { - window.$gz.eventbus.$emit( + window.$gz.eventBus.$emit( "menu-disable-item", FORM_KEY + ":duplicate" ); @@ -598,7 +598,7 @@ function clickHandler(menuItem) { .getReportChoice(m.vm, reportList, selectedItem) .then(res => { if (res) { - window.$gz.eventbus.$emit( + window.$gz.eventBus.$emit( "notify-success", FORM_KEY + "::report click, selected is: [" + res + "]" ); @@ -607,7 +607,7 @@ function clickHandler(menuItem) { break; default: - window.$gz.eventbus.$emit( + window.$gz.eventBus.$emit( "notify-warning", FORM_KEY + "::context click: [" + m.key + "]" ); @@ -666,7 +666,7 @@ function generateMenu(vm) { vm: vm }); - window.$gz.eventbus.$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 0bf8490c..aae6e55b 100644 --- a/ayanova/src/views/inventory.vue +++ b/ayanova/src/views/inventory.vue @@ -60,7 +60,7 @@ export default { }); }, created() { - window.$gz.eventbus.$emit("menu-change", { + window.$gz.eventBus.$emit("menu-change", { isMain: true, icon: "fa-dolly", title: window.$gz.locale.get("Inventory") diff --git a/ayanova/src/views/log.vue b/ayanova/src/views/log.vue index a0df2183..74046c10 100644 --- a/ayanova/src/views/log.vue +++ b/ayanova/src/views/log.vue @@ -23,7 +23,7 @@ /* Xeslint-disable */ export default { created() { - window.$gz.eventbus.$emit("menu-change", { + window.$gz.eventBus.$emit("menu-change", { isMain: false, icon: "fa-info-circle", title: window.$gz.locale.get("Log"), diff --git a/ayanova/src/views/login.vue b/ayanova/src/views/login.vue index 0682e309..d5466425 100644 --- a/ayanova/src/views/login.vue +++ b/ayanova/src/views/login.vue @@ -73,7 +73,7 @@ export default { }; }, created() { - window.$gz.eventbus.$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 d1982132..b078326d 100644 --- a/ayanova/src/views/notfound.vue +++ b/ayanova/src/views/notfound.vue @@ -16,7 +16,7 @@