This commit is contained in:
@@ -686,8 +686,9 @@ export default {
|
||||
// user opens child edit form to see exact error)
|
||||
//
|
||||
childRowHasError(vm, collectionName, rowIndex) {
|
||||
//todo: this just shows server errors, not local form errors
|
||||
//maybe find if there is any place that records item errors (form?)
|
||||
//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
|
||||
|
||||
//No server errors?
|
||||
if (window.$gz.util.objectIsEmpty(vm.formState.serverError)) {
|
||||
@@ -707,20 +708,12 @@ export default {
|
||||
let rowErrorTargetStart = `${collectionName}[${rowIndex}].`.toLowerCase();
|
||||
|
||||
//filter in items that start with the row collection name and index provided
|
||||
let ret = vm.formState.serverError.details.some(function(o) {
|
||||
// console.log("childrowHasError:", {
|
||||
// tgt: o.target.toLowerCase(),
|
||||
// tgtstrt: rowErrorTargetStart
|
||||
// });
|
||||
return vm.formState.serverError.details.some(function(o) {
|
||||
if (!o.target) {
|
||||
return false;
|
||||
}
|
||||
let r = o.target.toLowerCase().includes(rowErrorTargetStart);
|
||||
|
||||
return r;
|
||||
return o.target.toLowerCase().includes(rowErrorTargetStart);
|
||||
});
|
||||
|
||||
return ret;
|
||||
},
|
||||
///////////////////////////////
|
||||
// ShowMe
|
||||
|
||||
@@ -850,15 +850,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
poItemsRowClasses: function(item) {
|
||||
let hasError = this.form().childRowHasError(this, "Items", item.index);
|
||||
if (hasError) {
|
||||
if (this.form().childRowHasError(this, "Items", item.index)) {
|
||||
return "error";
|
||||
}
|
||||
//console.log("row_classes", { item: item, hasError: hasError });
|
||||
//if item.index in errors collection then highlight the row
|
||||
// if (item.calories < 200) {
|
||||
// return "orange"; //can also return multiple classes e.g ["orange","disabled"]
|
||||
// }
|
||||
},
|
||||
editItem: function(item) {
|
||||
this.editPoItemIndex = item.index;
|
||||
|
||||
Reference in New Issue
Block a user