This commit is contained in:
nemunaire 2020-03-08 01:06:44 +01:00
commit 0a79763f69
17 changed files with 459 additions and 158 deletions

BIN
htdocs/img/srstamps.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -1,50 +1,57 @@
<!DOCTYPE html>
<html ng-app="AtsebaytApp">
<html ng-app="AtsebaytApp" ng-jq="jQuery">
<head>
<base href="/">
<meta charset="utf-8">
<title>ât sebay.t SRS: MCQ and others course related stuff</title>
<title>SRS: MCQ and others course related stuff</title>
<link href="css/bootstrap.min.css" type="text/css" rel="stylesheet">
<style>
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
[ng-cloak] {
display:none !important;
}
</style>
</head>
<body>
<div style="position: fixed; bottom: 20px; right: 20px; z-index: -1; background-image: url('img/srstamps.png'); background-size: cover; width: 125px; height: 125px;">
</div>
<nav class="navbar sticky-top navbar-expand-sm navbar-dark bg-primary">
<a class="navbar-brand" href=".">
ât sebay.t
SRS
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#adminMenu" aria-controls="adminMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="loggedMenu" ng-if="isLogged">
<div class="collapse navbar-collapse" id="loggedMenu">
<ul class="navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="surveys">Questionnaires</a></li>
<li class="nav-item"><a class="nav-link" href="users">Utilisateurs</a></li>
<li class="nav-item"><a class="nav-link" href="adlin" target="_self">AdLin</a></li>
<li class="nav-item"><a class="nav-link" href="fic" target="_self">FIC</a></li>
<li class="nav-item"><a class="nav-link" ng-class="{'active': qactive}" href="surveys">Questionnaires</a></li>
<li class="nav-item"><a class="nav-link" href="virli" target="_self">VIRLI</a></li>
</ul>
<button class="navbar-text btn btn-link" ng-click="switchAdminMode()" ng-if="user.was_admin">
<button class="navbar-text btn btn-link" ng-click="switchAdminMode()" ng-if="user.was_admin" ng-cloak>
Vue admin
</button>
<button class="navbar-text btn btn-link" ng-click="switchAdminMode()" ng-if="user.is_admin">
<button class="navbar-text btn btn-link" ng-click="switchAdminMode()" ng-if="user.is_admin" ng-cloak>
Vue étudiant
</button>
<button class="navbar-text btn btn-link" ng-click="disconnectCurrentUser()">
<button class="navbar-text btn btn-link" ng-click="disconnectCurrentUser()" ng-if="isLogged" ng-cloak>
Se déconnecter
</button>
</div>
<div class="collapse navbar-collapse" id="loggedMenu" ng-if="!isLogged">
<ul class="navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="auth">Se connecter</a></li>
</ul>
<a href="auth/CRI" target="_self" class="navbar-text btn btn-dark" ng-if="!isLogged" ng-cloak>
Se connecter
</a>
</div>
</nav>
<div class="container mt-1" ng-view></div>
<div style="position: fixed; top: 60px; right: 0; z-index: 10; min-width: 30vw;">
<toast ng-repeat="toast in toasts" date="toast.date" msg="toast.msg" title="toast.title" variant="toast.variant"></toast>
</div>
<script src="js/jquery-3.4.1.slim.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/angular.min.js"></script>

View file

@ -13,26 +13,38 @@ angular.module("AtsebaytApp", ["ngRoute", "ngResource", "ngSanitize"])
controller: "SurveyController",
templateUrl: "views/survey.html"
})
.when("/users", {
controller: "UsersController",
templateUrl: "views/users.html"
.when("/surveys/:surveyId/responses", {
controller: "SurveyController",
templateUrl: "views/responses.html"
})
.when("/users/:userId", {
controller: "UserController",
templateUrl: "views/user.html"
.when("/surveys/:surveyId/responses/:questId", {
controller: "QuestionController",
templateUrl: "views/correction.html"
})
.when("/", {
controller: "SurveysController",
templateUrl: "views/home.html"
});
$locationProvider.html5Mode(true);
});
angular.module("AtsebaytApp")
.factory("AllResponses", function($resource) {
return $resource("/api/surveys/:surveyId/questions/:questId/responses/:respId", { surveyId: '@id', questId: '@id', respId: '@id' }, {
'update': {method: 'PUT'},
})
})
.factory("MyResponse", function($resource) {
return $resource("/api/surveys/:surveyId/responses/:respId", { surveyId: '@id', respId: '@id' })
})
.factory("Survey", function($resource) {
return $resource("/api/surveys/:surveyId", { surveyId: '@id' }, {
'update': {method: 'PUT'},
})
})
.factory("SurveyScore", function($resource) {
return $resource("/api/surveys/:surveyId/score", { surveyId: '@id' })
})
.factory("SurveyQuest", function($resource) {
return $resource("/api/surveys/:surveyId/questions/:questId", { surveyId: '@id', questId: '@id' }, {
'update': {method: 'PUT'},
@ -44,6 +56,110 @@ angular.module("AtsebaytApp")
})
});
angular.module("AtsebaytApp")
.directive('integer', function() {
return {
require: 'ngModel',
link: function(scope, ele, attr, ctrl){
ctrl.$parsers.unshift(function(viewValue){
return parseInt(viewValue, 10);
});
}
};
})
.component('toast', {
bindings: {
date: '=',
msg: '=',
title: '=',
variant: '=',
},
controller: function($element) {
$element.children(0).toast('show')
},
template: `<div class="toast mb-2" role="alert" aria-live="assertive" aria-atomic="true" data-delay="7000">
<div class="toast-header">
<span ng-if="$ctrl.variant" class="badge badge-pill badge-{{ $ctrl.variant }}" style="padding: .25em .66em">&nbsp;</span>&nbsp;
<strong class="mr-auto" ng-bind="$ctrl.title"></strong>
<small class="text-muted" ng-bind="$ctrl.date">just now</small>
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body" ng-bind-html="$ctrl.msg"></div>
</div>`
})
.component('surveyList', {
bindings: {
surveys: '=',
islogged: '=',
isadmin: '=',
},
controller: function($location, $rootScope) {
this.now = Date.now();
this.show = function(id) {
if ($rootScope.isLogged) {
$location.url("surveys/" + id);
} else {
$rootScope.addToast({
variant: "danger",
title: "Authentification requise",
msg: "Vous devez être connecté pour accéder aux questionnaires.",
});
$location.url("auth");
}
};
},
template: `<table class="table table-striped table-hover">
<thead>
<tr>
<th>Intitulé</th>
<th>État</th>
<th>Date</th>
<th ng-if="$ctrl.islogged">Score</th>
</tr>
</thead>
<tbody style="cursor: pointer;">
<tr ng-repeat="survey in $ctrl.surveys" ng-if="survey.shown" ng-click="$ctrl.show(survey.id)">
<td>{{ survey.title }}</td>
<td class="bg-info" ng-if="survey.start_availability > $ctrl.now">Prévu</td>
<td class="bg-warning" ng-if="survey.start_availability <= $ctrl.now && survey.end_availability >= $ctrl.now">En cours</td>
<td class="bg-primary" ng-if="survey.end_availability < $ctrl.now && !survey.corrected">Terminé</td>
<td class="bg-success" ng-if="survey.end_availability < $ctrl.now && survey.corrected">Corrigé</td>
<td ng-if="survey.start_availability > $ctrl.now">{{ survey.start_availability | date: "medium" }}</td>
<td ng-if="survey.start_availability <= $ctrl.now">{{ survey.end_availability | date: "medium" }}</td>
<td ng-if="$ctrl.islogged">N/A</td>
</tr>
</tbody>
<tfoot ng-if="$ctrl.isadmin">
<tr>
<td colspan="4">
<a href="surveys/new" class="btn btn-sm btn-primary">Ajouter un questionnaire</a>
</td>
</tr>
</tfoot>
</table>`
})
.component('surveyBadges', {
bindings: {
survey: '=',
},
controller: function() {
var now = Date.now()
this.test = function(a, b) {
return Date.parse(a) > now;
}
},
template: `<span class="badge badge-danger" ng-if="$ctrl.test($ctrl.survey.start_availability)">Prévu</span>
<span class="badge badge-warning" ng-if="!$ctrl.test($ctrl.survey.start_availability) && $ctrl.test($ctrl.survey.end_availability)">En cours</span>
<span class="badge badge-primary" ng-if="!$ctrl.test($ctrl.survey.end_availability)">Clos</span>
<span class="badge badge-success" ng-if="$ctrl.survey.corrected">Corrigé</span>`
});
angular.module("AtsebaytApp")
.run(function($rootScope, $interval, $http) {
$rootScope.checkLoginState = function() {
@ -66,6 +182,12 @@ angular.module("AtsebaytApp")
$rootScope.user.was_admin = tmp;
}
$rootScope.toasts = [];
$rootScope.addToast = function(toast) {
$rootScope.toasts.unshift(toast);
}
$rootScope.disconnectCurrentUser = function() {
$http({
method: 'POST',
@ -101,8 +223,8 @@ angular.module("AtsebaytApp")
}
})
.controller("SurveysController", function($scope, Survey, $location) {
$scope.now = Date.now();
.controller("SurveysController", function($scope, $rootScope, Survey, $location) {
$rootScope.qactive = $location.$$path == "/surveys";
$scope.surveys = Survey.query();
$scope.surveys.$promise.then(function(data) {
data.forEach(function(d,k) {
@ -110,18 +232,13 @@ angular.module("AtsebaytApp")
data[k].end_availability = Date.parse(data[k].end_availability)
})
})
$scope.show = function(id) {
$location.url("surveys/" + id);
};
})
.controller("SurveyController", function($scope, Survey, $routeParams, $location) {
$scope.now = Date.now();
.controller("SurveyController", function($scope, $rootScope, Survey, $routeParams, $location) {
$rootScope.qactive = true;
$scope.survey = Survey.get({ surveyId: $routeParams.surveyId });
$scope.survey.$promise.then(function(survey) {
survey.start_availability = Date.parse(survey.start_availability)
survey.end_availability = Date.parse(survey.end_availability)
survey.readonly = Date.now() > Date.parse(survey.end_availability)
})
$scope.saveSurvey = function() {
@ -143,10 +260,59 @@ angular.module("AtsebaytApp")
$scope.deleteSurvey = function() {
this.survey.$remove(function() { $location.url("/surveys/");});
}
$scope.showResponses = function() {
$location.url("surveys/" + this.survey.id + "/responses/" + this.question.id );
}
})
.controller("QuestionsController", function($scope, SurveyQuest, $http, $location) {
.controller("ResponsesController", function($scope, AllResponses) {
$scope.responses = AllResponses.query({ surveyId: $scope.survey.id, questId: $scope.question.id });
})
.controller("ScoreController", function($scope, SurveyScore) {
$scope.score = SurveyScore.get({ surveyId: $scope.survey.id, questId: $scope.question.id })
})
.controller("QuestionController", function($scope, Survey, SurveyQuest, SurveyQuest, AllResponses, $http, $routeParams) {
$scope.survey = Survey.get({ surveyId: $routeParams.surveyId });
$scope.survey.$promise.then(function(survey) {
survey.start_availability = Date.parse(survey.start_availability)
survey.end_availability = Date.parse(survey.end_availability)
})
$scope.question = SurveyQuest.get({ surveyId: $routeParams.surveyId, questId: $routeParams.questId });
$scope.responses = AllResponses.query({ surveyId: $routeParams.surveyId, questId: $routeParams.questId });
$scope.submitCorrection = function() {
this.response.$update()
}
$scope.submitCorrections = function() {
this.responses.forEach(function(response) {
response.$update()
})
}
})
.controller("QuestionsController", function($scope, SurveyQuest, MyResponse, $http, $location) {
$scope.questions = SurveyQuest.query({ surveyId: $scope.survey.id });
$scope.myresponses = MyResponse.query({ surveyId: $scope.survey.id });
$scope.myresponses.$promise.then(function (responses) {
$scope.questions.$promise.then(function (questions) {
var idxquestions = {}
questions.forEach(function(question, qid) {
idxquestions[question.id] = qid;
});
responses.forEach(function(response) {
if (!questions[idxquestions[response.id_question]].response) {
if (response.value) {
questions[idxquestions[response.id_question]].value = response.value;
questions[idxquestions[response.id_question]].response = response;
}
}
})
});
});
$scope.submitAnswers = function() {
$scope.submitInProgress = true;
@ -154,16 +320,24 @@ angular.module("AtsebaytApp")
$scope.questions.forEach(function(q) {
res.push({"id_question": q.id, "value": q.value})
});
console.log(res)
$http({
url: "/api/surveys/" + $scope.survey.id,
data: res,
method: "POST"
}).then(function(response) {
$scope.submitInProgress = false;
$scope.addToast({
variant: "success",
title: $scope.survey.title,
msg: "Vos réponses ont bien étés sauvegardées.",
});
}, function(response) {
$scope.submitInProgress = false;
alert("Une erreur s'est produite durant l'envoie de vos réponses : " + response.data.errmsg + "\nVeuillez réessayer dans quelques instants.");
$scope.addToast({
variant: "danger",
title: $scope.survey.title,
msg: "Une erreur s'est produite durant l'envoie de vos réponses : " + (response.data ? response.data.errmsg : "impossible de contacter le serveur") + "<br>Veuillez réessayer dans quelques instants.",
});
});
}

View file

@ -3,13 +3,13 @@
<h2>Accès à votre compte</h2>
<div class="form-group">
<label for="login">CRI login</label>
<input class="form-control" id="login" ng-model="auth.username" placeholder="Entrer votre login" autofocus>
<input class="form-control" id="login" ng-model="auth.username" placeholder="Entrer votre login" autofocus disabled>
</div>
<div class="form-group">
<label for="password">Mot de passe</label>
<input type="password" class="form-control" id="password" ng-model="auth.password" placeholder="Mot de passe">
<input type="password" class="form-control" id="password" ng-model="auth.password" placeholder="Mot de passe" disabled>
</div>
<button type="submit" class="btn btn-primary">
<button type="submit" class="btn btn-secondary disabled" disabled>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" ng-show="pleaseWait"></span>
Me connecter
</button>

View file

@ -0,0 +1,46 @@
<h2>
<span class="text-muted">{{ survey.title }}</span>
<small>
<span class="badge badge-danger" ng-if="survey.start_availability > now">Prévu</span>
<span class="badge badge-warning" ng-if="survey.start_availability <= now && survey.end_availability >= now">En cours</span>
<span class="badge badge-danger" ng-if="survey.end_availability < now">Clos</span>
</small>
</h2>
<h3>
{{ question.title }}
</h3>
<form class="mb-5" ng-submit="submitCorrections()" ng-cloak>
<div class="card mb-2" ng-repeat="response in responses">
<div class="card-body">
<button class="btn btn-success ml-1 float-right" ng-click="submitCorrection()"><svg class="bi bi-check" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M15.854 5.646a.5.5 0 010 .708l-7 7a.5.5 0 01-.708 0l-3.5-3.5a.5.5 0 11.708-.708L8.5 12.293l6.646-6.647a.5.5 0 01.708 0z" clip-rule="evenodd"></path></svg></button>
<p class="card-text" style="white-space: pre-line" ng-bind="response.value"></p>
<div class="form-group">
<div class="input-group mb-1">
<input class="form-control" type="number" ng-model="response.score" integer>
<div class="input-group-append">
<span class="input-group-text">/100</span>
</div>
</div>
</div>
<div class="form-group">
<textarea class="form-control" rows="1" ng-model="response.score_explaination" placeholder="Appréciation"></textarea>
</div>
<div class="form-group row" ng-if="response.time_scored">
<label class="col-2 col-form-label col-form-label-sm">Correction effectuée&nbsp;:</label>
<div class="col-10">
<input type="text" class="form-control-plaintext form-control-sm" value="{{ response.time_scored | date:'medium'}}" readonly>
</div>
</div>
<div class="form-group row" ng-if="response.time_scored">
<label class="col-2 col-form-label col-form-label-sm">Correcteur&nbsp;:</label>
<div class="col-10">
<input type="text" class="form-control-plaintext form-control-sm" value="{{ response.id_corrector }}" readonly>
</div>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary" ng-disabled="submitInProgress">Soumettre les corrections</button>
</form>

View file

@ -1,5 +1,5 @@
<div class="jumbotron mt-2">
<img class="float-right" src="https://photos.cri.epita.fr/thumb/mercie_d" alt="avatar" style="max-height: 150px">
<div class="jumbotron mt-2" ng-if="isLogged">
<img class="float-right" src="https://photos.cri.epita.fr/thumb/{{ isLogged.login }}" alt="avatar" style="max-height: 150px">
<h1>
Bienvenue {{ isLogged.login }}&nbsp;!
</h1>
@ -7,20 +7,17 @@
<p class="lead">Voici la liste des questionnaires&nbsp;:</p>
<table class="table" ng-controller="SurveysController">
<thead>
<tr>
<th>Intitulé</th>
<th>État</th>
<th>Date</th>
<th>Score</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="survey in surveys">
<td>{{ survey }}</td>
</tr>
</tbody>
</table>
<survey-list surveys="surveys" islogged="isLogged"></survey-list>
</div>
<div class="mt-2" ng-if="!isLogged">
<h3>Cours</h3>
<ul>
<li><a href="adlin" target="_self">ADministration Linux avancée</a></li>
<li><a href="fic" target="_self">FIC</a></li>
<li><a href="virli" target="_self">Virtualisation légère</a></li>
</ul>
<h3>Questionnaires</h3>
<survey-list surveys="surveys"></survey-list>
</div>

View file

@ -0,0 +1,25 @@
<h2>
{{ survey.title }}
<small>
<span class="badge badge-danger" ng-if="survey.start_availability > now">Prévu</span>
<span class="badge badge-warning" ng-if="survey.start_availability <= now && survey.end_availability >= now">En cours</span>
<span class="badge badge-danger" ng-if="survey.end_availability < now">Clos</span>
</small>
</h2>
<table class="table table-hover table-striped mb-5" ng-controller="QuestionsController" ng-if="survey.id" ng-cloak>
<thead>
<tr>
<th>Question</th>
<th>Réponses</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(qid,question) in questions" ng-click="showResponses()" ng-controller="ResponsesController">
<td ng-bind="question.title"></td>
<td>{{ responses.length }}</td>
<td></td>
</tr>
</tbody>
</table>

View file

@ -1,12 +1,9 @@
<button class="btn btn-primary ml-1 float-right" ng-click="editSurvey()" ng-if="user.is_admin && !survey.edit"><svg class="bi bi-pencil" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M13.293 3.293a1 1 0 011.414 0l2 2a1 1 0 010 1.414l-9 9a1 1 0 01-.39.242l-3 1a1 1 0 01-1.266-1.265l1-3a1 1 0 01.242-.391l9-9zM14 4l2 2-9 9-3 1 1-3 9-9z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M14.146 8.354l-2.5-2.5.708-.708 2.5 2.5-.708.708zM5 12v.5a.5.5 0 00.5.5H6v.5a.5.5 0 00.5.5H7v.5a.5.5 0 00.5.5H8v-1.5a.5.5 0 00-.5-.5H7v-.5a.5.5 0 00-.5-.5H5z" clip-rule="evenodd"></path></svg></button>
<a href="surveys/{{ survey.id }}/responses" class="btn btn-success ml-1 float-right" ng-if="user.is_admin"><svg class="bi bi-documents" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M5 4h8a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V6a2 2 0 012-2zm0 1a1 1 0 00-1 1v10a1 1 0 001 1h8a1 1 0 001-1V6a1 1 0 00-1-1H5z" clip-rule="evenodd"></path><path d="M7 2h8a2 2 0 012 2v10a2 2 0 01-2 2v-1a1 1 0 001-1V4a1 1 0 00-1-1H7a1 1 0 00-1 1H5a2 2 0 012-2z"></path></svg></a>
<h2>
{{ survey.title }}
<small>
<span class="badge badge-danger" ng-if="survey.start_availability > now">Prévu</span>
<span class="badge badge-warning" ng-if="survey.start_availability <= now && survey.end_availability >= now">En cours</span>
<span class="badge badge-danger" ng-if="survey.end_availability < now">Clos</span>
<span class="badge badge-success">Validé</span>
<span class="badge badge-info">Corrigé</span>
<survey-badges survey="survey"></survey-badges>
</small>
</h2>
@ -40,6 +37,13 @@
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="corrected" ng-model="survey.corrected">
<label class="form-check-label" for="corrected">
Marqué comme corrigé
</label>
</div>
<div class="form-group row">
<div class="col-sm-10">
<button type="submit" class="btn btn-primary">Enregistrer</button>
@ -50,6 +54,7 @@
</form>
<form class="mb-5" ng-submit="submitAnswers()" ng-controller="QuestionsController" ng-if="survey.id" ng-cloak>
<div class="card mb-2" ng-repeat="(qid,question) in questions">
<div class="card-body">
<button class="btn btn-danger ml-1 float-right" ng-click="deleteQuestion()" ng-if="user.is_admin"><svg class="bi bi-trash-fill" width="1em" height="1em" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.5 3a1 1 0 00-1 1v1a1 1 0 001 1H5v9a2 2 0 002 2h6a2 2 0 002-2V6h.5a1 1 0 001-1V4a1 1 0 00-1-1H12a1 1 0 00-1-1H9a1 1 0 00-1 1H4.5zm3 4a.5.5 0 01.5.5v7a.5.5 0 01-1 0v-7a.5.5 0 01.5-.5zM10 7a.5.5 0 01.5.5v7a.5.5 0 01-1 0v-7A.5.5 0 0110 7zm3 .5a.5.5 0 00-1 0v7a.5.5 0 001 0v-7z" clip-rule="evenodd"></path></svg></button>
@ -72,7 +77,8 @@
</div>
</div>
<textarea class="form-control" ng-if="!question.edit && question.kind == 'text'" rows="6" ng-model="question.value" placeholder="{{ question.placeholder }}"></textarea>
<textarea class="form-control" ng-if="!question.edit && question.kind == 'text' && !survey.readonly" rows="6" ng-model="question.value" placeholder="{{ question.placeholder }}"></textarea>
<p class="card-text alert alert-secondary" style="white-space: pre-line" ng-bind="question.value" ng-if="!question.edit && survey.readonly"></p>
<div class="form-group row" ng-if="question.edit && question.kind == 'text'">
<label class="col-2 col-form-label" for="q{{qid}}placeholder">Placeholder</label>
<div class="col">
@ -81,6 +87,8 @@
</div>
<p class="card-text text-center text-danger" ng-if="question.kind == 'mcq'">QCM non implémentés</p>
<p class="card-text alert alert-success" style="white-space: pre-line" ng-if="!question.edit && (question.response.score_explaination || question.response.score)"><strong>{{question.response.score}}&nbsp;:</strong> {{ question.response.score_explaination }}</p>
</div>
</div>

View file

@ -1,28 +1 @@
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Intitulé</th>
<th>État</th>
<th>Date</th>
<th>Score</th>
</tr>
</thead>
<tbody style="cursor: pointer;">
<tr ng-repeat="survey in surveys" ng-if="survey.shown" ng-click="show(survey.id)">
<td>{{ survey.title }}</td>
<td class="bg-info" ng-if="survey.start_availability > now">Prévu</td>
<td class="bg-warning" ng-if="survey.start_availability <= now && survey.end_availability >= now">En cours</td>
<td class="bg-success" ng-if="survey.end_availability < now">Terminé</td>
<td ng-if="survey.start_availability > now">{{ survey.start_availability | date: "medium" }}</td>
<td ng-if="survey.start_availability <= now">{{ survey.end_availability | date: "medium" }}</td>
<td>N/A</td>
</tr>
</tbody>
<tfoot ng-if="user.is_admin">
<tr>
<td colspan="4">
<a href="surveys/new" class="btn btn-sm btn-primary">Ajouter un questionnaire</a>
</td>
</tr>
</tfoot>
</table>
<survey-list surveys="surveys" islogged="isLogged" isadmin="user.is_admin"></survey-list>