This commit is contained in:
2020-02-12 23:31:42 +00:00
parent 362e48c59e
commit 3edb54e568
3 changed files with 49 additions and 32 deletions

View File

@@ -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

View File

@@ -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())

View File

@@ -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);