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 {
text-align: center;
line-height: 2;
font-family: Montserrat, serif;
font-style: bold;
font-weight: bold;
font-size: 18px;
color: #828282;
@ -99,3 +97,55 @@ a:hover {
a:active {
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);
}
}
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() {
localStorage.removeItem('token');

View File

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

View File

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

View File

@ -3,15 +3,9 @@ li.game {
margin-right: 20px;
}
li.game.winner {
font-weight: bold;
}
li.game.winner {}
/*Tekst wewnątrz boxa*/
li.game span {
float: right;
margin-right: 100px;
}
/*Górna linia drabinki*/
li.game-top {

View File

@ -11,7 +11,7 @@
</head>
<body onload="logoutVisibility(); loginVisibility();">
<body onload="logoutVisibility(); loginVisibility(); loadPlayers()">
<header>
<div class=" logoBox">
@ -41,260 +41,8 @@
</nav>
</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-->
<button type="button" class="collapsible">O 5. miejsce</button>
<button type="button" class="collapsible">Drabinka 8 par</button>
<div class="collapsibleContent">
<main id="tournament3" class="tournaments">
<!-- ROUND 3-->
@ -302,25 +50,41 @@
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
<input><br>
<input>
<span class="span-ladder" id="1">
<input id="1Input">
</span>
<span class="span-ladder" id="2">
<input id="2Input">
</span>
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
<input><br>
<input>
<span class="span-ladder" id="3">
<input id="3Input">
</span>
<span class="span-ladder" id="4">
<input id="4Input">
</span>
</li>
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox">
<input><br>
<input>
<span class="span-ladder" id="5">
<input id="5Input">
</span>
<span class="span-ladder" id="6">
<input id="6Input">
</span>
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox winner">
<input><br>
<input>
<span class="span-ladder" id="7">
<input id="7Input">
</span>
<span class="span-ladder" id="8">
<input id="8Input">
</span>
</li>
<li class="spacer">&nbsp;</li>
@ -330,13 +94,21 @@
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
<input><br>
<input>
<span class="span-ladder" id="9">
<input id="9Input">
</span>
<span class="span-ladder" id="10">
<input id="10Input">
</span>
</li>
<li class="game game-spacer">&nbsp;</li>
<li class="game game-bottom teambox">
<input><br>
<input>
<span class="span-ladder" id="11">
<input id="11Input">
</span>
<span class="span-ladder" id="12">
<input id="12Input">
</span>
</li>
<li class="spacer">&nbsp;</li>
@ -346,290 +118,23 @@
<li class="spacer">&nbsp;</li>
<li class="game game-top teambox winner">
<input><br>
<input>
<span class="span-ladder" id="13">
<input id="13Input">
</span>
<span class="span-ladder" id="14">
<input id="14Input">
</span>
</li>
<li class="spacer">&nbsp;</li>
</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>
</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>
<script type="text/javascript" src="collapsible.js"></script>
<script type="text/javascript" src="ladder.js"></script>
</body>
</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>
</head>
<body onload="renderTournaments();logoutVisibility(); loginVisibility();">
<body onload="renderTournaments();logoutVisibility(); loginVisibility(); checkRole();">
<header>
<div class="logoBox">
<a class="header_link" href="../../index.html"><img class="logo" src="../../../_global/logo.svg"
@ -51,8 +51,8 @@
<nav>
<ul>
<li><a href="#">Informacje</a></li>
<li><a href="zapisy/index.html">Zapisy</a></li>
<li><a href="drabinka/index.html">Drabinka</a></li>
<li id="zapisy"><a href="zapisy/index.html">Zapisy</a></li>
<li id="drabinka"><a href="drabinka/index.html">Drabinka</a></li>
</ul>
</nav>
</div>

View File

@ -130,7 +130,7 @@ function check(){
if(counter==5){
document.getElementById("loader").style.display="none";
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";
}else{
setTimeout(check, 1000);

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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">
</head>
@ -32,7 +32,7 @@
<br>
<div class="dropdown">
<button id ="dropbtn" class="dropbtn">Gotówka</button>
<button id="dropbtn" class="dropbtn">Gotówka</button>
<div class="dropdown-content">
<a id="paymentMethodCash">Gotówka</a>
<a id="paymentMethodTransfer">Przelew</a>
@ -50,17 +50,17 @@
</div>
<div class="login_footer">
<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>
<div id ="msg" class="loader" style="display:none;">
</div>
<button class="myButton" id="reopen" style="display:none;">
otwóż ponownie
<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>
<div id="msg" class="loader" style="display:none;">
</div>
<button class="myButton" id="reopen" style="display:none;">
otwórz ponownie
</button>
</div>
@ -69,7 +69,7 @@
</div>
<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>
</html>

View File

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

View File

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

View File

@ -56,32 +56,14 @@
<span id="b"></span>
</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>
<!-- MIKST-->
<!-- <button type="button" class="collapsible">Zapisani na turniej - MIKST</button>
<div class="collapsibleContent">

View File

@ -12,6 +12,10 @@ function saveIdTournament(id) {
localStorage.setItem('tournamentId', id);
}
function saveIdOrganisator(id) {
localStorage.setItem('organisatorId', id);
}
function checkRoleCreator() {
fetch('https://dragonmaster.pl/inz/user', {
headers: {
@ -64,7 +68,7 @@ async function renderTournaments(organiserTournament) {
organiser = `${tournament.creator}`;
// console.log(organiser)
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">
<img class="tournamentIcon" src="_main%20page/cup.svg" alt="">
</div>
@ -74,7 +78,7 @@ async function renderTournaments(organiserTournament) {
${tournament.place}
${tournament.from} do ${tournament.to}
<button class="tournamentOpen">OPEN</button>
<button class="tournamentOpen">${tournament.categotry}</button>
</div>
</div>
@ -96,7 +100,7 @@ async function renderTournaments(organiserTournament) {
${tournament.place}
${tournament.from} do ${tournament.to}
<button class="tournamentOpen">OPEN</button>
<button class="tournamentOpen">${tournament.categotry}</button>
</div>
</div>
@ -112,7 +116,7 @@ async function renderTournaments(organiserTournament) {
function logout() {
localStorage.clear();
localStorage.removeItem('token');
location.reload();
}
@ -162,3 +166,22 @@ function checkRole() {
}
}
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="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
turnieju</a>

View File

@ -7,7 +7,7 @@
<title>Padel Tournaments System</title>
<link href="style.css" rel="stylesheet">
<script>function logout() {
localStorage.clear();
localStorage.removeItem('token');
location.reload();
}
@ -31,10 +31,34 @@
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>
<body onload="logoutVisibility(); loginVisibility()">
<body onload="logoutVisibility(); loginVisibility(); checkRole();">
<header>
<div class="logoBox">
@ -49,6 +73,9 @@
<a class="header-link" href="#">Kontakt</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="../../panel_organizatora/dodawanie%20turnieju/index.html"
id="creator">Tworzenie
turnieju</a>
</div>
</header>

View File

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

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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">
</head>

View File

@ -7,7 +7,7 @@
<title>Padel Tournaments System</title>
<link href="style.css" rel="stylesheet">
<script>function logout() {
localStorage.clear();
localStorage.removeItem('token');
location.reload();
}
@ -31,10 +31,34 @@
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>
</head>
<body onload="logoutVisibility(); loginVisibility()">
<body onload="logoutVisibility(); loginVisibility(); checkRole()">
<header>
<div class="logoBox">
<a class="header_link" href="../index.html"><img class="logo" src="../../_global/logo.svg"
@ -46,8 +70,11 @@
id="login">LOGOWANIE</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="#"">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="../../panel_organizatora/dodawanie%20turnieju/index.html"
id="creator">Tworzenie
turnieju</a>
</div>
</header>

View File

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

View File

@ -67,7 +67,7 @@ function createTournament() {
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 == "") {
alert("Nie można utowrzyć turnieju! Proszę wypełnić wszystkie pola!")
alert("Nie można utworzyć turnieju! Proszę wypełnić wszystkie pola!")
}
else {
fetch('https://dragonmaster.pl/inz/tournament', {
@ -110,8 +110,8 @@ function createTournament() {
}
function logout() {
localStorage.clear();
location.reload();
localStorage.removeItem('token');
window.location.href = '../../normal_user/index.html'
}
function logoutVisibility() {

View File

@ -119,7 +119,8 @@
</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()">
Załóż turniej

View File

@ -27,33 +27,77 @@
// '","category":"' + "cat1" +
// '","}');
// });
function checkCheckBox() {
let checkBox = document.getElementById("checkBox");
// function checkCheckBox() {
// let checkBox = document.getElementById("checkBox");
if (checkBox.checked == true) {
return ("TRUE")
}
else {
return ("FALSE")
}
}
// if (checkBox.checked == true) {
// return ("TRUE")
// }
// else {
// return ("FALSE")
// }
// }
function checkRankingBox() {
let checkBox = document.getElementById("checkBoxRanking");
// function checkRankingBox() {
// let checkBox = document.getElementById("checkBoxRanking");
if (checkBox.checked == true) {
return ("1")
}
else {
return ("0")
}
}
// if (checkBox.checked == true) {
// return ("1")
// }
// else {
// return ("0")
// }
// }
function createTournament() {
let rankingChecker = checkRankingBox();
console.log(rankingChecker)
let checker = checkCheckBox();
console.log(checker)
if (document.getElementById("name").value == null || document.getElementById("name").value == "") {
document.getElementById("name").value = document.getElementById("name").placeholder
console.log(document.getElementById("name").value)
}
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', {
method: "POST",
headers: {
@ -77,20 +121,20 @@ function createTournament() {
"entriesTo": document.getElementById("entries").value,
"additionalInformations": document.getElementById("add-info").value,
"categotry": document.getElementById("category").value,
"visibility": checker
"visibility": "TRUE"
}
)
}
)
.then(res => res.json())
.then(data => console.log(data))
.then(data => window.location.href = '../../index.html')
.catch(error => console.log(error))
}
function logout() {
localStorage.clear();
localStorage.removeItem('token');
location.reload();
}
@ -147,7 +191,7 @@ async function renderTournaments() {
document.getElementById("term_from").placeholder = `${tournament.from}`
document.getElementById("term_to").placeholder = `${tournament.to}`
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("entry-fee").placeholder = `${tournament.entryFee}`
document.getElementById("director").placeholder = `${tournament.director}`

View File

@ -112,7 +112,7 @@
Widoczność turnieju
<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">
<label></label>
</div>