lp1642337 Boolean Filters in Reporter
authorKyle Huckins <khuckins@catalyte.io>
Thu, 16 Nov 2017 20:56:51 +0000 (20:56 +0000)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 24 May 2019 18:41:49 +0000 (14:41 -0400)
- Add condition check to see if filter is boolean, and if so,
substitute a confirm dialog for the default prompt, repalcing
the text input with buttons for True/False values.

Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Dawn Dale <ddale@georgialibraries.org>

Open-ILS/web/js/ui/default/staff/reporter/template/app.js

index c79a54b..4aeef63 100644 (file)
@@ -497,11 +497,23 @@ function($scope , $q , $routeParams , $location , $timeout , $window,  egCore ,
     $scope.changeFilterValue = function (items) {
         items.forEach(function(item) {
             var l = null;
-            egPromptDialog.open(egCore.strings.TEMPLATE_CONF_DEFAULT, item.value || '',
-                {ok : function(value) {
-                    if (value) egReportTemplateSvc.filter_fields[item.index].value = value;
-                }}
-            );
+            console.log(item);
+            if (item.datatype == "bool") {
+                egConfirmDialog.open(egCore.strings.TEMPLATE_CONF_DEFAULT, item.value || '',
+                    {ok : function() {
+                        egReportTemplateSvc.filter_fields[item.index].value = true;
+                    },
+                    cancel : function() {
+                        egReportTemplateSvc.filter_fields[item.index].value = false;
+                    }}, egCore.strings.TEMPLATE_CONF_TRUE, egCore.strings.TEMPLATE_CONF_FALSE
+                );
+            } else {
+                egPromptDialog.open(egCore.strings.TEMPLATE_CONF_DEFAULT, item.value || '',
+                    {ok : function(value) {
+                        if (value) egReportTemplateSvc.filter_fields[item.index].value = value;
+                    }}
+                );
+            }
         });
         fgrid.refresh();
     }