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")
|
if ($routeParams.claimId == "new")
|
||||||
$scope.fields = ["id_team", "id_exercice", "subject", "priority", "id_assignee"];
|
$scope.fields = ["id_team", "id_exercice", "subject", "priority", "id_assignee"];
|
||||||
else
|
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.assignees = ClaimAssignee.query();
|
||||||
$scope.whoami = Math.floor(getCookie("myassignee"));
|
$scope.whoami = Math.floor(getCookie("myassignee"));
|
||||||
$scope.teams = Teams.get();
|
$scope.teams = Teams.get();
|
||||||
|
@ -1099,10 +1099,15 @@ angular.module("FICApp")
|
||||||
"critical": "Critique",
|
"critical": "Critique",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.changeState = function(state) {
|
||||||
|
this.claim.state = state;
|
||||||
|
if (this.claim.id)
|
||||||
|
this.saveClaim(false);
|
||||||
|
}
|
||||||
$scope.assignToMe = function() {
|
$scope.assignToMe = function() {
|
||||||
this.claim.id_assignee = $scope.whoami;
|
this.claim.id_assignee = $scope.whoami;
|
||||||
if (this.claim.id)
|
if (this.claim.id)
|
||||||
this.saveClaim();
|
this.saveClaim(false);
|
||||||
}
|
}
|
||||||
$scope.saveDescription = function() {
|
$scope.saveDescription = function() {
|
||||||
$http({
|
$http({
|
||||||
|
@ -1116,9 +1121,9 @@ angular.module("FICApp")
|
||||||
$location.url("/claims/" + $scope.claim.id + "/");
|
$location.url("/claims/" + $scope.claim.id + "/");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$scope.saveClaim = function() {
|
$scope.saveClaim = function(backToList) {
|
||||||
if (this.claim.id_team) {
|
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 {
|
} else {
|
||||||
this.claim.id_team = null;
|
this.claim.id_team = null;
|
||||||
}
|
}
|
||||||
|
@ -1127,13 +1132,19 @@ angular.module("FICApp")
|
||||||
v.id_team = "" + v.id_team;
|
v.id_team = "" + v.id_team;
|
||||||
if ($scope.ndescription)
|
if ($scope.ndescription)
|
||||||
$scope.saveDescription();
|
$scope.saveDescription();
|
||||||
else
|
else if (backToList)
|
||||||
$location.url("/claims/");
|
$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 {
|
} else {
|
||||||
this.claim.$save(function() {
|
this.claim.$save(function() {
|
||||||
if (!this.ndescription)
|
if (!$scope.ndescription)
|
||||||
this.ndescription = "Création de la tâche";
|
$scope.ndescription = "Création de la tâche";
|
||||||
$scope.saveDescription();
|
$scope.saveDescription();
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
$rootScope.newBox('danger', 'An error occurs when trying to save claim:', response.data.errmsg);
|
$rootScope.newBox('danger', 'An error occurs when trying to save claim:', response.data.errmsg);
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="a in assignees" ng-click="edit(a)">
|
<tr ng-repeat="a in assignees" ng-click="edit(a)" ng-if="a.id !== 0">
|
||||||
<td>
|
<td>
|
||||||
{{ a.id }}
|
{{ a.id }}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
<div class="float-right btn-group ml-1" role="group" ng-if="claim.id">
|
||||||
|
<button class="btn btn-secondary" ng-if="claim.state != 'new'" ng-click="changeState('new')"><span class="glyphicon glyphicon-repeat" aria-hidden="true"></span> Nouveau</button>
|
||||||
|
<button class="btn btn-warning" ng-if="claim.state != 'need-info' && (claim.state == 'new' || claim.state == 'confirmed' || claim.state == 'in-progress')" ng-click="changeState('need-info')"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> Besoin d'infos</button>
|
||||||
|
<button class="btn btn-danger" ng-if="claim.state != 'confirmed'" ng-click="changeState('confirmed')"><span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span> Confirmer</button>
|
||||||
|
<button class="btn btn-info" ng-if="claim.state != 'in-progress' && (claim.state == 'need-info' || claim.state == 'confirmed' || claim.state == 'need-review')" ng-click="changeState('in-progress')"><span class="glyphicon glyphicon-hourglass" aria-hidden="true"></span> En cours</button>
|
||||||
|
<button class="btn btn-success" ng-if="claim.state != 'need-review' && (claim.state == 'in-progress' || claim.state == 'confirmed' || claim.state == 'need-info')" ng-click="changeState('need-review')"><span class="glyphicon glyphicon-saved" aria-hidden="true"></span> Fait</button>
|
||||||
|
<button class="btn btn-success" ng-if="claim.state != 'closed' && claim.state == 'need-review'" ng-click="changeState('closed')"><span class="glyphicon glyphicon-thumbs-down" aria-hidden="true"></span> Clore</button>
|
||||||
|
<button class="btn btn-dark" ng-if="claim.state != 'invalid' && (claim.state == 'new' || claim.state == 'need-info')" ng-click="changeState('invalid')"><span class="glyphicon glyphicon-save" aria-hidden="true"></span> Invalide</button>
|
||||||
|
</div>
|
||||||
|
<button class="float-right btn btn-primary" ng-if="claim.id && whoami && whoami != claim.id_assignee" ng-click="assignToMe()">Me l'assigner</button>
|
||||||
<h2>Tâche</h2>
|
<h2>Tâche</h2>
|
||||||
|
|
||||||
<form ng-submit="saveClaim()" class="row">
|
<form ng-submit="saveClaim()" class="row">
|
||||||
|
@ -31,7 +41,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-right" ng-show="claim.id">
|
<div class="text-right mb-3" ng-show="claim.id">
|
||||||
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-save" aria-hidden="true"></span> Save</button>
|
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-save" aria-hidden="true"></span> Save</button>
|
||||||
<button type="button" class="btn btn-danger" ng-click="deleteClaim()"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete</button>
|
<button type="button" class="btn btn-danger" ng-click="deleteClaim()"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,8 +62,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-repeat="description in claim.descriptions | orderBy:'id':true" class="alert" ng-class="{'alert-info': '' + description.id_assignee != whoami, 'alert-dark': '' + description.id_assignee == whoami}">
|
<div ng-repeat="description in claim.descriptions | orderBy:'id':true" class="alert" ng-class="{'alert-info': '' + description.id_assignee != whoami, 'alert-dark': '' + description.id_assignee == whoami}">
|
||||||
<strong>Par <em ng-if="!description.id_assignee">anonymous</em> <span ng-repeat="assignee in assignees" ng-if="assignee.id == description.id_assignee">{{ assignee.name }}</span> le {{ description.date | date:"mediumTime" }} :</strong>
|
<strong>Par <span ng-repeat="assignee in assignees" ng-if="assignee.id == description.id_assignee">{{ assignee.name }}</span> le {{ description.date | date:"mediumTime" }} :</strong>
|
||||||
{{ description.content }}
|
<span style="white-space: pre-line">{{ description.content }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in a new issue