diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..d552e99 --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,15 @@ + + + + + + + + Document + + + + + + + \ No newline at end of file diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/app.js b/frontend/normal_user/_main page/pojedynczy_turniej/app.js index ab12e2b..55ef099 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/app.js +++ b/frontend/normal_user/_main page/pojedynczy_turniej/app.js @@ -17,6 +17,8 @@ async function renderTournaments() { tournaments.forEach(tournament => { if (`${tournament.id}` == localStorage.getItem("tournamentId")) { + console.log(`${tournament.rang}`) + htmlDate = `

${tournament.name}

${tournament.places}
diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/index.html b/frontend/normal_user/_main page/pojedynczy_turniej/index.html index bef7c38..2efd527 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/index.html +++ b/frontend/normal_user/_main page/pojedynczy_turniej/index.html @@ -14,7 +14,7 @@
+ alt="Logo error">
-
- - +
diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy na turniej/app.js b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy na turniej/app.js index b5d799e..3d78fc6 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy na turniej/app.js +++ b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy na turniej/app.js @@ -49,29 +49,31 @@ function login() { } -// function checkRole() { -// fetch('https://dragonmaster.pl/inz/user', { -// method: "GET", -// headers: { -// 'Content-type': 'application/json' -// }, -// body: JSON.stringify( -// { -// "token": document.getElementById("loginusername").value, -// "password": document.getElementById("loginpassword").value -// } -// ) -// } -// ) -// .then(res => { -// if (res.ok) { -// alert("Teraz mozesz się zalogować!") -// } -// else { console.log("Coś poszło nie tak!") } -// return res -// }) -// .then(res => res.json()) -// .then(data => console.log(data['token']?.length > 0 ? localStorage.setItem("token", data['token']) : 'niedziaua')) -// .catch(error => console.log(error)) -// .then(token1 => token = token1) -// } \ No newline at end of file +function tournamentSave() { + fetch('https://dragonmaster.pl/inz/registration', { + method: "PUT", + headers: { + Authorization: ("Bearer " + localStorage.getItem("token")) + }, + body: JSON.stringify( + { + "paymentmethod": "cash", + "tournament": localStorage.getItem('tournamentId'), + "partner": document.getElementById("ID_input").value + } + ) + } + ) + .then(res => { + if (res.ok) { + alert("Udało się zapisać!") + + } + else { console.log("Coś poszło nie tak!") } + return res + }) + .then(res => res.json()) + .catch(error => console.log(error)) +} + + diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy na turniej/index.html b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy na turniej/index.html index d4fed07..d9bb18d 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy na turniej/index.html +++ b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy na turniej/index.html @@ -34,16 +34,16 @@ - 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 ca79021..26d6bca 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/collapsible.js +++ b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/collapsible.js @@ -2,13 +2,46 @@ var coll = document.getElementsByClassName("collapsible"); var i; for (i = 0; i < coll.length; i++) { - coll[i].addEventListener("click", function() { + coll[i].addEventListener("click", function () { this.classList.toggle("active"); var content = this.nextElementSibling; - if (content.style.maxHeight){ + if (content.style.maxHeight) { content.style.maxHeight = null; } else { content.style.maxHeight = content.scrollHeight + "px"; } }); -} \ No newline at end of file +} + + +function acceptPlayers(id) { + console.log(id) + const requestOptions = { + method: 'POST', + headers: { + 'Authorization': ("Bearer " + localStorage.getItem("token")) + }, + body: JSON.stringify({ title: id }) + }; + fetch('https://dragonmaster.pl/inz_swag/registration/payedUsingCash', requestOptions) + .then(response => response.json()) + .then(data => console.log("ok")); + +} + + +// GET request using fetch with set headers +function registrationsGet() { + let id = localStorage.getItem('tournamentId'); + const element = document.getElementById('tournament8'); + const headers = { + 'Authorization': ("Bearer " + localStorage.getItem("token")) + }; + fetch('https://dragonmaster.pl/inz/registrations' + '?id=' + id, { headers }) + .then(response => response.json()) + .then(data => element.innerHTML = data.map(dataItem => + `
${dataItem.userid} ${dataItem.paymenttype} ${dataItem.paymentstatus} ${dataItem.partner}
`) + ); +} + + diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/index.html b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/index.html index 2c64869..d76900b 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/index.html +++ b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/index.html @@ -11,15 +11,17 @@ - +
- +
+
--> - +
- Brak zawodników mikst +
+ +
diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/style.css b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/style.css index 7b59f74..0abc9ad 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/style.css +++ b/frontend/normal_user/_main page/pojedynczy_turniej/zapisy/style.css @@ -123,5 +123,13 @@ main { padding-top: 2%; padding-right: 2%; + border: 1px solid black; +} + +.zapisani { + width: 100px; + height: auto; + display: flex; + flex-direction: column; line-height: 200%; } \ No newline at end of file diff --git a/frontend/normal_user/app.js b/frontend/normal_user/app.js index 3947a24..01be7e1 100644 --- a/frontend/normal_user/app.js +++ b/frontend/normal_user/app.js @@ -20,21 +20,45 @@ function checkRoleCreator() { }) .then(res => res.json()) .then(json => { - let test = (json['id']) - renderTournaments(test) + let organiser = (json['id']) + renderTournaments(organiser) }) } -async function renderTournaments(test) { +function tournamentDelete(id) { + event.cancelBubble = true; + if (event.stopPropagation) event.stopPropagation(); + console.log(id) + fetch('https://dragonmaster.pl/inz/tournament', { + method: "DELETE", + headers: { + 'Content-type': 'application/json', + Authorization: ("Bearer " + localStorage.getItem("token")) + }, + + body: JSON.stringify( + { + "id": id + } + ) + } + ) + + .then(res => res.json()) + .then(data => console.log(data)) + .catch(error => console.log(error)) +} + + +async function renderTournaments(organiserTournament) { let tournaments = await showTournaments(); let html = ''; tournaments.forEach(tournament => { // console.log(test) organiser = `${tournament.creator}`; - console.log(organiser) // console.log(organiser) - if (organiser == test) { + if (organiser == organiserTournament) { let htmlSegment = `
@@ -50,9 +74,10 @@ async function renderTournaments(test) {
- + +
- `; + ` html += htmlSegment; } else { @@ -80,9 +105,6 @@ async function renderTournaments(test) { container.innerHTML = html; } -function checkRoleforDelete() { - -} function logout() { localStorage.clear(); @@ -134,16 +156,4 @@ function checkRole() { document.getElementById("creator").style.display = "none"; } -} - -// function creatorVisibility() { -// if (localStorage.getItem("token") == null) { -// document.getElementById("creator").style.display = "none"; -// } -// else if (checkRole()) { -// document.getElementById("creator").style.display = "none"; -// } -// else { -// document.getElementById("creator").style.display = ""; -// } -// } \ No newline at end of file +} \ No newline at end of file diff --git a/frontend/normal_user/logowanie/app.js b/frontend/normal_user/logowanie/app.js index b5d799e..9e38012 100644 --- a/frontend/normal_user/logowanie/app.js +++ b/frontend/normal_user/logowanie/app.js @@ -12,7 +12,7 @@ function checkRole() { window.location.href = '../index.html' } else { - window.location.href = '../../panel_organizatora/dodawanie turnieju/index.html' + window.location.href = '../index.html' } }) diff --git a/frontend/panel_organizatora/dodawanie turnieju/app.js b/frontend/panel_organizatora/dodawanie turnieju/app.js index 3beb17d..4db1cb4 100644 --- a/frontend/panel_organizatora/dodawanie turnieju/app.js +++ b/frontend/panel_organizatora/dodawanie turnieju/app.js @@ -41,18 +41,18 @@ function createTournament() { "typeOfLadder": "string", "pointsForTournament": "1", "places": "1", - "roles": document.getElementById("category").value, + "roles": "role", "ranked": document.getElementById("rank").value, "place": document.getElementById("place").value, - "from": "2020-10-10 10:10:10", - "to": "2020-10-10 10:10:10", - "rang": "rang1", + "from": document.getElementById("term_from").value, + "to": document.getElementById("term_to").value, + "rang": document.getElementById("rank").value, "entryFee": document.getElementById("entry-fee").value, "director": document.getElementById("director").value, "phone": document.getElementById("phone").value, - "entriesTo": "2020-10-10 10:10:10", + "entriesTo": document.getElementById("entries").value, "additionalInformations": document.getElementById("add-info").value, - "categotry": "cat1", + "categotry": document.getElementById("category").value, "visibility": "TRUE" } ) diff --git a/frontend/panel_organizatora/dodawanie turnieju/index.html b/frontend/panel_organizatora/dodawanie turnieju/index.html index 008ed4e..ae6a491 100644 --- a/frontend/panel_organizatora/dodawanie turnieju/index.html +++ b/frontend/panel_organizatora/dodawanie turnieju/index.html @@ -1,6 +1,6 @@ + xmlns="http://www.w3.org/1999/html"> @@ -9,20 +9,20 @@ Padel Tournaments System - +
+ alt="Logo error">