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