admin: Add buttons to navigate between teams

This commit is contained in:
nemunaire 2024-03-19 10:32:20 +01:00
parent e9dc522a81
commit 5a6d9047c2
2 changed files with 11 additions and 1 deletions

View file

@ -2364,6 +2364,12 @@ angular.module("FICApp")
$scope.teams = Team.query(); $scope.teams = Team.query();
$scope.fields = ["id", "name"]; $scope.fields = ["id", "name"];
$scope.order = [];
$scope.teams.$promise.then(function(teams) {
teams.forEach(function(team) {
$scope.order.push(team.id);
});
});
$scope.validateSearch = function(keyEvent) { $scope.validateSearch = function(keyEvent) {
if (keyEvent.which === 13) { if (keyEvent.which === 13) {
var myTeam = null; var myTeam = null;

View file

@ -1,5 +1,9 @@
<h1> <h1 ng-controller="TeamsListController">
{{ team.name }} {{ team.name }}
<div class="btn-group" role="group" ng-if="order.indexOf(team.id) >= 0">
<a href="teams/{{ order[order.indexOf(team.id) - 1] }}" title="Équipe précédente" ng-class="{'disabled': order.indexOf(team.id) == 0}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a>
<a href="teams/{{ order[order.indexOf(team.id) + 1] }}" title="Équipe suivante" ng-class="{'disabled': order.indexOf(team.id) == order.length - 1}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
</div>
<button type="button" ng-click="showScore()" class="float-right btn btn-primary mr-1" ng-if="team.id"> <button type="button" ng-click="showScore()" class="float-right btn btn-primary mr-1" ng-if="team.id">
Score Score
</button> </button>