This commit is contained in:
2020-02-08 00:33:28 +00:00
parent 39b3f10a18
commit f7394ef4d9
3 changed files with 10 additions and 32 deletions

View File

@@ -54,6 +54,7 @@ TODO: LOCALIZATION
- Keep the ones that rely on filtering dates between values because that's how the client will be sending the relative filters - Keep the ones that rely on filtering dates between values because that's how the client will be sending the relative filters
- DataTable, make bools display as checkboxes instead of text (could just use icons instead of actual checkbox) - DataTable, make bools display as checkboxes instead of text (could just use icons instead of actual checkbox)
- DataTable Need enum translator in it's own class or maybe part of locale or uses locale I guess
- Determine best way to handle filters at client then code it - Determine best way to handle filters at client then code it
- Modify datalist server code to alternatively accept a json filter string instead of a filter ID (post?) - Modify datalist server code to alternatively accept a json filter string instead of a filter ID (post?)

View File

@@ -484,7 +484,8 @@ function buildRecords(listData, columndefinitions, filters) {
); );
break; break;
case 10: //enum case 10: //enum
display = filters.enum(display, columndefinitions[iColumn].et); //TODO: Need enum translator
display = columndefinitions[iColumn].et + "." + display;
break; break;
default: default:
//do nothing, allow it to stay as is //do nothing, allow it to stay as is

View File

@@ -139,37 +139,13 @@ document.addEventListener("fetchEnd", function() {
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// FILTERS // FILTERS
// //
//example filter kept for just in case
// Vue.filter("capitalize", function vueFilterCapitalize(value) {
// if (!value) return "";
// value = value.toString();
// return value.charAt(0).toUpperCase() + value.slice(1);
// });
Vue.filter("capitalize", function vueFilterCapitalize(value) {
if (!value) return "";
value = value.toString();
return value.charAt(0).toUpperCase() + value.slice(1);
});
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString#Browser_compatibility
//https://www.currency-iso.org/en/home.html
Vue.filter("currency", function vueFilterCurrency(value) {
if (!value) return "";
return value.toLocaleString(window.$gz.locale.getBrowserLanguages(), {
style: "currency",
currency: "EUR"
});
});
Vue.filter("decimal", function vueFilterDecimal(value) {
if (!value) return "";
return "dec.fltr." + value;
});
Vue.filter("boolastext", function vueFilterBoolAsText(value) {
if (!value) return "";
return value ? "Yup" : "Nope";
});
Vue.filter("enum", function vueFilterDecimal(value, enumtype) {
if (!value) return enumtype + ".";
return enumtype + "." + value; //todo: actual values here
});
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
//GZ COMPONENTS //GZ COMPONENTS