admin: improve claims with related exercices
This commit is contained in:
parent
2e3f7c6894
commit
32dc9c1a8c
5 changed files with 91 additions and 11 deletions
|
@ -229,6 +229,9 @@ angular.module("FICApp")
|
|||
patch: {method: 'PATCH'}
|
||||
})
|
||||
})
|
||||
.factory("ExerciceClaims", function($resource) {
|
||||
return $resource("/api/exercices/:exerciceId/claims", { exerciceId: '@idExercice'})
|
||||
})
|
||||
.factory("ExerciceTags", function($resource) {
|
||||
return $resource("/api/exercices/:exerciceId/tags", { exerciceId: '@idExercice'}, {
|
||||
update: {method: 'PUT'}
|
||||
|
@ -267,7 +270,7 @@ angular.module("FICApp")
|
|||
}
|
||||
})
|
||||
.filter("toColor", function() {
|
||||
return function(input) {
|
||||
return function(num) {
|
||||
num >>>= 0;
|
||||
var b = num & 0xFF,
|
||||
g = (num & 0xFF00) >>> 8,
|
||||
|
@ -1056,14 +1059,14 @@ angular.module("FICApp")
|
|||
$location.url("/claims/" + id);
|
||||
};
|
||||
})
|
||||
.controller("ClaimController", function($scope, Claim, ClaimAssignee, Teams, Exercice, $routeParams, $location, $http) {
|
||||
.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;
|
||||
if (!v.priority)
|
||||
v.priority = "medium";
|
||||
});
|
||||
if ($routeParams.claimId == "new")
|
||||
$scope.fields = ["id_team", "subject", "priority", "id_exercice", "id_assignee"];
|
||||
$scope.fields = ["id_team", "id_exercice", "subject", "priority", "id_assignee"];
|
||||
else
|
||||
$scope.fields = ["state", "subject", "priority", "id_exercice", "id_assignee", "id_team", "creation"];
|
||||
$scope.assignees = ClaimAssignee.query();
|
||||
|
@ -1132,6 +1135,8 @@ angular.module("FICApp")
|
|||
if (!this.ndescription)
|
||||
this.ndescription = "Création de la tâche";
|
||||
$scope.saveDescription();
|
||||
}, function(response) {
|
||||
$rootScope.newBox('danger', 'An error occurs when trying to save claim:', response.data.errmsg);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1362,6 +1367,22 @@ angular.module("FICApp")
|
|||
}
|
||||
})
|
||||
|
||||
.controller("ExerciceClaimsController", function($scope, ExerciceClaims, Team, ClaimAssignee, $routeParams, $location) {
|
||||
$scope.claims = ExerciceClaims.query({ exerciceId: $routeParams.exerciceId });
|
||||
$scope.assignees = ClaimAssignee.query();
|
||||
|
||||
$scope.claims.$promise.then(function(claims) {
|
||||
claims.forEach(function(claim, cid) {
|
||||
$scope.claims[cid].team = Team.get({ teamId: claim.id_team });
|
||||
})
|
||||
});
|
||||
|
||||
$scope.showClosed = false;
|
||||
$scope.show = function(id) {
|
||||
$location.url("/claims/" + id);
|
||||
};
|
||||
})
|
||||
|
||||
.controller("ExerciceTagsController", function($scope, ExerciceTags, $routeParams, $rootScope) {
|
||||
$scope.tags = ExerciceTags.query({ exerciceId: $routeParams.exerciceId });
|
||||
|
||||
|
|
Reference in a new issue