From 1d5f183e42894cbbe157995cebc1f45eae36b479 Mon Sep 17 00:00:00 2001 From: ganka-xn Date: Fri, 16 Feb 2024 18:47:21 +0300 Subject: [PATCH 1/2] Project.3.3 - Frontend create players table --- src/main/webapp/css/my.css | 28 ++++++++++++++++++++ src/main/webapp/html/my.html | 51 ++++++++++++++++++++++++++++++++++-- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/css/my.css b/src/main/webapp/css/my.css index e69de29b..e6a01052 100644 --- a/src/main/webapp/css/my.css +++ b/src/main/webapp/css/my.css @@ -0,0 +1,28 @@ +/* Стили для заголовков */ +h1 { + color: blue; + font-size: 24px; +} + +/* Стили для ссылок */ +a { + text-decoration: none; + color: #0066cc; +} + +/* Стили для таблиц */ +table { + border-collapse: collapse; + width: 100%; +} + +td, th { + border: 1px solid black; + padding: 8px; +} + +/* Общие стили для всего документа */ +body { + font-family: Arial, sans-serif; + background-color: #f0f0f0; +} \ No newline at end of file diff --git a/src/main/webapp/html/my.html b/src/main/webapp/html/my.html index eb66ac55..0f771fe8 100644 --- a/src/main/webapp/html/my.html +++ b/src/main/webapp/html/my.html @@ -1,11 +1,58 @@ + RPG - + -

RPG admin panel

+

RPG admin panel

+ + + + + + + + + + + +
#NameTitleRaceProfessionLevelBirthdayBanned
+ + \ No newline at end of file From 2259c42295df900c34745870fd4fd54be7d5a028 Mon Sep 17 00:00:00 2001 From: ganka Date: Sat, 24 Feb 2024 20:04:54 +0300 Subject: [PATCH 2/2] Project.3.3 - Frontend completed --- src/main/webapp/css/my.css | 123 ++++++++++-- src/main/webapp/html/my.html | 356 ++++++++++++++++++++++++++++++++--- 2 files changed, 437 insertions(+), 42 deletions(-) diff --git a/src/main/webapp/css/my.css b/src/main/webapp/css/my.css index e6a01052..a7ddb770 100644 --- a/src/main/webapp/css/my.css +++ b/src/main/webapp/css/my.css @@ -1,28 +1,127 @@ +/* Общие стили для всего документа */ +body { + font-family: Arial, sans-serif; + background-color: #f0f0f0; +} + /* Стили для заголовков */ h1 { - color: blue; + color: darkgreen; font-size: 24px; } -/* Стили для ссылок */ -a { - text-decoration: none; - color: #0066cc; +h2 { + color: black; + font-size: 20px; +} + +select { + width: 150px; + padding: 10px; + font-size: 14px; + border: 1px solid #ccc; + border-radius: 4px; + background-color: #f9f9f9; + color: #333; } -/* Стили для таблиц */ table { border-collapse: collapse; width: 100%; + background-color: white; } -td, th { +th { border: 1px solid black; padding: 8px; + text-align: center; + background-color: #b7d9ee; } -/* Общие стили для всего документа */ -body { - font-family: Arial, sans-serif; - background-color: #f0f0f0; -} \ No newline at end of file +td { + border: 1px solid black; + padding: 8px; + text-align: left; +} + +.createNewAccount { + margin: 20px; + padding: 20px; + background-color: #f9f9f9; + border: 1px solid #ddd; + border-radius: 4px; /* Rounded corners */ +} + +.createNewAccount p { + font-weight: bold; + color: #333; /* Dark grey text */ +} + +.createNewAccount label { + display: block; /* Make labels block elements */ + margin-top: 10px; /* Add space above labels */ + color: #555; /* Medium grey text */ +} + +.createNewAccount input[type="text"], +.createNewAccount input[type="number"], +.createNewAccount input[type="date"], +.createNewAccount select { + width: 100%; /* Full width */ + padding: 8px; /* Padding inside the fields */ + margin-top: 5px; /* Add space above the fields */ + margin-bottom: 5px; /* Add space below the fields */ + border: 1px solid #ccc; /* Light grey border */ + border-radius: 4px; /* Rounded corners */ +} + +.createNewAccount button { + background-color: #5cb85c; /* Green background */ + color: white; /* White text */ + padding: 10px 20px; /* Padding inside the button */ + border: none; /* No border */ + border-radius: 4px; /* Rounded corners */ + cursor: pointer; /* Pointer cursor on hover */ + font-size: 16px; /* Larger font size */ +} + +.createNewAccount button:hover { + background-color: #4cae4c; /* Darker green background on hover */ +} + + +#pagingButtons { + text-align: center; /* Выравнивание содержимого по центру */ + margin: 20px 0; /* Отступ сверху и снизу */ + padding: 10px 0; /* Внутренний отступ сверху и снизу */ + background-color: #f2f2f2; /* Цвет фона */ + border: 1px solid #dcdcdc; /* Цвет границы */ + border-radius: 5px; /* Скругление углов */ + color: #333; /* Цвет текста */ + font-size: 16px; /* Размер шрифта */ +} + +.pagingButtonStyled { + background-color: #dddddd; + color: dimgrey; /* text */ + padding: 12px 18px; /* Padding inside the button */ + border: none; /* No border */ + border-radius: 4px; /* Rounded corners */ + cursor: pointer; /* Pointer cursor on hover */ + font-size: 14px; /* Larger font size */ +} + +.pagingButtonStyled:hover { + background-color: #ccc; + color: #fff; +} + +.currentPageButton { + background-color: cadetblue; + color: white; +} + +.currentPageButton:hover { + background-color: #48787b; + color: whitesmoke; +} diff --git a/src/main/webapp/html/my.html b/src/main/webapp/html/my.html index 0f771fe8..98897f1c 100644 --- a/src/main/webapp/html/my.html +++ b/src/main/webapp/html/my.html @@ -2,11 +2,22 @@ RPG - + - +

RPG admin panel

+
+

Accounts list:

+ + +
+ @@ -17,42 +28,327 @@

RPG admin panel

+ +
# Level Birthday BannedEditDelete
+
Pages:
+
+ +
+

Create a new account:

+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + +
+ function getPlayersCount() { + let playersCount = 0; + $.ajax({ + url: "/rest/players/count", + type: "GET", + async: false, + success: function (count) { + playersCount = parseInt(count); + }, + error: function (xhr, status, error) { + console.error("Request failed with status:", status, error); + } + }); + return playersCount; + } + + function deleteAccount(id) { + $.ajax({ + url: "/rest/players/" + id, + type: "DELETE", + success: function (response) { + console.log("Account deleted successfully"); + // обновляем список аккаунтов на текущей странице после удаления + showPage(getCurrentPageNumber()); + }, + error: function (xhr, status, error) { + console.error("Error deleting account:", error); + } + }); + } + + function getCurrentPageNumber() { + let currentPage = 0; + $("button.pagingButtonStyled").each(function () { + if ($(this).css("color") === "rgb(255, 0, 0)") { + currentPage = parseInt($(this).text()) - 1; + } + }); + + return currentPage; + } + + \ No newline at end of file