This commit is contained in:
2021-04-15 21:05:29 +00:00
parent cb3ea49a32
commit bfeaed4635
4 changed files with 24 additions and 11 deletions

View File

@@ -685,7 +685,7 @@ export default {
// (actual errors not returned just for row indicator, // (actual errors not returned just for row indicator,
// user opens child edit form to see exact error) // user opens child edit form to see exact error)
// //
childRowHasError(vm, collectionName, rowIndex) { childRowHasError(vm, path) {
//Note: this just shows server errors, not local form validation errors //Note: this just shows server errors, not local form validation errors
//it's assumed user will fix in form or when they submit see the error come back //it's assumed user will fix in form or when they submit see the error come back
//Note: this method is easily converted to return actual errors if it ever makes sense to do that but for now I'm ok with row TTM //Note: this method is easily converted to return actual errors if it ever makes sense to do that but for now I'm ok with row TTM
@@ -702,17 +702,31 @@ export default {
return null; return null;
} }
path = path.toLowerCase();
//Might be an error, check if collectionName is in error collection //Might be an error, check if collectionName is in error collection
//this is what we're dealing with //this is what we're dealing with
// { "code": "2200", "details": [ { "message": "LT:PurchaseOrderReceiptItemQuantityReceivedErrorInvalid", "target": "Items[0].QuantityReceived", "error": "2203" } ], "message": "ErrorAPI2200" } // { "code": "2200", "details": [ { "message": "LT:PurchaseOrderReceiptItemQuantityReceivedErrorInvalid", "target": "Items[0].QuantityReceived", "error": "2203" } ], "message": "ErrorAPI2200" }
let rowErrorTargetStart = `${collectionName}[${rowIndex}].`.toLowerCase(); //and this: target: "Items[3].scheduledUsers[1].EstimatedQuantity"
// let rowErrorTargetStart = `${collectionName}[${rowIndex}].`.toLowerCase();
// console.log("childRowHasError", {
// rowErrorTargetStart: rowErrorTargetStart,
// collectionName: collectionName,
// rowIndex: rowIndex
// });
// {
// "rowErrorTargetStart": "scheduledusers[1].",
// "collectionName": "ScheduledUsers",
// "rowIndex": 1
// }
//filter in items that start with the row collection name and index provided //filter in items that start with the row collection name and index provided
return vm.formState.serverError.details.some(function(o) { return vm.formState.serverError.details.some(function(o) {
if (!o.target) { if (!o.target) {
return false; return false;
} }
return o.target.toLowerCase().includes(rowErrorTargetStart); return o.target.toLowerCase().includes(path);
}); });
}, },
/////////////////////////////// ///////////////////////////////

View File

@@ -52,11 +52,6 @@
</v-col> </v-col>
</template> </template>
<template v-if="activeItemIndex != null"> <template v-if="activeItemIndex != null">
{{
`Items[${activeWoItemIndex}].scheduledUsers[
${activeItemIndex}
].estimatedQuantity`
}}
<v-col cols="12" sm="6" lg="4" xl="3"> <v-col cols="12" sm="6" lg="4" xl="3">
<gz-decimal <gz-decimal
v-model=" v-model="
@@ -187,7 +182,9 @@ export default {
} }
}, },
itemRowClasses: function(item) { itemRowClasses: function(item) {
if (this.form().childRowHasError(this, "ScheduledUsers", item.index)) { //"Items[3].scheduledUsers[1].
const path = `Items[${this.activeWoItemIndex}].ScheduledUsers[${item.index}].`;
if (this.form().childRowHasError(this, path)) {
return "font-weight-black font-italic error--text"; return "font-weight-black font-italic error--text";
} }
} }

View File

@@ -216,7 +216,8 @@ export default {
} }
}, },
itemRowClasses: function(item) { itemRowClasses: function(item) {
if (this.form().childRowHasError(this, "Items", item.index)) { const path = `Items[${item.index}].`;
if (this.form().childRowHasError(this, path)) {
return "font-weight-black font-italic error--text"; return "font-weight-black font-italic error--text";
} }
} }

View File

@@ -1322,7 +1322,8 @@ export default {
this.requestSelectDialog = true; this.requestSelectDialog = true;
}, },
poItemsRowClasses: function(item) { poItemsRowClasses: function(item) {
if (this.form().childRowHasError(this, "Items", item.index)) { const path = `Items[${item.index}].`;
if (this.form().childRowHasError(this, path)) {
return "font-weight-black font-italic error--text"; return "font-weight-black font-italic error--text";
} }
}, },