From 5fae4b163e54658b623cce4e85811cb785673cf2 Mon Sep 17 00:00:00 2001 From: lucas_nz Date: Wed, 30 Sep 2020 18:05:07 +1300 Subject: if a monitor filter is applied, expand the monitors (so it's easy to see the filter) --- www/js/EventDateTimeFilterCtrl.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/www/js/EventDateTimeFilterCtrl.js b/www/js/EventDateTimeFilterCtrl.js index 28779310..7867659b 100644 --- a/www/js/EventDateTimeFilterCtrl.js +++ b/www/js/EventDateTimeFilterCtrl.js @@ -29,6 +29,7 @@ angular.module('zmApp.controllers') $scope.$on('$ionicView.beforeEnter', function () { $scope.today = moment().format("YYYY-MM-DD"); $scope.monitors = NVR.getMonitorsNow(); + var countChecked = 0; if (!$scope.monitors.length) { NVR.getMonitors(1) .then (function (data) { @@ -36,6 +37,8 @@ angular.module('zmApp.controllers') for (var i=0; i < $scope.monitors.length; i++) { if ($scope.monitors[i].Monitor.isChecked == undefined) $scope.monitors[i].Monitor.isChecked = true; + if ($scope.monitors[i].Monitor.isChecked == true) + countChecked++; } }); } @@ -43,9 +46,14 @@ angular.module('zmApp.controllers') for (var i=0; i < $scope.monitors.length; i++) { if ($scope.monitors[i].Monitor.isChecked == undefined) $scope.monitors[i].Monitor.isChecked = true; + if ($scope.monitors[i].Monitor.isChecked == true) + countChecked++; } } - $scope.monitorsExpanded = false; + if (countChecked < $scope.monitors.length) + $scope.monitorsExpanded = true; + else + $scope.monitorsExpanded = false; }); $scope.toggleMonitors = function() { -- cgit v1.2.3