This commit is contained in:
@@ -51,7 +51,7 @@ export default {
|
|||||||
return window.$gz.translation;
|
return window.$gz.translation;
|
||||||
},
|
},
|
||||||
handleInput(value) {
|
handleInput(value) {
|
||||||
var ret = parseCurrency(value, {
|
let ret = parseCurrency(value, {
|
||||||
currency: this.currencyName,
|
currency: this.currencyName,
|
||||||
locale: this.languageName
|
locale: this.languageName
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
templateHasVisibleCustomFields() {
|
templateHasVisibleCustomFields() {
|
||||||
var template = this.$store.state.formCustomTemplate[this.formKey];
|
let template = this.$store.state.formCustomTemplate[this.formKey];
|
||||||
if (template == undefined) {
|
if (template == undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get the data out of the JSON string value
|
//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
|
//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
|
//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
|
//Get the field data type
|
||||||
//https://lodash.com/docs#find
|
//https://lodash.com/docs#find
|
||||||
var ctrlType = window.$gz._.find(
|
let ctrlType = window.$gz._.find(
|
||||||
this.$store.state.formCustomTemplate[this.formKey],
|
this.$store.state.formCustomTemplate[this.formKey],
|
||||||
["dataKey", dataKey]
|
["dataKey", dataKey]
|
||||||
).type;
|
).type;
|
||||||
|
|
||||||
//First get current value for the data that came from the server
|
//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
|
//Only process if value is non-null since all control types can handle null
|
||||||
if (ret != null) {
|
if (ret != null) {
|
||||||
//check types that matter
|
//check types that matter
|
||||||
@@ -279,7 +279,7 @@ export default {
|
|||||||
SetValueForField: function(dataKey, newValue) {
|
SetValueForField: function(dataKey, newValue) {
|
||||||
//Get the current data out of the json string value
|
//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)) {
|
if (!window.$gz._.has(cData, dataKey)) {
|
||||||
cData[dataKey] = null;
|
cData[dataKey] = null;
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//emit the new data so it syncs with the parent source
|
//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);
|
this.$emit("input", ret);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export default {
|
|||||||
date() {
|
date() {
|
||||||
//this tortuous fuckery is required so that the input and change events only fire on a real change, not initial page load
|
//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
|
//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) {
|
if (this.date != this.oldDate) {
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ export default {
|
|||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
//2017-08-15T12:10:34.4443084+03:00
|
//2017-08-15T12:10:34.4443084+03:00
|
||||||
var TimePortion = this.timeOnly;
|
let TimePortion = this.timeOnly;
|
||||||
if (!TimePortion) {
|
if (!TimePortion) {
|
||||||
TimePortion = "00:00:00";
|
TimePortion = "00:00:00";
|
||||||
}
|
}
|
||||||
@@ -135,15 +135,15 @@ export default {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
var DatePortion = this.dateOnly;
|
let DatePortion = this.dateOnly;
|
||||||
if (!DatePortion) {
|
if (!DatePortion) {
|
||||||
var v = new Date();
|
let v = new Date();
|
||||||
var fullYear = v.getFullYear();
|
let fullYear = v.getFullYear();
|
||||||
var fullMonth = v.getMonth() + 1;
|
let fullMonth = v.getMonth() + 1;
|
||||||
if (fullMonth < 10) {
|
if (fullMonth < 10) {
|
||||||
fullMonth = "0" + fullMonth.toString();
|
fullMonth = "0" + fullMonth.toString();
|
||||||
}
|
}
|
||||||
var fullDay = v.getDate();
|
let fullDay = v.getDate();
|
||||||
if (fullDay < 10) {
|
if (fullDay < 10) {
|
||||||
fullDay = "0" + fullDay.toString();
|
fullDay = "0" + fullDay.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -402,8 +402,8 @@ export default {
|
|||||||
//Used by narrow view to get the "header" text for a column based on the column key
|
//Used by narrow view to get the "header" text for a column based on the column key
|
||||||
getHeaderText(key) {
|
getHeaderText(key) {
|
||||||
//key format is row-column e.g."500-2"
|
//key format is row-column e.g."500-2"
|
||||||
var columnIndex = key.split("-")[1];
|
let columnIndex = key.split("-")[1];
|
||||||
var header = this.headers[columnIndex];
|
let header = this.headers[columnIndex];
|
||||||
if (header && header.text) {
|
if (header && header.text) {
|
||||||
return header.text;
|
return header.text;
|
||||||
}
|
}
|
||||||
@@ -436,7 +436,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
listViewChanged: function() {
|
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
|
//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;
|
// 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) {
|
if (vm.selectLists.listViews[i].id === -1) {
|
||||||
vm.selectLists.listViews.splice(i, 1);
|
vm.selectLists.listViews.splice(i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var ShouldGetData = vm.dataTablePagingOptions.page == 1;
|
let ShouldGetData = vm.dataTablePagingOptions.page == 1;
|
||||||
|
|
||||||
if (vm.listViewId == 0) {
|
if (vm.listViewId == 0) {
|
||||||
//default view, no saved, no cached
|
//default view, no saved, no cached
|
||||||
@@ -484,7 +484,7 @@ export default {
|
|||||||
//translate key to actual object type from header data
|
//translate key to actual object type from header data
|
||||||
//key format is row-column e.g."500-2"
|
//key format is row-column e.g."500-2"
|
||||||
//get the datatype of the column which matches the server columns array index
|
//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
|
//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 });
|
window.$gz.eventBus.$emit("openobject", { type: typeToOpen, id: i });
|
||||||
@@ -493,13 +493,13 @@ export default {
|
|||||||
return window.$gz.translation.get(tKey);
|
return window.$gz.translation.get(tKey);
|
||||||
},
|
},
|
||||||
getDataFromApi() {
|
getDataFromApi() {
|
||||||
var vm = this;
|
let vm = this;
|
||||||
if (vm.loading) {
|
if (vm.loading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//start with defaults
|
//start with defaults
|
||||||
var listOptions = {
|
let listOptions = {
|
||||||
DataListKey: vm.dataListKey,
|
DataListKey: vm.dataListKey,
|
||||||
Limit: 5,
|
Limit: 5,
|
||||||
Offset: 0
|
Offset: 0
|
||||||
@@ -514,10 +514,10 @@ export default {
|
|||||||
vm.loading = true;
|
vm.loading = true;
|
||||||
//Weird bug that causes grid to show all items selected after async method runs below to fetch data
|
//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
|
//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)
|
//untokenize ListView date token criteria (if there are any)
|
||||||
var untokenizedListView = untokenizeListView(vm.listView);
|
let untokenizedListView = untokenizeListView(vm.listView);
|
||||||
|
|
||||||
window.$gz.api
|
window.$gz.api
|
||||||
.upsert(vm.apiBaseUrl, {
|
.upsert(vm.apiBaseUrl, {
|
||||||
@@ -561,7 +561,7 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
//get pick lists
|
//get pick lists
|
||||||
var vm = this;
|
let vm = this;
|
||||||
|
|
||||||
initForm(vm).then(() => {
|
initForm(vm).then(() => {
|
||||||
//rehydrate last form settings
|
//rehydrate last form settings
|
||||||
@@ -579,11 +579,11 @@ function buildHeaders(columnData) {
|
|||||||
if (!columnData) {
|
if (!columnData) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
var ret = [];
|
let ret = [];
|
||||||
//iterate the columns
|
//iterate the columns
|
||||||
for (var i = 0; i < columnData.length; i++) {
|
for (let i = 0; i < columnData.length; i++) {
|
||||||
var cm = columnData[i];
|
let cm = columnData[i];
|
||||||
var h = {};
|
let h = {};
|
||||||
h.text = window.$gz.translation.get(cm.cm);
|
h.text = window.$gz.translation.get(cm.cm);
|
||||||
h.value = "columns.c" + i.toString(); //+".v";
|
h.value = "columns.c" + i.toString(); //+".v";
|
||||||
ret.push(h);
|
ret.push(h);
|
||||||
@@ -596,28 +596,28 @@ function buildHeaders(columnData) {
|
|||||||
function buildRecords(listData, columndefinitions) {
|
function buildRecords(listData, columndefinitions) {
|
||||||
//iterate data, build each object keyed with index name and display set to correct translated filter and then return
|
//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) {
|
if (!listData) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//cache display format stuff
|
//cache display format stuff
|
||||||
var timeZoneName = window.$gz.locale.getBrowserTimeZoneName();
|
let timeZoneName = window.$gz.locale.getBrowserTimeZoneName();
|
||||||
var languageName = window.$gz.locale.getBrowserLanguages();
|
let languageName = window.$gz.locale.getBrowserLanguages();
|
||||||
var hour12 = window.$gz.store.state.locale.hour12;
|
let hour12 = window.$gz.store.state.locale.hour12;
|
||||||
var currencyName = window.$gz.store.state.locale.currencyName;
|
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
|
//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++) {
|
for (let iRow = 0; iRow < listData.length; iRow++) {
|
||||||
var row = listData[iRow];
|
let row = listData[iRow];
|
||||||
//iterate row and build object representing row data keyed to index
|
//iterate row and build object representing row data keyed to index
|
||||||
//first column is the default column which sets the id for the row
|
//first column is the default column which sets the id for the row
|
||||||
var o = { id: row[0].v, columns: {} };
|
let o = { id: row[0].v, columns: {} };
|
||||||
for (var iColumn = 0; iColumn < row.length; iColumn++) {
|
for (let iColumn = 0; iColumn < row.length; iColumn++) {
|
||||||
var column = row[iColumn];
|
let column = row[iColumn];
|
||||||
|
|
||||||
var dataType = columndefinitions[iColumn].dt;
|
let dataType = columndefinitions[iColumn].dt;
|
||||||
var display = column.v;
|
let display = column.v;
|
||||||
/*
|
/*
|
||||||
public enum UiFieldDataType : int
|
public enum UiFieldDataType : int
|
||||||
{
|
{
|
||||||
@@ -690,7 +690,7 @@ function buildRecords(listData, columndefinitions) {
|
|||||||
//do nothing, allow it to stay as is (checkbox, plain text etc)
|
//do nothing, allow it to stay as is (checkbox, plain text etc)
|
||||||
}
|
}
|
||||||
//build the row column object vm will be used by the datatable
|
//build the row column object vm will be used by the datatable
|
||||||
var columnObject = {
|
let columnObject = {
|
||||||
v: display,
|
v: display,
|
||||||
t: dataType,
|
t: dataType,
|
||||||
key: iRow + "-" + iColumn
|
key: iRow + "-" + iColumn
|
||||||
@@ -723,9 +723,9 @@ async function fetchTranslatedHeaderNames(columnData) {
|
|||||||
if (!columnData) {
|
if (!columnData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var headerKeys = [];
|
let headerKeys = [];
|
||||||
for (var i = 0; i < columnData.length; i++) {
|
for (let i = 0; i < columnData.length; i++) {
|
||||||
var cm = columnData[i];
|
let cm = columnData[i];
|
||||||
headerKeys.push(cm.cm);
|
headerKeys.push(cm.cm);
|
||||||
}
|
}
|
||||||
//Now fetch all the keys and await the response before returning
|
//Now fetch all the keys and await the response before returning
|
||||||
@@ -742,9 +742,9 @@ async function fetchEnums(columnData) {
|
|||||||
if (!columnData) {
|
if (!columnData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var headerKeys = [];
|
let headerKeys = [];
|
||||||
for (var i = 1; i < columnData.length; i++) {
|
for (let i = 1; i < columnData.length; i++) {
|
||||||
var cm = columnData[i];
|
let cm = columnData[i];
|
||||||
if (cm.et) {
|
if (cm.et) {
|
||||||
await window.$gz.enums.fetchEnumList(cm.et);
|
await window.$gz.enums.fetchEnumList(cm.et);
|
||||||
}
|
}
|
||||||
@@ -804,8 +804,8 @@ function fetchListView(vm) {
|
|||||||
////////////////////
|
////////////////////
|
||||||
//
|
//
|
||||||
function saveFormSettings(vm) {
|
function saveFormSettings(vm) {
|
||||||
var unsavedlv = vm.listView;
|
let unsavedlv = vm.listView;
|
||||||
var cachedlv = vm.listView;
|
let cachedlv = vm.listView;
|
||||||
|
|
||||||
if (vm.listViewId == 0) {
|
if (vm.listViewId == 0) {
|
||||||
//we aren't using any listview
|
//we aren't using any listview
|
||||||
@@ -835,7 +835,7 @@ function saveFormSettings(vm) {
|
|||||||
////////////////////
|
////////////////////
|
||||||
//
|
//
|
||||||
function loadFormSettings(vm) {
|
function loadFormSettings(vm) {
|
||||||
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
let formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||||
|
|
||||||
//process SAVED formsettings
|
//process SAVED formsettings
|
||||||
if (formSettings.saved) {
|
if (formSettings.saved) {
|
||||||
@@ -917,16 +917,16 @@ function untokenizeListView(lvJson) {
|
|||||||
|
|
||||||
// console.log("WE HAVE TOKENS...PROCESSING...");
|
// console.log("WE HAVE TOKENS...PROCESSING...");
|
||||||
//we have one or more tokens, substitute them in the filter array
|
//we have one or more tokens, substitute them in the filter array
|
||||||
var ret = [];
|
let ret = [];
|
||||||
var lv = JSON.parse(lvJson);
|
let lv = JSON.parse(lvJson);
|
||||||
|
|
||||||
//iterate the incoming and copy to the outgoing directly
|
//iterate the incoming and copy to the outgoing directly
|
||||||
//except if a date token filter then substitute our own filter object in place
|
//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
|
//listview object
|
||||||
var lvo = lv[ilv];
|
let lvo = lv[ilv];
|
||||||
//instantiate return object
|
//instantiate return object
|
||||||
var reto = {};
|
let reto = {};
|
||||||
//copy over field name to return object
|
//copy over field name to return object
|
||||||
reto.fld = lvo.fld;
|
reto.fld = lvo.fld;
|
||||||
//sort?
|
//sort?
|
||||||
@@ -946,9 +946,9 @@ function untokenizeListView(lvJson) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//iterate the filter items in the source lvo object
|
//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
|
//get this filter item
|
||||||
var fi = lvo.filter.items[j];
|
let fi = lvo.filter.items[j];
|
||||||
//no token shortcut
|
//no token shortcut
|
||||||
if (!fi.token) {
|
if (!fi.token) {
|
||||||
//just copy it out
|
//just copy it out
|
||||||
@@ -956,7 +956,7 @@ function untokenizeListView(lvJson) {
|
|||||||
} else {
|
} else {
|
||||||
//it has a date token so let's build it out
|
//it has a date token so let's build it out
|
||||||
//filter item value contains the token, op is always equals
|
//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
|
//create and add a new filter item for each not undefined value
|
||||||
//{ after: undefined, before: undefined }
|
//{ after: undefined, before: undefined }
|
||||||
//AFTER DATE?
|
//AFTER DATE?
|
||||||
|
|||||||
@@ -79,11 +79,11 @@ export default {
|
|||||||
this.fetchValueIfNotPresent();
|
this.fetchValueIfNotPresent();
|
||||||
},
|
},
|
||||||
searchEntry(val, oldVal) {
|
searchEntry(val, oldVal) {
|
||||||
var vm = this;
|
let vm = this;
|
||||||
//clear any local errors
|
//clear any local errors
|
||||||
vm.clearErrors();
|
vm.clearErrors();
|
||||||
//if the search entry is in the results list then it's a drop down selection not a typed search so bail
|
//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) {
|
if (vm.searchResults[i].name == val) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ export default {
|
|||||||
return "fa-plus";
|
return "fa-plus";
|
||||||
},
|
},
|
||||||
handleEditClick: function() {
|
handleEditClick: function() {
|
||||||
var idToOpen = 0;
|
let idToOpen = 0;
|
||||||
if (this.lastSelection != null && this.lastSelection.id) {
|
if (this.lastSelection != null && this.lastSelection.id) {
|
||||||
idToOpen = this.lastSelection.id;
|
idToOpen = this.lastSelection.id;
|
||||||
}
|
}
|
||||||
@@ -157,13 +157,13 @@ export default {
|
|||||||
fetchValueIfNotPresent() {
|
fetchValueIfNotPresent() {
|
||||||
//is there a value that might require fetching?
|
//is there a value that might require fetching?
|
||||||
|
|
||||||
var vm = this;
|
let vm = this;
|
||||||
var val = vm.value;
|
let val = vm.value;
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//check if it's in the list of items we have here
|
//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) {
|
if (vm.searchResults[i].id == val) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -173,16 +173,16 @@ export default {
|
|||||||
window.$gz.form.addNoSelectionItem(vm.searchResults);
|
window.$gz.form.addNoSelectionItem(vm.searchResults);
|
||||||
} else {
|
} else {
|
||||||
//Not here, better get it
|
//Not here, better get it
|
||||||
var urlParams = "?ayaType=" + vm.ayaType + "&preId=" + vm.value;
|
let urlParams = "?ayaType=" + vm.ayaType + "&preId=" + vm.value;
|
||||||
vm.getList(urlParams);
|
vm.getList(urlParams);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
replaceLastSelection() {
|
replaceLastSelection() {
|
||||||
var vm = this;
|
let vm = this;
|
||||||
//check if searchResults has last selection, if not then add it back in again
|
//check if searchResults has last selection, if not then add it back in again
|
||||||
if (vm.lastSelection == null) {
|
if (vm.lastSelection == null) {
|
||||||
//it might be initializing
|
//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) {
|
if (vm.searchResults[i].id == vm.value) {
|
||||||
vm.lastSelection = vm.searchResults[i];
|
vm.lastSelection = vm.searchResults[i];
|
||||||
return;
|
return;
|
||||||
@@ -191,7 +191,7 @@ export default {
|
|||||||
return;
|
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) {
|
if (vm.searchResults[i].id == vm.lastSelection.id) {
|
||||||
return; //already there
|
return; //already there
|
||||||
}
|
}
|
||||||
@@ -200,7 +200,7 @@ export default {
|
|||||||
vm.searchResults.push(vm.lastSelection);
|
vm.searchResults.push(vm.lastSelection);
|
||||||
},
|
},
|
||||||
dropdown(e) {
|
dropdown(e) {
|
||||||
var vm = this;
|
let vm = this;
|
||||||
//check if we have only the initial loaded item and no selection item
|
//check if we have only the initial loaded item and no selection item
|
||||||
if (vm.searchResults.length < 3) {
|
if (vm.searchResults.length < 3) {
|
||||||
//get the default list
|
//get the default list
|
||||||
@@ -224,11 +224,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//split out just the text search part
|
//split out just the text search part
|
||||||
// var searchText = queryText;
|
// let searchText = queryText;
|
||||||
// if (queryText.includes(" ")) {
|
// if (queryText.includes(" ")) {
|
||||||
// //get the non tag part of query if possible
|
// //get the non tag part of query if possible
|
||||||
// //ignore bad condition of too many terms
|
// //ignore bad condition of too many terms
|
||||||
// var searchTerms = queryText.split(" ");
|
// let searchTerms = queryText.split(" ");
|
||||||
// if (searchTerms[0].includes("..")) {
|
// if (searchTerms[0].includes("..")) {
|
||||||
// searchText = searchTerms[1];
|
// searchText = searchTerms[1];
|
||||||
// } else {
|
// } else {
|
||||||
@@ -237,7 +237,7 @@ export default {
|
|||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
getList: function(urlParams) {
|
getList: function(urlParams) {
|
||||||
var vm = this;
|
let vm = this;
|
||||||
if (vm.fetching) {
|
if (vm.fetching) {
|
||||||
return;
|
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
|
//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
|
//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
|
//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 == "") {
|
if (this.searchEntry == null || this.searchEntry == "") {
|
||||||
emptyQuery = true;
|
emptyQuery = true;
|
||||||
} else {
|
} else {
|
||||||
//Pre-process the query to validate and send conditionally
|
//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
|
//get the discrete search terms and verify there are max two
|
||||||
var isATwoTermQuery = false;
|
let isATwoTermQuery = false;
|
||||||
var queryTerms = [];
|
let queryTerms = [];
|
||||||
if (val.includes(" ")) {
|
if (val.includes(" ")) {
|
||||||
queryTerms = val.split(" ");
|
queryTerms = val.split(" ");
|
||||||
if (queryTerms.length > 2) {
|
if (queryTerms.length > 2) {
|
||||||
@@ -334,9 +334,9 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//build url
|
//build url
|
||||||
var urlParams = "?ayaType=" + vm.ayaType;
|
let urlParams = "?ayaType=" + vm.ayaType;
|
||||||
if (!emptyQuery) {
|
if (!emptyQuery) {
|
||||||
var query = queryTerms[0];
|
let query = queryTerms[0];
|
||||||
if (queryTerms[1] != "[?]") {
|
if (queryTerms[1] != "[?]") {
|
||||||
query += " " + queryTerms[1];
|
query += " " + queryTerms[1];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
tagSearchEntry(val) {
|
tagSearchEntry(val) {
|
||||||
var vm = this;
|
let vm = this;
|
||||||
if (!val || vm.tagSearchUnderway) {
|
if (!val || vm.tagSearchUnderway) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ export default {
|
|||||||
return window.$gz.translation.get(tKey);
|
return window.$gz.translation.get(tKey);
|
||||||
},
|
},
|
||||||
addTag() {
|
addTag() {
|
||||||
var theTag = this.tagSearchEntry;
|
let theTag = this.tagSearchEntry;
|
||||||
theTag = this.normalizeTag(theTag);
|
theTag = this.normalizeTag(theTag);
|
||||||
//Maybe need to make sure there are no existing of the same tag? Although that shouldn't be possible technically
|
//Maybe need to make sure there are no existing of the same tag? Although that shouldn't be possible technically
|
||||||
this.sourcetags.push(theTag);
|
this.sourcetags.push(theTag);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export default {
|
|||||||
date() {
|
date() {
|
||||||
//this tortuous fuckery is required so that the input and change events only fire on a real change, not initial page load
|
//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
|
//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) {
|
if (this.date != this.oldDate) {
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ export default {
|
|||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
//2017-08-15T12:10:34.4443084+03:00
|
//2017-08-15T12:10:34.4443084+03:00
|
||||||
var TimePortion = this.timeOnly;
|
let TimePortion = this.timeOnly;
|
||||||
if (!TimePortion) {
|
if (!TimePortion) {
|
||||||
TimePortion = "00:00:00";
|
TimePortion = "00:00:00";
|
||||||
}
|
}
|
||||||
@@ -134,15 +134,15 @@ export default {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
var DatePortion = this.dateOnly;
|
let DatePortion = this.dateOnly;
|
||||||
if (!DatePortion) {
|
if (!DatePortion) {
|
||||||
var v = new Date();
|
let v = new Date();
|
||||||
var fullYear = v.getFullYear();
|
let fullYear = v.getFullYear();
|
||||||
var fullMonth = v.getMonth() + 1;
|
let fullMonth = v.getMonth() + 1;
|
||||||
if (fullMonth < 10) {
|
if (fullMonth < 10) {
|
||||||
fullMonth = "0" + fullMonth.toString();
|
fullMonth = "0" + fullMonth.toString();
|
||||||
}
|
}
|
||||||
var fullDay = v.getDate();
|
let fullDay = v.getDate();
|
||||||
if (fullDay < 10) {
|
if (fullDay < 10) {
|
||||||
fullDay = "0" + fullDay.toString();
|
fullDay = "0" + fullDay.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user