diff --git a/ayanova/src/api/form-custom-template.js b/ayanova/src/api/form-custom-template.js index 172a03ce..5bac526d 100644 --- a/ayanova/src/api/form-custom-template.js +++ b/ayanova/src/api/form-custom-template.js @@ -34,6 +34,8 @@ export default { }); resolve(); }); + } else { + resolve(); } }); } diff --git a/ayanova/src/components/custom-fields-control.vue b/ayanova/src/components/custom-fields-control.vue index c42041df..fe882ee9 100644 --- a/ayanova/src/components/custom-fields-control.vue +++ b/ayanova/src/components/custom-fields-control.vue @@ -115,7 +115,7 @@ export default { value: String, formKey: String, //used to grab template from store readOnly: Boolean - }, + }, computed: { c2: { get: function() { @@ -154,7 +154,7 @@ export default { // var cData = JSON.parse(this.value); - //then set item in the cData + //then set item in the cData //TODO: This will likely need also to be converted because dates and stuff //initial naive attempt: (tostring is suspect) cData[dataKey] = newValue.toString(); @@ -180,10 +180,11 @@ export default { } //trigger the template fetch - + //var v=this.$store.state.formCustomTemplate[this.formKey]; }, created() { + console.log("custom-fields-control::BEFORECREATE: TOP"); if (this.$gzdevmode()) { //debugger; if (!this.formKey) { diff --git a/ayanova/src/main.js b/ayanova/src/main.js index 497ed5e9..b4e93d26 100644 --- a/ayanova/src/main.js +++ b/ayanova/src/main.js @@ -39,6 +39,11 @@ import customFieldsControl from "./components/custom-fields-control.vue"; // LIBS AND GLOBAL ITEMS // (https://medium.com/js-dojo/use-any-javascript-library-with-vue-js-3f7e2a4974a8) // +todo: move all this shit to Window.$gz as subkeys on it and then modify all the caller code that used to use vm vue property version +//then modify the inventory-widget-edit form initialization shit so that the stuff needed after form loads still happens but the before is moved to route before enter and that it's all called +//with two separate methods: One standard one for init form before it is loaded and one for init form stuff for after it's loaded. BeforeLoadInit, AfterLoadInit or something +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 }); diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index f3ecbbf4..801ca62b 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -206,19 +206,68 @@ const FORM_BASE_URL = "Widget/"; const FORM_CUSTOM_TEMPLATE_KEY = "widget"; export default { + beforeRouteEnter(to, from, next) { + //debugger; + console.log("beforeRouteEnter: TOP"); + + var ltKeysRequired = [ + "Widget", + "WidgetName", + "WidgetSerial", + "WidgetDollarAmount", + "WidgetCount", + "WidgetRoles", + "WidgetStartDate", + "WidgetEndDate", + "WidgetNotes", + "WidgetCustom1", + "WidgetCustom2", + "WidgetCustom3", + "WidgetCustom4", + "WidgetCustom5", + "WidgetCustom6", + "WidgetCustom7", + "WidgetCustom8", + "WidgetCustom9", + "WidgetCustom10", + "WidgetCustom11", + "WidgetCustom12", + "WidgetCustom13", + "WidgetCustom14", + "WidgetCustom15", + "WidgetCustom16" + ]; + + $gzlocale + .fetch(ltKeysRequired) + .then( + $gzformcustomtemplate.get(FORM_CUSTOM_TEMPLATE_KEY).then(next()) + ); + + console.log("beforeRouteEnter: BOTTOM"); + // //very important as this in conjunction with the menu options means + // //navigation guards work properly by just sending people here + // next(() => { + // auth.logout(); + // next(); + // }); + }, beforeCreate() { console.log("BEFORECREATE: TOP"); var vm = this; initForm(this) .then(() => { vm.formState.ready = true; + console.log("BEFORECREATE: INITFORM THEN"); }) .catch(err => { vm.formState.ready = true; vm.$gzHandleFormError(err); }); + console.log("BEFORECREATE: BOTTOM"); }, created() { + console.log("CREATED: TOP"); this.rights = this.$gzrole.getRights(this, this.$gztype.Widget); this.$gzevent.$on("menu-click", clickHandler); @@ -626,9 +675,7 @@ var JUST_DELETED = false; // } function initForm(vm) { - return vm.$gzformcustomtemplate.get(FORM_CUSTOM_TEMPLATE_KEY).then(fetchLocaleText(vm).then( - populatePickLists(vm)) - ); + return populatePickLists(vm); } ////////////////////// @@ -646,38 +693,38 @@ function populatePickLists(vm) { ////////////////////// // // -function fetchLocaleText(vm) { - //Cache all required lt keys - var ltKeysRequired = [ - "Widget", - "WidgetName", - "WidgetSerial", - "WidgetDollarAmount", - "WidgetCount", - "WidgetRoles", - "WidgetStartDate", - "WidgetEndDate", - "WidgetNotes", - "WidgetCustom1", - "WidgetCustom2", - "WidgetCustom3", - "WidgetCustom4", - "WidgetCustom5", - "WidgetCustom6", - "WidgetCustom7", - "WidgetCustom8", - "WidgetCustom9", - "WidgetCustom10", - "WidgetCustom11", - "WidgetCustom12", - "WidgetCustom13", - "WidgetCustom14", - "WidgetCustom15", - "WidgetCustom16" - ]; +// function fetchLocaleText(vm) { +// //Cache all required lt keys +// var ltKeysRequired = [ +// "Widget", +// "WidgetName", +// "WidgetSerial", +// "WidgetDollarAmount", +// "WidgetCount", +// "WidgetRoles", +// "WidgetStartDate", +// "WidgetEndDate", +// "WidgetNotes", +// "WidgetCustom1", +// "WidgetCustom2", +// "WidgetCustom3", +// "WidgetCustom4", +// "WidgetCustom5", +// "WidgetCustom6", +// "WidgetCustom7", +// "WidgetCustom8", +// "WidgetCustom9", +// "WidgetCustom10", +// "WidgetCustom11", +// "WidgetCustom12", +// "WidgetCustom13", +// "WidgetCustom14", +// "WidgetCustom15", +// "WidgetCustom16" +// ]; - return vm.$gzlocale.fetch(ltKeysRequired); -} +// return vm.$gzlocale.fetch(ltKeysRequired); +// }