diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 24ca5267..fde1eaa2 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -259,9 +259,52 @@ TODO: 1 BETA DOCS: sometimes it just works, I'm guessing it's a milliseconds issue or something, round first maybe to remove ms then calc? - 1 todo: time control in native browser format isn't showing a title at all, check date as well. Date and time is ok - 1 todo: about FORM - does it show user has native date time input use browser override? + +- 1 todo: CURRENCY / DECIMAL control, not too happy with them, considering rolling my own maybe here are some ideas: + +To get current use the latest version which is completely different and seems ok, here is a dude who implemented it with vuetify so would need to copy this +as it's too small to just use his I think: https://github.com/phiny1/v-currency-field/blob/master/src/VCurrencyField.vue + +For the record the current vue-currency being used is "vue-currency-input": "1.20.3", + https://stackoverflow.com/questions/43208012/how-do-i-format-currencies-in-a-vue-component + Also a good post about rounding on that page as well + There is currently no intnl aware parser for currency, however + Here is an excellent idea about using the tostring formatter to figure out the parsing code + https://stackoverflow.com/questions/59678901/using-parsefloat-in-different-locales + So use that concept, but also add to it for the currency one to remove the currency symbol entirely and replace it with nothing so it can then be parsed + + + +function localeParseFloat(s, locale) { + // Get the thousands and decimal separator characters used in the locale. + let [,thousandsSeparator,,,,decimalSeparator] = 1111.1.toLocaleString(locale); + // Remove thousand separators, and put a point where the decimal separator occurs + s = Array.from(s, c => c === thousandsSeparator ? "" + : c === decimalSeparator ? "." : c).join(""); + // Now it can be parsed + return parseFloat(s); +} + +console.log(parseFloat(localeParseFloat("1.100,9"))); // user's locale +console.log(parseFloat(localeParseFloat("1.100,9", "us"))); // US locale +console.log(parseFloat(localeParseFloat("1.100,9", "nl"))); // Dutch locale: reversed meaning of separators +// And the same but with separators switched: +console.log(parseFloat(localeParseFloat("1,100.9"))); // user's locale +console.log(parseFloat(localeParseFloat("1,100.9", "us"))); // US locale +console.log(parseFloat(localeParseFloat("1,100.9", "nl"))); // Dutch locale: reversed meaning of separators + + + + + + + +-1 todo: why should user be able to open a part inventory transaction record in the first place? It opens to the history form, isn't that weird, theres nothing to see that isn't +in the grid is there?? + + + - 2 todo: when hide a section in wo like all tasks in customize should hide the add task woitem context menu item too - - - 2: the home notify subscription table shows object types but without the square brackets around them and should for consistency - 2: address "Required" uses street as the only required, however it should also alternatively accept latitude longitude instead of a street address for required validation - 2: reset to defaults button for form customize would be handy, especially on work order forms. diff --git a/ayanova/src/api/gzform.js b/ayanova/src/api/gzform.js index e6c4a61b..8a7779db 100644 --- a/ayanova/src/api/gzform.js +++ b/ayanova/src/api/gzform.js @@ -333,7 +333,6 @@ export default { if (isNumber(value)) { return true; } - const err = vm.$ay.t("ErrorFieldValueNotDecimal"); this.setFormState({ vm: vm, diff --git a/ayanova/src/components/decimal-control.vue b/ayanova/src/components/decimal-control.vue index d03a3474..69e72a8d 100644 --- a/ayanova/src/components/decimal-control.vue +++ b/ayanova/src/components/decimal-control.vue @@ -5,7 +5,8 @@ v-currency="{ currency: null, locale: languageName, - precision: precision + precision: precision, + allowNegative: true }" :value="currencyValue" :readonly="readonly"