This commit is contained in:
@@ -747,26 +747,26 @@ export default function initialize() {
|
|||||||
);
|
);
|
||||||
window.$gz.eventBus.$emit("notify-error", msg);
|
window.$gz.eventBus.$emit("notify-error", msg);
|
||||||
} else {
|
} else {
|
||||||
//TODO: also need the other locale settings such as number and date formats etc
|
// //TODO: also need the other locale settings such as number and date formats etc
|
||||||
var localOffset = new Date().getTimezoneOffset();
|
// var localOffset = new Date().getTimezoneOffset();
|
||||||
if (localOffset != 0) {
|
// if (localOffset != 0) {
|
||||||
localOffset = (localOffset / 60) * -1; //time is in minutes and reversed from what we want or expect
|
// localOffset = (localOffset / 60) * -1; //time is in minutes and reversed from what we want or expect
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (res.data.timeZoneOffset != localOffset) {
|
// if (res.data.timeZoneOffset != localOffset) {
|
||||||
//TODO: localize message and also actually have a fix for it here
|
// //TODO: localize message and also actually have a fix for it here
|
||||||
//so this should be a confirm prompt but for now will just show it
|
// //so this should be a confirm prompt but for now will just show it
|
||||||
|
|
||||||
//for now just show the message
|
// //for now just show the message
|
||||||
window.$gz.eventBus.$emit(
|
// window.$gz.eventBus.$emit(
|
||||||
"notify-info",
|
// "notify-info",
|
||||||
"Time zone offset for your account is set to " +
|
// "Time zone offset for your account is set to " +
|
||||||
res.data.timeZoneOffset +
|
// res.data.timeZoneOffset +
|
||||||
" which doesn't match the local timezone offset of " +
|
// " which doesn't match the local timezone offset of " +
|
||||||
localOffset,
|
// localOffset,
|
||||||
window.$gz.store.state.helpUrl + "intro/#searching"
|
// window.$gz.store.state.helpUrl + "intro/#searching"
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
// window.$gz.eventBus.$emit("notify-success", "Success");
|
// window.$gz.eventBus.$emit("notify-success", "Success");
|
||||||
// window.$gz.eventBus.$emit(
|
// window.$gz.eventBus.$emit(
|
||||||
@@ -782,7 +782,7 @@ export default function initialize() {
|
|||||||
//TODO: also need the other locale settings such as number and date formats etc to be added at server
|
//TODO: also need the other locale settings such as number and date formats etc to be added at server
|
||||||
window.$gz.store.commit("setLocale", {
|
window.$gz.store.commit("setLocale", {
|
||||||
decimalSeparator: ".",
|
decimalSeparator: ".",
|
||||||
currencySymbol: "$",
|
currencyName: "USD",
|
||||||
hour12: true,
|
hour12: true,
|
||||||
// shortDate: "YYYY-MM-DD",
|
// shortDate: "YYYY-MM-DD",
|
||||||
// shortTime: "hh:mm:ss A",
|
// shortTime: "hh:mm:ss A",
|
||||||
|
|||||||
@@ -376,6 +376,24 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
///////////////////////////////////////////
|
||||||
|
// Turn a decimal number into a local
|
||||||
|
// currency display
|
||||||
|
//
|
||||||
|
currencyLocalized(value, languageName, currencyName) {
|
||||||
|
if (!value) return "";
|
||||||
|
if (!languageName) {
|
||||||
|
languageName = this.getBrowserLanguages();
|
||||||
|
}
|
||||||
|
if (!currencyName) {
|
||||||
|
currencyName = window.$gz.store.state.locale.currencyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Intl.NumberFormat(languageName, {
|
||||||
|
style: "currency",
|
||||||
|
currency: currencyName
|
||||||
|
}).format(value);
|
||||||
|
},
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// dynamically set the vuetify language elements from
|
// dynamically set the vuetify language elements from
|
||||||
// users localized text (am/pm etc)
|
// users localized text (am/pm etc)
|
||||||
|
|||||||
@@ -436,6 +436,7 @@ function buildRecords(listData, columndefinitions, filters) {
|
|||||||
var timeZoneName = window.$gz.locale.getTimeZoneName();
|
var timeZoneName = window.$gz.locale.getTimeZoneName();
|
||||||
var languageName = window.$gz.locale.getBrowserLanguages();
|
var languageName = window.$gz.locale.getBrowserLanguages();
|
||||||
var hour12 = window.$gz.store.state.locale.hour12;
|
var hour12 = window.$gz.store.state.locale.hour12;
|
||||||
|
var currencyName = window.$gz.store.state.locale.currencyName;
|
||||||
|
|
||||||
//comes as an array of arrays, needs to leave as an array of objects representing each row
|
//comes as an array of arrays, needs to leave as an array of objects representing each row
|
||||||
for (var iRow = 0; iRow < listData.length; iRow++) {
|
for (var iRow = 0; iRow < listData.length; iRow++) {
|
||||||
@@ -479,7 +480,11 @@ function buildRecords(listData, columndefinitions, filters) {
|
|||||||
display = filters.decimal(display);
|
display = filters.decimal(display);
|
||||||
break;
|
break;
|
||||||
case 8: //currency
|
case 8: //currency
|
||||||
display = filters.currency(display);
|
display = window.$gz.locale.currencyLocalized(
|
||||||
|
display,
|
||||||
|
languageName,
|
||||||
|
currencyName
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 10: //enum
|
case 10: //enum
|
||||||
display = filters.enum(display, columndefinitions[iColumn].et);
|
display = filters.enum(display, columndefinitions[iColumn].et);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default new Vuex.Store({
|
|||||||
locale: {
|
locale: {
|
||||||
tag: "en-US",
|
tag: "en-US",
|
||||||
decimalSeparator: ".",
|
decimalSeparator: ".",
|
||||||
currencySymbol: "$",
|
currencyName: "USD",
|
||||||
hour12: true,
|
hour12: true,
|
||||||
// shortDate: "YYYY-MM-DD",
|
// shortDate: "YYYY-MM-DD",
|
||||||
// shortTime: "hh:mm:ss A",
|
// shortTime: "hh:mm:ss A",
|
||||||
@@ -60,7 +60,7 @@ export default new Vuex.Store({
|
|||||||
state.apiUrl = "";
|
state.apiUrl = "";
|
||||||
state.locale.tag = "en-US";
|
state.locale.tag = "en-US";
|
||||||
state.locale.decimalSeparator = ".";
|
state.locale.decimalSeparator = ".";
|
||||||
state.locale.currencySymbol = "$";
|
state.locale.currencyName = "USD";
|
||||||
state.locale.hour12 = true;
|
state.locale.hour12 = true;
|
||||||
// state.locale.shortDate = "YYYY-MM-DD";
|
// state.locale.shortDate = "YYYY-MM-DD";
|
||||||
// state.locale.shortTime = "hh:mm:ss A";
|
// state.locale.shortTime = "hh:mm:ss A";
|
||||||
@@ -81,7 +81,7 @@ export default new Vuex.Store({
|
|||||||
setLocale(state, data) {
|
setLocale(state, data) {
|
||||||
// mutate state
|
// mutate state
|
||||||
state.locale.decimalSeparator = data.decimalSeparator;
|
state.locale.decimalSeparator = data.decimalSeparator;
|
||||||
state.locale.currencySymbol = data.currencySymbol;
|
state.locale.currencyName = data.currencyName;
|
||||||
state.locale.hour12 = data.hour12;
|
state.locale.hour12 = data.hour12;
|
||||||
// state.locale.shortDate = data.shortDate;
|
// state.locale.shortDate = data.shortDate;
|
||||||
// state.locale.shortTime = data.shortTime;
|
// state.locale.shortTime = data.shortTime;
|
||||||
|
|||||||
Reference in New Issue
Block a user