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,
// 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
//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
@@ -702,17 +702,31 @@ export default {
return null;
}
path = path.toLowerCase();
//Might be an error, check if collectionName is in error collection
//this is what we're dealing with
// { "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
return vm.formState.serverError.details.some(function(o) {
if (!o.target) {
return false;
}
return o.target.toLowerCase().includes(rowErrorTargetStart);
return o.target.toLowerCase().includes(path);
});
},
///////////////////////////////