This commit is contained in:
2020-04-02 14:21:16 +00:00
parent a81ee7d204
commit 79d52064f3
7 changed files with 89 additions and 89 deletions

View File

@@ -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];
}