From: Mike Rylander Date: Thu, 20 Jul 2017 21:52:38 +0000 (-0400) Subject: LP#1705524: Use the new grid configuration for date format in the bills list X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f33efdc0a21ec4e0533e2cc380d94c63ed4bea6d;p=evergreen%2Fjoelewis.git LP#1705524: Use the new grid configuration for date format in the bills list The bills list in the patron interface predated any grid date formatting, so we bring it into the modern world. This also enhances the grid autoformatting for dates to support both flattened and dot-pathed item layout. Signed-off-by: Mike Rylander Signed-off-by: Tina Ji --- diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 index 3d4863cd88..840b83d001 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 @@ -100,9 +100,7 @@ path='grocery.billing_location.shortname' required hidden> - + diff --git a/Open-ILS/web/js/ui/default/staff/services/grid.js b/Open-ILS/web/js/ui/default/staff/services/grid.js index 41e2d98663..27344c0256 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -1936,6 +1936,15 @@ angular.module('egGridMod', * Others likely to follow... */ .filter('egGridValueFilter', ['$filter','egCore', function($filter,egCore) { + function traversePath(obj,path) { + var list = path.split('.'); + for (var part in path) { + if (obj[path]) obj = obj[path] + else return undef; + } + return obj; + } + var GVF = function(value, column, item) { switch(column.datatype) { case 'bool': @@ -1957,10 +1966,16 @@ angular.module('egGridMod', ? item[column.dateonlyinterval]() : item[column.dateonlyinterval]; + if (column.dateonlyinterval && !interval) // try it as a dotted path + interval = traversePath(item, column.dateonlyinterval); + var context = angular.isFunction(item[column.datecontext]) ? item[column.datecontext]() : item[column.datecontext]; + if (column.datecontext && !context) // try it as a dotted path + context = traversePath(item, column.datecontext); + var date_filter = column.datefilter || 'egOrgDateInContext'; return $filter(date_filter)(value, column.dateformat, context, interval);