From fdcd2993b180bcc734dbd85128645b3d07235f57 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 29 Jun 2021 15:14:26 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 8 ++++ ayanova/src/views/svc-unit-model.vue | 65 ++++++++++------------------ ayanova/src/views/svc-unit.vue | 65 ++++++++++------------------ 3 files changed, 52 insertions(+), 86 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 54a9d39a..d60ba97a 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -71,6 +71,14 @@ todo: notification new bell alert count add to title so shows in task bar when n todo: browser back to new record page when make new record then go back goes to new record again, should it go to record before *new* record page instead?? +todo: link back to list from single edit form + it would be very handy to have a simple link back to the list or back a level + on each edit form. If new record then it skips that and goes to list + so maybe a specific link to list, not just a back link + ideally accessible from the form, not two click by having to open menu, but + not sure about that, maybe in wide mode it could surface that from menu but in + narrow mode no shortcut because they could use the nav menu anyway and because fuck em, that's why :) + todo: notifications form if left sitting there should auto-refresh when it gets any new notifications? not 100% sure about this one, maybe it's a nice to have feature but a waste of time otherwise diff --git a/ayanova/src/views/svc-unit-model.vue b/ayanova/src/views/svc-unit-model.vue index 6c4e116d..92f7b2d3 100644 --- a/ayanova/src/views/svc-unit-model.vue +++ b/ayanova/src/views/svc-unit-model.vue @@ -280,29 +280,33 @@ export default { vm.formState.readOnly = !vm.rights.change; window.$gz.eventBus.$on("menu-click", clickHandler); + let setDirty = false; + let setValid = true; + //id 0 means create a new record don't load one if (vm.$route.params.recordid != 0) { //is there already an obj from a prior operation? if (this.$route.params.obj) { //yes, no need to fetch it this.obj = this.$route.params.obj; - window.$gz.form.setFormState({ - vm: vm, - loading: false - }); } else { await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading } } else { - window.$gz.form.setFormState({ - vm: vm, - loading: false - }); + //Might be a duplicate and contain another record + if (this.$route.params.obj) { + this.obj = this.$route.params.obj; + this.obj.concurrency = undefined; + this.obj.id = 0; + setDirty = true; + } } + window.$gz.form.setFormState({ vm: vm, - dirty: false, - valid: true + loading: false, + dirty: setDirty, + valid: setValid }); generateMenu(vm); @@ -588,41 +592,16 @@ export default { } }, async duplicate() { - let vm = this; - if (!vm.canDuplicate || vm.$route.params.recordid == 0) { - return; - } - window.$gz.form.setFormState({ - vm: vm, - loading: true - }); - let url = API_BASE_URL + "duplicate/" + vm.$route.params.recordid; - - try { - window.$gz.form.deleteAllErrorBoxErrors(vm); - let res = await window.$gz.api.upsert(url); - if (res.error) { - vm.formState.serverError = res.error; - window.$gz.form.setErrorBoxErrors(vm); - } else { - //Navigate to new record - this.$router.push({ - name: "unit-model-edit", - params: { - recordid: res.data.id, - obj: res.data // Pass data object to new form - } - }); + //Navigate to new record + this.$router.push({ + name: "unit-model-edit", + params: { + recordid: 0, + obj: this.obj } - } catch (ex) { - window.$gz.errorHandler.handleFormError(ex, vm); - } finally { - window.$gz.form.setFormState({ - vm: vm, - loading: false - }); - } + }); } + //end methods } }; diff --git a/ayanova/src/views/svc-unit.vue b/ayanova/src/views/svc-unit.vue index 18e1c62a..3198aefc 100644 --- a/ayanova/src/views/svc-unit.vue +++ b/ayanova/src/views/svc-unit.vue @@ -737,29 +737,33 @@ export default { vm.formState.readOnly = !vm.rights.change; window.$gz.eventBus.$on("menu-click", clickHandler); + let setDirty = false; + let setValid = true; + //id 0 means create a new record don't load one if (vm.$route.params.recordid != 0) { //is there already an obj from a prior operation? if (this.$route.params.obj) { //yes, no need to fetch it this.obj = this.$route.params.obj; - window.$gz.form.setFormState({ - vm: vm, - loading: false - }); } else { await vm.getDataFromApi(vm.$route.params.recordid); //let getdata handle loading } } else { - window.$gz.form.setFormState({ - vm: vm, - loading: false - }); + //Might be a duplicate and contain another record + if (this.$route.params.obj) { + this.obj = this.$route.params.obj; + this.obj.concurrency = undefined; + this.obj.id = 0; + setDirty = true; + } } + window.$gz.form.setFormState({ vm: vm, - dirty: false, - valid: true + loading: false, + dirty: setDirty, + valid: setValid }); generateMenu(vm); @@ -1115,41 +1119,16 @@ export default { } }, async duplicate() { - let vm = this; - if (!vm.canDuplicate || vm.$route.params.recordid == 0) { - return; - } - window.$gz.form.setFormState({ - vm: vm, - loading: true - }); - let url = API_BASE_URL + "duplicate/" + vm.$route.params.recordid; - - try { - window.$gz.form.deleteAllErrorBoxErrors(vm); - let res = await window.$gz.api.upsert(url); - if (res.error) { - vm.formState.serverError = res.error; - window.$gz.form.setErrorBoxErrors(vm); - } else { - //Navigate to new record - this.$router.push({ - name: "unit-edit", - params: { - recordid: res.data.id, - obj: res.data // Pass data object to new form - } - }); + //Navigate to new record + this.$router.push({ + name: "unit-edit", + params: { + recordid: 0, + obj: this.obj } - } catch (ex) { - window.$gz.errorHandler.handleFormError(ex, vm); - } finally { - window.$gz.form.setFormState({ - vm: vm, - loading: false - }); - } + }); }, + AddressCopyPhysicalToClipBoard() { let vm = this; let ret = "";