diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index b2e34411..48d2b392 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -45,9 +45,7 @@ CURRENT ROADMAP CURRENT TODOs =-=-=-=-=-=-= -Happy monday!! -In the midst of custom form saving which also requires a little modification in the server see FormCustomBiz GetAsync for details -then back here to code out the PUT route save of the form and also update local store. + TODO: Form customization diff --git a/ayanova/src/views/customize.vue b/ayanova/src/views/customize.vue index edca316a..a1c2edd7 100644 --- a/ayanova/src/views/customize.vue +++ b/ayanova/src/views/customize.vue @@ -200,40 +200,50 @@ export default { //clear any errors vm might be around from previous submit window.$gz.form.deleteAllErrorBoxErrors(this); - window.$gz.api - .upsert(url, this.obj) - .then(res => { - vm.formState.loading = false; - if (res.error != undefined) { - vm.formState.serverError = res.error; - window.$gz.form.setErrorBoxErrors(vm); - } else { - //Logic for detecting if a post or put: if id then it was a post, if no id then it was a put - if (res.data.id) { - //Handle "post" of new record (CREATE) - vm.obj = res.data; - window.$gz.form.setFormState({ - vm: vm, - dirty: false, - readOnly: res.readOnly ? true : false - }); - //change url to new record but don't actually navigate, replace current url with same url but with the actual id at the end instead of zero: - vm.$router.replace(vm.$route.fullPath.slice(0, -1) + res.data.id); - } else { - //Handle "put" of an existing record (UPDATE) - vm.obj.concurrencyToken = res.data.concurrencyToken; - window.$gz.form.setFormState({ - vm: vm, - dirty: false - }); - } - } - }) - .catch(function handleSubmitError(error) { - vm.formState.loading = false; - window.$gz.errorHandler.handleFormError(error, vm); - }); + //Create template data object here.... + //Rules: + console.log("Template from server:"); + console.log( + window.$gz.store.state.formCustomTemplate[this.formCustomTemplateKey] + ); + console.log("Working object:"); + console.log(this.obj); + + // window.$gz.api + // .upsert(url, this.obj) + // .then(res => { + // vm.formState.loading = false; + // if (res.error != undefined) { + // vm.formState.serverError = res.error; + // window.$gz.form.setErrorBoxErrors(vm); + // } else { + // //Logic for detecting if a post or put: if id then it was a post, if no id then it was a put + // if (res.data.id) { + // //Handle "post" of new record (CREATE) + // vm.obj = res.data; + // window.$gz.form.setFormState({ + // vm: vm, + // dirty: false, + // readOnly: res.readOnly ? true : false + // }); + + // //change url to new record but don't actually navigate, replace current url with same url but with the actual id at the end instead of zero: + // vm.$router.replace(vm.$route.fullPath.slice(0, -1) + res.data.id); + // } else { + // //Handle "put" of an existing record (UPDATE) + // vm.obj.concurrencyToken = res.data.concurrencyToken; + // window.$gz.form.setFormState({ + // vm: vm, + // dirty: false + // }); + // } + // } + // }) + // .catch(function handleSubmitError(error) { + // vm.formState.loading = false; + // window.$gz.errorHandler.handleFormError(error, vm); + // }); } } }; @@ -253,8 +263,7 @@ function clickHandler(menuItem) { if (m.owner == FORM_KEY && !m.disabled) { switch (m.key) { case "save": - alert("STUB: SAVE"); - // m.vm.submit(); + m.vm.submit(); break; default: