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 - 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 - 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: CUSTOMIZE not working on widget edit form
TODO: CUSTOM DATE FIELD NOT SETTING NOW?? TODO: CUSTOM DATE FIELD NOT SETTING NOW??
- Retest every kind of custom field - Retest every kind of custom field

View File

@@ -284,7 +284,7 @@ export default {
// GET DATA FROM API SERVER // GET DATA FROM API SERVER
// //
get(route) { get(route) {
console.log("gzapi::get(" + route + ")"); //console.log("gzapi::get(" + route + ")");
var that = this; var that = this;
return new Promise(function getDataFromServer(resolve, reject) { return new Promise(function getDataFromServer(resolve, reject) {
fetch(that.APIUrl(route), that.fetchGetOptions()) fetch(that.APIUrl(route), that.fetchGetOptions())

View File

@@ -73,20 +73,15 @@ export default {
window.$gz.locale.fetch(ltKeysRequired).then(next); window.$gz.locale.fetch(ltKeysRequired).then(next);
}, },
beforeCreate() { beforeCreate() {
var vm = this; // var vm = this;
vm.dataListKey = this.$route.params.dataListKey; // initForm(vm)
vm.recordid = this.$route.params.recordid; // .then(() => {
//debugger; // vm.formState.ready = true;
initForm(vm) // })
.then(() => { // .catch(err => {
vm.formState.ready = true; // vm.formState.ready = true;
}) // window.$gz.errorHandler.handleFormError(err);
.catch(err => { // });
debugger;
vm.formState.ready = true;
window.$gz.errorHandler.handleFormError(err);
});
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
//var vm = this; //var vm = this;
@@ -106,18 +101,39 @@ export default {
window.$gz.eventBus.$off("menu-click", clickHandler); window.$gz.eventBus.$off("menu-click", clickHandler);
}, },
created() { created() {
window.$gz.eventBus.$on("menu-click", clickHandler); var vm = this;
//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 initForm(vm)
generateMenu(this, false); //default is never read only and passing in this vm .then(() => {
//init disable save button so it can be enabled only on edit to show dirty form vm.formState.ready = true;
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save"); 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() { data() {
return { return {
obj: [], obj: [],
recordid: undefined, recordid: 0,
dataListKey: "", dataListKey: "-",
concurrencyToken: undefined, concurrencyToken: undefined,
formCustomTemplateKey: this.$route.params.formCustomTemplateKey, formCustomTemplateKey: this.$route.params.formCustomTemplateKey,
selectedDataListSortFilter: {}, selectedDataListSortFilter: {},
@@ -160,6 +176,7 @@ export default {
enableSaveButton(); enableSaveButton();
}, },
filterChanged: function() { filterChanged: function() {
console.log(this.selectedDataListSortFilter);
alert("STUB:FILTER SELECTED"); alert("STUB:FILTER SELECTED");
// //nothing to scan here just set form dirty // //nothing to scan here just set form dirty
// this.formState.dirty = true; // this.formState.dirty = true;
@@ -309,13 +326,12 @@ function generateMenu(vm) {
// //
// //
function initForm(vm) { function initForm(vm) {
return populatePickLists(vm).then(() => { return populatePickLists(vm);
//Must use return here //If need to call more then...:
return initDataObject(vm); // .then(() => {
}); // //Must use return here
// .catch(function handlePopulatePickListError(error) { // return initDataObject(vm);
// debugger; // });
// });
} }
//////////////////// ////////////////////
@@ -323,7 +339,7 @@ function initForm(vm) {
function populatePickLists(vm) { function populatePickLists(vm) {
//http://localhost:7575/api/v8/DataListSortFilter/PickList?ListKey=TestWidgetDataList //http://localhost:7575/api/v8/DataListSortFilter/PickList?ListKey=TestWidgetDataList
return window.$gz.api return window.$gz.api
.get("DataListSortFilter/PickList?ListKey=" + vm.dataListKey) .get("DataListSortFilter/PickList?ListKey=" + vm.$route.params.dataListKey)
.then(res => { .then(res => {
if (res.error != undefined) { if (res.error != undefined) {
window.$gz.errorHandler.handleFormError(res.error, vm); window.$gz.errorHandler.handleFormError(res.error, vm);