This commit is contained in:
2021-06-29 15:14:26 +00:00
parent 2fee84f166
commit fdcd2993b1
3 changed files with 52 additions and 86 deletions

View File

@@ -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

View File

@@ -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
}
};

View File

@@ -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 = "";