settings: add canJoinTeam parameter
This commit is contained in:
parent
921644deb4
commit
2b95995104
7 changed files with 159 additions and 36 deletions
|
@ -712,7 +712,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$rootScope.title = "Bienvenue au challenge forensic !";
|
||||
$rootScope.authors = null;
|
||||
|
||||
$scope.form = {"teamName": "", "members": [{}]};
|
||||
$scope.form = {"teamName": "", "jTeam": 0, "members": [{}]};
|
||||
|
||||
$scope.AddMember = function() {
|
||||
$scope.form.members.push({});
|
||||
|
@ -725,16 +725,29 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$('#teamName').addClass("is-invalid")
|
||||
return;
|
||||
} else {
|
||||
$('#teamName').removeClass("is-invalid")
|
||||
$('#vldBtn').removeClass("input-group-btn");
|
||||
$('#vldBtn').css("display", "none");
|
||||
$scope.part2 = true;
|
||||
$('#jvldBtn').css("display", "none");
|
||||
$scope.partR = true;
|
||||
$scope.partJ = false;
|
||||
}
|
||||
}
|
||||
$scope.JValidate = function() {
|
||||
if (!$scope.teams[$scope.form.jTeam]) {
|
||||
$('#jTeam').addClass("is-invalid")
|
||||
return;
|
||||
} else {
|
||||
$('#jTeam').removeClass("is-invalid")
|
||||
$('#jvldBtn').removeClass("input-group-btn");
|
||||
$('#jvldBtn').css("display", "none");
|
||||
$('#vldBtn').css("display", "none");
|
||||
$scope.partR = false;
|
||||
$scope.partJ = true;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.rsubmit = function() {
|
||||
if (!$scope.part2)
|
||||
return $scope.Validate();
|
||||
|
||||
var commonsubmit = function(registration) {
|
||||
// Remove empty members
|
||||
$scope.form.members = $scope.form.members.filter(function(m) {
|
||||
return ((m.lastname != undefined && m.lastname != "") || (m.firstname != undefined && m.firstname != "") || (m.nickname != undefined && m.nickname != ""));
|
||||
|
@ -748,6 +761,8 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
return;
|
||||
}
|
||||
|
||||
$scope.form.jTeam = parseInt($scope.form.jTeam);
|
||||
|
||||
$http({
|
||||
url: "registration",
|
||||
method: "POST",
|
||||
|
@ -771,6 +786,20 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
});
|
||||
}
|
||||
|
||||
$scope.rsubmit = function() {
|
||||
if (!$scope.partR)
|
||||
return $scope.Validate();
|
||||
else
|
||||
return commonsubmit(true);
|
||||
}
|
||||
|
||||
$scope.jsubmit = function() {
|
||||
if (!$scope.partJ)
|
||||
return $scope.JValidate();
|
||||
else
|
||||
return commonsubmit(false);
|
||||
}
|
||||
|
||||
$scope.$watch("my", function(my){
|
||||
if (my)
|
||||
$location.url(".");
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="teamName" ng-model="form.teamName" placeholder="" autofocus required>
|
||||
<span class="input-group-btn" id="vldBtn">
|
||||
<button class="btn btn-info" type="button" ng-click="Validate()">Valider</button>
|
||||
<span class="input-group-append" id="vldBtn">
|
||||
<button class="btn btn-info" type="button" ng-click="Validate()" ng-disabled="form.jTeam">Valider</button>
|
||||
</span>
|
||||
<div class="invalid-feedback">
|
||||
Veuillez indiquer un nom d'équipe valide.
|
||||
|
@ -36,13 +36,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="part2">
|
||||
<h4 style="text-indent: 0; margin-top: 20px">
|
||||
<div ng-if="partR">
|
||||
<h4 style="text-indent: 0; margin-top: 20px" ng-if="!settings.canJoinTeam">
|
||||
Membres d'équipe
|
||||
<button class="btn btn-sm btn-success" type="button" ng-click="AddMember()">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Ajouter un membre
|
||||
</button>
|
||||
</h4>
|
||||
<h4 style="text-indent: 0; margin-top: 20px" ng-if="settings.canJoinTeam">
|
||||
Chef d'équipe
|
||||
</h4>
|
||||
<p ng-if="message" ng-class="messageClass" ng-bind="message"></p>
|
||||
<div class="row form-group" ng-repeat="(mid, member) in form.members">
|
||||
<div class="col-sm">
|
||||
|
@ -57,13 +60,13 @@
|
|||
<div class="col-sm">
|
||||
<input type="text" class="form-control" ng-model="member.company" placeholder="Entreprise">
|
||||
</div>
|
||||
<div class="col-sm-auto">
|
||||
<div class="col-sm-auto" ng-if="!settings.canJoinTeam">
|
||||
<button class="btn btn-danger" type="button" ng-click="RemoveMember(mid)">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-info" style="margin-left: 40%;" type="submit">
|
||||
<button class="btn btn-info" style="margin-left: 40%;" type="submit" ng-disabled="form.jTeam">
|
||||
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||
S'inscrire
|
||||
</button>
|
||||
|
@ -71,3 +74,53 @@
|
|||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="jumbotron niceborder" style="text-indent: 1em" ng-if="settings.canJoinTeam">
|
||||
<p>
|
||||
Si votre équipe est déjà créée, rejoignez-là !
|
||||
</p>
|
||||
<form ng-submit="jsubmit()">
|
||||
|
||||
<div class="row">
|
||||
<label for="jTeam" class="col col-form-label">Nom d'équipe</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
<select class="custom-select" id="jTeam" ng-model="form.jTeam" ng-options="tid as t.name for (tid,t) in teams" required ng-disabled="partJ">
|
||||
</select>
|
||||
<span class="input-group-append" id="jvldBtn">
|
||||
<button class="btn btn-info" type="button" ng-click="JValidate()" ng-disabled="form.teamName">Valider</button>
|
||||
</span>
|
||||
<div class="invalid-feedback">
|
||||
Veuillez sélectionner une équipe valide.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="partJ">
|
||||
<h4 style="text-indent: 0; margin-top: 20px">
|
||||
Vos informations
|
||||
</h4>
|
||||
<p ng-if="message" ng-class="messageClass" ng-bind="message"></p>
|
||||
<div class="row form-group" ng-repeat="(mid, member) in form.members">
|
||||
<div class="col-sm">
|
||||
<input type="text" class="form-control" ng-model="member.lastname" placeholder="Nom" autofocus>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<input type="text" class="form-control" ng-model="member.firstname" placeholder="Prénom">
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<input type="text" class="form-control" ng-model="member.nickname" placeholder="Pseudo">
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<input type="text" class="form-control" ng-model="member.company" placeholder="Entreprise">
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-info" style="margin-left: 40%;" type="submit" ng-disabled="form.teamName">
|
||||
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||
Rejoindre
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
|
Reference in a new issue