Added - confirmation when queue gets created

This commit is contained in:
jakub.salavec
2025-06-16 14:17:43 +02:00
parent eb71794f38
commit 3a48de002a

View File

@@ -443,56 +443,57 @@ var GempLotrHallUI = Class.extend({
}, },
createTournament: function() { createTournament: function() {
const type = $("#gameTypeSelect").val(); var that = this;
// Depending on the type, pick the correct format code from the formatSelect dropdown
const formatCode = $("#formatSelect").val();
// Assign the format codes based on the selected game type const type = $("#gameTypeSelect").val();
let sealedFormatCode = null; // Depending on the type, pick the correct format code from the formatSelect dropdown
let soloDraftFormatCode = null; const formatCode = $("#formatSelect").val();
let tableDraftFormatCode = null;
if (type === "sealed") { // Assign the format codes based on the selected game type
sealedFormatCode = formatCode; let sealedFormatCode = null;
} else if (type === "solodraft") { let soloDraftFormatCode = null;
soloDraftFormatCode = formatCode; let tableDraftFormatCode = null;
} else if (type === "table_draft") {
tableDraftFormatCode = formatCode;
}
// Draft timer only applies to table draft if (type === "sealed") {
const tableDraftTimer = type === "table_draft" ? $("#draftTimer").val() : null; sealedFormatCode = formatCode;
} else if (type === "solodraft") {
soloDraftFormatCode = formatCode;
} else if (type === "table_draft") {
tableDraftFormatCode = formatCode;
}
const playoff = $("#pairingType").val(); // Draft timer only applies to table draft
const competitive = $("#competitiveSelect").val(); const tableDraftTimer = type === "table_draft" ? $("#draftTimer").val() : null;
const startableEarly = $("#startableEarlySelect").val();
const readyCheck = $("#readyCheckSelect").val(); const playoff = $("#pairingType").val();
const competitive = $("#competitiveSelect").val();
const startableEarly = $("#startableEarlySelect").val();
const readyCheck = $("#readyCheckSelect").val();
// Number input // Number input
const deckbuildingDuration = parseInt($("#deckDuration").val(), 10) || 15; const deckbuildingDuration = parseInt($("#deckDuration").val(), 10) || 15;
const maxPlayers = parseInt($("#numPlayers").val(), 10) || 4; const maxPlayers = parseInt($("#numPlayers").val(), 10) || 4;
// Call the communication layer with all gathered values // Call the communication layer with all gathered values
this.comm.createTournament( this.comm.createTournament(
type, type,
maxPlayers, maxPlayers,
sealedFormatCode, sealedFormatCode,
soloDraftFormatCode, soloDraftFormatCode,
tableDraftFormatCode, tableDraftFormatCode,
tableDraftTimer, tableDraftTimer,
playoff, playoff,
deckbuildingDuration, deckbuildingDuration,
competitive, competitive,
startableEarly, startableEarly,
readyCheck, readyCheck,
function(json) { function(json) {
// Success callback — handle your response here // Success callback
console.log("Tournament created successfully:", json); that.showDialog("Tournament Update", "Tournament queue created successfully");
// You can add preview or other logic here as needed },
}, this.hallErrorMap()
this.hallErrorMap() );
);
}, },
initTable: function(displayed, headerID, tableID) { initTable: function(displayed, headerID, tableID) {