diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-05-04 13:43:21 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-05-04 13:43:21 -0400 |
| commit | d1cad20e13e8f9485d7032e9ae21e958eec1f6fa (patch) | |
| tree | 0c630c6adeb581c204a9aa96bd2662c742dd71ad /www/js/EventModalCtrl.js | |
| parent | 6325eb356890e8bdc15ce958e8b0436ce65a8906 (diff) | |
#546 you now can delete with the trash icon
Diffstat (limited to 'www/js/EventModalCtrl.js')
| -rw-r--r-- | www/js/EventModalCtrl.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/www/js/EventModalCtrl.js b/www/js/EventModalCtrl.js index 0f56b488..6e42cfd6 100644 --- a/www/js/EventModalCtrl.js +++ b/www/js/EventModalCtrl.js @@ -1452,6 +1452,79 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro }; + + + $scope.deleteAndMoveNext = function (id) { + NVRDataModel.debug ("Delete and move next called with: "+id); + deleteEvent(id) + .then (function (succ) { + $ionicLoading.hide(); + $scope.modalData.doRefresh = true; + jumpToEvent(id,1); + + }) + }; + + function deleteEvent (id) { + //$scope.eventList.showDelete = false; + //curl -XDELETE http://server/zm/api/events/1.json + var loginData = NVRDataModel.getLogin(); + var apiDelete = loginData.apiurl + "/events/" + id + ".json"; + NVRDataModel.debug("DeleteEvent: ID=" + id ); + NVRDataModel.log("Delete event " + apiDelete); + + $ionicLoading.show( + { + template: "{{'kDeletingEvent' | translate}}...", + noBackdrop: true, + duration: zm.httpTimeout + }); + + return $http.delete(apiDelete) + .success(function(data) + { + $ionicLoading.hide(); + NVRDataModel.debug("delete output: " + JSON.stringify(data)); + + if (data.message == 'Error') + { + $ionicLoading.show( + { + template: "{{'kError' | translate}}...", + noBackdrop: true, + duration: 1500 + }); + + } + else + { + + $ionicLoading.hide(); + $ionicLoading.show( + { + template: "{{'kSuccess' | translate}}...", + noBackdrop: true, + duration: 1000 + }); + + + } + + // NVRDataModel.displayBanner('info', [$translate.instant('kDeleteEventSuccess')], 2000, 2000); + + + + + //doRefresh(); + + }) + .error(function(data) + { + $ionicLoading.hide(); + NVRDataModel.debug("delete error: " + JSON.stringify(data)); + NVRDataModel.displayBanner('error', [$translate.instant('kDeleteEventError1'), $translate.instant('kDeleteEventError2')]); + }); + } //-------------------------------------------------------- //Navigate to next/prev event in full screen mode //-------------------------------------------------------- |
