feat: ✨ Working ladder, updating tournamnet
This commit is contained in:
parent
cf07de831e
commit
86556b76bb
@ -54,9 +54,7 @@ header {
|
|||||||
.header-link {
|
.header-link {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 2;
|
line-height: 2;
|
||||||
|
font-weight: bold;
|
||||||
font-family: Montserrat, serif;
|
|
||||||
font-style: bold;
|
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #828282;
|
color: #828282;
|
||||||
|
|
||||||
@ -98,4 +96,56 @@ a:hover {
|
|||||||
|
|
||||||
a:active {
|
a:active {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ladderButtonFunctions {
|
||||||
|
/*Alignment*/
|
||||||
|
height: 50%;
|
||||||
|
float: right;
|
||||||
|
|
||||||
|
/*Button visual*/
|
||||||
|
background-color: #007C36;
|
||||||
|
border-radius: 15px;
|
||||||
|
border: 1px solid;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
/*Text visual*/
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: Montserrat, serif;
|
||||||
|
font-size: 18px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ladderButton {
|
||||||
|
/*Alignment*/
|
||||||
|
float: right;
|
||||||
|
|
||||||
|
/*Button visual*/
|
||||||
|
background-color: #007C36;
|
||||||
|
border-radius: 15px;
|
||||||
|
border: 1px solid;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
/*Text visual*/
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: Montserrat, serif;
|
||||||
|
font-size: 13px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.players-on-ladder {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
font-size: 19px;
|
||||||
|
justify-content: space-around;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
padding-right: 10px;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.span-ladder {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
height: auto;
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ for (i = 0; i < coll.length; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
localStorage.clear();
|
localStorage.removeItem('token');
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,15 +3,9 @@ li.game {
|
|||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.game.winner {
|
li.game.winner {}
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Tekst wewnątrz boxa*/
|
/*Tekst wewnątrz boxa*/
|
||||||
li.game span {
|
|
||||||
float: right;
|
|
||||||
margin-right: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Górna linia drabinki*/
|
/*Górna linia drabinki*/
|
||||||
li.game-top {
|
li.game-top {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body onload="logoutVisibility(); loginVisibility();">
|
<body onload="logoutVisibility(); loginVisibility(); loadPlayers()">
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<div class=" logoBox">
|
<div class=" logoBox">
|
||||||
@ -302,25 +302,41 @@
|
|||||||
<li class="spacer"> </li>
|
<li class="spacer"> </li>
|
||||||
|
|
||||||
<li class="game game-top teambox winner">
|
<li class="game game-top teambox winner">
|
||||||
<input><br>
|
<span class="span-ladder" id="1">
|
||||||
<input>
|
<input id="1Input">
|
||||||
|
</span>
|
||||||
|
<span class="span-ladder" id="2">
|
||||||
|
<input id="2Input">
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="game game-spacer"> </li>
|
<li class="game game-spacer"> </li>
|
||||||
<li class="game game-bottom teambox">
|
<li class="game game-bottom teambox">
|
||||||
<input><br>
|
<span class="span-ladder" id="3">
|
||||||
<input>
|
<input id="3Input">
|
||||||
|
</span>
|
||||||
|
<span class="span-ladder" id="4">
|
||||||
|
<input id="4Input">
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="spacer"> </li>
|
<li class="spacer"> </li>
|
||||||
|
|
||||||
<li class="game game-top teambox">
|
<li class="game game-top teambox">
|
||||||
<input><br>
|
<span class="span-ladder" id="5">
|
||||||
<input>
|
<input id="5Input">
|
||||||
|
</span>
|
||||||
|
<span class="span-ladder" id="6">
|
||||||
|
<input id="6Input">
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="game game-spacer"> </li>
|
<li class="game game-spacer"> </li>
|
||||||
<li class="game game-bottom teambox winner">
|
<li class="game game-bottom teambox winner">
|
||||||
<input><br>
|
<span class="span-ladder" id="7">
|
||||||
<input>
|
<input id="7Input">
|
||||||
|
</span>
|
||||||
|
<span class="span-ladder" id="8">
|
||||||
|
<input id="8Input">
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="spacer"> </li>
|
<li class="spacer"> </li>
|
||||||
@ -330,13 +346,21 @@
|
|||||||
<li class="spacer"> </li>
|
<li class="spacer"> </li>
|
||||||
|
|
||||||
<li class="game game-top teambox winner">
|
<li class="game game-top teambox winner">
|
||||||
<input><br>
|
<span class="span-ladder" id="9">
|
||||||
<input>
|
<input id="9Input">
|
||||||
|
</span>
|
||||||
|
<span class="span-ladder" id="10">
|
||||||
|
<input id="10Input">
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="game game-spacer"> </li>
|
<li class="game game-spacer"> </li>
|
||||||
<li class="game game-bottom teambox">
|
<li class="game game-bottom teambox">
|
||||||
<input><br>
|
<span class="span-ladder" id="11">
|
||||||
<input>
|
<input id="11Input">
|
||||||
|
</span>
|
||||||
|
<span class="span-ladder" id="12">
|
||||||
|
<input id="12Input">
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="spacer"> </li>
|
<li class="spacer"> </li>
|
||||||
@ -346,12 +370,17 @@
|
|||||||
<li class="spacer"> </li>
|
<li class="spacer"> </li>
|
||||||
|
|
||||||
<li class="game game-top teambox winner">
|
<li class="game game-top teambox winner">
|
||||||
<input><br>
|
<span class="span-ladder" id="13">
|
||||||
<input>
|
<input id="13Input">
|
||||||
|
</span>
|
||||||
|
<span class="span-ladder" id="14">
|
||||||
|
<input id="14Input">
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="spacer"> </li>
|
<li class="spacer"> </li>
|
||||||
</ul>
|
</ul>
|
||||||
<button class="saver-button">zapisz</button>
|
<button class="ladderButtonFunctions" id="saver" onclick="getPlayers()">Zapisz</button>
|
||||||
|
<button class="ladderButtonFunctions" id="saver" onclick="usersRemover()">Usuń wszystkich</button>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -630,6 +659,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="collapsible.js"></script>
|
<script type="text/javascript" src="collapsible.js"></script>
|
||||||
|
<script type="text/javascript" src="ladder.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
function getPlayers() {
|
||||||
|
for (let i = 1; i < 15; i++) {
|
||||||
|
if (localStorage.getItem(i + "value") == null || localStorage.getItem(i + "value") == "") {
|
||||||
|
let input = document.getElementById(i + "Input");
|
||||||
|
localStorage.setItem(i + "value", input.value);
|
||||||
|
console.log(i + "getPlayersy")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
location.reload()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function loadPlayers() {
|
||||||
|
for (let i = 0; i < 15; i++) {
|
||||||
|
if (localStorage.getItem(i + "value") == null || localStorage.getItem(i + "value") == "") {
|
||||||
|
console.log("Loading")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById(i).innerHTML = `<div class="players-on-ladder">` + localStorage.getItem(i + "value") + `<button class="ladderButton" onclick=playerDelete(id) id="` + i + `";>USUŃ</button></div>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function playerDelete(id) {
|
||||||
|
let i = id.toString()
|
||||||
|
console.log(i)
|
||||||
|
localStorage.setItem(i + "value", "")
|
||||||
|
location.reload()
|
||||||
|
}
|
||||||
|
|
||||||
|
function usersRemover() {
|
||||||
|
for (let i = 1; i < 15; i++) {
|
||||||
|
localStorage.removeItem(i + 'value');
|
||||||
|
}
|
||||||
|
location.reload()
|
||||||
|
}
|
@ -14,7 +14,7 @@ for (i = 0; i < coll.length; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
localStorage.clear();
|
localStorage.removeItem('token');
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ async function renderTournaments(organiserTournament) {
|
|||||||
|
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
localStorage.clear();
|
localStorage.removeItem('token');
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<a class="header_link" href="kontakt/index.html">Kontakt</a>
|
<a class="header_link" href="kontakt/index.html">Kontakt</a>
|
||||||
<a class="header_link" href="ranking/index.html">Ranking</a>
|
<a class="header_link" href="ranking/index.html">Ranking</a>
|
||||||
<a style="font-weight: bold" class="header_link" href="./index.html">Kalendarz turniejów</a>
|
<a class="header-link" href="./index.html">Kalendarz turniejów</a>
|
||||||
<a class="header_link" href="../panel_organizatora/dodawanie%20turnieju/index.html" id="creator">Tworzenie
|
<a class="header_link" href="../panel_organizatora/dodawanie%20turnieju/index.html" id="creator">Tworzenie
|
||||||
turnieju</a>
|
turnieju</a>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<title>Padel Tournaments System</title>
|
<title>Padel Tournaments System</title>
|
||||||
<link href="style.css" rel="stylesheet">
|
<link href="style.css" rel="stylesheet">
|
||||||
<script>function logout() {
|
<script>function logout() {
|
||||||
localStorage.clear();
|
localStorage.removeItem('token');
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,10 +31,34 @@
|
|||||||
document.getElementById("login").style.display = "";
|
document.getElementById("login").style.display = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
}</script>
|
}
|
||||||
|
|
||||||
|
function checkRole() {
|
||||||
|
if (localStorage.getItem("token") !== null) {
|
||||||
|
|
||||||
|
fetch('https://dragonmaster.pl/inz/user', {
|
||||||
|
headers: {
|
||||||
|
Authorization: ("Bearer " + localStorage.getItem("token"))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(json => {
|
||||||
|
if (json['role'] == '1') {
|
||||||
|
document.getElementById("creator").style.display = "none";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById("creator").style.display = '';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById("creator").style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body onload="logoutVisibility(); loginVisibility()">
|
<body onload="logoutVisibility(); loginVisibility(); checkRole();">
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<div class="logoBox">
|
<div class="logoBox">
|
||||||
@ -49,6 +73,9 @@
|
|||||||
<a class="header-link" href="#">Kontakt</a>
|
<a class="header-link" href="#">Kontakt</a>
|
||||||
<a class="header_link" href="../ranking/index.html">Ranking</a>
|
<a class="header_link" href="../ranking/index.html">Ranking</a>
|
||||||
<a class="header_link" href="../index.html">Kalendarz turniejów</a>
|
<a class="header_link" href="../index.html">Kalendarz turniejów</a>
|
||||||
|
<a class="header_link" href="../../panel_organizatora/dodawanie%20turnieju/index.html"
|
||||||
|
id="creator">Tworzenie
|
||||||
|
turnieju</a>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<title>Padel Tournaments System</title>
|
<title>Padel Tournaments System</title>
|
||||||
<link href="style.css" rel="stylesheet">
|
<link href="style.css" rel="stylesheet">
|
||||||
<script>function logout() {
|
<script>function logout() {
|
||||||
localStorage.clear();
|
localStorage.removeItem('token');
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,10 +31,34 @@
|
|||||||
document.getElementById("login").style.display = "";
|
document.getElementById("login").style.display = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkRole() {
|
||||||
|
if (localStorage.getItem("token") !== null) {
|
||||||
|
|
||||||
|
fetch('https://dragonmaster.pl/inz/user', {
|
||||||
|
headers: {
|
||||||
|
Authorization: ("Bearer " + localStorage.getItem("token"))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(json => {
|
||||||
|
if (json['role'] == '1') {
|
||||||
|
document.getElementById("creator").style.display = "none";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById("creator").style.display = '';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById("creator").style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
}</script>
|
}</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body onload="logoutVisibility(); loginVisibility()">
|
<body onload="logoutVisibility(); loginVisibility(); checkRole()">
|
||||||
<header>
|
<header>
|
||||||
<div class="logoBox">
|
<div class="logoBox">
|
||||||
<a class="header_link" href="../index.html"><img class="logo" src="../../_global/logo.svg"
|
<a class="header_link" href="../index.html"><img class="logo" src="../../_global/logo.svg"
|
||||||
@ -46,8 +70,11 @@
|
|||||||
id="login">LOGOWANIE</button>
|
id="login">LOGOWANIE</button>
|
||||||
<button class="loginButton" id="logout" onclick="logout()">Wyloguj</button>
|
<button class="loginButton" id="logout" onclick="logout()">Wyloguj</button>
|
||||||
<a class="header_link" href="../kontakt/index.html">Kontakt</a>
|
<a class="header_link" href="../kontakt/index.html">Kontakt</a>
|
||||||
<a class="header-link " href="#"">Ranking</a>
|
<a class="header-link " href="#">Ranking</a>
|
||||||
<a class=" header_link" href="../index.html">Kalendarz turniejów</a>
|
<a class=" header_link" href="../index.html">Kalendarz turniejów</a>
|
||||||
|
<a class="header_link" href="../../panel_organizatora/dodawanie%20turnieju/index.html"
|
||||||
|
id="creator">Tworzenie
|
||||||
|
turnieju</a>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ function createTournament() {
|
|||||||
|
|
||||||
console.log(checker)
|
console.log(checker)
|
||||||
if (name == null || name == "", place == null || place == "", from == null || from == "", to == null || to == "", rang == null || rang == "", entryFee == null || entryFee == "", director == null || director == "", phone == null || phone == "", entriesTo == null || entriesTo == "", additionalInformations == null || additionalInformations == "", category == null || category == "") {
|
if (name == null || name == "", place == null || place == "", from == null || from == "", to == null || to == "", rang == null || rang == "", entryFee == null || entryFee == "", director == null || director == "", phone == null || phone == "", entriesTo == null || entriesTo == "", additionalInformations == null || additionalInformations == "", category == null || category == "") {
|
||||||
alert("Nie można utowrzyć turnieju! Proszę wypełnić wszystkie pola!")
|
alert("Nie można utworzyć turnieju! Proszę wypełnić wszystkie pola!")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fetch('https://dragonmaster.pl/inz/tournament', {
|
fetch('https://dragonmaster.pl/inz/tournament', {
|
||||||
@ -110,8 +110,8 @@ function createTournament() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
localStorage.clear();
|
localStorage.removeItem('token');
|
||||||
location.reload();
|
window.location.href = '../../normal_user/index.html'
|
||||||
}
|
}
|
||||||
|
|
||||||
function logoutVisibility() {
|
function logoutVisibility() {
|
||||||
|
@ -27,33 +27,29 @@
|
|||||||
// '","category":"' + "cat1" +
|
// '","category":"' + "cat1" +
|
||||||
// '","}');
|
// '","}');
|
||||||
// });
|
// });
|
||||||
function checkCheckBox() {
|
// function checkCheckBox() {
|
||||||
let checkBox = document.getElementById("checkBox");
|
// let checkBox = document.getElementById("checkBox");
|
||||||
|
|
||||||
if (checkBox.checked == true) {
|
// if (checkBox.checked == true) {
|
||||||
return ("TRUE")
|
// return ("TRUE")
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
return ("FALSE")
|
// return ("FALSE")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
function checkRankingBox() {
|
// function checkRankingBox() {
|
||||||
let checkBox = document.getElementById("checkBoxRanking");
|
// let checkBox = document.getElementById("checkBoxRanking");
|
||||||
|
|
||||||
if (checkBox.checked == true) {
|
// if (checkBox.checked == true) {
|
||||||
return ("1")
|
// return ("1")
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
return ("0")
|
// return ("0")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
function createTournament() {
|
function createTournament() {
|
||||||
let rankingChecker = checkRankingBox();
|
|
||||||
console.log(rankingChecker)
|
|
||||||
let checker = checkCheckBox();
|
|
||||||
console.log(checker)
|
|
||||||
fetch('https://dragonmaster.pl/inz/tournament', {
|
fetch('https://dragonmaster.pl/inz/tournament', {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -77,20 +73,20 @@ function createTournament() {
|
|||||||
"entriesTo": document.getElementById("entries").value,
|
"entriesTo": document.getElementById("entries").value,
|
||||||
"additionalInformations": document.getElementById("add-info").value,
|
"additionalInformations": document.getElementById("add-info").value,
|
||||||
"categotry": document.getElementById("category").value,
|
"categotry": document.getElementById("category").value,
|
||||||
"visibility": checker
|
"visibility": "TRUE"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => console.log(data))
|
.then(data => window.location.href = '../../index.html')
|
||||||
.catch(error => console.log(error))
|
.catch(error => console.log(error))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
localStorage.clear();
|
localStorage.removeItem('token');
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user