admin: can delete team history item

This commit is contained in:
nemunaire 2017-12-21 21:25:23 +01:00 committed by Pierre-Olivier Mercier
parent a0737d91b9
commit e9910fe827
4 changed files with 77 additions and 2 deletions

View file

@ -891,8 +891,19 @@ angular.module("FICApp")
$location.url("/teams/" + $scope.team.id + "/stats");
}
})
.controller("TeamHistoryController", function($scope, TeamHistory, $routeParams) {
.controller("TeamHistoryController", function($scope, TeamHistory, $routeParams, $http, $rootScope) {
$scope.history = TeamHistory.query({ teamId: $routeParams.teamId });
$scope.delHistory = function(row) {
$http({
url: "/api/teams/" + $routeParams.teamId + "/history.json",
method: "DELETE",
data: row
}).then(function(response) {
$scope.history = TeamHistory.query({ teamId: $routeParams.teamId });
}, function(response) {
$rootScope.newBox('danger', 'An error occurs when removing history item: ', response.data);
});
}
})
.controller("TeamStatsController", function($scope, TeamStats, $routeParams) {
$scope.teamstats = TeamStats.get({ teamId: $routeParams.teamId });