From 5dfb97759aecb4ec0ef468ade226a413ad794e3f Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 17 Jun 2019 23:15:23 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 6 +- ayanova/src/api/locale.js | 4 + ayanova/src/views/inventory-widget-edit.vue | 141 +++++++++++++++----- 3 files changed, 115 insertions(+), 36 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 8253742f..c1900a4e 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -4,7 +4,7 @@ Success is the ability to go from failure to failure without loss of enthusiasm "A smooth sea never made a skilled sailor" Franklin D. Roosevelt - +"Every man has two lives, and the second starts when he realizes he has just one" ~ Confucius BIG PLAN @@ -71,7 +71,9 @@ DONE (NEEDS re-test ON MOBILE for appearance and functionality): Reports - stub - If I use the library dialog component and figure it out in theory it will just popup when required and not pollute the shell template with anything. I guess it inserts itself into the dom. - I have a question in to the developer about how to do the example with templates here: https://github.com/yariksav/vuetify-dialog/issues/39 - The vuetify dialog example I would use is here: https://vuetifyjs.com/en/components/dialogs#form and the top one without activator here: https://vuetifyjs.com/en/components/dialogs#without-activator -#### HAPPY MONDAY MUTHAFUCKA! TODO: Fill selection boxes, autocomplete handling etc +TODO: For form initialization modify widget edit make an simple init call for onCreate + - Init should be promisified and have a chain of promises for form initialization so async stuff can properly finalize before init is done and code moves on +TODO: Fill selection boxes, autocomplete handling etc - Use the enumpicklist route to get a list of roles and use it for the widget UI - Do I cache that shit? Cache invalidation is hard. - Also what is the best way to load that stuff, some will be unbounded and should be done through autofill / search route, but some are static like the roles and rarely change and small so they might as well just load all at once. diff --git a/ayanova/src/api/locale.js b/ayanova/src/api/locale.js index 4aaf58de..50d8815d 100644 --- a/ayanova/src/api/locale.js +++ b/ayanova/src/api/locale.js @@ -24,6 +24,8 @@ export default { } if (needIt.length == 0) { + //eslint-disable-next-line + debugger; resolve(); return; } @@ -36,6 +38,8 @@ export default { _.forEach(response.data, function commitFetchedLTItemToStore(item) { store.commit("addLocaleText", item); }); + //eslint-disable-next-line + debugger; resolve(); }); }); diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index 14112231..3ca02396 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -266,51 +266,124 @@ function generateMenu(vm) { var JUST_DELETED = false; +////////////////////// +// +// +function initForm(vm) { + return populatePickLists(vm).then(() => { + return fetchLocaleText(vm); + //eslint-disable-next-line + debugger; + }); + //return fetchLocaleText().then(populatePickLists(vm)); +} + +function populatePickLists(vm) { + return vm.$gzapi + .get("AyaEnumPickList/list/authorizationroles") //roles + .then(res => { + if (res.error) { + throw res.error; + } + //populate here but for now show it + //eslint-disable-next-line + debugger; + }); +} + +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).then(() => { + //eslint-disable-next-line + debugger; + }); +} + export default { beforeCreate() { //console.log("BEFORECREATE: TOP"); - - //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" - ]; var vm = this; - this.$gzlocale - .fetch(ltKeysRequired) + initForm(this) .then(() => { - //populate all form pick list data - - //don't have access to local data object until here + //eslint-disable-next-line + debugger; vm.formState.ready = true; }) .catch(err => { vm.formState.ready = true; vm.$gzHandleFormError(err); }); + + // //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" + // ]; + + // this.$gzlocale + // .fetch(ltKeysRequired) + // .then(() => { + // //populate all form pick list data + // populatePickLists().then(() => { + // //don't have access to local data object until here + // vm.formState.ready = true; + // }); + // }) + // .catch(err => { + // vm.formState.ready = true; + // vm.$gzHandleFormError(err); + // }); }, created() { // console.log("CREATED: TOP");