This commit is contained in:
2019-12-06 21:58:45 +00:00
parent 221f2ef338
commit 10437c4ca4
2 changed files with 55 additions and 2 deletions

View File

@@ -44,10 +44,22 @@ 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
- When go to save then synthesize the record to send back
- Update the Store on success
- Do not add any custom fields not set to be displayed, their mere presence in teh template means they are to be displayed
- SAVE
- Update the Store on success
- Do not add any custom fields not set to be displayed, their mere presence in teh template means they are to be displayed
- POST vs PUT? Is post ever appropriate? Shouldn't every form have a custom if it can already and if it's fetched and doesn't exist make one?
- Maybe need to modify the db init code in server to also create formCustom for every possible formCustom object and then only have a PUT route, no post?
- Perhaps GET route will create one automatically if it's something that should exist but doesn't and return that? Dynamically?
- Saves data storage for unused forms, but really that won't be shit anyway so...?
TODO: HELP LINKS
- Make sure each form has a unique help link and also make a stub page in the documentation for that help link to be filled in later or now if applicable

View File

@@ -193,6 +193,47 @@ export default {
//nothing to scan here just set form dirty
this.formState.dirty = true;
enableSaveButton();
},
submit() {
var vm = this;
var url = API_BASE_URL + this.$route.params.id;
//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);
});
}
}
};