This commit is contained in:
@@ -4,8 +4,8 @@
|
|||||||
<v-form ref="form">
|
<v-form ref="form">
|
||||||
<v-row>
|
<v-row>
|
||||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||||
|
{{ obj }}
|
||||||
<template v-for="(item, index) in obj.editView">
|
<template v-for="(item, index) in editView">
|
||||||
<v-col :key="item.key" cols="12" sm="6" lg="4" xl="3" px-2>
|
<v-col :key="item.key" cols="12" sm="6" lg="4" xl="3" px-2>
|
||||||
<v-card :data-cy="'columncard:' + item.key">
|
<v-card :data-cy="'columncard:' + item.key">
|
||||||
<v-card-title>
|
<v-card-title>
|
||||||
@@ -20,9 +20,6 @@
|
|||||||
v-model="item.include"
|
v-model="item.include"
|
||||||
:label="$ay.t('Include')"
|
:label="$ay.t('Include')"
|
||||||
:ref="item.key"
|
:ref="item.key"
|
||||||
:disabled="
|
|
||||||
item.sort != null || item.filter.items.length > 0
|
|
||||||
"
|
|
||||||
@change="includeChanged(item)"
|
@change="includeChanged(item)"
|
||||||
></v-switch>
|
></v-switch>
|
||||||
<div v-if="item.rid" class="v-label mb-8 mt-6">
|
<div v-if="item.rid" class="v-label mb-8 mt-6">
|
||||||
@@ -68,6 +65,8 @@ export default {
|
|||||||
let vm = this;
|
let vm = this;
|
||||||
if (this.formState.dirty) {
|
if (this.formState.dirty) {
|
||||||
//LVNEW: SAVE AUTOMATICALLY?
|
//LVNEW: SAVE AUTOMATICALLY?
|
||||||
|
//No, better to follow consistent pattern
|
||||||
|
throw "ay-data-list-column-view:beforeRouteLeave save automatically not implemented yet";
|
||||||
|
|
||||||
// //Put in unsaved listview
|
// //Put in unsaved listview
|
||||||
// let formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
// let formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||||
@@ -91,7 +90,6 @@ export default {
|
|||||||
try {
|
try {
|
||||||
//set route values in data object so init form can handle
|
//set route values in data object so init form can handle
|
||||||
vm.dataListKey = this.$route.params.dataListKey;
|
vm.dataListKey = this.$route.params.dataListKey;
|
||||||
vm.formKey = this.$route.params.formKey;
|
|
||||||
await initForm(vm);
|
await initForm(vm);
|
||||||
vm.formState.ready = true;
|
vm.formState.ready = true;
|
||||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||||
@@ -109,15 +107,16 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
obj: {
|
obj: {
|
||||||
editView: [],
|
id: 0,
|
||||||
name: "",
|
|
||||||
public: true,
|
|
||||||
concurrency: 0,
|
concurrency: 0,
|
||||||
userId: 0
|
userId: 0,
|
||||||
|
listKey: null,
|
||||||
|
columns: null,
|
||||||
|
sort: null
|
||||||
},
|
},
|
||||||
dataListKey: undefined,
|
dataListKey: undefined,
|
||||||
formKey: undefined,
|
|
||||||
fieldDefinitions: [],
|
fieldDefinitions: [],
|
||||||
|
editView: [],
|
||||||
effectiveListView: undefined,
|
effectiveListView: undefined,
|
||||||
concurrency: undefined,
|
concurrency: undefined,
|
||||||
selectLists: {
|
selectLists: {
|
||||||
@@ -198,25 +197,8 @@ export default {
|
|||||||
dirty: true
|
dirty: true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
toggleSort: function(item) {
|
|
||||||
if (item.sort == null) {
|
|
||||||
item.sort = "+";
|
|
||||||
} else if (item.sort == "+") {
|
|
||||||
item.sort = "-";
|
|
||||||
} else {
|
|
||||||
item.sort = null;
|
|
||||||
}
|
|
||||||
//make sure sorted fields are INCLUDED
|
|
||||||
if (item.sort) {
|
|
||||||
item.include = true;
|
|
||||||
}
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: this,
|
|
||||||
dirty: true
|
|
||||||
});
|
|
||||||
},
|
|
||||||
move: function(direction, index) {
|
move: function(direction, index) {
|
||||||
let totalItems = this.obj.editView.length;
|
let totalItems = this.editView.length;
|
||||||
let newIndex = 0;
|
let newIndex = 0;
|
||||||
//calculate new index
|
//calculate new index
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
@@ -241,112 +223,7 @@ export default {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.obj.editView.splice(
|
this.editView.splice(newIndex, 0, this.editView.splice(index, 1)[0]);
|
||||||
newIndex,
|
|
||||||
0,
|
|
||||||
this.obj.editView.splice(index, 1)[0]
|
|
||||||
);
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: this,
|
|
||||||
dirty: true
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addFilterCondition(item) {
|
|
||||||
let filterItem = { op: null, value: null, display: null };
|
|
||||||
let filterItemSet = false;
|
|
||||||
|
|
||||||
//DATE relative token?
|
|
||||||
if (item.uiFieldDataType === 1) {
|
|
||||||
if (item.tempFilterToken) {
|
|
||||||
//no or has value?
|
|
||||||
|
|
||||||
//this redundancy is because there are two ways to select the no value and has value; both present in the relative pick list
|
|
||||||
//and also in the select specific value picklist as the date filter picker for convenience so this is a workaround
|
|
||||||
//to simulate if the user had done the full *select* first then picked novalue or has value
|
|
||||||
|
|
||||||
if (item.tempFilterToken == "*NOVALUE*") {
|
|
||||||
filterItem.op = "=";
|
|
||||||
filterItem.value = "*NULL*";
|
|
||||||
filterItemSet = true;
|
|
||||||
} else if (item.tempFilterToken == "*HASVALUE*") {
|
|
||||||
filterItem.op = "!=";
|
|
||||||
filterItem.value = "*NULL*";
|
|
||||||
filterItemSet = true;
|
|
||||||
} else {
|
|
||||||
//some kind of relative date token?
|
|
||||||
if (item.tempFilterToken != "*select*") {
|
|
||||||
//special relative token
|
|
||||||
filterItem.op = "="; //equality
|
|
||||||
filterItem.token = true;
|
|
||||||
filterItem.value = item.tempFilterToken;
|
|
||||||
filterItemSet = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//BLANKS / NONBLANKS TOKENS?
|
|
||||||
if (false == filterItemSet && item.tempFilterOperator == "*NOVALUE*") {
|
|
||||||
filterItem.op = "=";
|
|
||||||
filterItem.value = "*NULL*";
|
|
||||||
filterItemSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (false == filterItemSet && item.tempFilterOperator == "*HASVALUE*") {
|
|
||||||
filterItem.op = "!=";
|
|
||||||
filterItem.value = "*NULL*";
|
|
||||||
filterItemSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//JUST REGULAR FILTER ITEM
|
|
||||||
if (
|
|
||||||
false == filterItemSet &&
|
|
||||||
item.tempFilterOperator &&
|
|
||||||
item.tempFilterValue != null
|
|
||||||
) {
|
|
||||||
filterItem.op = item.tempFilterOperator;
|
|
||||||
filterItem.value = item.tempFilterValue;
|
|
||||||
//only add if there is both an op and a value
|
|
||||||
//above here for tokens that isn't a restriction but
|
|
||||||
//after passing through those conditions were at a point where there MUST be both
|
|
||||||
if (filterItem.op && filterItem.value != null) {
|
|
||||||
filterItemSet = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filterItemSet) {
|
|
||||||
//display
|
|
||||||
filterItem.display = getDisplayForFilter(
|
|
||||||
this,
|
|
||||||
item.uiFieldDataType,
|
|
||||||
filterItem.op,
|
|
||||||
filterItem.value,
|
|
||||||
item.enumType
|
|
||||||
);
|
|
||||||
|
|
||||||
//add only if not already in the collection (accidental double click)
|
|
||||||
//de-lodash
|
|
||||||
// if (!window.$gz. _.find(item.filter.items, filterItem)) {
|
|
||||||
|
|
||||||
//some fits better here as it only test for truthiness and returns immediately on true
|
|
||||||
//also the item is unique and display doesn't need to be compared for equality it's irrelevant
|
|
||||||
//so only the op and the value need to be checked
|
|
||||||
if (
|
|
||||||
!item.filter.items.some(
|
|
||||||
z => z.op == filterItem.op && z.value == filterItem.value
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
item.filter.items.push(filterItem);
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: this,
|
|
||||||
dirty: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
removeFilterCondition(item, index) {
|
|
||||||
item.filter.items.splice(index, 1);
|
|
||||||
window.$gz.form.setFormState({
|
window.$gz.form.setFormState({
|
||||||
vm: this,
|
vm: this,
|
||||||
dirty: true
|
dirty: true
|
||||||
@@ -363,69 +240,81 @@ export default {
|
|||||||
async submit() {
|
async submit() {
|
||||||
if (this.canSave) {
|
if (this.canSave) {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
//check that "unsaved filter" is not the name
|
|
||||||
//if it is, set it empty and force user to set a name
|
|
||||||
if (vm.obj.name == vm.$ay.t("FilterUnsaved")) {
|
|
||||||
vm.obj.name = "";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
vm.formState.loading = true;
|
vm.formState.loading = true;
|
||||||
|
|
||||||
let url = API_BASE_URL;
|
let url = API_BASE_URL;
|
||||||
|
|
||||||
let lvSave = {
|
/*
|
||||||
id: 0,
|
|
||||||
userId: vm.obj.userId || 1,
|
{
|
||||||
name: vm.obj.name,
|
"data": {
|
||||||
public: vm.obj.public,
|
"id": 1,
|
||||||
|
"concurrency": 4999088,
|
||||||
|
"userId": 1,
|
||||||
|
"listKey": "TestWidgetDataList",
|
||||||
|
"columns": "[\"widgetname\",\"widgetserial\",\"widgetdollaramount\",\"widgetusertype\",\"widgetstartdate\",\"widgetactive\",\"username\"]",
|
||||||
|
"sort": "{\"widgetname\":\"+\"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"concurrency": 0,
|
||||||
|
"userId": 0,
|
||||||
|
"listKey": "string",
|
||||||
|
"columns": "string",
|
||||||
|
"sort": "string"
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
let columnView = {
|
||||||
|
userId: vm.$store.state.userId,
|
||||||
listKey: vm.dataListKey,
|
listKey: vm.dataListKey,
|
||||||
listView: JSON.stringify(generateListViewFromEdited(vm))
|
columns: JSON.stringify(generateListViewFromEdited(vm)),
|
||||||
|
sort: vm.obj.sort //not set here, just keep existing one that was fetched when opened this form
|
||||||
};
|
};
|
||||||
|
|
||||||
//clear any errors vm might be around from previous submit
|
//clear any errors vm might be around from previous submit
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(this);
|
window.$gz.form.deleteAllErrorBoxErrors(this);
|
||||||
try {
|
try {
|
||||||
let res = await window.$gz.api.upsert(url, lvSave);
|
let res = await window.$gz.api.post(url, columnView);
|
||||||
|
|
||||||
vm.formState.loading = false;
|
vm.formState.loading = false;
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
vm.formState.serverError = res.error;
|
vm.formState.serverError = res.error;
|
||||||
window.$gz.form.setErrorBoxErrors(vm);
|
window.$gz.form.setErrorBoxErrors(vm);
|
||||||
} else {
|
} else {
|
||||||
//successfully updated regardless if POST or PUT so update the local cache
|
// //successfully updated regardless if POST or PUT so update the local cache
|
||||||
//Update the formSettings now that it's saved
|
// //Update the formSettings now that it's saved
|
||||||
let formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
// let formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||||
formSettings.temp.cachedListView = lvSave.listView;
|
// formSettings.temp.cachedListView = lvSave.listView;
|
||||||
formSettings.temp.page = 1;
|
// formSettings.temp.page = 1;
|
||||||
formSettings.saved.dataTable.unsavedListView = null;
|
// formSettings.saved.dataTable.unsavedListView = null;
|
||||||
|
// window.$gz.form.setFormSettings(vm.formKey, formSettings);
|
||||||
window.$gz.form.setFormSettings(vm.formKey, formSettings);
|
|
||||||
|
|
||||||
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put
|
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put
|
||||||
if (res.data.id) {
|
// if (res.data.id) {
|
||||||
//Handle "post" of new record (CREATE)
|
// //Handle "post" of new record (CREATE)
|
||||||
|
// //No longer dirty
|
||||||
//No longer dirty
|
// window.$gz.form.setFormState({
|
||||||
window.$gz.form.setFormState({
|
// vm: vm,
|
||||||
vm: vm,
|
// dirty: false
|
||||||
dirty: false
|
// });
|
||||||
});
|
// //change url to new record
|
||||||
|
// vm.$router.replace(
|
||||||
//change url to new record
|
// window.$gz.api.replaceAfterLastSlash(
|
||||||
vm.$router.replace(
|
// vm.$route.fullPath,
|
||||||
window.$gz.api.replaceAfterLastSlash(
|
// res.data.id
|
||||||
vm.$route.fullPath,
|
// )
|
||||||
res.data.id
|
// );
|
||||||
)
|
// } else {
|
||||||
);
|
// //Handle "put" of an existing record (UPDATE)
|
||||||
} else {
|
// vm.obj.concurrency = res.data.concurrency;
|
||||||
//Handle "put" of an existing record (UPDATE)
|
// window.$gz.form.setFormState({
|
||||||
vm.obj.concurrency = res.data.concurrency;
|
// vm: vm,
|
||||||
window.$gz.form.setFormState({
|
// dirty: false
|
||||||
vm: vm,
|
// });
|
||||||
dirty: false
|
// }
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
vm.formState.loading = false;
|
vm.formState.loading = false;
|
||||||
@@ -436,12 +325,9 @@ export default {
|
|||||||
async reset() {
|
async reset() {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
vm.formState.loading = true;
|
vm.formState.loading = true;
|
||||||
|
|
||||||
|
let url = API_BASE_URL + vm.dataListKey;
|
||||||
let url = API_BASE_URL + vm.listViewId;
|
|
||||||
|
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||||
let res = await window.$gz.api.remove(url);
|
let res = await window.$gz.api.remove(url);
|
||||||
@@ -450,15 +336,14 @@ export default {
|
|||||||
vm.formState.serverError = res.error;
|
vm.formState.serverError = res.error;
|
||||||
window.$gz.form.setErrorBoxErrors(vm);
|
window.$gz.form.setErrorBoxErrors(vm);
|
||||||
} else {
|
} else {
|
||||||
//set it to the default list view so the caller doesn't try to load the non-existant deleted view it was just working with
|
// //set it to the default list view so the caller doesn't try to load the non-existant deleted view it was just working with
|
||||||
let formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
// let formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||||
formSettings.temp.cachedListView = null;
|
// formSettings.temp.cachedListView = null;
|
||||||
formSettings.temp.page = 1;
|
// formSettings.temp.page = 1;
|
||||||
formSettings.saved.dataTable.unsavedListView = null;
|
// formSettings.saved.dataTable.unsavedListView = null;
|
||||||
|
// window.$gz.form.setFormSettings(vm.formKey, formSettings);
|
||||||
window.$gz.form.setFormSettings(vm.formKey, formSettings);
|
// // navigate backwards
|
||||||
// navigate backwards
|
// vm.$router.go(-1);
|
||||||
vm.$router.go(-1);
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//Update the form status
|
//Update the form status
|
||||||
@@ -542,12 +427,10 @@ function generateMenu(vm) {
|
|||||||
//
|
//
|
||||||
async function initForm(vm) {
|
async function initForm(vm) {
|
||||||
await fetchTranslatedText(vm);
|
await fetchTranslatedText(vm);
|
||||||
await populateSelectionLists(vm);
|
|
||||||
await populateFieldDefinitions(vm);
|
await populateFieldDefinitions(vm);
|
||||||
await fetchTranslatedFieldNames(vm);
|
await fetchTranslatedFieldNames(vm);
|
||||||
await setEffectiveListView(vm);
|
await fetchColumnView(vm);
|
||||||
await initDataObject(vm);
|
initWorkingView(vm);
|
||||||
await fetchEnums(vm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
@@ -558,243 +441,10 @@ async function fetchTranslatedText(vm) {
|
|||||||
await window.$gz.translation.cacheTranslations([
|
await window.$gz.translation.cacheTranslations([
|
||||||
"ResetToDefault",
|
"ResetToDefault",
|
||||||
"DataListView",
|
"DataListView",
|
||||||
"GridFilterName",
|
"Include"
|
||||||
"Include",
|
|
||||||
"AnyUser",
|
|
||||||
"Sort",
|
|
||||||
"Filter",
|
|
||||||
"GridFilterDialogAndRadioText",
|
|
||||||
"GridFilterDialogOrRadioText",
|
|
||||||
"GridRowFilterDropDownBlanksItem",
|
|
||||||
"GridRowFilterDropDownNonBlanksItem",
|
|
||||||
"GridRowFilterDropDownEquals",
|
|
||||||
"GridRowFilterDropDownGreaterThan",
|
|
||||||
"GridRowFilterDropDownGreaterThanOrEqualTo",
|
|
||||||
"GridRowFilterDropDownLessThan",
|
|
||||||
"GridRowFilterDropDownLessThanOrEqualTo",
|
|
||||||
"GridRowFilterDropDownNotEquals",
|
|
||||||
"GridRowFilterDropDownDoesNotContain",
|
|
||||||
"GridRowFilterDropDownContains",
|
|
||||||
"GridRowFilterDropDownStartsWith",
|
|
||||||
"GridRowFilterDropDownEndsWith",
|
|
||||||
"SelectItem",
|
|
||||||
"DateRangeYesterday",
|
|
||||||
"DateRangeToday",
|
|
||||||
"DateRangeTomorrow",
|
|
||||||
"DateRangeLastWeek",
|
|
||||||
"DateRangeThisWeek",
|
|
||||||
"DateRangeNextWeek",
|
|
||||||
"DateRangeLastMonth",
|
|
||||||
"DateRangeThisMonth",
|
|
||||||
"DateRangeNextMonth",
|
|
||||||
"DateRange14DayWindow",
|
|
||||||
"DateRangePast",
|
|
||||||
"DateRangeFuture",
|
|
||||||
"DateRangeLastYear",
|
|
||||||
"DateRangeThisYear",
|
|
||||||
"DateRangeInTheLastThreeMonths",
|
|
||||||
"DateRangeInTheLastSixMonths",
|
|
||||||
"DateRangePastYear",
|
|
||||||
"DateRangePast90Days",
|
|
||||||
"DateRangePast30Days",
|
|
||||||
"DateRangePast24Hours",
|
|
||||||
"DateRangeJanuary",
|
|
||||||
"DateRangeFebruary",
|
|
||||||
"DateRangeMarch",
|
|
||||||
"DateRangeApril",
|
|
||||||
"DateRangeMay",
|
|
||||||
"DateRangeJune",
|
|
||||||
"DateRangeJuly",
|
|
||||||
"DateRangeAugust",
|
|
||||||
"DateRangeSeptember",
|
|
||||||
"DateRangeOctober",
|
|
||||||
"DateRangeNovember",
|
|
||||||
"DateRangeDecember",
|
|
||||||
"DateRangePreviousYearThisMonth",
|
|
||||||
"DateRangePreviousYearLastMonth",
|
|
||||||
"DateRangePreviousYearNextMonth",
|
|
||||||
"True",
|
|
||||||
"False",
|
|
||||||
"Name"
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
function populateSelectionLists(vm) {
|
|
||||||
vm.selectLists.dateFilterOperators.push(
|
|
||||||
...[
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
|
|
||||||
id: "*HASVALUE*"
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownGreaterThan"), id: ">" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
|
|
||||||
id: ">="
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownLessThan"), id: "<" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownLessThanOrEqualTo"), id: "<=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownNotEquals"), id: "!=" }
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
vm.selectLists.dateFilterTokens.push(
|
|
||||||
...[
|
|
||||||
{ name: "(" + vm.$ay.t("SelectItem") + ")", id: "*select*" }, //If select then use entry in date /time picker
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
|
|
||||||
id: "*HASVALUE*"
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("DateRangeYesterday"), id: "*yesterday*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeToday"), id: "*today*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeTomorrow"), id: "*tomorrow*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeLastWeek"), id: "*lastweek*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeThisWeek"), id: "*thisweek*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeNextWeek"), id: "*nextweek*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeLastMonth"), id: "*lastmonth*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeThisMonth"), id: "*thismonth*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeNextMonth"), id: "*nextmonth*" },
|
|
||||||
{ name: vm.$ay.t("DateRange14DayWindow"), id: "*14daywindow*" },
|
|
||||||
{ name: vm.$ay.t("DateRangePast"), id: "*past*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeFuture"), id: "*future*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeLastYear"), id: "*lastyear*" }, //prior year from jan to dec
|
|
||||||
{ name: vm.$ay.t("DateRangeThisYear"), id: "*thisyear*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("DateRangeInTheLastThreeMonths"),
|
|
||||||
id: "*last3months*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("DateRangeInTheLastSixMonths"),
|
|
||||||
id: "*last6months*"
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("DateRangePastYear"), id: "*pastyear*" }, //last 365 days
|
|
||||||
{ name: vm.$ay.t("DateRangePast90Days"), id: "*past90days*" },
|
|
||||||
{ name: vm.$ay.t("DateRangePast30Days"), id: "*past30days*" },
|
|
||||||
{ name: vm.$ay.t("DateRangePast24Hours"), id: "*past24hours*" },
|
|
||||||
|
|
||||||
{ name: vm.$ay.t("DateRangeJanuary"), id: "*january*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeFebruary"), id: "*february*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeMarch"), id: "*march*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeApril"), id: "*april*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeMay"), id: "*may*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeJune"), id: "*june*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeJuly"), id: "*july*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeAugust"), id: "*august*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeSeptember"), id: "*september*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeOctober"), id: "*october*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeNovember"), id: "*november*" },
|
|
||||||
{ name: vm.$ay.t("DateRangeDecember"), id: "*december*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("DateRangePreviousYearThisMonth"),
|
|
||||||
id: "*lastyearthismonth*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("DateRangePreviousYearLastMonth"),
|
|
||||||
id: "*lastyearlastmonth*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("DateRangePreviousYearNextMonth"),
|
|
||||||
id: "*lastyearnextmonth*"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
vm.selectLists.stringFilterOperators.push(
|
|
||||||
...[
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
|
|
||||||
id: "*HASVALUE*"
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownGreaterThan"), id: ">" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
|
|
||||||
id: ">="
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownLessThan"), id: "<" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownLessThanOrEqualTo"), id: "<=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownNotEquals"), id: "!=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownDoesNotContain"), id: "!-%-" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownContains"), id: "-%-" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownStartsWith"), id: "%-" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownEndsWith"), id: "-%" }
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
vm.selectLists.integerFilterOperators.push(
|
|
||||||
...[
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
|
|
||||||
id: "*HASVALUE*"
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownGreaterThan"), id: ">" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
|
|
||||||
id: ">="
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownLessThan"), id: "<" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownLessThanOrEqualTo"), id: "<=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownNotEquals"), id: "!=" }
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
vm.selectLists.boolFilterOperators.push(
|
|
||||||
...[
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
|
|
||||||
id: "*HASVALUE*"
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownNotEquals"), id: "!=" }
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
vm.selectLists.decimalFilterOperators.push(
|
|
||||||
...[
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
|
|
||||||
id: "*HASVALUE*"
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownGreaterThan"), id: ">" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
|
|
||||||
id: ">="
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownLessThan"), id: "<" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownLessThanOrEqualTo"), id: "<=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownNotEquals"), id: "!=" }
|
|
||||||
]
|
|
||||||
);
|
|
||||||
//tags filter only by equals in initial release, see DataListSqlFilterCriteriaBuilder.cs line 523 for deets
|
|
||||||
vm.selectLists.tagFilterOperators.push({
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownEquals"),
|
|
||||||
id: "="
|
|
||||||
});
|
|
||||||
|
|
||||||
vm.selectLists.enumFilterOperators.push(
|
|
||||||
...[
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
|
|
||||||
{
|
|
||||||
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
|
|
||||||
id: "*HASVALUE*"
|
|
||||||
},
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
|
|
||||||
{ name: vm.$ay.t("GridRowFilterDropDownNotEquals"), id: "!=" }
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
//
|
//
|
||||||
async function populateFieldDefinitions(vm) {
|
async function populateFieldDefinitions(vm) {
|
||||||
@@ -826,119 +476,46 @@ async function fetchTranslatedFieldNames(vm) {
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
async function setEffectiveListView(vm) {
|
async function fetchColumnView(vm) {
|
||||||
/*
|
let res = await window.$gz.api.get(API_BASE_URL + vm.dataListKey);
|
||||||
effectiveListView
|
if (res.error) {
|
||||||
- Second get the ListView that is currently in use so can setup the page view
|
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
|
||||||
- If listviewid is zero then that's starting with the default list view so need to fetch it and then init the form
|
|
||||||
- If listviewid is -1 then that's starting with an unsaved listview so get that from the saved form store
|
|
||||||
- If listviewid is greater than 0 then it's a saved listview and there sb a cached version of it but ideally maybe fetch it from
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (vm.listViewId == null) {
|
|
||||||
throw new Error(
|
|
||||||
"ay-data-list::setEffectiveListView - listViewId is not set"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
|
||||||
|
|
||||||
if (vm.listViewId == -1) {
|
|
||||||
if (formSettings.saved.dataTable.unsavedListView != null) {
|
|
||||||
vm.effectiveListView = JSON.parse(
|
|
||||||
formSettings.saved.dataTable.unsavedListView
|
|
||||||
);
|
|
||||||
vm.obj.name = vm.$ay.t("FilterUnsaved");
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
} else if (vm.listViewId == 0) {
|
|
||||||
//get default list view
|
|
||||||
//http://localhost:7575/api/v8/DataListView/default/TestWidgetDataList
|
|
||||||
let res = await window.$gz.api.get(API_BASE_URL + vm.dataListKey);
|
|
||||||
|
|
||||||
if (res.error) {
|
|
||||||
// throw new Error(res.error);
|
|
||||||
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
|
|
||||||
} else {
|
|
||||||
vm.effectiveListView = JSON.parse(res.data);
|
|
||||||
vm.obj.name = vm.$ay.t("FilterUnsaved");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
//listview has an id value
|
vm.obj = res.data;
|
||||||
let res = await window.$gz.api.get(API_BASE_URL + vm.listViewId);
|
|
||||||
if (res.error) {
|
|
||||||
//throw new Error(res.error);
|
|
||||||
throw new Error(window.$gz.errorHandler.errorToString(res, vm));
|
|
||||||
} else {
|
|
||||||
vm.effectiveListView = JSON.parse(res.data.listView);
|
|
||||||
vm.obj.public = res.data.public;
|
|
||||||
vm.obj.name = res.data.name;
|
|
||||||
vm.obj.concurrency = res.data.concurrency;
|
|
||||||
vm.obj.userId = res.data.userId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
//
|
//
|
||||||
function initDataObject(vm) {
|
function initWorkingView(vm) {
|
||||||
if (vm.effectiveListView == null) {
|
// if (vm.effectiveListView == null) {
|
||||||
throw new Error(
|
// throw new Error(
|
||||||
"ay-data-list::initDataObject - effectiveListView is not set"
|
// "ay-data-list::initWorkingView - effectiveListView is not set"
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
if (vm.fieldDefinitions == null) {
|
if (vm.fieldDefinitions == null) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"ay-data-list::initDataObject - fieldDefinitions are not set"
|
"ay-data-list::initWorkingView - fieldDefinitions are not set"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let ret = [];
|
let ret = [];
|
||||||
|
let columns = JSON.parse(vm.obj.columns);
|
||||||
|
|
||||||
//Pass 1, iterate the listview first
|
//Pass 1, iterate the listview first
|
||||||
for (let i = 0; i < vm.effectiveListView.length; i++) {
|
for (let i = 0; i < columns.length; i++) {
|
||||||
let lvItem = vm.effectiveListView[i];
|
|
||||||
//de-lodash
|
//de-lodash
|
||||||
//let fld = window.$gz. _.find(vm.fieldDefinitions, ["fieldKey", lvItem.fld]);
|
//let fld = window.$gz. _.find(vm.fieldDefinitions, ["fieldKey", lvItem.fld]);
|
||||||
let fld = vm.fieldDefinitions.find(z => z.fieldKey == lvItem.fld);
|
let fld = vm.fieldDefinitions.find(z => z.fieldKey == columns[i]);
|
||||||
let o = {
|
let o = {
|
||||||
key: fld.fieldKey,
|
key: fld.fieldKey,
|
||||||
title: vm.$ay.t(fld.tKey),
|
title: vm.$ay.t(fld.tKey),
|
||||||
include: true,
|
include: true
|
||||||
isFilterable: fld.isFilterable,
|
|
||||||
isSortable: fld.isSortable,
|
|
||||||
enumType: fld.enumType,
|
|
||||||
uiFieldDataType: fld.uiFieldDataType,
|
|
||||||
isCustomField: fld.isCustomField,
|
|
||||||
sort: lvItem.sort || null,
|
|
||||||
filter: lvItem.filter || { any: false, items: [] },
|
|
||||||
tempFilterOperator: null,
|
|
||||||
tempFilterToken: null,
|
|
||||||
tempFilterValue: null
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (fld.isRowId) {
|
if (fld.isRowId) {
|
||||||
o.rid = true;
|
o.rid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If it's a tag and it's not been set yet it needs to have an empty array to stat with for the picker
|
|
||||||
if (o.uiFieldDataType == 9 && o.tempFilterValue == null) {
|
|
||||||
o.tempFilterValue = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
//Add display text for filter item (same as in addFilterCondition)
|
|
||||||
for (let j = 0; j < o.filter.items.length; j++) {
|
|
||||||
let fi = o.filter.items[j];
|
|
||||||
fi.display = getDisplayForFilter(
|
|
||||||
vm,
|
|
||||||
o.uiFieldDataType,
|
|
||||||
fi.op,
|
|
||||||
fi.value,
|
|
||||||
o.enumType
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret.push(o);
|
ret.push(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -946,176 +523,23 @@ function initDataObject(vm) {
|
|||||||
for (let i = 0; i < vm.fieldDefinitions.length; i++) {
|
for (let i = 0; i < vm.fieldDefinitions.length; i++) {
|
||||||
let fld = vm.fieldDefinitions[i];
|
let fld = vm.fieldDefinitions[i];
|
||||||
|
|
||||||
//is this field already in ret array?
|
|
||||||
//de-lodash
|
|
||||||
// if (null == window.$gz. _.find(ret, ["key", fld.fieldKey])) {
|
|
||||||
if (null == ret.find(z => z.key == fld.fieldKey)) {
|
if (null == ret.find(z => z.key == fld.fieldKey)) {
|
||||||
//nope, so add it
|
//nope, so add it
|
||||||
let o = {
|
let o = {
|
||||||
key: fld.fieldKey,
|
key: fld.fieldKey,
|
||||||
title: vm.$ay.t(fld.tKey),
|
title: vm.$ay.t(fld.tKey),
|
||||||
include: false,
|
include: false
|
||||||
isFilterable: fld.isFilterable,
|
|
||||||
isSortable: fld.isSortable,
|
|
||||||
enumType: fld.enumType,
|
|
||||||
uiFieldDataType: fld.uiFieldDataType,
|
|
||||||
isCustomField: fld.isCustomField,
|
|
||||||
sort: null,
|
|
||||||
filter: { any: false, items: [] },
|
|
||||||
tempFilterOperator: null,
|
|
||||||
tempFilterToken: null,
|
|
||||||
tempFilterValue: null
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (fld.isRowId) {
|
if (fld.isRowId) {
|
||||||
o.rid = true;
|
o.rid = true;
|
||||||
o.include = true;
|
o.include = true;
|
||||||
}
|
}
|
||||||
//If it's a tag and it's not been set yet it needs to have an empty array to stat with for the picker
|
|
||||||
if (o.uiFieldDataType == 9 && o.tempFilterValue == null) {
|
|
||||||
o.tempFilterValue = [];
|
|
||||||
}
|
|
||||||
ret.push(o);
|
ret.push(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vm.obj.editView = ret;
|
vm.editView = ret;
|
||||||
|
|
||||||
// if (window.$gz.dev) {
|
|
||||||
// if (vm.obj.editView.length != vm.fieldDefinitions.length) {
|
|
||||||
// throw new Error(
|
|
||||||
// "ay-data-list-column-view::initDataObject - working array length not equal to total field definition length"
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return Promise.resolve();
|
|
||||||
|
|
||||||
//eoc
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Ensures translated enum lists are available pre-cached
|
|
||||||
//
|
|
||||||
function fetchEnums(vm) {
|
|
||||||
//build an array of all enums then execute method
|
|
||||||
let enumKeys = [];
|
|
||||||
for (let i = 0; i < vm.fieldDefinitions.length; i++) {
|
|
||||||
let fld = vm.fieldDefinitions[i];
|
|
||||||
if (fld.uiFieldDataType == 10) {
|
|
||||||
enumKeys.push(fld.enumType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (enumKeys.length > 0) {
|
|
||||||
return window.$gz.enums.fetchEnumList(enumKeys);
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Convert working object to actual listView
|
|
||||||
//
|
|
||||||
function updateEditedListView(vm) {
|
|
||||||
//turn the obj.editView settings into an actual listview
|
|
||||||
//compare it with the effectiveListView to see if there are any changes between the two
|
|
||||||
//set the form to dirty if there are changes and can save
|
|
||||||
//this.formState.dirty = true;
|
|
||||||
//this way user can build their way back to the same view and then no need to save if no changes
|
|
||||||
//build an array of all enums then execute method
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Convert filter properties to translated / displayable
|
|
||||||
// used when making new filter and loading existing
|
|
||||||
//
|
|
||||||
function getDisplayForFilter(
|
|
||||||
vm,
|
|
||||||
uiFieldDataType,
|
|
||||||
filterOperator,
|
|
||||||
filterValue,
|
|
||||||
enumType
|
|
||||||
) {
|
|
||||||
//BLANKS FILTER
|
|
||||||
if (filterOperator == "=" && filterValue == "*NULL*") {
|
|
||||||
//de-lodash
|
|
||||||
// return window.$gz. _.find(vm.selectLists.stringFilterOperators, {
|
|
||||||
// id: "*NOVALUE*"
|
|
||||||
// }).name;
|
|
||||||
return vm.selectLists.stringFilterOperators.find(z => z.id == "*NOVALUE*")
|
|
||||||
.name;
|
|
||||||
}
|
|
||||||
// NONBLANKS FILTER
|
|
||||||
if (filterOperator == "!=" && filterValue == "*NULL*") {
|
|
||||||
//de-lodash
|
|
||||||
// return window.$gz. _.find(vm.selectLists.stringFilterOperators, {
|
|
||||||
// id: "*HASVALUE*"
|
|
||||||
// }).name;
|
|
||||||
return vm.selectLists.stringFilterOperators.find(z => z.id == "*HASVALUE*")
|
|
||||||
.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
//DATE RELATIVE TOKEN FILTER
|
|
||||||
if (uiFieldDataType === 1 && filterValue[0] == "*") {
|
|
||||||
//de-lodash
|
|
||||||
// let valueDisplay = window.$gz. _.find(vm.selectLists.dateFilterTokens, {
|
|
||||||
// id: filterValue
|
|
||||||
// }).name;
|
|
||||||
|
|
||||||
let valueDisplay = vm.selectLists.dateFilterTokens.find(
|
|
||||||
z => z.id == filterValue
|
|
||||||
).name;
|
|
||||||
|
|
||||||
return filterOperator + " " + valueDisplay;
|
|
||||||
}
|
|
||||||
|
|
||||||
//VALUE FILTER
|
|
||||||
//Nothing more to do if there isn't both a value AND an operator at this point
|
|
||||||
if (filterOperator == null || filterValue == null) {
|
|
||||||
// if (window.$gz.dev) {
|
|
||||||
// throw new Error(
|
|
||||||
// "ay-data-list-column-view::getDisplayForFilter Value filter missing one ore more of Operator, Value"
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
let valueDisplay = "selected value";
|
|
||||||
switch (uiFieldDataType) {
|
|
||||||
case 1: //date translate
|
|
||||||
valueDisplay = window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
|
||||||
filterValue
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 8: //currency translate
|
|
||||||
valueDisplay = window.$gz.locale.currencyLocalized(filterValue);
|
|
||||||
break;
|
|
||||||
case 7: //decimal translate
|
|
||||||
valueDisplay = window.$gz.locale.decimalLocalized(filterValue);
|
|
||||||
break;
|
|
||||||
case 6: //BOOL translate
|
|
||||||
let tKey = filterValue ? "True" : "False";
|
|
||||||
valueDisplay = vm.$ay.t(tKey);
|
|
||||||
break;
|
|
||||||
case 10: //ENUM translate
|
|
||||||
valueDisplay = window.$gz.enums.get(enumType, filterValue);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
valueDisplay = filterValue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Operator
|
|
||||||
//de-lodash
|
|
||||||
// let opDisplay = window.$gz. _.find(vm.selectLists.stringFilterOperators, {
|
|
||||||
// id: filterOperator
|
|
||||||
// }).name;
|
|
||||||
|
|
||||||
let opDisplay = vm.selectLists.stringFilterOperators.find(
|
|
||||||
z => z.id == filterOperator
|
|
||||||
).name;
|
|
||||||
|
|
||||||
return opDisplay + ' "' + valueDisplay + '"';
|
|
||||||
|
|
||||||
//eoc
|
//eoc
|
||||||
}
|
}
|
||||||
@@ -1125,15 +549,16 @@ function getDisplayForFilter(
|
|||||||
// Convert editedList view to real list view and return
|
// Convert editedList view to real list view and return
|
||||||
//
|
//
|
||||||
function generateListViewFromEdited(vm) {
|
function generateListViewFromEdited(vm) {
|
||||||
|
return;
|
||||||
//obj: { editView: [], name: "", public: true },
|
//obj: { editView: [], name: "", public: true },
|
||||||
if (vm.obj.editView == null || vm.obj.editView.length == 0) {
|
if (vm.editView == null || vm.editView.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let ret = [];
|
let ret = [];
|
||||||
|
|
||||||
for (let i = 0; i < vm.obj.editView.length; i++) {
|
for (let i = 0; i < vm.editView.length; i++) {
|
||||||
let ev = vm.obj.editView[i];
|
let ev = vm.editView[i];
|
||||||
if (!ev.include) {
|
if (!ev.include) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user