diff options
| author | lucas_nz <lucas_nz@outlook.com> | 2020-09-30 18:05:07 +1300 |
|---|---|---|
| committer | lucas_nz <lucas_nz@outlook.com> | 2020-09-30 18:08:43 +1300 |
| commit | 5fae4b163e54658b623cce4e85811cb785673cf2 (patch) | |
| tree | afab93fdb0d4864bcca5427efdfffb55da0cba49 /www/js/EventDateTimeFilterCtrl.js | |
| parent | 8968a524a2df044b3f90d1c6fce110993eb8cf85 (diff) | |
if a monitor filter is applied, expand the monitors (so it's easy to see the filter)
Diffstat (limited to 'www/js/EventDateTimeFilterCtrl.js')
| -rw-r--r-- | www/js/EventDateTimeFilterCtrl.js | 10 |
1 files changed, 9 insertions, 1 deletions
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() { |
