Skip to content

Commit

Permalink
fix : admin-access code fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ha-seungwon committed Aug 17, 2023
1 parent 509c203 commit 3ab620e
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/main/resources/static/html/admin-access.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ <h1>Access users</h1>
<option value="5000">5000</option>
<option value="10000">10000</option>
</select>
<br>
<label for="pageSize">display option:</label>
<select id="displayOption" name="displayOption">
<option value="data" >data</option>
<option value="email"selected>email</option>
</select>
<br>
</div>
</div>

Expand Down
85 changes: 85 additions & 0 deletions src/main/resources/static/html/admin-data.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="../css/admin.css">
</head>
</br>
<body>
<h1>Access users</h1>
<div id="table-container">
<div id="search-container">
<div id="userSearchForm">
<label for="userName">user name :</label>
<input type="text" id="userName" name="userName">
<br>
<label for="dateFrom">date from :</label>
<input type="number" id="dateFrom" name="dateFrom" step="5">
<br>
<label for="dateTo">date to :</label>
<input type="number" id="dateTo" name="dateTo" step="5">
<br>
<label for="sortBy">sort by :</label>
<select id="sortBy" name="sortBy">
<option value="accessTime,asc">ascending</option>
<option value="accessTime,desc">descending</option>
</select>
<br>
<label for="pageSize">page size:</label>
<select id="pageSize" name="pageSize">
<option value="10" selected>10</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="5000">5000</option>
<option value="10000">10000</option>
</select>
<br>
<label for="pageSize">display option:</label>
<select id="displayOption" name="displayOption">
<option value="data" selected>data</option>
<option value="email">email</option>
</select>
<br>


<br>
<label for="pageSize">display option:</label>
<select id="date" name="displayOption">
<option value="1월" selected>data</option>
<option value="2월">email</option>
</select>
<br>
</div>
</div>

<table id="user-table">
<thead>
<tr>
<th>last login</th>
<th>name</th>
<th>email</th>
<th>encrypt password</th>
<th>block</th>
</tr>
</thead>
<tbody id="table-body">
<!-- User rows will be dynamically added here -->
</tbody>
</table>
<div id="pagination">
<!-- Pagination links will be dynamically generated here -->
</div>
</br>
</br>
</div>
<script src="../js/admin-access.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</body>
</html>
28 changes: 27 additions & 1 deletion src/main/resources/static/js/admin-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,46 @@ async function displayUsers() {
tableBody.innerHTML = '';
const startIndex = (currentPage - 1) * pageSize;
const endIndex = startIndex + pageSize;
const displayOption = document.getElementById('displayOption').value;


for (let index = startIndex; index < endIndex && index < users.length; index++) {
const user = users[index];
const row = document.createElement('tr');
row.id = `user-${user.id}`;

let displayValue = "";
if (displayOption === "data") {
displayValue = user.dateTime;
} else if (displayOption === "email") {
displayValue = user.memberEmail;
}

row.innerHTML = `
<td>${user.dateTime}</td>
<td>${displayValue}</td>
<td>${user.memberName}</td>
<td>${user.memberEmail}</td>
<td>${user.memberEncryptedPassword}</td>
<td><button onclick="blockButtonEventHandler(${user.id})">Block</button></td>`;
tableBody.appendChild(row);
}
}
function navigateToPage(option) {
if (option === "data") {
// Navigate to the data page (replace with the actual URL)
window.location.href = "./admin-data.html";
} else if (option === "email") {
// Navigate to the email page (replace with the actual URL)
window.location.href = "./admin-access.html";
}
}
const displayOptionSelection = document.getElementById('displayOption');
displayOptionSelection.addEventListener('change', () => {
const selectedOption = displayOptionSelection.value;
navigateToPage(selectedOption);
});



async function updatePagination() {
pagination.innerHTML = '';
Expand Down

0 comments on commit 3ab620e

Please sign in to comment.