This commit is contained in:
2021-04-15 20:42:21 +00:00
parent 7ffedfb152
commit cb3ea49a32
4 changed files with 27 additions and 13 deletions

View File

@@ -235,7 +235,11 @@ OVERALL
- woitem must show error indicator in row if error is in it's children so user knows where to go
`Items[${activeWoItemIndex}].scheduledUsers[
${activeItemIndex}
].estimatedQuantity`
Items[3].scheduledUsers[ 0 ].estimatedQuantity
target: "Items[3].scheduledUsers[0].EstimatedQuantity"
- test partial save (### and delete ###) with fail at each level (make up a fail if have to at server)
- Error messages should display correctly both in alert box and in each item's controls

View File

@@ -52,6 +52,11 @@
</v-col>
</template>
<template v-if="activeItemIndex != null">
{{
`Items[${activeWoItemIndex}].scheduledUsers[
${activeItemIndex}
].estimatedQuantity`
}}
<v-col cols="12" sm="6" lg="4" xl="3">
<gz-decimal
v-model="
@@ -65,9 +70,7 @@
:error-messages="
form().serverErrors(
this,
`Items[${activeWoItemIndex}].scheduledUsers[
${activeItemIndex}
].estimatedQuantity`
`Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].estimatedQuantity`
)
"
:rules="[

View File

@@ -58,7 +58,9 @@
v-model="value.items[activeItemIndex].notes"
:readonly="formState.readOnly"
:label="$ay.t('WorkOrderItemSummary')"
:error-messages="form().serverErrors(this, 'notes')"
:error-messages="
form().serverErrors(this, `items[${activeItemIndex}].notes`)
"
ref="notes"
data-cy="notes"
@input="fieldValueChanged('notes')"

View File

@@ -487,7 +487,7 @@ export default {
//handle errors
if (err.error) {
//# FAIL ROUTE
console.log("DISPLAY RES ERROR: ", err);
console.log("RAW ERROR OBJECT: ", err);
//REHYDRATE ERRORS
//convert to form() error handling understood format
let compiledError = {
@@ -501,22 +501,27 @@ export default {
if (err.state != null) {
compiledError.details.push(err.state);
}
//bugbug: details is an array inside so there could be multiple errors for that target so need to iterate it inside the iteration
//wouldn't this just be easier to do directly inside the saves themselves??
//why compile it at all, why not make it directly ready to display at the end, there's no other use for this info really
err.items.forEach(z =>
compiledError.details.push({
message: z.e.details.message,
error: z.e.details.error,
target: `Items[${z.objectIndex}].${z.e.details.target}`
message: z.e.details[0].message,
error: z.e.details[0].error,
target: `Items[${z.objectIndex}].${z.e.details[0].target}`
})
);
err.scheduledUsers.forEach(z =>
compiledError.details.push({
message: z.e.details.message,
error: z.e.details.error,
target: `Items[${z.woItemIndex}].scheduledUsers[${z.objectIndex}].${z.e.details.target}`
message: z.e.details[0].message,
error: z.e.details[0].error,
target: `Items[${z.woItemIndex}].scheduledUsers[${z.objectIndex}].${z.e.details[0].target}`
})
);
console.log("Compiled error ", compiledError);
vm.formState.serverError = compiledError;
window.$gz.form.setErrorBoxErrors(vm);