This commit is contained in:
@@ -45,9 +45,7 @@ CURRENT ROADMAP
|
|||||||
CURRENT TODOs
|
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
|
TODO: Form customization
|
||||||
|
|
||||||
|
|||||||
@@ -200,40 +200,50 @@ export default {
|
|||||||
|
|
||||||
//clear any errors vm might be around from previous submit
|
//clear any errors vm might be around from previous submit
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(this);
|
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:
|
//Create template data object here....
|
||||||
vm.$router.replace(vm.$route.fullPath.slice(0, -1) + res.data.id);
|
//Rules:
|
||||||
} else {
|
console.log("Template from server:");
|
||||||
//Handle "put" of an existing record (UPDATE)
|
console.log(
|
||||||
vm.obj.concurrencyToken = res.data.concurrencyToken;
|
window.$gz.store.state.formCustomTemplate[this.formCustomTemplateKey]
|
||||||
window.$gz.form.setFormState({
|
);
|
||||||
vm: vm,
|
console.log("Working object:");
|
||||||
dirty: false
|
console.log(this.obj);
|
||||||
});
|
|
||||||
}
|
// window.$gz.api
|
||||||
}
|
// .upsert(url, this.obj)
|
||||||
})
|
// .then(res => {
|
||||||
.catch(function handleSubmitError(error) {
|
// vm.formState.loading = false;
|
||||||
vm.formState.loading = false;
|
// if (res.error != undefined) {
|
||||||
window.$gz.errorHandler.handleFormError(error, vm);
|
// 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) {
|
if (m.owner == FORM_KEY && !m.disabled) {
|
||||||
switch (m.key) {
|
switch (m.key) {
|
||||||
case "save":
|
case "save":
|
||||||
alert("STUB: SAVE");
|
m.vm.submit();
|
||||||
// m.vm.submit();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user