This commit is contained in:
2022-02-24 19:51:12 +00:00
parent 0abe75fe48
commit da29037a01
2 changed files with 31 additions and 35 deletions

View File

@@ -134,7 +134,7 @@
</slot> </slot>
<slot name="settings"> <slot name="settings">
<div> <div>
settings default slot for settings
</div> </div>
</slot> </slot>
<div v-if="hasError" class="mx-2 mt-4 d-flex align-center"> <div v-if="hasError" class="mx-2 mt-4 d-flex align-center">

View File

@@ -40,6 +40,7 @@
></gz-chart-bar-horizontal> ></gz-chart-bar-horizontal>
</template> </template>
<template slot="settings"> <template slot="settings">
<div></div>
<v-col v-if="context" cols="12"> <v-col v-if="context" cols="12">
<v-dialog <v-dialog
v-model="context" v-model="context"
@@ -55,16 +56,27 @@
<v-card-text style="height: 500px;"> <v-card-text style="height: 500px;">
<v-select <v-select
v-model="localSettings.dateRange" v-model="settings.dateRange"
:items="selectLists.dateFilterTokens" :items="selectLists.dateFilterTokens"
item-text="name" item-text="name"
item-value="id" item-value="id"
:label="$ay.t('TimeSpanDateRange')" :label="$ay.t('TimeSpanDateRange')"
prepend-icon="$ayiFilter"
></v-select> ></v-select>
settings: {{ settings }}<br /> <v-select
localsettings: {{ localSettings }} v-model="settings.unit"
:items="selectLists.units"
item-text="name"
item-value="id"
:label="$ay.t('Unit')"
></v-select>
<v-text-field
v-model="settings.customTitle"
:label="$ay.t('Name')"
></v-text-field>
{{ settings }}
</v-card-text> </v-card-text>
<v-divider></v-divider> <v-divider></v-divider>
@@ -101,18 +113,10 @@ export default {
return { return {
obj: {}, obj: {},
context: false, context: false,
localSettings: {},
selectLists: { selectLists: {
dateFilterOperators: [],
dateFilterTokens: [], dateFilterTokens: [],
stringFilterOperators: [],
integerFilterOperators: [],
boolFilterOperators: [],
decimalFilterOperators: [],
tagFilterOperators: [], tagFilterOperators: [],
roleFilterOperators: [], units: []
enumFilterOperators: [],
intervalFilterOperators: []
} }
}; };
}, },
@@ -176,7 +180,7 @@ export default {
// //
// //
async function initWidget(vm) { async function initWidget(vm) {
console.log("INitializing widget dash-labotr-hours-personal"); //console.log("INitializing widget dash-labotr-hours-personal");
await fetchTranslatedText(); await fetchTranslatedText();
populateSelectionLists(vm); populateSelectionLists(vm);
} }
@@ -188,24 +192,14 @@ async function initWidget(vm) {
async function fetchTranslatedText() { async function fetchTranslatedText() {
await window.$gz.translation.cacheTranslations([ await window.$gz.translation.cacheTranslations([
"Filter", "Filter",
"GridFilterDialogAndRadioText",
"GridFilterDialogOrRadioText",
"GridRowFilterDropDownBlanksItem", "GridRowFilterDropDownBlanksItem",
"GridRowFilterDropDownNonBlanksItem", "GridRowFilterDropDownNonBlanksItem",
"GridRowFilterDropDownEquals", "GridRowFilterDropDownEquals",
"GridRowFilterDropDownGreaterThan",
"GridRowFilterDropDownGreaterThanOrEqualTo",
"GridRowFilterDropDownLessThan",
"GridRowFilterDropDownLessThanOrEqualTo",
"GridRowFilterDropDownNotEquals", "GridRowFilterDropDownNotEquals",
"GridRowFilterDropDownDoesNotContain", "GridRowFilterDropDownDoesNotContain",
"GridRowFilterDropDownContains", "GridRowFilterDropDownContains",
"GridRowFilterDropDownStartsWith",
"GridRowFilterDropDownEndsWith",
"SelectItem",
"DateRangeYesterday", "DateRangeYesterday",
"DateRangeToday", "DateRangeToday",
"DateRangeTomorrow",
"DateRangeLastWeek", "DateRangeLastWeek",
"DateRangeThisWeek", "DateRangeThisWeek",
"DateRangeNextWeek", "DateRangeNextWeek",
@@ -214,7 +208,6 @@ async function fetchTranslatedText() {
"DateRangeNextMonth", "DateRangeNextMonth",
"DateRange14DayWindow", "DateRange14DayWindow",
"DateRangePast", "DateRangePast",
"DateRangeFuture",
"DateRangeLastYear", "DateRangeLastYear",
"DateRangeThisYear", "DateRangeThisYear",
"DateRangeInTheLastThreeMonths", "DateRangeInTheLastThreeMonths",
@@ -240,18 +233,11 @@ async function fetchTranslatedText() {
"DateRangePreviousYearThisMonth", "DateRangePreviousYearThisMonth",
"DateRangePreviousYearLastMonth", "DateRangePreviousYearLastMonth",
"DateRangePreviousYearNextMonth", "DateRangePreviousYearNextMonth",
"True", "TimeSpanDays",
"False" "TimeSpanMonths"
]); ]);
} }
/*
"TimeSpanDays": "days",
"TimeSpanHours": "hours",
"TimeSpanMinutes": "minutes",
"TimeSpanMonths": "months",
*/
///////////////////////////////// /////////////////////////////////
// //
// //
@@ -324,5 +310,15 @@ function populateSelectionLists(vm) {
{ name: vm.$ay.t("GridRowFilterDropDownContains"), id: "-%-" } { name: vm.$ay.t("GridRowFilterDropDownContains"), id: "-%-" }
] ]
); );
vm.selectLists.units.push(
...[
{ name: vm.$ay.t("TimeSpanDays"), id: "day" },
{
name: vm.$ay.t("TimeSpanMonths"),
id: "month"
}
]
);
} }
</script> </script>