From 649e81708623f6d65a626389fb0be22cbf6aaca8 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 26 Nov 2020 19:46:52 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 29 ++++++---------- ayanova/src/api/enums.js | 3 +- ayanova/src/api/errorhandler.js | 12 +++++-- ayanova/src/components/pick-list.vue | 3 +- ayanova/src/router.js | 2 +- ayanova/src/views/adm-license.vue | 6 ++-- ayanova/src/views/ay-about.vue | 3 +- ayanova/src/views/ay-evaluate.vue | 3 +- ayanova/src/views/ay-report-edit.vue | 3 +- ayanova/src/views/cust-customer-note.vue | 44 +++++++++++++++++++++--- 10 files changed, 75 insertions(+), 33 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 7e9e1d43..412fb6c6 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -85,6 +85,15 @@ todo: Uifielddatatype Phone and TimeSpan support at client, translation keys etc todo: input type email url phone number etc supported on device to activate? if not, it must be supported somehow so figure it out +todo: search form weirdness + ICONS + search for "abc" in imported data get a user result then the other results below do not have logos + i.e. workorder headoffice, project + needs all icons to show properly + TYPE NAMES + results for some type names show as "type 59" for example instead of "Customer note" + + ............................................................ @@ -92,26 +101,8 @@ todo: input type email url phone number etc supported on device to activate? CURRENTLY WORKING ON: Customer notes migration OUTSTANDING - +Customer note form when not coming from customer should have a link back to the customer form where the name is - todo: note list should default to order by date descending - todo: customer list should default to name alpha a-z - - todo: Search for customer note results in error due to unfinished code: - 2020-11-26 08:01:12.5541|ERROR|SERVER|Error=>Npgsql.PostgresException (0x80004005): 42703: column m.name does not exist - at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<g__ReadMessageLong|0>d.MoveNext() ---- End of stack trace from previous location --- - at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<g__ReadMessageLong|0>d.MoveNext() ---- End of stack trace from previous location --- - at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) - at Npgsql.NpgsqlDataReader.NextResult() - at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) - at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) - at AyaNova.Biz.BizObjectNameFetcherDirect.Name(AyaType ayaType, Int64 id, DbCommand cmd) in C:\data\code\raven\server\AyaNova\biz\BizObjectNameFetcherDirect.cs:line 73 - at AyaNova.Biz.BizObjectNameFetcherDirect.Name(AyaTypeId tid, DbCommand cmd) in C:\data\code\raven\server\AyaNova\biz\BizObjectNameFetcherDirect.cs:line 12 - at AyaNova.Biz.Search.DoSearchAsync(AyContext ct, Int64 translationId, AuthorizationRoles currentUserRoles, SearchRequestParameters searchParameters) in C:\data\code\raven\server\AyaNova\biz\Search.cs:line 231 - at AyaNova.Api.Controllers.SearchController.PostSearch(SearchRequestParameters searchParams) in C:\data\code\raven\server\AyaNova\Controllers\SearchController.cs:line 67 - at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) diff --git a/ayanova/src/api/enums.js b/ayanova/src/api/enums.js index a51dc27e..56a402ae 100644 --- a/ayanova/src/api/enums.js +++ b/ayanova/src/api/enums.js @@ -95,7 +95,8 @@ export default { let res = await window.$gz.api.get("enum-list/list/" + enumKey); //We never expect there to be no data here if (!res.hasOwnProperty("data")) { - throw new Error(res); + // throw new Error(res); + return Promise.reject(res); } return res.data; } diff --git a/ayanova/src/api/errorhandler.js b/ayanova/src/api/errorhandler.js index 22df189c..4307b077 100644 --- a/ayanova/src/api/errorhandler.js +++ b/ayanova/src/api/errorhandler.js @@ -32,7 +32,7 @@ function dealWithError(msg, vm) { let errMsg = "DEV MODE errorHandler.js:: Unexpected error: \r\n" + msg; // eslint-disable-next-line no-console console.error(errMsg); - //console.trace(); + //debugger; } @@ -68,8 +68,16 @@ function dealWithError(msg, vm) { // and return human readable text // function decodeError(e, vm) { + // console.log("decodeError The e object is an object:"); + // //console.log(JSON.stringify(e)); + // console.log(typeof e === "object"); + //empty? - if (e == null || e == "") { + if ( + e == null || + e == "" || + (typeof e === "object" && Object.keys(e).length === 0) + ) { return "errorHandler::decodeError - Error is unknown / empty"; } diff --git a/ayanova/src/components/pick-list.vue b/ayanova/src/components/pick-list.vue index d442013f..44adfed2 100644 --- a/ayanova/src/components/pick-list.vue +++ b/ayanova/src/components/pick-list.vue @@ -271,7 +271,8 @@ export default { vm.fetching = false; //We never expect there to be no data here if (!res.hasOwnProperty("data")) { - throw new Error(res); + //throw new Error(res); + return Promise.reject(res); } vm.searchResults = res.data; window.$gz.form.addNoSelectionItem(vm.searchResults, true); diff --git a/ayanova/src/router.js b/ayanova/src/router.js index 219a23ea..4cb210d6 100644 --- a/ayanova/src/router.js +++ b/ayanova/src/router.js @@ -174,7 +174,7 @@ export default new Router({ import(/* webpackChunkName: "cust" */ "./views/cust-customer-notes.vue") }, { - path: "/cust-customer-notes/:customerid/:recordid", + path: "/cust-customer-note/:recordid", name: "customer-note-edit", component: () => import(/* webpackChunkName: "cust" */ "./views/cust-customer-note.vue") diff --git a/ayanova/src/views/adm-license.vue b/ayanova/src/views/adm-license.vue index 0f9ce66a..35595c8e 100644 --- a/ayanova/src/views/adm-license.vue +++ b/ayanova/src/views/adm-license.vue @@ -589,14 +589,16 @@ async function initForm(vm) { let res = await window.$gz.api.get("license"); //We never expect there to be no data here if (!res.hasOwnProperty("data")) { - throw new Error(res); + return Promise.reject(res); + //throw new Error(res); } vm.currentLicenseInfo = res.data.license; res = await window.$gz.api.get("license/database-empty"); //We never expect there to be no data here if (!res.hasOwnProperty("data")) { - throw new Error(res); + return Promise.reject(res); + //throw new Error(res); } vm.dbIsEmpty = res.data; } diff --git a/ayanova/src/views/ay-about.vue b/ayanova/src/views/ay-about.vue index 39b59c9c..16f2559b 100644 --- a/ayanova/src/views/ay-about.vue +++ b/ayanova/src/views/ay-about.vue @@ -305,7 +305,8 @@ async function getServerInfo(vm) { let res = await window.$gz.api.get("server-info"); //We never expect there to be no data here if (!res.hasOwnProperty("data")) { - throw new Error(res); + //throw new Error(res); + return Promise.reject(res); } else { vm.serverInfo = res.data; } diff --git a/ayanova/src/views/ay-evaluate.vue b/ayanova/src/views/ay-evaluate.vue index 17aa8baf..d01758c4 100644 --- a/ayanova/src/views/ay-evaluate.vue +++ b/ayanova/src/views/ay-evaluate.vue @@ -205,7 +205,8 @@ export default { let res = await window.$gz.api.get("license/database-empty"); //We never expect there to be no data here if (!res.hasOwnProperty("data")) { - throw new Error(res); + return Promise.reject(res); + //throw new Error(res); } if (res.data != true) { let dialogResult = await window.$gz.dialog.confirmGeneric( diff --git a/ayanova/src/views/ay-report-edit.vue b/ayanova/src/views/ay-report-edit.vue index 6d41c6ae..9337f8bb 100644 --- a/ayanova/src/views/ay-report-edit.vue +++ b/ayanova/src/views/ay-report-edit.vue @@ -1186,7 +1186,8 @@ async function fetchReportData(vm) { let res = await window.$gz.api.upsert("report/data", reportDataOptions); //We never expect there to be no data here if (!res.hasOwnProperty("data")) { - throw new Error(res); + return Promise.reject(res); + //throw new Error(res); } else { vm.reportData = res.data; } diff --git a/ayanova/src/views/cust-customer-note.vue b/ayanova/src/views/cust-customer-note.vue index f8b39ffe..c254e9bc 100644 --- a/ayanova/src/views/cust-customer-note.vue +++ b/ayanova/src/views/cust-customer-note.vue @@ -7,7 +7,7 @@ - {{ customername }} + {{ customername }} { + window.$gz.errorHandler.handleFormError(err, vm); + }); + } } } else { vm.obj.customerId = this.$route.params.customerid; @@ -188,6 +193,15 @@ export default { } }, methods: { + goToCustomer() { + this.$router.push({ + name: "customer-edit", + params: { + recordid: this.obj.customerId + } + }); + }, + canSave: function() { return this.formState.valid && this.formState.dirty; }, @@ -233,6 +247,7 @@ export default { window.$gz.form.setErrorBoxErrors(vm); } else { vm.obj = res.data; + //modify the menu as necessary generateMenu(vm); //Update the form status @@ -502,8 +517,29 @@ async function initForm(vm) { // Ensures UI translated text is available // async function fetchTranslatedText(vm) { - await window.$gz.translation.cacheTranslations(["CustomerNoteNotes"]); + await window.$gz.translation.cacheTranslations([ + "CustomerNoteNotes", + "CustomerNoteNoteDate" + ]); +} + +/////////////////////////////////////////////////////////// +// +// +async function fetchCustomerName(vm) { + //If customer name is missing then fetch it here to display + //this will happen when this form is directly opened from a search + //or record history etc + + let res = await window.$gz.api.get( + `name/${window.$gz.type.Customer}/${vm.obj.customerId}` + ); + + //We never expect there to be no data here + if (!res.hasOwnProperty("data")) { + return Promise.reject(res); + } else { + vm.customername = res.data; + } } - -