summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2016-12-29 17:26:23 -0500
committerPliable Pixels <pliablepixels@gmail.com>2016-12-29 17:26:23 -0500
commit4590992c3670836d6d04293d855f05dee8e8c339 (patch)
treeec734de1c551dedc9972f2f92b1ee9b812b6eaee
parentb8e3c2c1f15740f4de47298983083865b5754e39 (diff)
swipe left to flag/unflag events (archive/un-archive) - still some UI work to be done #388
-rw-r--r--www/css/style.css31
-rw-r--r--www/js/EventCtrl.js87
-rw-r--r--www/templates/events.html19
3 files changed, 135 insertions, 2 deletions
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 @@
<div class="col col-80">
<div class="item-text-wrap">
- <b>{{event.Event.MonitorName}}</b> ({{event.Event.Id}}) &nbsp;
+ <b><i ng-if="event.Event.Archived=='1'" class="ion-ios-flag" style="color:red">&nbsp;</i>{{event.Event.MonitorName}}</b> ({{event.Event.Id}}) &nbsp;
<button ng-if="gifshotSupported" class="button button-small button-clear icon gif-icon" ng-click="permissionsDownload(event)">
</button>
@@ -79,6 +79,8 @@
<i class="ion-images"></i> {{event.Event.Frames}} &nbsp;
<i class="ion-ios-bell-outline"></i> {{event.Event.AlarmFrames}} &nbsp;
<i class="ion-arrow-graph-up-right"></i> {{event.Event.TotScore}}
+
+
</div>
</div>
<!--row-->
@@ -184,6 +186,18 @@
<!-- isGroupShown -->
<ion-delete-button class="ion-minus-circled" ng-click="deleteEvent(event.Event.Id, $index)">
</ion-delete-button>
+
+
+ <ion-option-button ng-if="event.Event.Archived == 1" class="button-balanced" ng-click= "archiveUnarchiveEvent($index,event.Event.Id)">Unflag</ion-option-button>
+
+ <ion-option-button ng-if="event.Event.Archived == 0" class="button-assertive" ng-click="archiveUnarchiveEvent($index, event.Event.Id)" >Flag</ion-option-button>
+
+ <!-- hack to make sure swipe left displays well
+ if there is no content and our list height is set
+ to a larger height, the swipe display acts weird -->
+
+ <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
+
</ion-item>
</ion-list>
</div>
@@ -198,6 +212,9 @@
</ion-infinite-scroll>
</div>
<canvas id="canvas" class="hiddengifcanvas"></canvas>
+
+
+
</ion-content>
<div class="events-float-filter" ng-if="isEventFilterOn" on-tap="filterTapped();"><span translate="kFilterOn"></span></div>
<div class="bwmode" ng-if="$root.runMode=='lowbw'">