From 4590992c3670836d6d04293d855f05dee8e8c339 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Thu, 29 Dec 2016 17:26:23 -0500 Subject: swipe left to flag/unflag events (archive/un-archive) - still some UI work to be done #388 --- www/css/style.css | 31 ++++++++++++++++- www/js/EventCtrl.js | 87 +++++++++++++++++++++++++++++++++++++++++++++++ www/templates/events.html | 19 ++++++++++- 3 files changed, 135 insertions(+), 2 deletions(-) (limited to 'www') diff --git a/www/css/style.css b/www/css/style.css index 18a34314..ed8ac441 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -1172,7 +1172,36 @@ videogular div.event-time { top: -99999px; } - +.item-options .button{ + display: -webkit-box; + display: -moz-box; + display: -ms-inline-flexbox; + display: -webkit-inline-flex; + display: inline-flex; + -webkit-box-direction: normal; + -moz-box-direction: normal; + -webkit-box-orient: horizontal; + -moz-box-orient: horizontal; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + -webkit-flex-wrap: nowrap; + -ms-flex-wrap: nowrap; + flex-wrap: nowrap; + -webkit-box-pack: center; + -moz-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-align-content: center; + -ms-flex-line-pack: center; + align-content: center; + -webkit-box-align: center; + -moz-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; +} @media (min-width:600px) { .montage-time { diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 32f8b119..a3958501 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -1556,6 +1556,91 @@ angular.module('zmApp.controllers') ); } + $scope.archiveUnarchiveEvent = function (ndx,eid) + { + //https://server/zm/api/events/11902.json -XPUT -d"Event[Archived]=1" + NVRDataModel.debug ("Archiving request for EID="+eid); + var loginData = NVRDataModel.getLogin(); + var apiArchive = loginData.apiurl + "/events/" + eid + ".json"; + var setArchiveBit = ($scope.events[ndx].Event.Archived == '0') ? "1":"0"; + + NVRDataModel.debug ("Calling archive with:"+apiArchive+ " and Archive="+setArchiveBit); + //put(url, data, [config]); + + // $http.put(apiArchive,"Event[Archived]="+setArchiveBit) + // + $ionicLoading.show( + { + template: "{{'kPleaseWait' | translate}}...", + noBackdrop: true, + duration: zm.httpTimeout + }); + + $http({ + + method: 'POST', + headers: + { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Accept': '*/*', + }, + transformRequest: function(obj) + { + var str = []; + for (var p in obj) + str.push(encodeURIComponent(p) + "=" + + encodeURIComponent(obj[p])); + var foo = str.join("&"); + // console.log("****RETURNING " + foo); + NVRDataModel.debug("MonitorCtrl: parmeters constructed: " + foo); + return foo; + }, + url: apiArchive, + data: { + "Event[Archived]":setArchiveBit + + } + }) + .then (function (success) { + + NVRDataModel.log ("archiving response: "+ JSON.stringify(success)); + if (success.data.message == 'Error') + { + $ionicLoading.show( + { + template: "{{'kError' | translate}}...", + noBackdrop: true, + duration: 1500 + }); + + } + else + { + + + $ionicLoading.show( + { + template: "{{'kSuccess' | translate}}...", + noBackdrop: true, + duration: 1000 + }); + if ($scope.events[ndx].Event.Archived == '0') + $scope.events[ndx].Event.Archived = '1'; + else + $scope.events[ndx].Event.Archived = '0'; + } + + + + }, + function (error) { + NVRDataModel.log ("Error archiving: "+ JSON.stringify(error)); + } ); + + + + }; + //-------------------------------------------------------------------------- // Takes care of deleting individual events //-------------------------------------------------------------------------- @@ -1576,6 +1661,8 @@ angular.module('zmApp.controllers') duration: zm.httpTimeout }); + + $http.delete(apiDelete) .success(function(data) { diff --git a/www/templates/events.html b/www/templates/events.html index 5d60a46b..d76d4083 100644 --- a/www/templates/events.html +++ b/www/templates/events.html @@ -63,7 +63,7 @@
- {{event.Event.MonitorName}} ({{event.Event.Id}})   +  {{event.Event.MonitorName}} ({{event.Event.Id}})   @@ -79,6 +79,8 @@ {{event.Event.Frames}}   {{event.Event.AlarmFrames}}   {{event.Event.TotScore}} + +
@@ -184,6 +186,18 @@ + + + Unflag + + Flag + + + +









+ @@ -198,6 +212,9 @@ + + +
-- cgit v1.2.3