admin: improve claims with menu
This commit is contained in:
parent
9186bbc229
commit
6f64eaed95
3 changed files with 32 additions and 11 deletions
|
|
@ -1068,7 +1068,7 @@ angular.module("FICApp")
|
|||
if ($routeParams.claimId == "new")
|
||||
$scope.fields = ["id_team", "id_exercice", "subject", "priority", "id_assignee"];
|
||||
else
|
||||
$scope.fields = ["state", "subject", "priority", "id_exercice", "id_assignee", "id_team", "creation"];
|
||||
$scope.fields = ["subject", "priority", "id_exercice", "id_assignee", "id_team", "creation", "state"];
|
||||
$scope.assignees = ClaimAssignee.query();
|
||||
$scope.whoami = Math.floor(getCookie("myassignee"));
|
||||
$scope.teams = Teams.get();
|
||||
|
|
@ -1099,10 +1099,15 @@ angular.module("FICApp")
|
|||
"critical": "Critique",
|
||||
};
|
||||
|
||||
$scope.changeState = function(state) {
|
||||
this.claim.state = state;
|
||||
if (this.claim.id)
|
||||
this.saveClaim(false);
|
||||
}
|
||||
$scope.assignToMe = function() {
|
||||
this.claim.id_assignee = $scope.whoami;
|
||||
if (this.claim.id)
|
||||
this.saveClaim();
|
||||
this.saveClaim(false);
|
||||
}
|
||||
$scope.saveDescription = function() {
|
||||
$http({
|
||||
|
|
@ -1116,9 +1121,9 @@ angular.module("FICApp")
|
|||
$location.url("/claims/" + $scope.claim.id + "/");
|
||||
});
|
||||
}
|
||||
$scope.saveClaim = function() {
|
||||
$scope.saveClaim = function(backToList) {
|
||||
if (this.claim.id_team) {
|
||||
this.claim.id_team = Math.floor(this.claim.id_team);
|
||||
this.claim.id_team = parseInt(this.claim.id_team, 10);
|
||||
} else {
|
||||
this.claim.id_team = null;
|
||||
}
|
||||
|
|
@ -1127,13 +1132,19 @@ angular.module("FICApp")
|
|||
v.id_team = "" + v.id_team;
|
||||
if ($scope.ndescription)
|
||||
$scope.saveDescription();
|
||||
else
|
||||
else if (backToList)
|
||||
$location.url("/claims/");
|
||||
else
|
||||
$scope.claim = Claim.get({ claimId: $routeParams.claimId }, function(v) {
|
||||
v.id_team = "" + v.id_team;
|
||||
if (!v.priority)
|
||||
v.priority = "medium";
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.claim.$save(function() {
|
||||
if (!this.ndescription)
|
||||
this.ndescription = "Création de la tâche";
|
||||
if (!$scope.ndescription)
|
||||
$scope.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);
|
||||
|
|
|
|||
Reference in a new issue