MM/Swiss can only be chosen at tournament creation, and display according fields properly

This commit is contained in:
Claude Brisson
2024-07-13 11:58:28 +02:00
parent bbf0308994
commit d7952fcf94
2 changed files with 9 additions and 1 deletions

View File

@@ -278,4 +278,12 @@ onLoad(() => {
shortName.on('input', e => {
manualShortName = true;
});
$('select[name="pairing"]').on('change', e => {
let pairing = e.target.value.toLowerCase();
if (pairing === 'mms') $('#tournament-infos .mms').removeClass('hidden');
else $('#tournament-infos .mms').addClass('hidden');
if (pairing === 'swiss') $('#tournament-infos .swiss').removeClass('hidden');
else $('#tournament-infos .swiss').addClass('hidden');
});
});

View File

@@ -89,7 +89,7 @@
<div class="four wide field">
<label>Pairing</label>
<span class="info"></span>
<select name="pairing">
<select name="pairing" #if($tour)disabled#end>
<option value="MAC_MAHON" #if(!$tour || $tour.pairing.type == 'MAC_MAHON') selected #end>Mac Mahon</option>
<option value="SWISS" #if($tour && $tour.pairing.type == 'SWISS') selected #end>Swiss</option>
## TODO <option value="ROUND_ROBIN" #if($tour && $tour.pairing.type == 'ROUND_ROBIN') selected #end>Round-robin</option>