This commit is contained in:
2019-07-19 19:41:58 +00:00
parent 177f08f49d
commit 7bbe2bd315
22 changed files with 191 additions and 192 deletions

View File

@@ -11,7 +11,7 @@
</v-flex>
<v-flex mb-4 v-if="this.formReady">
<h1 class="display-2 font-weight-bold mb-3">
{{ this.$gzlocale.get("Welcome") }}
{{ lt("Welcome") }}
</h1>
</v-flex>
</v-layout>
@@ -21,7 +21,7 @@
<script>
export default {
created() {
this.$gzlocale
window.$gz.locale
.fetch(["Welcome"])
.then(() => (this.formReady = true))
.catch(err => {
@@ -31,6 +31,11 @@ export default {
},
data() {
return { formReady: false };
},
methods: {
lt(ltKey) {
return window.$gz.locale.get(ltKey);
}
}
};
</script>

View File

@@ -1,7 +1,7 @@
<template>
<div v-if="this.$store.state.formCustomTemplate[formKey]">
<span class="v-label v-label--active theme--light">
{{ this.$gzlocale.get("ObjectCustomFieldCustomGrid") }}
{{ lt("ObjectCustomFieldCustomGrid") }}
</span>
<!-- <div>
<h5>FORMKEY: {{ formKey }}</h5>
@@ -128,7 +128,7 @@ export default {
},
methods: {
lt: function(ltkey) {
return this.$gzlocale.get(ltkey);
return window.$gz.locale.get(ltkey);
},
GetValueForField: function(dataKey) {
if (!this.value) {
@@ -171,11 +171,11 @@ export default {
// console.log("custom-fields-control::BEFORECREATE: TOP");
//check pre-requisites exist just in case
if (this.$gzdevmode()) {
if (!this.$_) {
throw "custom-fields-control: $_ (lodash) is required and missing";
if (!window.$gz._) {
throw "custom-fields-control: $gz._ (lodash) is required and missing";
}
if (!this.$gzlocale) {
throw "custom-fields-control: $gzlocale is required and missing";
if (!window.$gz.locale) {
throw "custom-fields-control: $gz.locale is required and missing";
}
}

View File

@@ -64,7 +64,7 @@ export default {
throw "DateTimeControl: the DayJS library is required and missing";
}
if (!window.$gz.locale) {
throw "DateTimeControl: $gzlocale is required and missing";
throw "DateTimeControl: $gz.locale is required and missing";
}
}
},
@@ -102,24 +102,24 @@ export default {
return this.value
? window.$gz.dayjs
.utc(this.value)
.add(this.$gzlocale.format().timeZoneOffset, "hour")
.format(this.$gzlocale.format().shortDateAndTime)
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format(window.$gz.locale.format().shortDateAndTime)
: "";
},
formatDate() {
return this.value
? window.$gz.dayjs
.utc(this.value)
.add(this.$gzlocale.format().timeZoneOffset, "hour")
.format(this.$gzlocale.format().shortDate)
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format(window.$gz.locale.format().shortDate)
: "";
},
formatTime() {
return this.value
? window.$gz.dayjs
.utc(this.value)
.add(this.$gzlocale.format().timeZoneOffset, "hour")
.format(this.$gzlocale.format().shortTime)
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format(window.$gz.locale.format().shortTime)
: "";
},
dateOnly: {
@@ -128,20 +128,20 @@ export default {
var defaultDateString = window.$gz
.dayjs()
.utc()
.add(this.$gzlocale.format().timeZoneOffset, "hour")
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format("YYYY-MM-DD");
return this.value
? window.$gz.dayjs
.utc(this.value)
.add(this.$gzlocale.format().timeZoneOffset, "hour")
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format("YYYY-MM-DD")
: defaultDateString;
},
set(value) {
this.date = window.$gz.dayjs
.utc(value + " " + this.timeOnly)
.subtract(this.$gzlocale.format().timeZoneOffset, "hour")
.subtract(window.$gz.locale.format().timeZoneOffset, "hour")
.toISOString();
}
},
@@ -150,20 +150,20 @@ export default {
//TODO: this will likely need an improvement for forms where there should be an automatic pre-set time chosen like workorder labor;
var defaultTimeString = window.$gz.dayjs
.utc()
.add(this.$gzlocale.format().timeZoneOffset, "hour")
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format("HH:mm:ss");
return this.value
? window.$gz.dayjs
.utc(this.value)
.add(this.$gzlocale.format().timeZoneOffset, "hour")
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format("HH:mm:ss")
: defaultTimeString;
},
set(value) {
this.date = window.$gz.dayjs
.utc(this.dateOnly + " " + value)
.subtract(this.$gzlocale.format().timeZoneOffset, "hour")
.subtract(window.$gz.locale.format().timeZoneOffset, "hour")
.toISOString();
}
}

View File

@@ -18,9 +18,7 @@
<v-toolbar flat>
<v-toolbar-title>
<v-icon large color="primary">fa-splotch</v-icon>
<span class="hidden-sm-and-down">{{
this.$gzlocale.get("WidgetList")
}}</span>
<span class="hidden-sm-and-down">{{ lt("WidgetList") }}</span>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn v-if="this.rights.change" icon @click="newItem()">
@@ -45,7 +43,7 @@
:total-items="totalItems"
:loading="loading"
:rows-per-page-items="rowsPerPageItems"
:rows-per-page-text="this.$gzlocale.get('RowsPerPage')"
:rows-per-page-text="lt('RowsPerPage')"
class="elevation-1"
select-all
>
@@ -93,7 +91,7 @@ export default {
beforeCreate() {
var that = this;
this.$gzlocale
window.$gz.locale
.fetch([
"Widget",
"WidgetList",
@@ -108,8 +106,10 @@ export default {
"RowsPerPage"
])
.then(() => {
that.$_.forEach(that.headers, function setHeaderLocalizedText(header) {
header.text = that.$gzlocale.get(header.text);
window.$gz._.forEach(that.headers, function setHeaderLocalizedText(
header
) {
header.text = window.$gz.locale.get(header.text);
});
})
.then(() => {
@@ -194,6 +194,12 @@ export default {
}
},
methods: {
lt(ltKey) {
return window.$gz.locale.get(ltKey);
},
ltFormat() {
return window.$gz.locale.format();
},
newItem() {
this.$router.push({
name: "inventory-widget-edit",
@@ -247,8 +253,9 @@ export default {
}
this.loading = true;
var listUrl = "Widget/ListWidgets?" + this.$gzapi.buildQuery(listOptions);
this.$gzapi.get(listUrl).then(res => {
var listUrl =
"Widget/ListWidgets?" + window.$gz.api.buildQuery(listOptions);
window.$gz.api.get(listUrl).then(res => {
that.loading = false;
that.Items = res.data;
that.totalItems = res.paging.count;

View File

@@ -60,7 +60,7 @@ export default {
return;
}
vm.tagSearchUnderway = true;
vm.$gzapi
window.$gz.api
.get("TagList/picklist?query=" + val) //roles
.then(res => {
if (res.error) {
@@ -95,7 +95,7 @@ export default {
},
normalizeTag(tagName) {
//kebab case takes care of all the things we need for tags in one go
tagName = this.$_.kebabCase(tagName);
tagName = window.$gz._.kebabCase(tagName);
//No longer than 255 characters
tagName = tagName.length > 255 ? tagName.substr(0, 255 - 1) : tagName;
return tagName;
@@ -104,11 +104,11 @@ export default {
beforeCreate() {
//check pre-requisites exist just in case
if (this.$gzdevmode()) {
if (!this.$_) {
throw "tag-picker: $_ (lodash) is required and missing";
if (!window.$gz._) {
throw "tag-picker: $gz._ (lodash) is required and missing";
}
if (!this.$gzlocale) {
throw "tag-picker: $gzlocale is required and missing";
if (!window.$gz.locale) {
throw "tag-picker: $gz.locale is required and missing";
}
}
}