admin: can sort claim by last_update

This commit is contained in:
nemunaire 2020-01-24 18:24:20 +01:00
parent 83b7df7e69
commit d8584a8a31
4 changed files with 31 additions and 2 deletions

View file

@ -1092,7 +1092,7 @@ angular.module("FICApp")
$scope.assignees = ClaimAssignee.query();
$scope.whoami = getCookie("myassignee");
$scope.teams = Teams.get();
$scope.fields = ["subject", "id_team", "state", "id_assignee", "creation", "id"];
$scope.fields = ["subject", "id_team", "state", "id_assignee", "last_update", "id"];
$scope.order = "priority";
$scope.chOrder = function(no) {
@ -1108,6 +1108,19 @@ angular.module("FICApp")
$location.url("/claims/" + id);
};
})
.controller("ClaimLastUpdateController", function($scope, $http) {
$scope.init = function(claim) {
$http.get("/api/claims/" + claim.id + "/last_update").then(function(response) {
if (response.data)
$scope.last_update = response.data;
else
$scope.last_update = claim.creation;
claim.last_update = $scope.last_update;
}, function(response) {
$scope.last_update = claim.creation;
})
}
})
.controller("ClaimController", function($scope, Claim, ClaimAssignee, Teams, Exercice, $routeParams, $location, $http, $rootScope) {
$scope.claim = Claim.get({ claimId: $routeParams.claimId }, function(v) {
v.id_team = "" + v.id_team;