feat: W pełni działająca wersja systemu na obronę

This commit is contained in:
Arek 2022-06-20 01:03:31 +02:00
parent 781c45fe49
commit 14f35721d1
9 changed files with 121 additions and 569 deletions

View File

@ -9,6 +9,30 @@ 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() { function checkRole() {
if (localStorage.getItem("token") !== null) { if (localStorage.getItem("token") !== null) {
@ -20,7 +44,7 @@ function checkRole() {
}) })
.then(res => res.json()) .then(res => res.json())
.then(json => { .then(json => {
if (json['role'] == '1') { if (json['role'] == '1' || json['role'] == '2') {
document.getElementById("zapisy").style.display = "none"; document.getElementById("zapisy").style.display = "none";
document.getElementById("drabinka").style.display = "none"; document.getElementById("drabinka").style.display = "none";
} }

View File

@ -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-->
@ -384,279 +132,6 @@
</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> <script type="text/javascript" src="ladder.js"></script>

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

@ -56,24 +56,6 @@
<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>

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">${tournament.rang}</button> <button class="tournamentOpen">${tournament.categotry}</button>
</div> </div>
</div> </div>
@ -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

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

@ -50,6 +50,54 @@
// } // }
function createTournament() { function createTournament() {
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', { fetch('https://dragonmaster.pl/inz/tournament', {
method: "POST", method: "POST",
headers: { headers: {
@ -143,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>