From 86556b76bb863bf8f79c06ef835f04c3409a84da Mon Sep 17 00:00:00 2001 From: Arek Date: Sun, 19 Jun 2022 22:40:31 +0200 Subject: [PATCH] feat: :sparkles: Working ladder, updating tournamnet --- frontend/_global/header.css | 56 ++++++++++++++++- .../drabinka/collapsible.js | 2 +- .../pojedynczy_turniej/drabinka/css/li.css | 8 +-- .../pojedynczy_turniej/drabinka/index.html | 62 ++++++++++++++----- .../pojedynczy_turniej/drabinka/ladder.js | 40 ++++++++++++ .../pojedynczy_turniej/zapisy/collapsible.js | 2 +- frontend/normal_user/app.js | 2 +- frontend/normal_user/index.html | 2 +- frontend/normal_user/kontakt/index.html | 33 +++++++++- frontend/normal_user/ranking/index.html | 33 +++++++++- .../dodawanie turnieju/app.js | 6 +- .../panel_organizatora/edycja turnieju/app.js | 46 +++++++------- 12 files changed, 228 insertions(+), 64 deletions(-) create mode 100644 frontend/normal_user/_main page/pojedynczy_turniej/drabinka/ladder.js diff --git a/frontend/_global/header.css b/frontend/_global/header.css index d113d4a..d0a5cc2 100644 --- a/frontend/_global/header.css +++ b/frontend/_global/header.css @@ -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; @@ -98,4 +96,56 @@ 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; } \ No newline at end of file diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js index 6f45ad8..39c9b84 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js +++ b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js @@ -14,7 +14,7 @@ for (i = 0; i < coll.length; i++) { } function logout() { - localStorage.clear(); + localStorage.removeItem('token'); location.reload(); } diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/css/li.css b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/css/li.css index 7cd2bff..5813c6d 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/css/li.css +++ b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/css/li.css @@ -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 { diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html index 67a3af3..849512e 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html +++ b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html @@ -11,7 +11,7 @@ - +
@@ -302,25 +302,41 @@
  •  
  • -
    - + + + + + +
  •  
  • -
    - + + + + + +
  •  
  • -
    - + + + + + +
  •  
  • -
    - + + + + + +
  •  
  • @@ -330,13 +346,21 @@
  •  
  • -
    - + + + + + +
  •  
  • -
    - + + + + + +
  •  
  • @@ -346,12 +370,17 @@
  •  
  • -
    - + + + + + +
  •  
  • - + +
    @@ -630,6 +659,7 @@ + \ No newline at end of file diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/ladder.js b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/ladder.js new file mode 100644 index 0000000..e9eea99 --- /dev/null +++ b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/ladder.js @@ -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 = `
    ` + localStorage.getItem(i + "value") + `
    `; + } + } +} + +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() +} diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/collapsible.js b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/collapsible.js index 362ac00..60dc858 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/collapsible.js +++ b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/collapsible.js @@ -14,7 +14,7 @@ for (i = 0; i < coll.length; i++) { } function logout() { - localStorage.clear(); + localStorage.removeItem('token'); location.reload(); } diff --git a/frontend/normal_user/app.js b/frontend/normal_user/app.js index c040569..ea262d9 100644 --- a/frontend/normal_user/app.js +++ b/frontend/normal_user/app.js @@ -112,7 +112,7 @@ async function renderTournaments(organiserTournament) { function logout() { - localStorage.clear(); + localStorage.removeItem('token'); location.reload(); } diff --git a/frontend/normal_user/index.html b/frontend/normal_user/index.html index 5b84b3b..b5b299a 100644 --- a/frontend/normal_user/index.html +++ b/frontend/normal_user/index.html @@ -23,7 +23,7 @@ Kontakt Ranking - Kalendarz turniejów + Kalendarz turniejów Tworzenie turnieju diff --git a/frontend/normal_user/kontakt/index.html b/frontend/normal_user/kontakt/index.html index 54ea411..d5aaf3d 100644 --- a/frontend/normal_user/kontakt/index.html +++ b/frontend/normal_user/kontakt/index.html @@ -7,7 +7,7 @@ Padel Tournaments System + } + + 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"; + } + } + - +
    diff --git a/frontend/normal_user/ranking/index.html b/frontend/normal_user/ranking/index.html index 73c611d..e7949ad 100644 --- a/frontend/normal_user/ranking/index.html +++ b/frontend/normal_user/ranking/index.html @@ -7,7 +7,7 @@ Padel Tournaments System - +
    diff --git a/frontend/panel_organizatora/dodawanie turnieju/app.js b/frontend/panel_organizatora/dodawanie turnieju/app.js index d3700b5..6dad5de 100644 --- a/frontend/panel_organizatora/dodawanie turnieju/app.js +++ b/frontend/panel_organizatora/dodawanie turnieju/app.js @@ -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() { diff --git a/frontend/panel_organizatora/edycja turnieju/app.js b/frontend/panel_organizatora/edycja turnieju/app.js index 986a2f9..e3f98bf 100644 --- a/frontend/panel_organizatora/edycja turnieju/app.js +++ b/frontend/panel_organizatora/edycja turnieju/app.js @@ -27,33 +27,29 @@ // '","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) fetch('https://dragonmaster.pl/inz/tournament', { method: "POST", headers: { @@ -77,20 +73,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(); }