This commit is contained in:
2021-01-07 19:13:13 +00:00
parent e8f94c3c71
commit b3d2accf1c
3 changed files with 15 additions and 13 deletions

View File

@@ -84,6 +84,8 @@ function getControlLabel(ctrl) {
// from server error collection // from server error collection
// //
function getErrorsForField(vm, ref) { function getErrorsForField(vm, ref) {
//Note: to debug this on forms just put {{ formState.serverError }}
//on the form to see what is actually stored there and should be showing
let ret = []; let ret = [];
if (ref == "generalerror") { if (ref == "generalerror") {
ret = vm.formState.serverError.details.filter( ret = vm.formState.serverError.details.filter(

View File

@@ -11,7 +11,7 @@
item-text="name" item-text="name"
item-value="id" item-value="id"
item-disabled="!active" item-disabled="!active"
:error-messages="errors" :error-messages="errorMessages"
:loading="fetching" :loading="fetching"
:placeholder="$ay.t('Search')" :placeholder="$ay.t('Search')"
:search-input.sync="searchEntry" :search-input.sync="searchEntry"
@@ -25,7 +25,7 @@
> >
<template v-slot:prepend-item v-if="hasError()"> <template v-slot:prepend-item v-if="hasError()">
<div class="pl-2"> <div class="pl-2">
<span class="error--text"> {{ errors[0] }}</span> <span class="error--text"> {{ entryError }}</span>
</div> </div>
</template> </template>
@@ -47,7 +47,7 @@ export default {
data() { data() {
return { return {
searchResults: [], searchResults: [],
errors: [], entryError: null,
searchEntry: null, searchEntry: null,
lastSelection: null, lastSelection: null,
fetching: false, fetching: false,
@@ -61,7 +61,7 @@ export default {
type: Number, type: Number,
default: null default: null
}, },
errorMessages: { type: Array, default: null },
readonly: { type: Boolean, default: false }, readonly: { type: Boolean, default: false },
disabled: { type: Boolean, default: false }, disabled: { type: Boolean, default: false },
ayaType: { ayaType: {
@@ -102,7 +102,7 @@ export default {
}, },
searchEntry(val, oldVal) { searchEntry(val, oldVal) {
let vm = this; let vm = this;
//clear any local errors //clear any local entryError
vm.clearErrors(); vm.clearErrors();
//if the search entry is in the results list then it's a drop down selection not a typed search so bail //if the search entry is in the results list then it's a drop down selection not a typed search so bail
for (let i = 0; i < vm.searchResults.length; i++) { for (let i = 0; i < vm.searchResults.length; i++) {
@@ -121,7 +121,7 @@ export default {
this.doSearch(val); this.doSearch(val);
}, },
errors(val) { entryError(val) {
if (this.hasError()) { if (this.hasError()) {
this.errorIcon = "$ayiQuestionCircle"; this.errorIcon = "$ayiQuestionCircle";
} else { } else {
@@ -134,10 +134,10 @@ export default {
return this.lastSelection; return this.lastSelection;
}, },
hasError: function() { hasError: function() {
return this.errors.length > 0; return this.entryError != null;
}, },
clearErrors: function() { clearErrors: function() {
this.errors = []; this.entryError = null;
}, },
handleErrorClick: function() { handleErrorClick: function() {
//open help nav for picklist //open help nav for picklist
@@ -319,7 +319,7 @@ export default {
if (searchFor.includes(" ")) { if (searchFor.includes(" ")) {
queryTerms = searchFor.split(" "); queryTerms = searchFor.split(" ");
if (queryTerms.length > 2) { if (queryTerms.length > 2) {
vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid")); vm.entryError = vm.$ay.t("ErrorPickListQueryInvalid");
return; return;
} }
isATwoTermQuery = true; isATwoTermQuery = true;
@@ -355,7 +355,7 @@ export default {
queryTerms[0].startsWith("..") && queryTerms[0].startsWith("..") &&
queryTerms[1].startsWith("..") queryTerms[1].startsWith("..")
) { ) {
vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid")); vm.entryError = vm.$ay.t("ErrorPickListQueryInvalid");
return; return;
} }
@@ -364,7 +364,7 @@ export default {
!queryTerms[0].startsWith("..") && !queryTerms[0].startsWith("..") &&
!queryTerms[1].startsWith("..") !queryTerms[1].startsWith("..")
) { ) {
vm.errors.push(vm.$ay.t("ErrorPickListQueryInvalid")); vm.entryError = vm.$ay.t("ErrorPickListQueryInvalid");
return; return;
} }
} }

View File

@@ -1,5 +1,6 @@
<template> <template>
<div> <div>
{{ formState.serverError }}
<gz-report-selector ref="reportSelector"></gz-report-selector> <gz-report-selector ref="reportSelector"></gz-report-selector>
<div v-if="formState.ready"> <div v-if="formState.ready">
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error> <gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
@@ -73,7 +74,6 @@
> >
<gz-pick-list <gz-pick-list
:ayaType="ayaTypes().Unit" :ayaType="ayaTypes().Unit"
:variant="'customerid:' + obj.customerId"
:showEditIcon="true" :showEditIcon="true"
v-model="obj.unitId" v-model="obj.unitId"
:readonly="formState.readOnly" :readonly="formState.readOnly"
@@ -85,7 +85,7 @@
></gz-pick-list> ></gz-pick-list>
</v-col> </v-col>
<!-- --------------------------------- --> <!-- :variant="'customerid:' + obj.customerId" --------------------------------- -->
<v-col <v-col
v-if="form().showMe(this, 'CustomerServiceRequestDetails')" v-if="form().showMe(this, 'CustomerServiceRequestDetails')"
cols="12" cols="12"