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 - 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) - 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 - Error messages should display correctly both in alert box and in each item's controls

View File

@@ -52,6 +52,11 @@
</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="
@@ -65,9 +70,7 @@
:error-messages=" :error-messages="
form().serverErrors( form().serverErrors(
this, this,
`Items[${activeWoItemIndex}].scheduledUsers[ `Items[${activeWoItemIndex}].scheduledUsers[${activeItemIndex}].estimatedQuantity`
${activeItemIndex}
].estimatedQuantity`
) )
" "
:rules="[ :rules="[

View File

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

View File

@@ -487,7 +487,7 @@ export default {
//handle errors //handle errors
if (err.error) { if (err.error) {
//# FAIL ROUTE //# FAIL ROUTE
console.log("DISPLAY RES ERROR: ", err); console.log("RAW ERROR OBJECT: ", err);
//REHYDRATE ERRORS //REHYDRATE ERRORS
//convert to form() error handling understood format //convert to form() error handling understood format
let compiledError = { let compiledError = {
@@ -501,22 +501,27 @@ export default {
if (err.state != null) { if (err.state != null) {
compiledError.details.push(err.state); 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 => err.items.forEach(z =>
compiledError.details.push({ compiledError.details.push({
message: z.e.details.message, message: z.e.details[0].message,
error: z.e.details.error, error: z.e.details[0].error,
target: `Items[${z.objectIndex}].${z.e.details.target}` target: `Items[${z.objectIndex}].${z.e.details[0].target}`
}) })
); );
err.scheduledUsers.forEach(z => err.scheduledUsers.forEach(z =>
compiledError.details.push({ compiledError.details.push({
message: z.e.details.message, message: z.e.details[0].message,
error: z.e.details.error, error: z.e.details[0].error,
target: `Items[${z.woItemIndex}].scheduledUsers[${z.objectIndex}].${z.e.details.target}` target: `Items[${z.woItemIndex}].scheduledUsers[${z.objectIndex}].${z.e.details[0].target}`
}) })
); );
console.log("Compiled error ", compiledError);
vm.formState.serverError = compiledError; vm.formState.serverError = compiledError;
window.$gz.form.setErrorBoxErrors(vm); window.$gz.form.setErrorBoxErrors(vm);