diff --git a/views/travel/travel.html b/views/travel/travel.html index 988dacb..a43e14f 100644 --- a/views/travel/travel.html +++ b/views/travel/travel.html @@ -93,8 +93,8 @@

Admin actions

-
Ban travel
-
Delete travel
+ +
Delete travel
diff --git a/views/travel/travel.js b/views/travel/travel.js index d38ff6c..d15a2cb 100644 --- a/views/travel/travel.js +++ b/views/travel/travel.js @@ -57,4 +57,23 @@ angular.module('app.travel', ['ngRoute', 'ui-leaflet']) console.log('data error'); }); + + //delete travel + $scope.deleteTravel = function() { + console.log("delete travel: " + $routeParams.travelid); + $http({ + url: urlapi + '/admin/travels/id/' + $routeParams.travelid, + method: "DELETE" + }) + .then(function(data) { + console.log(data); + $scope.travels = data.data; + + window.location = "#!/main/"; + }, + function(data) { // optional + // failed + }); + }; + }); diff --git a/views/user/user.html b/views/user/user.html index ef23797..49e44ed 100644 --- a/views/user/user.html +++ b/views/user/user.html @@ -97,8 +97,8 @@

Admin actions

-
Ban user
-
Delete user
+ +
Delete user
diff --git a/views/user/user.js b/views/user/user.js index eeaa447..3ab6f45 100644 --- a/views/user/user.js +++ b/views/user/user.js @@ -31,4 +31,19 @@ angular.module('app.user', ['ngRoute']) console.log('data error'); $scope.$broadcast('scroll.refreshComplete'); //refresher stop }); + + //delete user + $scope.deleteUser = function() { + console.log("delete user: " + $routeParams.userid); + $http({ + url: urlapi + 'admin/users/id/' + $routeParams.userid, + method: "DELETE" + }) + .then(function(data) { + window.location = "#!/main/"; + }, + function(data) { // optional + // failed + }); + }; });