From: Kyle Huckins <khuckins@catalyte.io>
Date: Thu, 16 Nov 2017 20:56:51 +0000 (+0000)
Subject: lp1642337 Boolean Filters in Reporter
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=cd31046e2412348a5ea8992c4f5474be13ac3433;p=evergreen%2Fjoelewis.git

lp1642337 Boolean Filters in Reporter

- 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>
---

diff --git a/Open-ILS/web/js/ui/default/staff/reporter/template/app.js b/Open-ILS/web/js/ui/default/staff/reporter/template/app.js
index c79a54bf37..4aeef637f8 100644
--- a/Open-ILS/web/js/ui/default/staff/reporter/template/app.js
+++ b/Open-ILS/web/js/ui/default/staff/reporter/template/app.js
@@ -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();
     }