Browse Source

added delete travel and user

master
arnaucode 7 years ago
parent
commit
8b8528ba11
4 changed files with 38 additions and 4 deletions
  1. +2
    -2
      views/travel/travel.html
  2. +19
    -0
      views/travel/travel.js
  3. +2
    -2
      views/user/user.html
  4. +15
    -0
      views/user/user.js

+ 2
- 2
views/travel/travel.html

@ -93,8 +93,8 @@
<h3 class="panel-title">Admin actions</h3>
</div>
<div class="panel-body">
<div class="btn btn-block btn-sm c_orange300">Ban travel</div>
<div class="btn btn-block btn-sm c_red300">Delete travel</div>
<!--<div class="btn btn-block btn-sm c_orange300">Ban travel</div>-->
<div ng-click="deleteTravel()" class="btn btn-block btn-sm c_red300">Delete travel</div>
</div>
</div>
</div>

+ 19
- 0
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
});
};
});

+ 2
- 2
views/user/user.html

@ -97,8 +97,8 @@
<h3 class="panel-title">Admin actions</h3>
</div>
<div class="panel-body">
<div class="btn btn-block btn-sm c_orange300">Ban user</div>
<div class="btn btn-block btn-sm c_red300">Delete user</div>
<!--<div class="btn btn-block btn-sm c_orange300">Ban user</div>-->
<div ng-click="deleteUser()" class="btn btn-block btn-sm c_red300">Delete user</div>
</div>
</div>
</div>

+ 15
- 0
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
});
};
});

Loading…
Cancel
Save