This commit is contained in:
@@ -30,7 +30,7 @@ function dealWithError(msg, vm) {
|
||||
if (vm) {
|
||||
if (vm.$gzdevmode()) {
|
||||
//make sure formState.appError is defined on data
|
||||
if (!vm.$_.has(vm, "formState.appError")) {
|
||||
if (!window.$gz._.has(vm, "formState.appError")) {
|
||||
throw "DEV ERROR errorHandler::dealWithError -> formState.appError seems to be missing from form's vue data object";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,16 +61,16 @@ export default {
|
||||
confirmDelete(vm) {
|
||||
//https://github.com/yariksav/vuetify-dialog#readme
|
||||
return vm.$dialog.warning({
|
||||
text: vm.$gzlocale.get("DeletePrompt"),
|
||||
title: vm.$gzlocale.get("Delete"),
|
||||
text: window.$gz.locale.get("DeletePrompt"),
|
||||
title: window.$gz.locale.get("Delete"),
|
||||
icon: "fa-exclamation-triangle",
|
||||
actions: [
|
||||
{
|
||||
text: vm.$gzlocale.get("Cancel"),
|
||||
text: window.$gz.locale.get("Cancel"),
|
||||
key: false
|
||||
},
|
||||
{
|
||||
text: vm.$gzlocale.get("Delete"),
|
||||
text: window.$gz.locale.get("Delete"),
|
||||
color: "red",
|
||||
key: true
|
||||
}
|
||||
@@ -81,16 +81,16 @@ export default {
|
||||
//
|
||||
confirmLeaveUnsaved(vm) {
|
||||
return vm.$dialog.warning({
|
||||
text: vm.$gzlocale.get("AreYouSureUnsavedChanges"),
|
||||
title: vm.$gzlocale.get("Leave"),
|
||||
text: window.$gz.locale.get("AreYouSureUnsavedChanges"),
|
||||
title: window.$gz.locale.get("Leave"),
|
||||
icon: "fa-exclamation-triangle",
|
||||
actions: [
|
||||
{
|
||||
text: vm.$gzlocale.get("Cancel"),
|
||||
text: window.$gz.locale.get("Cancel"),
|
||||
key: false
|
||||
},
|
||||
{
|
||||
text: vm.$gzlocale.get("Leave"),
|
||||
text: window.$gz.locale.get("Leave"),
|
||||
color: "red",
|
||||
key: true
|
||||
}
|
||||
@@ -103,12 +103,12 @@ export default {
|
||||
displayLTErrorMessage(vm, ltKeyText, ltKeyTitle = undefined) {
|
||||
//https://github.com/yariksav/vuetify-dialog#readme
|
||||
return vm.$dialog.error({
|
||||
text: ltKeyText ? vm.$gzlocale.get(ltKeyText) : "",
|
||||
title: ltKeyTitle ? vm.$gzlocale.get(ltKeyTitle) : "",
|
||||
text: ltKeyText ? window.$gz.locale.get(ltKeyText) : "",
|
||||
title: ltKeyTitle ? window.$gz.locale.get(ltKeyTitle) : "",
|
||||
icon: "fa-exclamation-triangle",
|
||||
actions: [
|
||||
{
|
||||
text: vm.$gzlocale.get("OK"),
|
||||
text: window.$gz.locale.get("OK"),
|
||||
key: true
|
||||
}
|
||||
]
|
||||
@@ -119,9 +119,9 @@ export default {
|
||||
async getReportChoice(vm, reports, preselected) {
|
||||
const result = await vm.$dialog.showAndWait(reportChooser, {
|
||||
reports: reports,
|
||||
title: vm.$gzlocale.get("Report"),
|
||||
oktext: vm.$gzlocale.get("Print"),
|
||||
canceltext: vm.$gzlocale.get("Cancel"),
|
||||
title: window.$gz.locale.get("Report"),
|
||||
oktext: window.$gz.locale.get("Print"),
|
||||
canceltext: window.$gz.locale.get("Cancel"),
|
||||
selectedvalue: preselected
|
||||
});
|
||||
return result;
|
||||
|
||||
@@ -80,11 +80,11 @@ function getControlLabel(ctrl) {
|
||||
function getErrorsForField(vm, ref) {
|
||||
var ret = [];
|
||||
if (ref == "errorbox") {
|
||||
ret = vm.$_.filter(vm.formState.serverError.details, function(o) {
|
||||
ret = window.$gz._.filter(vm.formState.serverError.details, function(o) {
|
||||
return !o.target;
|
||||
});
|
||||
} else {
|
||||
ret = vm.$_.filter(vm.formState.serverError.details, function(o) {
|
||||
ret = window.$gz._.filter(vm.formState.serverError.details, function(o) {
|
||||
if (!o.target) {
|
||||
return false;
|
||||
}
|
||||
@@ -142,11 +142,11 @@ export default {
|
||||
}
|
||||
|
||||
// "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}",
|
||||
var err = vm.$gzlocale.get("ErrorRequiredFieldEmpty");
|
||||
var err = window.$gz.locale.get("ErrorRequiredFieldEmpty");
|
||||
var fieldName = getControlLabel(ctrl);
|
||||
err = vm.$_.replace(err, "{0}", fieldName);
|
||||
err = window.$gz._.replace(err, "{0}", fieldName);
|
||||
//lodash replace only replaces first instance so need to do it twice
|
||||
err = vm.$_.replace(err, "{0}", fieldName);
|
||||
err = window.$gz._.replace(err, "{0}", fieldName);
|
||||
//Update the form status
|
||||
this.setFormState({
|
||||
vm: vm,
|
||||
@@ -174,10 +174,10 @@ export default {
|
||||
if (value.length > max) {
|
||||
//get the localized rule text
|
||||
// "ErrorFieldLengthExceeded": "{0} can not exceed {1} characters.",
|
||||
var err = vm.$gzlocale.get("ErrorFieldLengthExceeded");
|
||||
var err = window.$gz.locale.get("ErrorFieldLengthExceeded");
|
||||
var fieldName = getControlLabel(ctrl);
|
||||
err = vm.$_.replace(err, "{0}", fieldName);
|
||||
err = vm.$_.replace(err, "{1}", max);
|
||||
err = window.$gz._.replace(err, "{0}", fieldName);
|
||||
err = window.$gz._.replace(err, "{1}", max);
|
||||
//Update the form status
|
||||
this.setFormState({
|
||||
vm: vm,
|
||||
@@ -235,7 +235,7 @@ export default {
|
||||
|
||||
if (valueStart.isAfter(valueEnd)) {
|
||||
// "ErrorStartDateAfterEndDate": "Start date must be earlier than stop / end date",
|
||||
var err = vm.$gzlocale.get("ErrorStartDateAfterEndDate");
|
||||
var err = window.$gz.locale.get("ErrorStartDateAfterEndDate");
|
||||
//Update the form status
|
||||
this.setFormState({
|
||||
vm: vm,
|
||||
@@ -271,7 +271,7 @@ export default {
|
||||
}
|
||||
|
||||
// "ErrorFieldValueNotInteger": "Value must be an integer"
|
||||
var err = vm.$gzlocale.get("ErrorFieldValueNotInteger");
|
||||
var err = window.$gz.locale.get("ErrorFieldValueNotInteger");
|
||||
//Update the form status
|
||||
this.setFormState({
|
||||
vm: vm,
|
||||
@@ -288,7 +288,7 @@ export default {
|
||||
return false;
|
||||
}
|
||||
//TODO: Handle commas and spaces in numbers
|
||||
//as per vm.$gzlocale rules for numbers
|
||||
//as per window.$gz.locale rules for numbers
|
||||
|
||||
var ctrl = getControl(vm, ref);
|
||||
if (typeof ctrl == "undefined") {
|
||||
@@ -308,7 +308,7 @@ export default {
|
||||
}
|
||||
|
||||
// "ErrorFieldValueNotDecimal": "Value must be a number"
|
||||
var err = vm.$gzlocale.get("ErrorFieldValueNotDecimal");
|
||||
var err = window.$gz.locale.get("ErrorFieldValueNotDecimal");
|
||||
//Update the form status
|
||||
this.setFormState({
|
||||
vm: vm,
|
||||
@@ -324,22 +324,22 @@ export default {
|
||||
//CHECK PREREQUISITES IN DEV MODE TO ENSURE FORM ISN"T MISSING NEEDED DATA ATTRIBUTES ETC
|
||||
if (vm.$gzdevmode()) {
|
||||
//make sure formState.serverErrors is defined on data
|
||||
if (!vm.$_.has(vm, "formState.serverError")) {
|
||||
if (!window.$gz._.has(vm, "formState.serverError")) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> formState.serverError seems to be missing from form's vue data object";
|
||||
}
|
||||
|
||||
//make sure formState.appError is defined on data
|
||||
if (!vm.$_.has(vm, "formState.appError")) {
|
||||
if (!window.$gz._.has(vm, "formState.appError")) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> formState.appError seems to be missing from form's vue data object";
|
||||
}
|
||||
|
||||
//make sure formState.errorBoxMessage is defined on data
|
||||
if (!vm.$_.has(vm, "formState.errorBoxMessage")) {
|
||||
if (!window.$gz._.has(vm, "formState.errorBoxMessage")) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> formState.errorBoxMessage seems to be missing from form's vue data object";
|
||||
}
|
||||
|
||||
//ensure the error returned is in an expected format to catch coding errors at the server end
|
||||
if (!vm.$_.isEmpty(vm.formState.serverError)) {
|
||||
if (!window.$gz._.isEmpty(vm.formState.serverError)) {
|
||||
//Make sure there is an error code if there is an error collection
|
||||
if (!vm.formState.serverError.code) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> server returned error without code";
|
||||
@@ -349,7 +349,7 @@ export default {
|
||||
var ret = [];
|
||||
|
||||
//check for errors if we have any errors
|
||||
if (!vm.$_.isEmpty(vm.formState.serverError)) {
|
||||
if (!window.$gz._.isEmpty(vm.formState.serverError)) {
|
||||
//debugger;
|
||||
//First let's get the top level error code
|
||||
|
||||
@@ -358,7 +358,7 @@ export default {
|
||||
//GENERAL ERROR
|
||||
if (ref == "errorbox") {
|
||||
//Add any general errors to ret
|
||||
var err = vm.$gzlocale.get("ErrorAPI" + apiErrorCode.toString());
|
||||
var err = window.$gz.locale.get("ErrorAPI" + apiErrorCode.toString());
|
||||
if (vm.formState.serverError.message) {
|
||||
err = err + "\r\n" + vm.formState.serverError.message;
|
||||
}
|
||||
@@ -372,17 +372,17 @@ export default {
|
||||
//DETAIL ERRORS
|
||||
//{"error":{"code":"2200","details":[{"message":"Exception: Error converting value \"\" to type 'AyaNova.Biz.AUTHORIZATION_ROLES'. Path 'roles', line 1, position 141.","target":"roles","error":"2203"}],"message":"Object did not pass validation"}}
|
||||
//Specific field validation errors are in an array in "details" key
|
||||
if (!vm.$_.isEmpty(vm.formState.serverError.details)) {
|
||||
if (!window.$gz._.isEmpty(vm.formState.serverError.details)) {
|
||||
//See if this key is in the details array
|
||||
var errorsForField = getErrorsForField(vm, ref);
|
||||
|
||||
if (errorsForField.length > 0) {
|
||||
//iterate the errorsForField object and add each to return array of errors
|
||||
vm.$_.each(errorsForField, function(ve) {
|
||||
window.$gz._.each(errorsForField, function(ve) {
|
||||
var fldErr = "";
|
||||
var fldErrorCode = parseInt(ve.error);
|
||||
fldErr =
|
||||
vm.$gzlocale.get("ErrorAPI" + fldErrorCode.toString()) +
|
||||
window.$gz.locale.get("ErrorAPI" + fldErrorCode.toString()) +
|
||||
" [" +
|
||||
ve.error +
|
||||
"]";
|
||||
@@ -443,7 +443,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
//If ref appears in the formState.serverErrors details collection, remove each one
|
||||
var m = vm.$_.remove(vm.formState.serverError.details, function(o) {
|
||||
var m = window.$gz._.remove(vm.formState.serverError.details, function(o) {
|
||||
if (!o.target) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export default {
|
||||
|
||||
//LOGOUT
|
||||
vm.appBar.menuItems.push({
|
||||
title: vm.$gzlocale.get("Logout"),
|
||||
title: window.$gz.locale.get("Logout"),
|
||||
icon: "sign-out-alt",
|
||||
key: "app:logout"
|
||||
});
|
||||
@@ -48,7 +48,7 @@ export default {
|
||||
|
||||
//HELP
|
||||
vm.appBar.menuItems.push({
|
||||
title: vm.$gzlocale.get("MenuHelp"),
|
||||
title: window.$gz.locale.get("MenuHelp"),
|
||||
icon: "question-circle",
|
||||
key: "app:help",
|
||||
data: vm.appBar.helpUrl
|
||||
@@ -56,7 +56,7 @@ export default {
|
||||
|
||||
//ABOUT
|
||||
vm.appBar.menuItems.push({
|
||||
title: vm.$gzlocale.get("HelpAboutAyaNova"),
|
||||
title: window.$gz.locale.get("HelpAboutAyaNova"),
|
||||
icon: "info-circle",
|
||||
key: "app:nav:abt",
|
||||
data: "about"
|
||||
@@ -75,7 +75,7 @@ export default {
|
||||
vm.appBar.menuItems.push({ divider: true, inset: false });
|
||||
//customize
|
||||
vm.appBar.menuItems.push({
|
||||
title: vm.$gzlocale.get("Customize"),
|
||||
title: window.$gz.locale.get("Customize"),
|
||||
icon: "sliders-h",
|
||||
data: ctx.formData.ayaType,
|
||||
key: "app:customize"
|
||||
|
||||
Reference in New Issue
Block a user