From 9a15ae5cec3b73820776d1c001e9a364fa879311 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 7 Feb 2020 23:32:22 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 14 ++-- ayanova/src/api/ayanova-version.js | 5 +- ayanova/src/api/locale.js | 29 +++----- .../src/components/custom-fields-control.vue | 13 ++-- ayanova/src/components/date-time-control.vue | 9 +-- ayanova/src/components/gz-data-table.vue | 3 - .../components/testinventorywidgetlist.vue | 3 - ayanova/src/components/time-control.vue | 7 +- ayanova/src/main.js | 1 - ayanova/src/store.js | 10 +-- ayanova/src/views/ay-about.vue | 70 +++++++------------ 11 files changed, 61 insertions(+), 103 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 1c5c9653..2d97ee66 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -50,16 +50,14 @@ SHELL / NAV / MENUS / LAYOUT TODO: LOCALIZATION - TODO ACTIONS - - Currency / decimal INPUT handle commas test to see if working fully - - needs to parse the currency, maybe I can cobble that together since the number portion stays the same?? (arabic?) - - INPUT currency / decimal can a german user input a currency as 1.234,56 ? (comma is the decimal separator and decimal is the thousands separator) - - https://dm4t2.github.io/vue-currency-input/guide/#installation - - PARSERS - - Update / test own parser for currency and decimal for validation purposes - - already something in there for currency I think - + - Get rid of timezone numeric override and any other deprecated stuff (currency symbol, decimal symbol etc) and associated code at client and server - Add the new overrides for language and timezone and currency code and 12hour at client and server + - CurrencyName (only one can't be inferred) + - Time zone name + - language name + - 12hr time + - Make functional user settings form with all overrides so can test shit out - Need a browser check on opening the login page that will check to ensure the browser can do the date conversions properly etc and tell user browser is unsuitable if it isn't diff --git a/ayanova/src/api/ayanova-version.js b/ayanova/src/api/ayanova-version.js index 2787706a..d9e0174a 100644 --- a/ayanova/src/api/ayanova-version.js +++ b/ayanova/src/api/ayanova-version.js @@ -1,11 +1,12 @@ export default { - version: "8.0.0-alpha.2020.Jan.31", + version: "8.0.0-alpha.2020.Feb-07", copyright: "Copyright © 1999-2020, Ground Zero Tech-Works Inc. All Rights Reserved", browser: { platform: window.navigator.platform, userAgent: window.navigator.userAgent, - language: window.navigator.language, + languages: window.navigator.languages, + tz: Intl.DateTimeFormat().resolvedOptions().timeZone, oscpu: window.navigator.oscpu, maxTouchPoints: window.navigator.maxTouchPoints, webdriver: window.navigator.webdriver, diff --git a/ayanova/src/api/locale.js b/ayanova/src/api/locale.js index 4b4be71f..e4e114bc 100644 --- a/ayanova/src/api/locale.js +++ b/ayanova/src/api/locale.js @@ -158,24 +158,7 @@ export default { "AM", "PM" ], - decimalValidate(required) { - return { required: required, decimal: [2, this.format().decimalSeparator] }; - }, - decimalParse(v) { - if (v) { - if ( - this.decimalSeparator != "." && - v.includes(this.format().decimalSeparator) - ) { - v = v.replace(this.format().decimalSeparator, "."); - } - v = parseFloat(v); - } - return v; - }, - format() { - return window.$gz.store.state.locale; - }, + //////////////////////////////////////////////////////// // Take in a string that contains one or more //locale keys between square brackets @@ -224,6 +207,12 @@ export default { getCurrencyName() { return window.$gz.store.state.locale.currencyName; }, + ////////////////////////////////////////////////// + // Get the user's chosen 12hr clock + // + getHour12() { + return window.$gz.store.state.locale.hour12; + }, /////////////////////////////////////////// // Turn a utc date into a displayable // short date and time @@ -246,7 +235,7 @@ export default { } if (!hour12) { - hour12 = window.$gz.store.state.locale.hour12; + hour12 = this.getHour12(); } //parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z") @@ -306,7 +295,7 @@ export default { } if (!hour12) { - hour12 = window.$gz.store.state.locale.hour12; + hour12 = this.getHour12(); } //parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z") diff --git a/ayanova/src/components/custom-fields-control.vue b/ayanova/src/components/custom-fields-control.vue index c7400a91..337ca562 100644 --- a/ayanova/src/components/custom-fields-control.vue +++ b/ayanova/src/components/custom-fields-control.vue @@ -17,7 +17,8 @@ >
- + > -->
@@ -104,7 +105,8 @@
- + > -->
@@ -167,9 +169,6 @@ export default { lt: function(ltkey) { return window.$gz.locale.get(ltkey); }, - ltFormat() { - return window.$gz.locale.format(); - }, form() { //nothing return window.$gz.form; diff --git a/ayanova/src/components/date-time-control.vue b/ayanova/src/components/date-time-control.vue index 9e9ee277..ac9dc4e2 100644 --- a/ayanova/src/components/date-time-control.vue +++ b/ayanova/src/components/date-time-control.vue @@ -53,7 +53,7 @@ @@ -87,9 +87,10 @@ export default { //cache display format stuff timeZoneName: window.$gz.locale.getTimeZoneName(), languageName: window.$gz.locale.getBrowserLanguages(), - hour12: window.$gz.store.state.locale.hour12, - defaultLocale: window.$gz.locale.getBrowserFirstLanguage().split("-", 1)[0], - ampmFormat: window.$gz.locale.format().hour12 ? "ampm" : "24hr" + hour12: window.$gz.locale.getHour12(), + defaultLocale: window.$gz.locale.getBrowserFirstLanguage().split("-", 1)[0] + // ampmFormat: window.$gz.locale.getHour12() ? "ampm" : "24hr" + //:format="ampmFormat" }), props: { label: String, diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index b8ab1ff4..66e29564 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -331,9 +331,6 @@ export default { lt(ltKey) { return window.$gz.locale.get(ltKey); }, - ltFormat() { - return window.$gz.locale.format(); - }, getDataFromApi() { var that = this; diff --git a/ayanova/src/components/testinventorywidgetlist.vue b/ayanova/src/components/testinventorywidgetlist.vue index 2cddda1f..2b5814b5 100644 --- a/ayanova/src/components/testinventorywidgetlist.vue +++ b/ayanova/src/components/testinventorywidgetlist.vue @@ -212,9 +212,6 @@ Actual in inspector browser code: lt(ltKey) { return window.$gz.locale.get(ltKey); }, - ltFormat() { - return window.$gz.locale.format(); - }, newItem() { this.$router.push({ name: "inventory-widget-edit", diff --git a/ayanova/src/components/time-control.vue b/ayanova/src/components/time-control.vue index 843db81f..31106bd3 100644 --- a/ayanova/src/components/time-control.vue +++ b/ayanova/src/components/time-control.vue @@ -17,7 +17,7 @@ @@ -51,9 +51,8 @@ export default { //cache display format stuff timeZoneName: window.$gz.locale.getTimeZoneName(), languageName: window.$gz.locale.getBrowserLanguages(), - hour12: window.$gz.store.state.locale.hour12, - defaultLocale: window.$gz.locale.getBrowserFirstLanguage().split("-", 1)[0], - ampmFormat: window.$gz.locale.format().hour12 ? "ampm" : "24hr" + hour12: window.$gz.locale.getHour12(), + defaultLocale: window.$gz.locale.getBrowserFirstLanguage().split("-", 1)[0] }), props: { label: String, diff --git a/ayanova/src/main.js b/ayanova/src/main.js index 2db299de..99db7a93 100644 --- a/ayanova/src/main.js +++ b/ayanova/src/main.js @@ -154,7 +154,6 @@ Vue.filter("currency", function vueFilterCurrency(value) { style: "currency", currency: "EUR" }); - // return locale.format().currencySymbol + value.toFixed(2); }); Vue.filter("decimal", function vueFilterDecimal(value) { diff --git a/ayanova/src/store.js b/ayanova/src/store.js index d9342f4f..e64cacbd 100644 --- a/ayanova/src/store.js +++ b/ayanova/src/store.js @@ -21,14 +21,10 @@ export default new Vuex.Store({ homePage: undefined, localeText: {}, locale: { - tag: "en-US", - decimalSeparator: ".", + languageOverride: "en-US", + timeZoneOverride: ".", currencyName: "USD", - hour12: true, - // shortDate: "YYYY-MM-DD", - // shortTime: "hh:mm:ss A", - // shortDateAndTime: "YYYY-MM-DD hh:mm:ss A", - timeZoneOffset: -7 //timeZoneOffset is in decimal hours + hour12: true }, navItems: [], logArray: [], diff --git a/ayanova/src/views/ay-about.vue b/ayanova/src/views/ay-about.vue index 0b63426c..9be29cc5 100644 --- a/ayanova/src/views/ay-about.vue +++ b/ayanova/src/views/ay-about.vue @@ -16,107 +16,92 @@ {{ lt("ClientApp") }}
- {{ lt("Version") }}: + {{ lt("Version") }}: {{ clientInfo.version }}
- {{ lt("User") }}: + {{ lt("User") }}: {{ this.$store.state.userName }}
- 12h: + 12h: - {{ ltFormat().hour12 }} + {{ locale().getHour12() }}
- {{ lt("UserTimeZoneOffset") }}: + {{ lt("TimeZone") }}: - {{ ltFormat().timeZoneOffset }} + {{ locale().getTimeZoneName() }}
- {{ lt("DecimalSeparator") }}: - {{ ltFormat().decimalSeparator }} + {{ lt("LanguageCode") }}: + {{ locale().getBrowserFirstLanguage() }}
- {{ lt("CurrencySymbol") }}: - {{ ltFormat().currencySymbol }} + {{ lt("CurrencyCode") }}: + {{ locale().getCurrencyName() }}
- - {{ lt("Browser") }}
- {{ name }}: + {{ name }}: {{ value }}
{{ lt("Server") }}
- {{ lt("ServerAddress") }}: + {{ lt("ServerAddress") }}: {{ this.$store.state.apiUrl }}
- {{ lt("Version") }}: + {{ lt("Version") }}: {{ serverInfo.serverVersion }}
- {{ lt("SchemaVersion") }}: + {{ lt("SchemaVersion") }}: {{ serverInfo.dbSchemaVersion }}
- {{ lt("ServerTime") }}: + {{ lt("ServerTime") }}: {{ serverInfo.serverLocalTime }}
- {{ lt("TimeZone") }}: + {{ lt("TimeZone") }}: {{ serverInfo.serverTimeZone }}
{{ lt("HelpLicense") }}
- {{ lt("RegisteredUser") }}: + {{ lt("RegisteredUser") }}: {{ serverInfo.license.license.licensedTo }}
- {{ lt("DatabaseID") }}: + {{ lt("DatabaseID") }}: {{ serverInfo.license.license.dbId }}
- {{ lt("LicenseSerial") }}: + {{ lt("LicenseSerial") }}: {{ serverInfo.license.license.keySerial }}
- {{ lt("LicenseExpiration") }}: + {{ lt("LicenseExpiration") }}: {{ serverInfo.license.license.licenseExpiration }}
- {{ lt("SupportedUntil") }}: + {{ lt("SupportedUntil") }}: {{ serverInfo.license.license.maintenanceExpiration }} @@ -198,12 +183,9 @@ export default { "Log", "User", "Browser", - "UserTimeZoneOffset", - "DecimalSeparator", - "CurrencySymbol", - "ShortDateFormat", - "ShortTimeFormat", - "ShortDateAndTimeFormat" + "LanguageCode", + "TimeZone", + "CurrencyCode" ]) .then(function() { vm.formState.ready = true; @@ -269,8 +251,8 @@ export default { lt(ltKey) { return window.$gz.locale.get(ltKey); }, - ltFormat() { - return window.$gz.locale.format(); + locale() { + return window.$gz.locale; } } };