From 45b6bc9455313c012bc8275f496d6d4d563eebb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=87=D0=BD=D1=8B=D0=B9=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=9F=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2=D0=B8=D1=87?= Date: Fri, 22 May 2026 16:00:04 +0700 Subject: [PATCH 1/8] Initial commit --- src/main/webapp/css/my.css | 32 +++++++++++ src/main/webapp/html/my.html | 106 ++++++++++++++++++++++++++++++++++- 2 files changed, 137 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/css/my.css b/src/main/webapp/css/my.css index e69de29b..45b2d897 100644 --- a/src/main/webapp/css/my.css +++ b/src/main/webapp/css/my.css @@ -0,0 +1,32 @@ +table { + border: 2px solid gray; + width: auto; + align-items: center; +} + +td, th { + border: 1px solid gray; + padding: 10px; + text-align: left; +} + +.dropdown-list { + display: flex; + align-items: center; + justify-content: center; + gap: 6px; + padding: 4px; + width: 200px; + height: 34px; + background: #FFFFFF; + border: 1px solid black; + border-radius: 4px; + box-sizing: border-box; + font-size: 13px; + margin-bottom: 5px; +} + +/*.dropdown-list select {*/ +/* flex: 1;*/ +/* min-width: 0; !* Предотвращает выход за границы контейнера *!*/ +/*}*/ \ No newline at end of file diff --git a/src/main/webapp/html/my.html b/src/main/webapp/html/my.html index eb66ac55..f65aa1c6 100644 --- a/src/main/webapp/html/my.html +++ b/src/main/webapp/html/my.html @@ -1,11 +1,115 @@ RPG + -

RPG admin panel

+

RPG admin panel

+ + + + + + + + + + + + + + + + +
#NameTitleRaceProfessionLevelBirthdayBanned
+ + \ No newline at end of file From 2161faab947f9732e138a35b90c077a2a75588f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=87=D0=BD=D1=8B=D0=B9=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=9F=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2=D0=B8=D1=87?= Date: Fri, 22 May 2026 18:42:18 +0700 Subject: [PATCH 2/8] CSS and JS for CounterPerPage and Pages --- src/main/webapp/css/my.css | 50 ++++++++++++-- src/main/webapp/html/my.html | 125 ++++++++++++++++++++++++----------- 2 files changed, 131 insertions(+), 44 deletions(-) diff --git a/src/main/webapp/css/my.css b/src/main/webapp/css/my.css index 45b2d897..40eb9b72 100644 --- a/src/main/webapp/css/my.css +++ b/src/main/webapp/css/my.css @@ -26,7 +26,49 @@ td, th { margin-bottom: 5px; } -/*.dropdown-list select {*/ -/* flex: 1;*/ -/* min-width: 0; !* Предотвращает выход за границы контейнера *!*/ -/*}*/ \ No newline at end of file +#pagination { + display: flex; + align-items: center; + justify-content: left; + margin-top: 0.5em; +} + +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + padding: 0.2em 0.5em; + margin: 0.1em; + border: 1px solid #9CA3AF; + border-radius: 8px; + background: #D1D5DB; + color: #111827; + font: inherit; + cursor: pointer; + width: fit-content; + white-space: nowrap; + transition: background 0.2s, transform 0.1s, box-shadow 0.2s; +} + +.btn:hover { + background: #BCC5CC; + border-color: #8A939C; +} + +/*.btn:active {*/ +/* transform: scale(0.9);*/ +/* background: #A8B1B9;*/ +/*}*/ + +.btn.active { + color: red; + background: #D1D5DB; + border: 2px solid #9CA3AF; + font-weight: 600; +} + +.btn.active:hover { + background: #BCC5CC; + border-color: #78716C; +} + diff --git a/src/main/webapp/html/my.html b/src/main/webapp/html/my.html index f65aa1c6..0b236f0b 100644 --- a/src/main/webapp/html/my.html +++ b/src/main/webapp/html/my.html @@ -34,23 +34,52 @@

RPG admin panel

+ + \ No newline at end of file From bd00c345efe956a4ab4360f4637de001ed7365a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=87=D0=BD=D1=8B=D0=B9=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=9F=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2=D0=B8=D1=87?= Date: Sat, 23 May 2026 11:15:12 +0700 Subject: [PATCH 3/8] Add delete function --- src/main/webapp/css/my.css | 5 -- src/main/webapp/html/my.html | 133 ++++++++++++++++++++++------------- 2 files changed, 85 insertions(+), 53 deletions(-) diff --git a/src/main/webapp/css/my.css b/src/main/webapp/css/my.css index 40eb9b72..c05e0537 100644 --- a/src/main/webapp/css/my.css +++ b/src/main/webapp/css/my.css @@ -55,11 +55,6 @@ td, th { border-color: #8A939C; } -/*.btn:active {*/ -/* transform: scale(0.9);*/ -/* background: #A8B1B9;*/ -/*}*/ - .btn.active { color: red; background: #D1D5DB; diff --git a/src/main/webapp/html/my.html b/src/main/webapp/html/my.html index 0b236f0b..8cfab4a4 100644 --- a/src/main/webapp/html/my.html +++ b/src/main/webapp/html/my.html @@ -29,6 +29,9 @@

RPG admin panel

Level Birthday Banned + Edit + Delete + @@ -39,10 +42,10 @@

RPG admin panel

From a7e39b4417d460aabc6a615d314f820182ac1f3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=87=D0=BD=D1=8B=D0=B9=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=9F=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2=D0=B8=D1=87?= Date: Sat, 23 May 2026 14:34:03 +0700 Subject: [PATCH 5/8] Add save function --- src/main/webapp/html/my.html | 62 ++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/html/my.html b/src/main/webapp/html/my.html index 8089663f..fb168a19 100644 --- a/src/main/webapp/html/my.html +++ b/src/main/webapp/html/my.html @@ -86,7 +86,7 @@

RPG admin panel

// document.querySelector(selector).src = '/img/save.png'; // } - editAccount(btn); + editSaveAccount(btn); } }); @@ -264,7 +264,44 @@

RPG admin panel

}); } - function editAccount(pressedBtn) { + function saveAccount(id, data, row) { + const url = '/rest/players/' + id; + console.log(data); + $.ajax({ + url: url, + type: 'POST', + contentType: 'application/json', + data: JSON.stringify(data), + success: function(response) { + for (let entry of Object.entries(data)) { + let field = entry[0]; + let value = entry[1]; + + const cell = row.querySelector('td[data-field="' + field + '"]'); + + if (cell) { + if (field === 'banned') { + if (value === true || value === 'true') { + cell.textContent = 'true'; + } else { + cell.textContent = 'false'; + } + } else if (field !== 'id' && field !== 'birthday' && field !== 'level') { + cell.textContent = value; + } else if (field === 'birthday') { + cell.textContent = new Data(value).toLocaleString(); + } + } + } + }, + error: function(xhr) { + alert('Ошибка сохранения: ' + (xhr.responseJSON?.message || 'Неизвестная ошибка')); + // При ошибке можно вызвать editAccount(pressedBtn) снова, чтобы откатить изменения + } + }); + } + + function editSaveAccount(pressedBtn) { const row = pressedBtn.closest('tr'); if (!row) return; @@ -282,6 +319,27 @@

RPG admin panel

if (btnDelete) btnDelete.classList.add('hidden'); enableInlineEditing(row, btnId); + } else { + pressedBtn.classList.remove(editingMode); + const img = pressedBtn.querySelector('img'); + + if (img) img.src = '/img/edit.png'; + + const btnDelete = document.getElementById('btn_delete_' + btnId); + if (btnDelete) btnDelete.classList.remove('hidden'); + + const updatedData = {}; + row.querySelectorAll('[data-field]').forEach(elem => { + const field = elem.dataset.field; + + if (elem.tagName === 'SELECT') { + updatedData[field] = elem.value; + } else if (elem.tagName === 'INPUT') { + updatedData[field] = elem.value; + } + }); + + saveAccount(btnId, updatedData, row); } } From fff24a32ed24543b7db8840d70d8679601fc1959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=87=D0=BD=D1=8B=D0=B9=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=9F=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2=D0=B8=D1=87?= Date: Sun, 24 May 2026 19:03:02 +0700 Subject: [PATCH 6/8] Add create function --- src/main/webapp/css/my.css | 61 ++++++++++++ src/main/webapp/html/my.html | 184 ++++++++++++++++++++++++++++++++++- 2 files changed, 241 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/css/my.css b/src/main/webapp/css/my.css index 56396829..bffe0c2b 100644 --- a/src/main/webapp/css/my.css +++ b/src/main/webapp/css/my.css @@ -95,3 +95,64 @@ td, th { display: block; margin: 0 auto; } + +h3 { + margin: 0 0 1em 0; + font-size: 1.1em; +} + +/* Create from */ +.create-form { + display: grid; + grid-template-columns: max-content 1fr; + gap: 0.8em 1em; + align-items: start; + width: 30%; +} + +.form-field { + display: contents; +} + +.form-field label { + grid-column: 1; + text-align: right; + font-size: 0.9em; + font-weight: 500; + color: #374151; + white-space: nowrap; +} + +.form-field input { + grid-column: 2; + width: 100%; +} + +/* Messages under form */ +#create-message { + padding: 0.5em 1em; + border-radius: 4px; + font-weight: 500; +} + +#create-message.success { + background: #d1fae5; + color: #065f46; + border: 1px solid #a7f3d0; +} + +#create-message.error { + background: #fee2e2; + color: #991b1b; + border: 1px solid #fecaca; +} + +.error-list { + margin: 0.5em 0; + padding-left: 1.2em; + list-style-type: disc; +} + +.error-list li { + margin-bottom: 0.2em; +} \ No newline at end of file diff --git a/src/main/webapp/html/my.html b/src/main/webapp/html/my.html index fb168a19..95cca99f 100644 --- a/src/main/webapp/html/my.html +++ b/src/main/webapp/html/my.html @@ -1,7 +1,7 @@ - RPG + RPG @@ -41,8 +41,75 @@

RPG admin panel

+
+

Create new account:

+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+

+ +
+ + From f62281a0c8370159c017f23413b6e375af5fab14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=87=D0=BD=D1=8B=D0=B9=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=9F=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2=D0=B8=D1=87?= Date: Sun, 24 May 2026 19:40:53 +0700 Subject: [PATCH 7/8] Change coding for Russian --- src/main/java/com/game/config/WebConfig.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/game/config/WebConfig.java b/src/main/java/com/game/config/WebConfig.java index 7a324807..4ae3dfab 100644 --- a/src/main/java/com/game/config/WebConfig.java +++ b/src/main/java/com/game/config/WebConfig.java @@ -36,6 +36,7 @@ public void setApplicationContext(@Autowired ApplicationContext applicationConte public ThymeleafViewResolver viewResolver() { ThymeleafViewResolver viewResolver = new ThymeleafViewResolver(); viewResolver.setTemplateEngine(templateEngine()); + viewResolver.setCharacterEncoding("UTF-8"); return viewResolver; } @@ -59,6 +60,7 @@ public SpringResourceTemplateResolver templateResolver() { templateResolver.setSuffix(".html"); templateResolver.setTemplateMode(TemplateMode.HTML); templateResolver.setCacheable(false); + templateResolver.setCharacterEncoding("UTF-8"); return templateResolver; } From b511a3f7c140536e8edf56020c96078cd6d076dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=87=D0=BD=D1=8B=D0=B9=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=9F=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2=D0=B8=D1=87?= Date: Sun, 24 May 2026 19:55:54 +0700 Subject: [PATCH 8/8] Clear unused variables --- src/main/webapp/html/my.html | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main/webapp/html/my.html b/src/main/webapp/html/my.html index 95cca99f..f4c63723 100644 --- a/src/main/webapp/html/my.html +++ b/src/main/webapp/html/my.html @@ -117,7 +117,7 @@

Create new account:

let counterPerPage = document.getElementById("counter-per-page"); if (counterPerPage) { - counterPerPage.addEventListener("change", (e)=>{ + counterPerPage.addEventListener("change", ()=>{ showAccounts(0); }); } @@ -144,14 +144,6 @@

Create new account:

} if (btn.id.startsWith('btn_edit_')) { - let btnId = btn.id.replace('btn_edit_',''); - // Скрытие кнопки Delete - // document.getElementById('btn_delete_' + btnId).classList.add('hidden'); - // - // const selector = '#btn_edit_' + btnId + ' img'; - // if (document.querySelector(selector)) { - // document.querySelector(selector).src = '/img/save.png'; - // } editSaveAccount(btn); }