From 881564f1b8051698e4d73dea6badf5cb6c7510e5 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 13 May 2021 23:35:10 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 12 +++++++++++- ayanova/src/api/gzutil.js | 17 +++++++++++++++++ ayanova/src/components/data-table.vue | 10 +++++++--- .../src/components/work-order-item-labors.vue | 2 +- ayanova/src/views/svc-workorder.vue | 7 ++----- 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index e961ea1e..07f833b9 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -57,6 +57,8 @@ todo: workorders - need to set billing and service address from customers on mig todo: custom required rules only apply to new records!! +todo: + todo: Translation: "Physical" address seems wierd, rename to Street address or Delivery address or Service Address or whatever todo: broken rules can't save should color save button red in addition to disabled some forms can't see what's what todo: Any "Priority" type value in UI that has colors should use ayaFireAlt icon instead of round circle which is for minor status only @@ -79,6 +81,13 @@ todo: REPORTING also it should be named to indicate the server is modifying the data before it's sent to the template i.e. name everything so it's clear what is being done where +todo: reporting custom fields + Joyce ran into an issue with a custom field defined as currency adn wanted to use it in a calculation on a report but it presents as a string + Look into either a helper to ease that or more ideally it presents as the type that it's supposed to be pre-modified? (not sure of the implications) + Do I have a custom fields helper already? What does it do? + Maybe translated custom fields alongside the string version?? + Users see it as currency would be just as confused as Joyce was expecting it to be a number + todo: cleanup unnecessary use of a ayatype access inside the Methods of objects as it's now available in vue via main object, e.g. where you see this: ayaTypes().XXXX you can replace it directly with this: $ay.ayt().XXXX and then REMOVE completely the ayaTypes() method in the vm of that object todo: use const, not let unless need to reassign the variable @@ -312,7 +321,8 @@ CURRENTLY DOING: labors (but involves contract change below) todo: on put needs to return object if prices updated, not just concurrency token!! prices are *always* updated contract or not bc set by choice of part, not at client any object modified at server must return object - only some won't need this + only some won't need this, but at the end they may all need it one way or another + for efficiency I guess don't return it if no change but keep an eye out todo: complete the backend contract stuff: it needs to also handle tagged specific values as well diff --git a/ayanova/src/api/gzutil.js b/ayanova/src/api/gzutil.js index 115f373c..acf66bf1 100644 --- a/ayanova/src/api/gzutil.js +++ b/ayanova/src/api/gzutil.js @@ -339,6 +339,23 @@ export default { ); }, /////////////////////////////// + // Truncate a string + //truncates and adds ellipses + // + // @param {String} source string + // @param {number} length desired + // @return {string} A new string truncated with ellipses at end + truncateString: function(s, len) { + if (this.stringIsNullOrEmpty(s)) { + return s; + } + if (s.length > len) { + return s.substring(0, len) + "..."; + } else { + return s; + } + }, + /////////////////////////////// // Format tags for display // // diff --git a/ayanova/src/components/data-table.vue b/ayanova/src/components/data-table.vue index db592106..f249639b 100644 --- a/ayanova/src/components/data-table.vue +++ b/ayanova/src/components/data-table.vue @@ -1003,9 +1003,13 @@ function buildRecords(listData, columndefinitions, ridColumnOpenable) { ); break; case 4: //text - if (display.length > MAX_TEXT_COLUMN_LENGTH) { - display = display.substring(0, MAX_TEXT_COLUMN_LENGTH) + "..."; - } + // if (display.length > MAX_TEXT_COLUMN_LENGTH) { + // display = display.substring(0, MAX_TEXT_COLUMN_LENGTH) + "..."; + // } + display = window.$gz.util.truncateString( + display, + MAX_TEXT_COLUMN_LENGTH + ); break; case 5: //Integer //display is already set, just some styling to do diff --git a/ayanova/src/components/work-order-item-labors.vue b/ayanova/src/components/work-order-item-labors.vue index c40f7639..bccfcb08 100644 --- a/ayanova/src/components/work-order-item-labors.vue +++ b/ayanova/src/components/work-order-item-labors.vue @@ -939,7 +939,7 @@ export default { this.pvm.languageName, this.pvm.currencyName ), - serviceDetails: x.serviceDetails + serviceDetails: window.$gz.util.truncateString(x.serviceDetails, 100) }; }); }, diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index 3488c0ec..c67e28b9 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -916,8 +916,7 @@ async function saveLabors(vm, woItemIndex) { for (let i = 0; i < vm.obj.items[woItemIndex].labors.length; i++) { let o = vm.obj.items[woItemIndex].labors[i]; if (o.isDirty) { - const isPost = o.id == 0; - let res = await window.$gz.api.upsert(`${API_BASE_URL}items/labors`, o); + const res = await window.$gz.api.upsert(`${API_BASE_URL}items/labors`, o); if (res.error) { handleSaveError(vm, { error: res.error, @@ -927,9 +926,7 @@ async function saveLabors(vm, woItemIndex) { }); } else { //Server will update fields on put or post for most workorder graph objecs so need to update entire object here - - vm.obj.items[woItemIndex].labors.splice(i, 1, res.data); //vue needs the splice to trigger reactivity or else the UI won't update - //vm.obj.items[woItemIndex].labors[i] = res.data; + vm.obj.items[woItemIndex].labors.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update } } }