Merge branch 'master' of git.wmi.amu.edu.pl:s444413/Padel-Tournaments-System

This commit is contained in:
Tomasz Sidoruk 2022-10-20 09:40:05 +02:00
commit d2892f36ff
24 changed files with 394 additions and 647 deletions

View File

@ -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;
} }

View File

@ -9,6 +9,57 @@ async function showTournaments() {
console.log(error); console.log(error);
} }
} }
function checkId() {
if (localStorage.getItem("token") !== null) {
fetch('https://dragonmaster.pl/inz/user', {
headers: {
Authorization: ("Bearer " + localStorage.getItem("token"))
}
})
.then(res => res.json())
.then(json => {
return (json['id'])
})
}
else {
document.getElementById("creator").style.display = "none";
}
}
function checkOwner() {
if (localStorage.getItem("organisatorId") == checkId()) {
console.log("dziaua")
}
}
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' || json['role'] == '2') {
document.getElementById("zapisy").style.display = "none";
document.getElementById("drabinka").style.display = "none";
}
else {
document.getElementById("zapisy").style.display = '';
document.getElementById("drabinka").style.display = '';
}
})
}
else {
document.getElementById("zapisy").style.display = "none";
document.getElementById("drabinka").style.display = "none";
}
}
function logout() { function logout() {
localStorage.removeItem('token'); localStorage.removeItem('token');

View File

@ -58,13 +58,10 @@
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 6px 15px; margin-top: 0.5%;
gap: 10px;
margin-top: 1%;
/*position: absolute;*/ /*position: absolute;*/
width: 73px; width: 90px;
height: 29px; height: 29px;
/* PFP GREEN */ /* PFP GREEN */

View File

@ -14,7 +14,7 @@ for (i = 0; i < coll.length; i++) {
} }
function logout() { function logout() {
localStorage.clear(); localStorage.removeItem('token');
location.reload(); location.reload();
} }

View File

@ -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 {

View File

@ -11,7 +11,7 @@
</head> </head>
<body onload="logoutVisibility(); loginVisibility();"> <body onload="logoutVisibility(); loginVisibility(); loadPlayers()">
<header> <header>
<div class=" logoBox"> <div class=" logoBox">
@ -41,260 +41,8 @@
</nav> </nav>
</div> </div>
<button type="button" class="collapsible">Drabinka Główna</button>
<!-- Zawartość collapsu-->
<div class="collapsibleContent">
<!-- Turniej-->
<main id="tournament">
<!-- ROUND 1-->
<ul class="round round-1">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner ">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Gracjan Wojciechowski<br>
Maurycy Błaszczyk
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Marcin Szewczyk<br>
Martin Marciniak
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Patryk Kołodziej<br>
Emil Kaczmarczyk
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox">
Dorian Jasiński<br>
Dawid Borkowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox winner">
Emanuel Czerwiński<br>
Bartłomiej Michalak
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Anatol Piotrowski<br>
Filip Pawlak
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Aleksander Pietrzak<br>
Olaf Górecki
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Kryspin Ostrowski<br>
Bartłomiej Baranowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Janusz Kwiatkowski<br>
Kamil Szulc
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Kryspin Sokołowski<br>
Roman Jankowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Oktawian Sikora<br>
Marcel Borkowski
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jerzy Stępień<br>
Alojzy Witkowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Olaf Rutkowski<br>
Klaudiusz Chmielewski
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Wróblewski<br>
Oskar Kowalski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Jarosław Cieślak<br>
Kamil Piotrowski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 2-->
<ul class="round round-2">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak<br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Marcin Szewczyk<br>
Martin Marciniak
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Emanuel Czerwiński<br>
Bartłomiej Michalak
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Anatol Piotrowski<br>
Filip Pawlak
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox">
Kryspin Ostrowski<br>
Bartłomiej Baranowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox winner">
Kryspin Sokołowski<br>
Roman Jankowski
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox">
Jerzy Stępień<br>
Alojzy Witkowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox winner">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 3-->
<ul class="round round-3">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak<br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Emanuel Czerwiński <br>
Bartłomiej Michalak
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox">
Kryspin Sokołowski <br>
Roman Jankowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox winner">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 4-->
<ul class="round round-4">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 5-->
<ul class="round round-5">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="spacer">&nbsp;</li>
</ul>
</main>
</div>
<!-- DRABINKA O 3 MIEJSCE-->
<button type="button" class="collapsible">O 3. miejsce</button>
<div class="collapsibleContent">
<main id="tournament2">
<!-- ROUND 4-->
<ul class="round round-4">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 5-->
<ul class="round round-5">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="spacer">&nbsp;</li>
</ul>
</main>
</div>
<!-- DRABINKA O 5 MIEJSCE--> <!-- DRABINKA O 5 MIEJSCE-->
<button type="button" class="collapsible">O 5. miejsce</button> <button type="button" class="collapsible">Drabinka 8 par</button>
<div class="collapsibleContent"> <div class="collapsibleContent">
<main id="tournament3" class="tournaments"> <main id="tournament3" class="tournaments">
<!-- ROUND 3--> <!-- ROUND 3-->
@ -302,25 +50,41 @@
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</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">&nbsp;</li> <li class="game game-spacer">&nbsp;</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">&nbsp;</li> <li class="spacer">&nbsp;</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">&nbsp;</li> <li class="game game-spacer">&nbsp;</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">&nbsp;</li> <li class="spacer">&nbsp;</li>
@ -330,13 +94,21 @@
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</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">&nbsp;</li> <li class="game game-spacer">&nbsp;</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">&nbsp;</li> <li class="spacer">&nbsp;</li>
@ -346,290 +118,23 @@
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</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">&nbsp;</li> <li class="spacer">&nbsp;</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>
<!-- DRABINKA O 7 MIEJSCE-->
<button type="button" class="collapsible">O 7. miejsce</button>
<div class="collapsibleContent">
<main id="tournament4">
<!-- ROUND 4-->
<ul class="round round-4">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 5-->
<ul class="round round-5">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="spacer">&nbsp;</li>
</ul>
</main>
</div>
<!-- DRABINKA O 9 MIEJSCE-->
<button type="button" class="collapsible">O 9. miejsce</button>
<div class="collapsibleContent">
<main id="tournament5">
<!-- ROUND 2-->
<ul class="round round-2">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak<br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Marcin Szewczyk<br>
Martin Marciniak
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Emanuel Czerwiński<br>
Bartłomiej Michalak
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Anatol Piotrowski<br>
Filip Pawlak
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox">
Kryspin Ostrowski<br>
Bartłomiej Baranowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox winner">
Kryspin Sokołowski<br>
Roman Jankowski
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox">
Jerzy Stępień<br>
Alojzy Witkowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox winner">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 3-->
<ul class="round round-3">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak<br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Emanuel Czerwiński <br>
Bartłomiej Michalak
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox">
Kryspin Sokołowski <br>
Roman Jankowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox winner">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 4-->
<ul class="round round-4">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 5-->
<ul class="round round-5">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="spacer">&nbsp;</li>
</ul>
</main>
</div>
<!-- DRABINKA O 11 MIEJSCE-->
<button type="button" class="collapsible">O 11. miejsce</button>
<div class="collapsibleContent">
<main id="tournament6">
<!-- ROUND 4-->
<ul class="round round-4">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 5-->
<ul class="round round-5">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="spacer">&nbsp;</li>
</ul>
</main>
</div>
<!-- DRABINKA O 13 MIEJSCE-->
<button type="button" class="collapsible">O 13. miejsce</button>
<div class="collapsibleContent">
<main id="tournament7">
<!-- ROUND 3-->
<ul class="round round-3">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak<br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Emanuel Czerwiński <br>
Bartłomiej Michalak
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox">
Kryspin Sokołowski <br>
Roman Jankowski
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox winner">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 4-->
<ul class="round round-4">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 5-->
<ul class="round round-5">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="spacer">&nbsp;</li>
</ul>
</main>
</div>
<!-- DRABINKA O 15 MIEJSCE-->
<button type="button" class="collapsible">O 15. miejsce</button>
<div class="collapsibleContent">
<main id="tournament8">
<!-- ROUND 4-->
<ul class="round round-4">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
Jędrzej Wróblewski <br>
Oskar Kowalski
</li>
<li class="spacer">&nbsp;</li>
</ul>
<!-- ROUND 5-->
<ul class="round round-5">
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
Jędrzej Kubiak <br>
Borys Kamiński
</li>
<li class="spacer">&nbsp;</li>
</ul>
</main>
</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>

View File

@ -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()
}

View File

@ -10,7 +10,7 @@
<script type="text/javascript" src="app.js"></script> <script type="text/javascript" src="app.js"></script>
</head> </head>
<body onload="renderTournaments();logoutVisibility(); loginVisibility();"> <body onload="renderTournaments();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"
@ -51,8 +51,8 @@
<nav> <nav>
<ul> <ul>
<li><a href="#">Informacje</a></li> <li><a href="#">Informacje</a></li>
<li><a href="zapisy/index.html">Zapisy</a></li> <li id="zapisy"><a href="zapisy/index.html">Zapisy</a></li>
<li><a href="drabinka/index.html">Drabinka</a></li> <li id="drabinka"><a href="drabinka/index.html">Drabinka</a></li>
</ul> </ul>
</nav> </nav>
</div> </div>

View File

@ -130,7 +130,7 @@ function check(){
if(counter==5){ if(counter==5){
document.getElementById("loader").style.display="none"; document.getElementById("loader").style.display="none";
document.getElementById("msg").style.display="block"; document.getElementById("msg").style.display="block";
document.getElementById("msg").innerText="you probably closed popup"; document.getElementById("msg").innerText="zamknąłeś okno pop-up bez płatności";
document.getElementById("reopen").style.display="block"; document.getElementById("reopen").style.display="block";
}else{ }else{
setTimeout(check, 1000); setTimeout(check, 1000);

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Padle tournament system</title> <title>Padel Tournament System</title>
<link href="style.css" rel="stylesheet"> <link href="style.css" rel="stylesheet">
</head> </head>
@ -32,7 +32,7 @@
<br> <br>
<div class="dropdown"> <div class="dropdown">
<button id ="dropbtn" class="dropbtn">Gotówka</button> <button id="dropbtn" class="dropbtn">Gotówka</button>
<div class="dropdown-content"> <div class="dropdown-content">
<a id="paymentMethodCash">Gotówka</a> <a id="paymentMethodCash">Gotówka</a>
<a id="paymentMethodTransfer">Przelew</a> <a id="paymentMethodTransfer">Przelew</a>
@ -50,26 +50,26 @@
</div> </div>
<div class="login_footer"> <div class="login_footer">
<div id="loader" class="loader" style="display:none;"> <div id="loader" class="loader" style="display:none;">
<div class="dot"></div> <div class="dot"></div>
<div class="dot"></div> <div class="dot"></div>
<div class="dot"></div> <div class="dot"></div>
<div class="dot"></div> <div class="dot"></div>
<div class="dot"></div> <div class="dot"></div>
</div> </div>
<div id ="msg" class="loader" style="display:none;"> <div id="msg" class="loader" style="display:none;">
</div> </div>
<button class="myButton" id="reopen" style="display:none;"> <button class="myButton" id="reopen" style="display:none;">
otwóż ponownie otwórz ponownie
</button> </button>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript" src="app.js"></script> <script type="text/javascript" src="app.js"></script>
<script src ="https://btcpay.dragonmaster.pl/modal/btcpay.js"></script> <script src="https://btcpay.dragonmaster.pl/modal/btcpay.js"></script>
</body> </body>
</html> </html>

View File

@ -44,6 +44,8 @@ html {
height: 15%; height: 15%;
width: 100%; width: 100%;
margin-top: 1%;
background-color: #ffffff; background-color: #ffffff;
} }
@ -58,6 +60,7 @@ html {
height: 10%; height: 10%;
width: 100%; width: 100%;
padding-top: 1%; padding-top: 1%;
margin-bottom: 1%;
background-color: #ffffff; background-color: #ffffff;
position: relative; position: relative;

View File

@ -14,7 +14,7 @@ for (i = 0; i < coll.length; i++) {
} }
function logout() { function logout() {
localStorage.clear(); localStorage.removeItem('token');
location.reload(); location.reload();
} }

View File

@ -56,32 +56,14 @@
<span id="b"></span> <span id="b"></span>
</div> </div>
<div class="partParameters">
Dopuszczeni do turnieju
<div class="pretty p-switch p-fill" style="margin-left: 5%">
<input type="checkbox" />
<div class="state p-success">
<label></label>
</div>
</div>
<br>
Zapis opłacony
<div class="pretty p-switch p-fill" style="margin-left: 5%">
<input type="checkbox" />
<div class="state p-success">
<label></label>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<!-- MIKST--> <!-- MIKST-->
<!-- <button type="button" class="collapsible">Zapisani na turniej - MIKST</button> <!-- <button type="button" class="collapsible">Zapisani na turniej - MIKST</button>
<div class="collapsibleContent"> <div class="collapsibleContent">

View File

@ -12,6 +12,10 @@ function saveIdTournament(id) {
localStorage.setItem('tournamentId', id); localStorage.setItem('tournamentId', id);
} }
function saveIdOrganisator(id) {
localStorage.setItem('organisatorId', id);
}
function checkRoleCreator() { function checkRoleCreator() {
fetch('https://dragonmaster.pl/inz/user', { fetch('https://dragonmaster.pl/inz/user', {
headers: { headers: {
@ -64,7 +68,7 @@ async function renderTournaments(organiserTournament) {
organiser = `${tournament.creator}`; organiser = `${tournament.creator}`;
// console.log(organiser) // console.log(organiser)
if (organiser == organiserTournament) { if (organiser == organiserTournament) {
let htmlSegment = `<div class = "tournamentBox" onclick="window.location.href='../panel_organizatora/edycja turnieju/index.html'; saveIdTournament(${tournament.id});"> let htmlSegment = `<div class = "tournamentBox" onclick="window.location.href='../panel_organizatora/edycja turnieju/index.html'; saveIdTournament(${tournament.id});saveIdOrganisator(${tournament.creator});">
<div class="tournamentIconBox"> <div class="tournamentIconBox">
<img class="tournamentIcon" src="_main%20page/cup.svg" alt=""> <img class="tournamentIcon" src="_main%20page/cup.svg" alt="">
</div> </div>
@ -74,7 +78,7 @@ async function renderTournaments(organiserTournament) {
${tournament.place} ${tournament.place}
${tournament.from} do ${tournament.to} ${tournament.from} do ${tournament.to}
<button class="tournamentOpen">OPEN</button> <button class="tournamentOpen">${tournament.categotry}</button>
</div> </div>
</div> </div>
@ -96,7 +100,7 @@ async function renderTournaments(organiserTournament) {
${tournament.place} ${tournament.place}
${tournament.from} do ${tournament.to} ${tournament.from} do ${tournament.to}
<button class="tournamentOpen">OPEN</button> <button class="tournamentOpen">${tournament.categotry}</button>
</div> </div>
</div> </div>
@ -112,7 +116,7 @@ async function renderTournaments(organiserTournament) {
function logout() { function logout() {
localStorage.clear(); localStorage.removeItem('token');
location.reload(); location.reload();
} }
@ -161,4 +165,23 @@ function checkRole() {
document.getElementById("creator").style.display = "none"; document.getElementById("creator").style.display = "none";
} }
}
function checkId() {
if (localStorage.getItem("token") !== null) {
fetch('https://dragonmaster.pl/inz/user', {
headers: {
Authorization: ("Bearer " + localStorage.getItem("token"))
}
})
.then(res => res.json())
.then(json => {
return (json['id'])
})
}
else {
document.getElementById("creator").style.display = "none";
}
} }

View File

@ -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>

View File

@ -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>

View File

@ -19,7 +19,7 @@ function checkRole() {
} }
function login() { function login() {
localStorage.clear() localStorage.removeItem('token')
fetch('https://dragonmaster.pl/inz/user/login', { fetch('https://dragonmaster.pl/inz/user/login', {
method: "POST", method: "POST",
headers: { headers: {

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Padle tournament system</title> <title>Padel Tournament System</title>
<link href="style.css" rel="stylesheet"> <link href="style.css" rel="stylesheet">
</head> </head>

View File

@ -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>

View File

@ -11,9 +11,10 @@
background-color: #828282; background-color: #828282;
/*Text*/ /*Text*/
font-family: Arial, serif; font-family: Montserrat, serif;
font-size: 12px; font-size: 18px;
color: #ffffff; color: #ffffff;
font-weight: 600;
} }
@ -21,6 +22,7 @@
/*Button alignment*/ /*Button alignment*/
width: 25%; width: 25%;
height: 5%; height: 5%;
margin-top: 3%;
/*Button visual*/ /*Button visual*/
@ -29,7 +31,8 @@
background-color: #007C36; background-color: #007C36;
/*Text*/ /*Text*/
font-family: Arial, serif; font-family: Montserrat, serif;
font-size: 12px; font-size: 18px;
color: #ffffff; color: #ffffff;
font-weight: 600;
} }

View File

@ -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() {

View File

@ -119,7 +119,8 @@
</div> </div>
<button class="cancelButton" type="button" id="cancel" onclick="">Anuluj</button> <button class="cancelButton" type="button" id="cancel"
onclick="window.location.href = '../../normal_user/index.html'">Anuluj</button>
<button class="submitButton" type="submit" id="tournamentsubmit" onclick="createTournament()"> <button class="submitButton" type="submit" id="tournamentsubmit" onclick="createTournament()">
Załóż turniej Załóż turniej

View File

@ -27,33 +27,77 @@
// '","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(); if (document.getElementById("name").value == null || document.getElementById("name").value == "") {
console.log(rankingChecker) document.getElementById("name").value = document.getElementById("name").placeholder
let checker = checkCheckBox(); console.log(document.getElementById("name").value)
console.log(checker) }
if (document.getElementById("place").value == null || document.getElementById("place").value == "") {
document.getElementById("place").value = document.getElementById("place").placeholder
console.log(document.getElementById("place").value)
}
if (document.getElementById("category").value == null || document.getElementById("category").value == "") {
document.getElementById("category").value = document.getElementById("category").placeholder
console.log(document.getElementById("category").value)
}
if (document.getElementById("term_from").value == null || document.getElementById("term_from").value == "") {
document.getElementById("term_from").value = document.getElementById("term_from").placeholder
console.log(document.getElementById("term_from").value)
}
if (document.getElementById("term_to").value == null || document.getElementById("term_to").value == "") {
document.getElementById("term_to").value = document.getElementById("term_to").placeholder
console.log(document.getElementById("term_to").value)
}
if (document.getElementById("rank").value == null || document.getElementById("rank").value == "") {
document.getElementById("rank").value = document.getElementById("rank").placeholder
console.log(document.getElementById("rank").value)
}
if (document.getElementById("entry-fee").value == null || document.getElementById("entry-fee").value == "") {
document.getElementById("entry-fee").value = document.getElementById("entry-fee").placeholder
console.log(document.getElementById("entry-fee").value)
}
if (document.getElementById("director").value == null || document.getElementById("director").value == "") {
document.getElementById("director").value = document.getElementById("director").placeholder
console.log(document.getElementById("director").value)
}
if (document.getElementById("phone").value == null || document.getElementById("phone").value == "") {
document.getElementById("phone").value = document.getElementById("phone").placeholder
console.log(document.getElementById("phone").value)
}
if (document.getElementById("entries").value == null || document.getElementById("entries").value == "") {
document.getElementById("entries").value = document.getElementById("entries").placeholder
console.log(document.getElementById("entries").value)
}
if (document.getElementById("add-info").value == null || document.getElementById("add-info").value == "") {
document.getElementById("add-info").value = document.getElementById("add-info").placeholder
console.log(document.getElementById("add-info").value)
}
if (document.getElementById("category").value == null || document.getElementById("category").value == "") {
document.getElementById("category").value = document.getElementById("category").placeholder
console.log(document.getElementById("category").value)
}
fetch('https://dragonmaster.pl/inz/tournament', { fetch('https://dragonmaster.pl/inz/tournament', {
method: "POST", method: "POST",
headers: { headers: {
@ -77,20 +121,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();
} }
@ -147,7 +191,7 @@ async function renderTournaments() {
document.getElementById("term_from").placeholder = `${tournament.from}` document.getElementById("term_from").placeholder = `${tournament.from}`
document.getElementById("term_to").placeholder = `${tournament.to}` document.getElementById("term_to").placeholder = `${tournament.to}`
document.getElementById("place").placeholder = `${tournament.place}` document.getElementById("place").placeholder = `${tournament.place}`
document.getElementById("category").placeholder = `${tournament.roles}` document.getElementById("category").placeholder = `${tournament.categotry}`
document.getElementById("rank").placeholder = `${tournament.rang}` document.getElementById("rank").placeholder = `${tournament.rang}`
document.getElementById("entry-fee").placeholder = `${tournament.entryFee}` document.getElementById("entry-fee").placeholder = `${tournament.entryFee}`
document.getElementById("director").placeholder = `${tournament.director}` document.getElementById("director").placeholder = `${tournament.director}`

View File

@ -112,7 +112,7 @@
Widoczność turnieju Widoczność turnieju
<div class="pretty p-switch p-fill" style="margin-left: 5%"> <div class="pretty p-switch p-fill" style="margin-left: 5%">
<input type="checkbox" id="checkBox" /> <input type="checkbox" id="checkBox" checked />
<div class="state p-success"> <div class="state p-success">
<label></label> <label></label>
</div> </div>