moved t function to global and misc cleanup

This commit is contained in:
2020-04-04 17:06:25 +00:00
parent 90c388ecc2
commit 43de3c8fb0
20 changed files with 242 additions and 286 deletions

View File

@@ -39,7 +39,7 @@
clearable
@click:clear="fieldValueChanged('name')"
:counter="255"
:label="t('Name')"
:label="$ay.t('Name')"
:rules="[
form().max255(this, 'name'),
form().required(this, 'name')
@@ -54,7 +54,7 @@
<v-checkbox
v-model="obj.public"
:readonly="this.formState.readOnly"
:label="t('AnyUser')"
:label="$ay.t('AnyUser')"
ref="public"
@change="fieldValueChanged('public')"
></v-checkbox>
@@ -73,7 +73,7 @@
<v-switch
v-if="!item.rid"
v-model="item.include"
:label="t('Include')"
:label="$ay.t('Include')"
:ref="item.key"
:disabled="
item.sort != null || item.filter.items.length > 0
@@ -81,7 +81,7 @@
@change="includeChanged(item)"
></v-switch>
<div v-if="item.rid" class="v-label mb-8 mt-6">
{{ t("Include") }}
{{ $ay.t("Include") }}
</div>
<!-- RE-ORDER CONTROL -->
<div class="d-flex justify-space-between">
@@ -123,7 +123,7 @@
></v-btn
>
<label class="v-label theme--light"
>&nbsp;{{ t("Sort") }}</label
>&nbsp;{{ $ay.t("Sort") }}</label
>
</div>
</template>
@@ -139,7 +139,7 @@
:items="selectLists.dateFilterTokens"
item-text="name"
item-value="id"
:label="t('Filter')"
:label="$ay.t('Filter')"
prepend-icon="fa-filter"
></v-select>
<div v-if="item.tempFilterToken == '*select*'">
@@ -179,7 +179,7 @@
:items="selectLists.stringFilterOperators"
item-text="name"
item-value="id"
:label="t('Filter')"
:label="$ay.t('Filter')"
prepend-icon="fa-filter"
></v-select>
<v-text-field
@@ -207,7 +207,7 @@
:items="selectLists.integerFilterOperators"
item-text="name"
item-value="id"
:label="t('Filter')"
:label="$ay.t('Filter')"
prepend-icon="fa-filter"
></v-select>
<v-text-field
@@ -235,7 +235,7 @@
:items="selectLists.boolFilterOperators"
item-text="name"
item-value="id"
:label="t('Filter')"
:label="$ay.t('Filter')"
prepend-icon="fa-filter"
></v-select>
<v-radio-group
@@ -248,10 +248,13 @@
row
>
<v-radio
:label="t('False')"
:label="$ay.t('False')"
:value="false"
></v-radio>
<v-radio :label="t('True')" :value="true"></v-radio>
<v-radio
:label="$ay.t('True')"
:value="true"
></v-radio>
</v-radio-group>
<v-btn
@@ -270,7 +273,7 @@
:items="selectLists.decimalFilterOperators"
item-text="name"
item-value="id"
:label="t('Filter')"
:label="$ay.t('Filter')"
prepend-icon="fa-filter"
></v-select>
<gz-decimal
@@ -297,7 +300,7 @@
:items="selectLists.decimalFilterOperators"
item-text="name"
item-value="id"
:label="t('Filter')"
:label="$ay.t('Filter')"
prepend-icon="fa-filter"
></v-select>
<gz-currency
@@ -324,7 +327,7 @@
:items="selectLists.tagFilterOperators"
item-text="name"
item-value="id"
:label="t('Filter')"
:label="$ay.t('Filter')"
prepend-icon="fa-filter"
></v-select>
@@ -348,7 +351,7 @@
:items="selectLists.enumFilterOperators"
item-text="name"
item-value="id"
:label="t('Filter')"
:label="$ay.t('Filter')"
prepend-icon="fa-filter"
></v-select>
@@ -382,11 +385,11 @@
<!-- AND / OR FILTER CONDITIONS -->
<v-radio-group v-model="item.filter.any" row>
<v-radio
:label="t('GridFilterDialogAndRadioText')"
:label="$ay.t('GridFilterDialogAndRadioText')"
:value="false"
></v-radio>
<v-radio
:label="t('GridFilterDialogOrRadioText')"
:label="$ay.t('GridFilterDialogOrRadioText')"
:value="true"
></v-radio> </v-radio-group
></v-subheader>
@@ -558,9 +561,6 @@ export default {
}
},
methods: {
t: function(tKey) {
return window.$gz.translation.get(tKey);
},
enumSelectionList: function(enumKey) {
return window.$gz.enums.getSelectionList(enumKey);
},
@@ -700,13 +700,6 @@ export default {
form() {
return window.$gz.form;
},
// setAsUnsavedListView() {
// //switch to unsaved listview if not already
// if (this.listViewId != -1) {
// this.listViewId = -1;
// vm.obj.name = vm.t("FilterUnsaved");
// }
// },
fieldValueChanged(ref) {
if (!this.formState.loading && !this.formState.readOnly) {
window.$gz.form.fieldValueChanged(this, ref);
@@ -717,7 +710,7 @@ export default {
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.t("FilterUnsaved")) {
if (vm.obj.name == vm.$ay.t("FilterUnsaved")) {
vm.obj.name = "";
return;
}
@@ -1052,143 +1045,143 @@ function fetchTranslatedText(vm) {
function populateSelectionLists(vm) {
vm.selectLists.dateFilterOperators.push(
...[
{ name: vm.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{
name: vm.t("GridRowFilterDropDownNonBlanksItem"),
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
id: "*HASVALUE*"
},
{ name: vm.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.t("GridRowFilterDropDownGreaterThan"), id: ">" },
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.$ay.t("GridRowFilterDropDownGreaterThan"), id: ">" },
{
name: vm.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
name: vm.$ay.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
id: ">="
},
{ name: vm.t("GridRowFilterDropDownLessThan"), id: "<" },
{ name: vm.t("GridRowFilterDropDownLessThanOrEqualTo"), id: "<=" },
{ name: vm.t("GridRowFilterDropDownNotEquals"), 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.t("SelectItem") + ")", id: "*select*" }, //If select then use entry in date /time picker
{ name: vm.t("DateRangeYesterday"), id: "*yesterday*" },
{ name: vm.t("DateRangeToday"), id: "*today*" },
{ name: vm.t("DateRangeTomorrow"), id: "*tomorrow*" },
{ name: vm.t("DateRangeLastWeek"), id: "*lastweek*" },
{ name: vm.t("DateRangeThisWeek"), id: "*thisweek*" },
{ name: vm.t("DateRangeNextWeek"), id: "*nextweek*" },
{ name: vm.t("DateRangeLastMonth"), id: "*lastmonth*" },
{ name: vm.t("DateRangeThisMonth"), id: "*thismonth*" },
{ name: vm.t("DateRangeNextMonth"), id: "*nextmonth*" },
{ name: vm.t("DateRange14DayWindow"), id: "*14daywindow*" },
{ name: vm.t("DateRangePast"), id: "*past*" },
{ name: vm.t("DateRangeFuture"), id: "*future*" },
{ name: vm.t("DateRangeLastYear"), id: "*lastyear*" }, //prior year from jan to dec
{ name: vm.t("DateRangeThisYear"), id: "*thisyear*" },
{ name: "(" + vm.$ay.t("SelectItem") + ")", id: "*select*" }, //If select then use entry in date /time picker
{ 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.t("DateRangeInTheLastThreeMonths"),
name: vm.$ay.t("DateRangeInTheLastThreeMonths"),
id: "*last3months*"
},
{
name: vm.t("DateRangeInTheLastSixMonths"),
name: vm.$ay.t("DateRangeInTheLastSixMonths"),
id: "*last6months*"
},
{ name: vm.t("DateRangePastYear"), id: "*pastyear*" }, //last 365 days
{ name: vm.$ay.t("DateRangePastYear"), id: "*pastyear*" }, //last 365 days
{ name: vm.t("DateRangePast90Days"), id: "*past90days*" },
{ name: vm.t("DateRangePast30Days"), id: "*past30days*" },
{ name: vm.t("DateRangePast24Hours"), id: "*past24hours*" }
{ name: vm.$ay.t("DateRangePast90Days"), id: "*past90days*" },
{ name: vm.$ay.t("DateRangePast30Days"), id: "*past30days*" },
{ name: vm.$ay.t("DateRangePast24Hours"), id: "*past24hours*" }
]
);
vm.selectLists.stringFilterOperators.push(
...[
{ name: vm.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{
name: vm.t("GridRowFilterDropDownNonBlanksItem"),
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
id: "*HASVALUE*"
},
{ name: vm.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.t("GridRowFilterDropDownGreaterThan"), id: ">" },
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.$ay.t("GridRowFilterDropDownGreaterThan"), id: ">" },
{
name: vm.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
name: vm.$ay.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
id: ">="
},
{ name: vm.t("GridRowFilterDropDownLessThan"), id: "<" },
{ name: vm.t("GridRowFilterDropDownLessThanOrEqualTo"), id: "<=" },
{ name: vm.t("GridRowFilterDropDownNotEquals"), id: "!=" },
{ name: vm.t("GridRowFilterDropDownDoesNotContain"), id: "!-%-" },
{ name: vm.t("GridRowFilterDropDownContains"), id: "-%-" },
{ name: vm.t("GridRowFilterDropDownStartsWith"), id: "%-" },
{ name: vm.t("GridRowFilterDropDownEndsWith"), 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.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{
name: vm.t("GridRowFilterDropDownNonBlanksItem"),
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
id: "*HASVALUE*"
},
{ name: vm.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.t("GridRowFilterDropDownGreaterThan"), id: ">" },
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.$ay.t("GridRowFilterDropDownGreaterThan"), id: ">" },
{
name: vm.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
name: vm.$ay.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
id: ">="
},
{ name: vm.t("GridRowFilterDropDownLessThan"), id: "<" },
{ name: vm.t("GridRowFilterDropDownLessThanOrEqualTo"), id: "<=" },
{ name: vm.t("GridRowFilterDropDownNotEquals"), 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.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{
name: vm.t("GridRowFilterDropDownNonBlanksItem"),
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
id: "*HASVALUE*"
},
{ name: vm.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.t("GridRowFilterDropDownNotEquals"), id: "!=" }
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.$ay.t("GridRowFilterDropDownNotEquals"), id: "!=" }
]
);
vm.selectLists.decimalFilterOperators.push(
...[
{ name: vm.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{
name: vm.t("GridRowFilterDropDownNonBlanksItem"),
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
id: "*HASVALUE*"
},
{ name: vm.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.t("GridRowFilterDropDownGreaterThan"), id: ">" },
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.$ay.t("GridRowFilterDropDownGreaterThan"), id: ">" },
{
name: vm.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
name: vm.$ay.t("GridRowFilterDropDownGreaterThanOrEqualTo"),
id: ">="
},
{ name: vm.t("GridRowFilterDropDownLessThan"), id: "<" },
{ name: vm.t("GridRowFilterDropDownLessThanOrEqualTo"), id: "<=" },
{ name: vm.t("GridRowFilterDropDownNotEquals"), 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.t("GridRowFilterDropDownEquals"),
name: vm.$ay.t("GridRowFilterDropDownEquals"),
id: "="
});
vm.selectLists.enumFilterOperators.push(
...[
{ name: vm.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{ name: vm.$ay.t("GridRowFilterDropDownBlanksItem"), id: "*NOVALUE*" },
{
name: vm.t("GridRowFilterDropDownNonBlanksItem"),
name: vm.$ay.t("GridRowFilterDropDownNonBlanksItem"),
id: "*HASVALUE*"
},
{ name: vm.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.t("GridRowFilterDropDownNotEquals"), id: "!=" }
{ name: vm.$ay.t("GridRowFilterDropDownEquals"), id: "=" },
{ name: vm.$ay.t("GridRowFilterDropDownNotEquals"), id: "!=" }
]
);
}
@@ -1248,7 +1241,7 @@ function setEffectiveListView(vm) {
vm.effectiveListView = JSON.parse(
formSettings.saved.dataTable.unsavedListView
);
vm.obj.name = vm.t("FilterUnsaved");
vm.obj.name = vm.$ay.t("FilterUnsaved");
return Promise.resolve();
}
} else if (vm.listViewId == 0) {
@@ -1261,7 +1254,7 @@ function setEffectiveListView(vm) {
throw res.error;
} else {
vm.effectiveListView = JSON.parse(res.data);
vm.obj.name = vm.t("FilterUnsaved");
vm.obj.name = vm.$ay.t("FilterUnsaved");
}
});
} else {
@@ -1299,7 +1292,7 @@ function initDataObject(vm) {
let fld = window.$gz._.find(vm.fieldDefinitions, ["fieldKey", lvItem.fld]);
let o = {
key: fld.fieldKey,
title: vm.t(fld.tKey),
title: vm.$ay.t(fld.tKey),
include: true,
isFilterable: fld.isFilterable,
isSortable: fld.isSortable,
@@ -1347,7 +1340,7 @@ function initDataObject(vm) {
//nope, so add it
let o = {
key: fld.fieldKey,
title: vm.t(fld.tKey),
title: vm.$ay.t(fld.tKey),
include: false,
isFilterable: fld.isFilterable,
isSortable: fld.isSortable,
@@ -1475,7 +1468,7 @@ function getDisplayForFilter(
case 6: //BOOL translate
//debugger;
let tKey = filterValue ? "True" : "False";
valueDisplay = vm.t(tKey);
valueDisplay = vm.$ay.t(tKey);
break;
case 10: //ENUM translate
valueDisplay = window.$gz.enums.get(enumType, filterValue);