This commit is contained in:
2021-04-12 18:49:36 +00:00
parent 07336466a2
commit 3a62c5cd26
2 changed files with 25 additions and 26 deletions

View File

@@ -232,19 +232,20 @@ BIG PICTURE STUFF
CURRENT ACTIONABLE TODOS
todo: can I turn control labels into hyperlinks for getting to feeder records? If not then need to find a way to accomplish it
e.g. can workorder status title be changed to a hyper link to status list
e.g. can projects title be turned to a hyper link to projects list
ideally not in menu because it would be a lot on a workorder and need space for wo graph subitem links
todo: failed saved on a grandchild item shouldn't preclude the rest saving
e.g. if there is a concurrency error on a child that shouldn't block the rest but a fatal error probably should
v.next? needs planning, some things should fail the whole op maybe
todo: do we need a dirty indicator at every level??
todo: "delete selected item" text instead of "Delete" for subitems
todo: workordercustomX translation keys not set yet, just copy workorderItem ones I guess
todo: need to add a popup error if attempting to save from locked to locked state and there are other changes that need to be saved
(or let error from server handle it?? Not a first class UI experience though and might be a quite common mistake)
todo: can I turn control labels into hyperlinks for getting to feeder records? If not then need to find a way to accomplish it
e.g. can workorder status title be changed to a hyper link to status list
e.g. can projects title be turned to a hyper link to projects list
ideally not in menu because it would be a lot on a workorder and need space for wo graph subitem links
todo: failed saved on a grandchild item shouldn't preclude the rest saving
e.g. if there is a concurrency error on a child that shouldn't block the rest but a fatal error probably should
v.next? needs planning, some things should fail the whole op maybe
todo: do we need a dirty indicator at every level??
todo: "delete selected item" text instead of "Delete" for subitems
todo: workordercustomX translation keys not set yet, just copy workorderItem ones I guess

View File

@@ -409,30 +409,26 @@ export default {
window.$gz.form.deleteAllErrorBoxErrors(vm);
//#######################################################
// ███████╗ █████╗ ██╗ ██╗███████╗
// ██╔════╝██╔══██╗██║ ██║██╔════╝
// ███████╗███████║██║ ██║█████╗
// ╚════██║██╔══██║╚██╗ ██╔╝██╔══╝
// ███████║██║ ██║ ╚████╔╝ ███████╗
// ╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝
//walk the tree and save dirty
//items in order
//individual save will throw on
//exception short circuiting here
//Delete flagged items first upwards from bottom of graph
//one by one individually
//then save all items downwards from top of graph
//mostly via workorderitem
//items in correct order
//########################################################
let noProblem = true;
//HEADER MUST BE SAVED FIRST IF IT's NEW
//UNSAVED HEADER MUST BE FIRST
//(otherwise there's nothing to hang the other things off of)
let headerSaved = false;
if (this.obj.concurrency == 0) {
console.log("concurrency 0, saving header");
noProblem = await saveHeader(vm);
headerSaved = true;
}
//### STATE first if unlocking only
//if moving to another locked state this will block further updates below but we're accepting that
//and user can unlock first to finish updating
//LOCKED? State must be saved first then (assuming it unlocks)
let stateSaved = false;
if (this.obj.isLockedAtServer) {
noProblem = await saveState(vm);
@@ -619,7 +615,6 @@ async function saveHeader(vm) {
}
let isPost = o.id == 0;
let res = await window.$gz.api.upsert(`${API_BASE_URL}`, o);
console.log("result of saving header is ", res);
if (res.error) {
displayResError(vm, res);
return false;
@@ -630,6 +625,9 @@ async function saveHeader(vm) {
if (isPost) {
vm.obj.id = res.data.id;
vm.obj.serial = res.data.serial;
//walk all unsaved direct children and set the workorder id so they can save
o.states.forEach(z => (z.workOrderId = o.id));
o.items.forEach(z => (z.workOrderId = o.id));
}
return true;
}