From 5783882c029dc1836dbfe799d6f34ddee8218a87 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 16 Apr 2021 21:54:57 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 5 +++++ ayanova/src/api/gzform.js | 1 + ayanova/src/views/svc-workorder.vue | 25 +++++++++---------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 2d852c91..bb4b8acd 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -60,6 +60,11 @@ todo: cleanup unnecessary use of a ayatype access inside the Methods of objects todo: use const, not let unless need to reassign the variable Going to need a case by case through all uses but it's a very important precaution so code it that way now for all new code +todo: why the need for setErrorBoxErrors when setting the formstate errors already allows all the fields to pickup the errors for them + shouldn't the errorbox itself pickup it's own errors and elminate the need for this?? + currently is: + maybe could be this?: + might even be a drop in replacement, should test, would reduce fuckery todo: gzdecimal triggering dirty just by clicking into and out of a field witha value in it. also, it sometimes shows without the decimal then with the decimal for editing then without, it's crazy diff --git a/ayanova/src/api/gzform.js b/ayanova/src/api/gzform.js index 0268b197..5c9c7cda 100644 --- a/ayanova/src/api/gzform.js +++ b/ayanova/src/api/gzform.js @@ -721,6 +721,7 @@ export default { // childRowErrorClass // returns class to set on row if error exists for row // else returns nothing + //( called by some forms but notably not the workorder or PO which have this built in) // childRowErrorClass(vm, collectionName, rowIndex) { if (this.childRowHasError(vm, collectionName, rowIndex)) { diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index c031c683..14317f6a 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -498,7 +498,7 @@ export default { //# FAIL ROUTE vm.formState.serverError = formErrorFromSaveResult(); - window.$gz.form.setErrorBoxErrors(vm); + window.$gz.form.setErrorBoxErrors(vm); //set generalerror errors in error box at top, not related to form field errors which happen alternatively based on formState.serverError which is confusing //TODO: If it's a fatal error set accordingly and bail out here // if (err.fatal) { @@ -789,17 +789,10 @@ async function deleteScheduledUsers(vm, woItemIndex) { if (res.error) { handleSaveError({ error: res.error, - itemIndex: woItemIndex, + itemUid: vm.obj.items[woItemIndex].uid, childKey: "scheduledUsers", - childIndex: i + childUid: d.uid }); - - err.scheduledUsers.push({ - e: res.error, - objectIndex: d.objectIndex, - woItemIndex: d.woItemIndex - }); - err.error = true; } else { vm.obj.items[woItemIndex].scheduledUsers.splice(i, 1); } @@ -825,12 +818,12 @@ async function saveScheduledUsers(vm, woItemIndex, err) { o ); if (res.error) { - err.scheduledUsers.push({ - e: res.error, - objectIndex: i, - woItemIndex: woItemIndex + handleSaveError({ + error: res.error, + itemUid: vm.obj.items[woItemIndex].uid, + childKey: "scheduledUsers", + childUid: o.uid }); - err.error = true; } else { //update any server changed fields //always updated: @@ -859,7 +852,7 @@ function handleSaveError(e) { error: res.error, itemUid: item.uid, //uid of item childKey: "scheduledUsers", - childId: i //uid of child item will be located later as index + childUid: i //uid of child item will be located later as index } * */