From 3edb54e568d1ed8fdd8582eaba1fde10d7565480 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 12 Feb 2020 23:31:42 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 3 +- ayanova/src/api/gzapi.js | 2 +- ayanova/src/views/ay-sort-filter.vue | 76 +++++++++++++++++----------- 3 files changed, 49 insertions(+), 32 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 4f4c3c54..1427e4df 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -72,7 +72,8 @@ TODO: FILTER AT CLIENT - Make functional user settings form with all overrides so can test shit out - Need a browser check on opening the login page that will check to ensure the browser can do the date conversions properly etc and tell user browser is unsuitable if it isn't - +TODO: Created hook is probably where I should be doing the stuff I'm doing in beforeCreate hook, test if can simply move it in widget edit form to created + - Reason being that the data object is not fully set up in beforecreate but I'm putting data into it as if it is which seems weird TODO: CUSTOMIZE not working on widget edit form TODO: CUSTOM DATE FIELD NOT SETTING NOW?? - Retest every kind of custom field diff --git a/ayanova/src/api/gzapi.js b/ayanova/src/api/gzapi.js index 66df92ad..dbbd0158 100644 --- a/ayanova/src/api/gzapi.js +++ b/ayanova/src/api/gzapi.js @@ -284,7 +284,7 @@ export default { // GET DATA FROM API SERVER // get(route) { - console.log("gzapi::get(" + route + ")"); + //console.log("gzapi::get(" + route + ")"); var that = this; return new Promise(function getDataFromServer(resolve, reject) { fetch(that.APIUrl(route), that.fetchGetOptions()) diff --git a/ayanova/src/views/ay-sort-filter.vue b/ayanova/src/views/ay-sort-filter.vue index 5aaa7008..937110a2 100644 --- a/ayanova/src/views/ay-sort-filter.vue +++ b/ayanova/src/views/ay-sort-filter.vue @@ -73,20 +73,15 @@ export default { window.$gz.locale.fetch(ltKeysRequired).then(next); }, beforeCreate() { - var vm = this; - vm.dataListKey = this.$route.params.dataListKey; - vm.recordid = this.$route.params.recordid; - //debugger; - initForm(vm) - .then(() => { - vm.formState.ready = true; - }) - .catch(err => { - debugger; - - vm.formState.ready = true; - window.$gz.errorHandler.handleFormError(err); - }); + // var vm = this; + // initForm(vm) + // .then(() => { + // vm.formState.ready = true; + // }) + // .catch(err => { + // vm.formState.ready = true; + // window.$gz.errorHandler.handleFormError(err); + // }); }, beforeRouteLeave(to, from, next) { //var vm = this; @@ -106,18 +101,39 @@ export default { window.$gz.eventBus.$off("menu-click", clickHandler); }, created() { - window.$gz.eventBus.$on("menu-click", clickHandler); - //NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here - //modify the menu as necessary - generateMenu(this, false); //default is never read only and passing in this vm - //init disable save button so it can be enabled only on edit to show dirty form - window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save"); + var vm = this; + + initForm(vm) + .then(() => { + vm.formState.ready = true; + vm.dataListKey = this.$route.params.dataListKey; + vm.recordid = this.$route.params.recordid; + window.$gz.eventBus.$on("menu-click", clickHandler); + //NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here + //modify the menu as necessary + generateMenu(this, false); //default is never read only and passing in this vm + //init disable save button so it can be enabled only on edit to show dirty form + window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save"); + }) + .catch(err => { + vm.formState.ready = true; + window.$gz.errorHandler.handleFormError(err); + }); + + // vm.dataListKey = this.$route.params.dataListKey; + // vm.recordid = this.$route.params.recordid; + // window.$gz.eventBus.$on("menu-click", clickHandler); + // //NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here + // //modify the menu as necessary + // generateMenu(this, false); //default is never read only and passing in this vm + // //init disable save button so it can be enabled only on edit to show dirty form + // window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save"); }, data() { return { obj: [], - recordid: undefined, - dataListKey: "", + recordid: 0, + dataListKey: "-", concurrencyToken: undefined, formCustomTemplateKey: this.$route.params.formCustomTemplateKey, selectedDataListSortFilter: {}, @@ -160,6 +176,7 @@ export default { enableSaveButton(); }, filterChanged: function() { + console.log(this.selectedDataListSortFilter); alert("STUB:FILTER SELECTED"); // //nothing to scan here just set form dirty // this.formState.dirty = true; @@ -309,13 +326,12 @@ function generateMenu(vm) { // // function initForm(vm) { - return populatePickLists(vm).then(() => { - //Must use return here - return initDataObject(vm); - }); - // .catch(function handlePopulatePickListError(error) { - // debugger; - // }); + return populatePickLists(vm); + //If need to call more then...: + // .then(() => { + // //Must use return here + // return initDataObject(vm); + // }); } //////////////////// @@ -323,7 +339,7 @@ function initForm(vm) { function populatePickLists(vm) { //http://localhost:7575/api/v8/DataListSortFilter/PickList?ListKey=TestWidgetDataList return window.$gz.api - .get("DataListSortFilter/PickList?ListKey=" + vm.dataListKey) + .get("DataListSortFilter/PickList?ListKey=" + vm.$route.params.dataListKey) .then(res => { if (res.error != undefined) { window.$gz.errorHandler.handleFormError(res.error, vm);