Registration status in progress
This commit is contained in:
@@ -143,6 +143,35 @@
|
||||
|
||||
#player.popup {
|
||||
min-width: 65vw;
|
||||
#final-reg {
|
||||
.final {
|
||||
color: green;
|
||||
display: none;
|
||||
}
|
||||
&.final {
|
||||
.preliminary {
|
||||
display: none;
|
||||
}
|
||||
.final {
|
||||
display: initial;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
td.reg-status {
|
||||
.final {
|
||||
color: green;
|
||||
display: none;
|
||||
}
|
||||
&.final {
|
||||
.final {
|
||||
display: initial;
|
||||
}
|
||||
.preliminary {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* pairing section */
|
||||
|
@@ -67,13 +67,17 @@ function parseRank(rank) {
|
||||
}
|
||||
|
||||
function fillPlayer(player) {
|
||||
// hack UK / GB
|
||||
let country = player.country.toLowerCase();
|
||||
if ('uk' === country) country = 'gb';
|
||||
let form = $('#player-form')[0];
|
||||
form.val('name', player.name);
|
||||
form.val('firstname', player.firstname);
|
||||
form.val('country', player.country.toLowerCase());
|
||||
form.val('country', country);
|
||||
form.val('club', player.club);
|
||||
form.val('rank', parseRank(player.rank));
|
||||
form.val('rating', player.rating);
|
||||
form.val('final', false);
|
||||
$('#needle')[0].value = '';
|
||||
initSearch();
|
||||
$('#register').focus();
|
||||
@@ -90,8 +94,10 @@ onLoad(() => {
|
||||
$('#add').on('click', e => {
|
||||
let form = $('#player-form')[0];
|
||||
form.addClass('add');
|
||||
// $('#player-form input.participation').forEach(chk => chk.checked = true);
|
||||
// keep preliminary/final status
|
||||
let status = form.val('final') || false;
|
||||
form.reset();
|
||||
form.val('final', status);
|
||||
$('#player').removeClass('edit').addClass('create');
|
||||
modal('player');
|
||||
$('#needle').focus();
|
||||
@@ -131,7 +137,8 @@ onLoad(() => {
|
||||
rank: form.val('rank'),
|
||||
country: form.val('country'),
|
||||
club: form.val('club'),
|
||||
skip: form.find('input.participation').map((input,i) => [i+1, input.checked]).filter(arr => !arr[1]).map(arr => arr[0])
|
||||
skip: form.find('input.participation').map((input,i) => [i+1, input.checked]).filter(arr => !arr[1]).map(arr => arr[0]),
|
||||
final: form.val('final')
|
||||
}
|
||||
if (form.hasClass('add')) {
|
||||
api.postJson(`tour/${tour_id}/part`, player)
|
||||
@@ -152,6 +159,8 @@ onLoad(() => {
|
||||
}
|
||||
});
|
||||
$('#players > tbody > tr').on('click', e => {
|
||||
let regStatus = e.target.closest('td.reg-status');
|
||||
if (regStatus) return;
|
||||
let id = e.target.closest('tr').attr('data-id');
|
||||
api.getJson(`tour/${tour_id}/part/${id}`)
|
||||
.then(player => {
|
||||
@@ -164,6 +173,9 @@ onLoad(() => {
|
||||
form.val('rank', player.rank);
|
||||
form.val('country', player.country);
|
||||
form.val('club', player.club);
|
||||
form.val('final', player.final);
|
||||
if (player.final) $('#final-reg').addClass('final');
|
||||
else $('#final-reg').removeClass('final');
|
||||
for (r = 1; r <= tour_rounds; ++r) {
|
||||
form.val(`r${r}`, !(player.skip && player.skip.includes(r)));
|
||||
}
|
||||
@@ -210,4 +222,44 @@ onLoad(() => {
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#reg-status').on('click', e => {
|
||||
let current = $('#final-reg').hasClass('final');
|
||||
if (current) {
|
||||
$('input[name="final"]')[0].value = false;
|
||||
$('#final-reg').removeClass('final');
|
||||
} else {
|
||||
$('input[name="final"]')[0].value = true;
|
||||
$('#final-reg').addClass('final');
|
||||
}
|
||||
});
|
||||
$('.reg-status').on('click', e => {
|
||||
let cell = e.target.closest('td');
|
||||
let tr = e.target.closest('tr');
|
||||
let id = tr.data('id');
|
||||
let newStatus = !cell.hasClass('final');
|
||||
api.putJson(`tour/${tour_id}/part/${id}`, {
|
||||
id: id,
|
||||
final: newStatus
|
||||
}).then(player => {
|
||||
if (player !== 'error') {
|
||||
cell.toggleClass('final');
|
||||
}
|
||||
});
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
$('#filter').on('input', (e) => {
|
||||
let input = e.target;
|
||||
let value = input.value.toUpperCase();
|
||||
if (value === '') $('tbody > tr').removeClass('hidden');
|
||||
else $('tbody > tr').forEach(tr => {
|
||||
let txt = tr.data('text');
|
||||
if (txt && txt.indexOf(value) === -1) tr.addClass('hidden');
|
||||
else tr.removeClass('hidden');
|
||||
});
|
||||
});
|
||||
$('#filter-box i').on('click', e => {
|
||||
$('#filter')[0].value = '';
|
||||
$('tbody > tr').removeClass('hidden');
|
||||
});
|
||||
});
|
||||
|
@@ -18,6 +18,7 @@ function setResult(id, result) {
|
||||
}
|
||||
let resultCell = row.find('td.result');
|
||||
resultCell.text(dispResult).data('result', result);
|
||||
standingsUpToDate = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@@ -1,10 +1,18 @@
|
||||
<div class="tab-content" id="registration-tab">
|
||||
<div id="reg-view">
|
||||
<div>
|
||||
<div id="filter-box" class="ui icon input">
|
||||
<input type="text" id="filter" placeholder="Search..."/>
|
||||
<i class="circular times link icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="players-list" class="roundbox">
|
||||
#set($parts = $api.get("tour/${params.id}/part"))
|
||||
#set($pmap = $utils.toMap($parts))
|
||||
<table id="players" class="ui celled selectable striped table">
|
||||
<thead>
|
||||
<th>Reg</th>
|
||||
<th>Name</th>
|
||||
<th>First name</th>
|
||||
<th>Country</th>
|
||||
@@ -15,10 +23,14 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
#foreach($part in $parts)
|
||||
<tr data-id="$part.id">
|
||||
<tr data-id="$part.id" data-text="$esc.html("$part.name.toUpperCase() $part.firstname.toUpperCase() $part.club.toUpperCase()")">
|
||||
<td class="centered reg-status #if($part.final)final#end">
|
||||
<span class="preliminary"><i class="fa fa-question"></i></span>
|
||||
<span class="final"><i class="fa fa-check"></i></span>
|
||||
</td>
|
||||
<td>$part.name</td>
|
||||
<td>$part.firstname</td>
|
||||
<td>$part.country</td>
|
||||
<td>$part.country.toUpperCase()</td>
|
||||
<td>$part.club</td>
|
||||
<td data-sort="$part.rank">#rank($part.rank)</td>
|
||||
<td>$part.rating</td>
|
||||
@@ -141,6 +153,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline fields">
|
||||
<label>Final ?</label>
|
||||
<div id="final-reg" class="field">
|
||||
<input name="final" type="hidden"/>
|
||||
<button id="reg-status" type="button" class="ui icon roundedremove mini button">
|
||||
<span class="final"><i class="fa fa-check"></i></span>
|
||||
<span class="preliminary"><i class="fa fa-question"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<label>Participation</label>
|
||||
#foreach($r in [1..$tour.rounds])
|
||||
<div class="centered field">
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<th>result</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
#set($dispRst = {'?':'?', 'w':'w+', 'b':'b+', '=':'=', 'X':'X', '#':'1-1', '0':'0-0'})
|
||||
#set($dispRst = {'?':'?', 'w':'1-0', 'b':'0-1', '=':'½-½', 'X':'X', '#':'1-1', '0':'0-0'})
|
||||
#foreach($game in $games)
|
||||
#set($white = $pmap[$game.w])
|
||||
#set($black = $pmap[$game.b])
|
||||
|
@@ -73,6 +73,7 @@
|
||||
const tour_id = ${tour.id};
|
||||
const tour_rounds = ${tour.rounds};
|
||||
let activeRound = ${round};
|
||||
let standingsUpToDate = true;
|
||||
// $params
|
||||
#end
|
||||
#set($datepickerLocale = $translate.datepickerLocale($request.lang, $request.loc))
|
||||
@@ -105,6 +106,9 @@
|
||||
$('.step').removeClass('active');
|
||||
$(`.step[data-step="${step}"], #${step}-tab`).addClass('active');
|
||||
window.location.hash = `#${step}`;
|
||||
if (step === 'standings' && !standingsUpToDate) {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
|
Reference in New Issue
Block a user