diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 69525db1..6b50079d 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -346,6 +346,9 @@ CURRENTLY DOING: labors and in future Unit change may trigger this as well so make it re-usable Once this is in place, perhaps don't need the whole contract control stuff anymore since it should just handle it...right? + todo: address setting - rather than setting it *at* the client automatically shouldn't it set at the server automatically? + this would remove some weight from the client and with a forcefullrefresh system in place that will help with this as well. + todo: check contract expiry for applying!! todo: Test back end correctly sets contract on new wo and correctly sets response time (complete by date) on NEW workorder diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index 93dcea0c..566dd0c0 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -451,6 +451,10 @@ export default { const isPost = vm.obj.id == 0; + //some ops require a full refresh like ones that trigger contract changes + let forceFullRefresh = false; + let contractIdBeforeSave = vm.obj.contractId; + //reset error object this.saveResult.fatal = false; this.saveResult.errors = null; @@ -519,11 +523,21 @@ export default { } }); } else { - window.$gz.form.setFormState({ - vm: vm, - dirty: false, - valid: true - }); + //check if full refresh is necessary + if (vm.obj.contractId != contractIdBeforeSave) { + //there may be others which is why I'm doing it this way with the extra variable + forceFullRefresh = true; + } + + if (forceFullRefresh) { + await vm.getDataFromApi(vm.$route.params.recordid); + } else { + window.$gz.form.setFormState({ + vm: vm, + dirty: false, + valid: true + }); + } } } } catch (ex) { @@ -644,8 +658,6 @@ async function saveHeader(vm) { //} } else { - - //this sets 'o' to all values in assigned *except* the ones itemized with removedKey which is a fake key and just used for this trick to work //as undefined won't console.log("Header save, return data is: ", res.data);