From 79d52064f3c1b61dc2eb7786fc68a6de16d054ab Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 2 Apr 2020 14:21:16 +0000 Subject: [PATCH] --- ayanova/src/components/currency-control.vue | 2 +- .../src/components/custom-fields-control.vue | 12 +-- ayanova/src/components/date-control.vue | 14 +-- ayanova/src/components/gz-data-table.vue | 90 +++++++++---------- ayanova/src/components/pick-list.vue | 42 ++++----- ayanova/src/components/tag-picker.vue | 4 +- ayanova/src/components/time-control.vue | 14 +-- 7 files changed, 89 insertions(+), 89 deletions(-) diff --git a/ayanova/src/components/currency-control.vue b/ayanova/src/components/currency-control.vue index cbfca14e..fbbd9c70 100644 --- a/ayanova/src/components/currency-control.vue +++ b/ayanova/src/components/currency-control.vue @@ -51,7 +51,7 @@ export default { return window.$gz.translation; }, handleInput(value) { - var ret = parseCurrency(value, { + let ret = parseCurrency(value, { currency: this.currencyName, locale: this.languageName }); diff --git a/ayanova/src/components/custom-fields-control.vue b/ayanova/src/components/custom-fields-control.vue index ccd072f8..2b94d76e 100644 --- a/ayanova/src/components/custom-fields-control.vue +++ b/ayanova/src/components/custom-fields-control.vue @@ -182,7 +182,7 @@ export default { } }, templateHasVisibleCustomFields() { - var template = this.$store.state.formCustomTemplate[this.formKey]; + let template = this.$store.state.formCustomTemplate[this.formKey]; if (template == undefined) { return false; } @@ -195,7 +195,7 @@ export default { } //get the data out of the JSON string value - var cData = JSON.parse(this.value); + let cData = JSON.parse(this.value); //Custom field types can be changed by the user and cause old entered data to be invalid for that field type //Here we need to take action if the data is of an incompatible type for the control field type and attempt to coerce or simply nullify if not co-ercable the data @@ -206,13 +206,13 @@ export default { //Get the field data type //https://lodash.com/docs#find - var ctrlType = window.$gz._.find( + let ctrlType = window.$gz._.find( this.$store.state.formCustomTemplate[this.formKey], ["dataKey", dataKey] ).type; //First get current value for the data that came from the server - var ret = cData[dataKey]; + let ret = cData[dataKey]; //Only process if value is non-null since all control types can handle null if (ret != null) { //check types that matter @@ -279,7 +279,7 @@ export default { SetValueForField: function(dataKey, newValue) { //Get the current data out of the json string value // - var cData = JSON.parse(this.value); + let cData = JSON.parse(this.value); if (!window.$gz._.has(cData, dataKey)) { cData[dataKey] = null; } @@ -293,7 +293,7 @@ export default { } //emit the new data so it syncs with the parent source - var ret = JSON.stringify(cData); + let ret = JSON.stringify(cData); this.$emit("input", ret); } }, diff --git a/ayanova/src/components/date-control.vue b/ayanova/src/components/date-control.vue index 1f8a3d66..5a3f614f 100644 --- a/ayanova/src/components/date-control.vue +++ b/ayanova/src/components/date-control.vue @@ -68,7 +68,7 @@ export default { date() { //this tortuous fuckery is required so that the input and change events only fire on a real change, not initial page load //also it shouldn't signal a change if the values are the same and nothing was effectively changed - var hasChanged = false; + let hasChanged = false; if (this.date != this.oldDate) { hasChanged = true; } @@ -115,7 +115,7 @@ export default { }, set(value) { //2017-08-15T12:10:34.4443084+03:00 - var TimePortion = this.timeOnly; + let TimePortion = this.timeOnly; if (!TimePortion) { TimePortion = "00:00:00"; } @@ -135,15 +135,15 @@ export default { ); }, set(value) { - var DatePortion = this.dateOnly; + let DatePortion = this.dateOnly; if (!DatePortion) { - var v = new Date(); - var fullYear = v.getFullYear(); - var fullMonth = v.getMonth() + 1; + let v = new Date(); + let fullYear = v.getFullYear(); + let fullMonth = v.getMonth() + 1; if (fullMonth < 10) { fullMonth = "0" + fullMonth.toString(); } - var fullDay = v.getDate(); + let fullDay = v.getDate(); if (fullDay < 10) { fullDay = "0" + fullDay.toString(); } diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index 09a2b650..1fd5799e 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -402,8 +402,8 @@ export default { //Used by narrow view to get the "header" text for a column based on the column key getHeaderText(key) { //key format is row-column e.g."500-2" - var columnIndex = key.split("-")[1]; - var header = this.headers[columnIndex]; + let columnIndex = key.split("-")[1]; + let header = this.headers[columnIndex]; if (header && header.text) { return header.text; } @@ -436,7 +436,7 @@ export default { }, listViewChanged: function() { - var vm = this; + let vm = this; //If listview had changed it can only have changed *away* from the unsaved filter item if it's present so just remove the unsaved filter item if it exists @@ -448,13 +448,13 @@ export default { // return n.id == -1; // }); - for (var i = vm.selectLists.listViews.length - 1; i >= 0; i--) { + for (let i = vm.selectLists.listViews.length - 1; i >= 0; i--) { if (vm.selectLists.listViews[i].id === -1) { vm.selectLists.listViews.splice(i, 1); } } - var ShouldGetData = vm.dataTablePagingOptions.page == 1; + let ShouldGetData = vm.dataTablePagingOptions.page == 1; if (vm.listViewId == 0) { //default view, no saved, no cached @@ -484,7 +484,7 @@ export default { //translate key to actual object type from header data //key format is row-column e.g."500-2" //get the datatype of the column which matches the server columns array index - var typeToOpen = this.serverColumns[key.split("-")[1]].ay; + let typeToOpen = this.serverColumns[key.split("-")[1]].ay; //i is the actual AyaNova index of vm record so we have all we need to open vm object window.$gz.eventBus.$emit("openobject", { type: typeToOpen, id: i }); @@ -493,13 +493,13 @@ export default { return window.$gz.translation.get(tKey); }, getDataFromApi() { - var vm = this; + let vm = this; if (vm.loading) { return; } //start with defaults - var listOptions = { + let listOptions = { DataListKey: vm.dataListKey, Limit: 5, Offset: 0 @@ -514,10 +514,10 @@ export default { vm.loading = true; //Weird bug that causes grid to show all items selected after async method runs below to fetch data //this puts a pin in it then resets it after the fetch is completed - var preSelected = [...vm.selected]; + let preSelected = [...vm.selected]; //untokenize ListView date token criteria (if there are any) - var untokenizedListView = untokenizeListView(vm.listView); + let untokenizedListView = untokenizeListView(vm.listView); window.$gz.api .upsert(vm.apiBaseUrl, { @@ -561,7 +561,7 @@ export default { }, created() { //get pick lists - var vm = this; + let vm = this; initForm(vm).then(() => { //rehydrate last form settings @@ -579,11 +579,11 @@ function buildHeaders(columnData) { if (!columnData) { return []; } - var ret = []; + let ret = []; //iterate the columns - for (var i = 0; i < columnData.length; i++) { - var cm = columnData[i]; - var h = {}; + for (let i = 0; i < columnData.length; i++) { + let cm = columnData[i]; + let h = {}; h.text = window.$gz.translation.get(cm.cm); h.value = "columns.c" + i.toString(); //+".v"; ret.push(h); @@ -596,28 +596,28 @@ function buildHeaders(columnData) { function buildRecords(listData, columndefinitions) { //iterate data, build each object keyed with index name and display set to correct translated filter and then return - var ret = []; + let ret = []; if (!listData) { return ret; } //cache display format stuff - var timeZoneName = window.$gz.locale.getBrowserTimeZoneName(); - var languageName = window.$gz.locale.getBrowserLanguages(); - var hour12 = window.$gz.store.state.locale.hour12; - var currencyName = window.$gz.store.state.locale.currencyName; + let timeZoneName = window.$gz.locale.getBrowserTimeZoneName(); + let languageName = window.$gz.locale.getBrowserLanguages(); + let hour12 = window.$gz.store.state.locale.hour12; + let currencyName = window.$gz.store.state.locale.currencyName; //comes as an array of arrays, needs to leave as an array of objects representing each row - for (var iRow = 0; iRow < listData.length; iRow++) { - var row = listData[iRow]; + for (let iRow = 0; iRow < listData.length; iRow++) { + let row = listData[iRow]; //iterate row and build object representing row data keyed to index //first column is the default column which sets the id for the row - var o = { id: row[0].v, columns: {} }; - for (var iColumn = 0; iColumn < row.length; iColumn++) { - var column = row[iColumn]; + let o = { id: row[0].v, columns: {} }; + for (let iColumn = 0; iColumn < row.length; iColumn++) { + let column = row[iColumn]; - var dataType = columndefinitions[iColumn].dt; - var display = column.v; + let dataType = columndefinitions[iColumn].dt; + let display = column.v; /* public enum UiFieldDataType : int { @@ -690,7 +690,7 @@ function buildRecords(listData, columndefinitions) { //do nothing, allow it to stay as is (checkbox, plain text etc) } //build the row column object vm will be used by the datatable - var columnObject = { + let columnObject = { v: display, t: dataType, key: iRow + "-" + iColumn @@ -723,9 +723,9 @@ async function fetchTranslatedHeaderNames(columnData) { if (!columnData) { return; } - var headerKeys = []; - for (var i = 0; i < columnData.length; i++) { - var cm = columnData[i]; + let headerKeys = []; + for (let i = 0; i < columnData.length; i++) { + let cm = columnData[i]; headerKeys.push(cm.cm); } //Now fetch all the keys and await the response before returning @@ -742,9 +742,9 @@ async function fetchEnums(columnData) { if (!columnData) { return; } - var headerKeys = []; - for (var i = 1; i < columnData.length; i++) { - var cm = columnData[i]; + let headerKeys = []; + for (let i = 1; i < columnData.length; i++) { + let cm = columnData[i]; if (cm.et) { await window.$gz.enums.fetchEnumList(cm.et); } @@ -804,8 +804,8 @@ function fetchListView(vm) { //////////////////// // function saveFormSettings(vm) { - var unsavedlv = vm.listView; - var cachedlv = vm.listView; + let unsavedlv = vm.listView; + let cachedlv = vm.listView; if (vm.listViewId == 0) { //we aren't using any listview @@ -835,7 +835,7 @@ function saveFormSettings(vm) { //////////////////// // function loadFormSettings(vm) { - var formSettings = window.$gz.form.getFormSettings(vm.formKey); + let formSettings = window.$gz.form.getFormSettings(vm.formKey); //process SAVED formsettings if (formSettings.saved) { @@ -917,16 +917,16 @@ function untokenizeListView(lvJson) { // console.log("WE HAVE TOKENS...PROCESSING..."); //we have one or more tokens, substitute them in the filter array - var ret = []; - var lv = JSON.parse(lvJson); + let ret = []; + let lv = JSON.parse(lvJson); //iterate the incoming and copy to the outgoing directly //except if a date token filter then substitute our own filter object in place - for (var ilv = 0; ilv < lv.length; ilv++) { + for (let ilv = 0; ilv < lv.length; ilv++) { //listview object - var lvo = lv[ilv]; + let lvo = lv[ilv]; //instantiate return object - var reto = {}; + let reto = {}; //copy over field name to return object reto.fld = lvo.fld; //sort? @@ -946,9 +946,9 @@ function untokenizeListView(lvJson) { } //iterate the filter items in the source lvo object - for (var j = 0; j < lvo.filter.items.length; j++) { + for (let j = 0; j < lvo.filter.items.length; j++) { //get this filter item - var fi = lvo.filter.items[j]; + let fi = lvo.filter.items[j]; //no token shortcut if (!fi.token) { //just copy it out @@ -956,7 +956,7 @@ function untokenizeListView(lvJson) { } else { //it has a date token so let's build it out //filter item value contains the token, op is always equals - var filterDates = relativeDatefilterCalculator.tokenToDates(fi.value); + let filterDates = relativeDatefilterCalculator.tokenToDates(fi.value); //create and add a new filter item for each not undefined value //{ after: undefined, before: undefined } //AFTER DATE? diff --git a/ayanova/src/components/pick-list.vue b/ayanova/src/components/pick-list.vue index 6caad7fc..a0f6a763 100644 --- a/ayanova/src/components/pick-list.vue +++ b/ayanova/src/components/pick-list.vue @@ -79,11 +79,11 @@ export default { this.fetchValueIfNotPresent(); }, searchEntry(val, oldVal) { - var vm = this; + let vm = this; //clear any local errors vm.clearErrors(); //if the search entry is in the results list then it's a drop down selection not a typed search so bail - for (var i = 0; i < vm.searchResults.length; i++) { + for (let i = 0; i < vm.searchResults.length; i++) { if (vm.searchResults[i].name == val) { return; } @@ -133,7 +133,7 @@ export default { return "fa-plus"; }, handleEditClick: function() { - var idToOpen = 0; + let idToOpen = 0; if (this.lastSelection != null && this.lastSelection.id) { idToOpen = this.lastSelection.id; } @@ -157,13 +157,13 @@ export default { fetchValueIfNotPresent() { //is there a value that might require fetching? - var vm = this; - var val = vm.value; + let vm = this; + let val = vm.value; if (val == null) { return; } //check if it's in the list of items we have here - for (var i = 0; i < vm.searchResults.length; i++) { + for (let i = 0; i < vm.searchResults.length; i++) { if (vm.searchResults[i].id == val) { return; } @@ -173,16 +173,16 @@ export default { window.$gz.form.addNoSelectionItem(vm.searchResults); } else { //Not here, better get it - var urlParams = "?ayaType=" + vm.ayaType + "&preId=" + vm.value; + let urlParams = "?ayaType=" + vm.ayaType + "&preId=" + vm.value; vm.getList(urlParams); } }, replaceLastSelection() { - var vm = this; + let vm = this; //check if searchResults has last selection, if not then add it back in again if (vm.lastSelection == null) { //it might be initializing - for (var i = 0; i < vm.searchResults.length; i++) { + for (let i = 0; i < vm.searchResults.length; i++) { if (vm.searchResults[i].id == vm.value) { vm.lastSelection = vm.searchResults[i]; return; @@ -191,7 +191,7 @@ export default { return; } - for (var i = 0; i < vm.searchResults.length; i++) { + for (let i = 0; i < vm.searchResults.length; i++) { if (vm.searchResults[i].id == vm.lastSelection.id) { return; //already there } @@ -200,7 +200,7 @@ export default { vm.searchResults.push(vm.lastSelection); }, dropdown(e) { - var vm = this; + let vm = this; //check if we have only the initial loaded item and no selection item if (vm.searchResults.length < 3) { //get the default list @@ -224,11 +224,11 @@ export default { } //split out just the text search part - // var searchText = queryText; + // let searchText = queryText; // if (queryText.includes(" ")) { // //get the non tag part of query if possible // //ignore bad condition of too many terms - // var searchTerms = queryText.split(" "); + // let searchTerms = queryText.split(" "); // if (searchTerms[0].includes("..")) { // searchText = searchTerms[1]; // } else { @@ -237,7 +237,7 @@ export default { // } }, getList: function(urlParams) { - var vm = this; + let vm = this; if (vm.fetching) { return; } @@ -269,17 +269,17 @@ export default { //NOTE debounce with a watcher is a bit different, currently it has to be done exactly this way, nothing else will work properly //https://vuejs.org/v2/guide/migration.html#debounce-Param-Attribute-for-v-model-removed //----------------- - var vm = this; + let vm = this; //NOTE: empty query is valid; it means get the top 100 ordered by template order - var emptyQuery = false; + let emptyQuery = false; if (this.searchEntry == null || this.searchEntry == "") { emptyQuery = true; } else { //Pre-process the query to validate and send conditionally - var val = this.searchEntry; + let val = this.searchEntry; //get the discrete search terms and verify there are max two - var isATwoTermQuery = false; - var queryTerms = []; + let isATwoTermQuery = false; + let queryTerms = []; if (val.includes(" ")) { queryTerms = val.split(" "); if (queryTerms.length > 2) { @@ -334,9 +334,9 @@ export default { } //build url - var urlParams = "?ayaType=" + vm.ayaType; + let urlParams = "?ayaType=" + vm.ayaType; if (!emptyQuery) { - var query = queryTerms[0]; + let query = queryTerms[0]; if (queryTerms[1] != "[?]") { query += " " + queryTerms[1]; } diff --git a/ayanova/src/components/tag-picker.vue b/ayanova/src/components/tag-picker.vue index a363b7b2..e0f63001 100644 --- a/ayanova/src/components/tag-picker.vue +++ b/ayanova/src/components/tag-picker.vue @@ -71,7 +71,7 @@ export default { }, watch: { tagSearchEntry(val) { - var vm = this; + let vm = this; if (!val || vm.tagSearchUnderway) { return; } @@ -99,7 +99,7 @@ export default { return window.$gz.translation.get(tKey); }, addTag() { - var theTag = this.tagSearchEntry; + let theTag = this.tagSearchEntry; theTag = this.normalizeTag(theTag); //Maybe need to make sure there are no existing of the same tag? Although that shouldn't be possible technically this.sourcetags.push(theTag); diff --git a/ayanova/src/components/time-control.vue b/ayanova/src/components/time-control.vue index 76c3d316..afc8b931 100644 --- a/ayanova/src/components/time-control.vue +++ b/ayanova/src/components/time-control.vue @@ -73,7 +73,7 @@ export default { date() { //this tortuous fuckery is required so that the input and change events only fire on a real change, not initial page load //also it shouldn't signal a change if the values are the same and nothing was effectively changed - var hasChanged = false; + let hasChanged = false; if (this.date != this.oldDate) { hasChanged = true; } @@ -114,7 +114,7 @@ export default { }, set(value) { //2017-08-15T12:10:34.4443084+03:00 - var TimePortion = this.timeOnly; + let TimePortion = this.timeOnly; if (!TimePortion) { TimePortion = "00:00:00"; } @@ -134,15 +134,15 @@ export default { ); }, set(value) { - var DatePortion = this.dateOnly; + let DatePortion = this.dateOnly; if (!DatePortion) { - var v = new Date(); - var fullYear = v.getFullYear(); - var fullMonth = v.getMonth() + 1; + let v = new Date(); + let fullYear = v.getFullYear(); + let fullMonth = v.getMonth() + 1; if (fullMonth < 10) { fullMonth = "0" + fullMonth.toString(); } - var fullDay = v.getDate(); + let fullDay = v.getDate(); if (fullDay < 10) { fullDay = "0" + fullDay.toString(); }