Add frontend support to archive / unarchive Event
This commit is contained in:
parent
5b9a27c5ca
commit
a8b56f37e0
|
@ -97,6 +97,9 @@ ZoneMinder.factory('Event', function($http) {
|
||||||
},
|
},
|
||||||
delete: function(eventId) {
|
delete: function(eventId) {
|
||||||
return $http.delete('/api/events/'+ eventId + '.json');
|
return $http.delete('/api/events/'+ eventId + '.json');
|
||||||
|
},
|
||||||
|
archive: function(eventId) {
|
||||||
|
return $http.post('/api/events/archive/'+ eventId + '.json');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -157,6 +157,8 @@ ZoneMinder.controller('EventController', function($scope, Event, $modalInstance,
|
||||||
$scope.avgScore = results.data.event.Event.AvgScore;
|
$scope.avgScore = results.data.event.Event.AvgScore;
|
||||||
$scope.maxScore = results.data.event.Event.MaxScore;
|
$scope.maxScore = results.data.event.Event.MaxScore;
|
||||||
$scope.notes = results.data.event.Event.Notes;
|
$scope.notes = results.data.event.Event.Notes;
|
||||||
|
$scope.archived = results.data.event.Event.Archived;
|
||||||
|
$scope.archive_text = $scope.archived == 0 ? 'Archive' : 'Unarchive';
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.cancel = function () {
|
$scope.cancel = function () {
|
||||||
|
@ -169,6 +171,13 @@ ZoneMinder.controller('EventController', function($scope, Event, $modalInstance,
|
||||||
console.log(results);
|
console.log(results);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.archive = function() {
|
||||||
|
Event.archive(eventId).then(function(results) {
|
||||||
|
$scope.archived = results.data.archived;
|
||||||
|
$scope.archive_text = $scope.archived == 0 ? 'Archive' : 'Unarchive';
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
ZoneMinder.controller('MonitorController', function($scope, $http, $location, Monitor) {
|
ZoneMinder.controller('MonitorController', function($scope, $http, $location, Monitor) {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<span class="pull-right glyphicon glyphicon-chevron-right"><span class="sr-only">Next</span></span>
|
<span class="pull-right glyphicon glyphicon-chevron-right"><span class="sr-only">Next</span></span>
|
||||||
|
<button type="button" class="btn btn-default" ng-click="archive()">{{ archive_text }}</button>
|
||||||
<button type="button" class="btn btn-danger" ng-click="delete()">Delete</button>
|
<button type="button" class="btn btn-danger" ng-click="delete()">Delete</button>
|
||||||
<button type="button" class="btn btn-warning" ng-click="cancel()">Cancel</button>
|
<button type="button" class="btn btn-warning" ng-click="cancel()">Cancel</button>
|
||||||
<span class="pull-left glyphicon glyphicon-chevron-left"><span class="sr-only">Previous</span></span>
|
<span class="pull-left glyphicon glyphicon-chevron-left"><span class="sr-only">Previous</span></span>
|
||||||
|
|
Loading…
Reference in New Issue