214 lines
6.0 KiB
HTML
214 lines
6.0 KiB
HTML
<html>
|
|
|
|
|
|
<head>
|
|
<title>마우스 타자 관리자 페이지</title>
|
|
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
|
|
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
|
<link rel="stylesheet" type="text/css" href="./../css/module.css">
|
|
<link rel="stylesheet" type="text/css" href="./../css/color_button.css">
|
|
<link rel="stylesheet" type="text/css" href="./../css/admin.css">
|
|
|
|
<script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script>
|
|
<script type="text/javascript" src="./../js/main.js"></script>
|
|
<script type="text/javascript" src="./../js/maestro_list_manager.js"></script>
|
|
<script type="text/javascript" src="./../js/maestro_list.js"></script>
|
|
<script type="text/javascript" src="./../js/maestro_list_navigator.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$("#header").load("admin_header.html");
|
|
|
|
loadMaestroList("");
|
|
});
|
|
|
|
function searchMaestro() {
|
|
let maestroName = $("#search_name").val();
|
|
|
|
if(maestroName.length === 0) {
|
|
$("#error_message").text("학생 이름을 입력하세요.");
|
|
$("#search_name").focus();
|
|
}
|
|
|
|
loadMaestroList(maestroName);
|
|
}
|
|
|
|
function loadMaestroList($maestroName) {
|
|
let xhr = new XMLHttpRequest();
|
|
xhr.open('POST', './../server/admin/registered_maestro_list.php', true);
|
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
xhr.send("maestro_name=" + $maestroName);
|
|
xhr.onload = function() {
|
|
if(xhr.readyState === 4 && xhr.status === 200) {
|
|
// console.log(xhr.responseText);
|
|
// console.log(xhr.responseText.length);
|
|
if(xhr.responseText.length === 0 || xhr.responseText === null) {
|
|
console.log("no data from server");
|
|
$("#error_message").text("서버에서 요청을 수행하지 못했습니다.");
|
|
return;
|
|
}
|
|
|
|
let replyJSON = JSON.parse(xhr.responseText);
|
|
// console.log(replyJSON);
|
|
|
|
if(replyJSON === null) {
|
|
console.log("no data from server");
|
|
$("#error_message").text("서버에서 데이터가 넘어오지 않았습니다.");
|
|
return;
|
|
}
|
|
|
|
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
|
console.log(replyJSON["ERROR"]);
|
|
$("#error_message").text(replyJSON["ERROR"]);
|
|
return;
|
|
}
|
|
|
|
if(replyJSON["RESULT"] === "fail") {
|
|
console.log(replyJSON["RESULT"]);
|
|
$("#error_message").text(replyJSON["ERROR"]);
|
|
return;
|
|
}
|
|
|
|
updateMaestroList(replyJSON["MaestroList"]);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function updateMaestroList(jsonList) {
|
|
$("#maestro_list_result_contents").empty();
|
|
printHeader();
|
|
printContents(jsonList);
|
|
printFooter();
|
|
}
|
|
|
|
function printHeader() {
|
|
$("#maestro_list_result_contents").append(
|
|
"<ul id='search_maestro_list' class='maestro_list'>"
|
|
+ " <li>"
|
|
+ " <span class='maestro_name'>이름</span>"
|
|
+ " <span class='maestro_account_type'>금액</span>"
|
|
+ " </li>"
|
|
);
|
|
}
|
|
|
|
function printContents(jsonList) {
|
|
console.log(jsonList);
|
|
if(jsonList === undefined || jsonList.length === 0)
|
|
return;
|
|
|
|
for(let i = 0; i < jsonList.length; i++) {
|
|
$("#maestro_list_result_contents").append(
|
|
"<li class='search_result_list'>"
|
|
+ " <span class='maestro_id hide'>" + jsonList[i].MaestroID + "</span>"
|
|
+ " <input type='text' value='" + jsonList[i].Name + "' class='maestro_name'>"
|
|
+ " <input type='text' value='" + jsonList[i].AccountType + "' class='maestro_account_type'>"
|
|
+ " <input type='button' class='maestro_register' value='등록' onClick='register(this)'>"
|
|
+ "</li>"
|
|
);
|
|
}
|
|
}
|
|
|
|
function printFooter() {
|
|
$("#maestro_list_result_contents").append("</ul>");
|
|
}
|
|
|
|
function getClickedObjectID(clickedObject) {
|
|
let tagDiv = $(clickedObject).closest(".player_list");
|
|
let tagDivID = tagDiv.prop("id");
|
|
// console.log(tagDivIDName);
|
|
|
|
return tagDivID;
|
|
}
|
|
|
|
function register(inputButton) {
|
|
console.log(inputButton);
|
|
|
|
|
|
let id = $(inputButton).siblings(".maestro_id");
|
|
let maestroID = id.text();
|
|
console.log(maestroID);
|
|
|
|
let name = $(inputButton).siblings(".maestro_name");
|
|
let maestroName = name.val();
|
|
console.log(maestroName);
|
|
|
|
let xhr = new XMLHttpRequest(); //new로 생성.
|
|
xhr.open('POST', './../server/admin/register_maestro.php', true);
|
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
xhr.send("maestro_id=" + maestroID);
|
|
xhr.onload = function() {
|
|
if(xhr.readyState === 4 && xhr.status === 200) {
|
|
// console.log(xhr.responseText);
|
|
// console.log(xhr.responseText.length);
|
|
if(xhr.responseText.length === 0 || xhr.responseText === null) {
|
|
console.log("no data from server");
|
|
$("#error_message").text("서버에서 요청을 수행하지 못했습니다.");
|
|
return;
|
|
}
|
|
|
|
let replyJSON = JSON.parse(xhr.responseText);
|
|
// console.log(replyJSON);
|
|
|
|
if(replyJSON === null) {
|
|
console.log("no data from server");
|
|
$("#error_message").text("서버에서 데이터가 넘어오지 않았습니다.");
|
|
return;
|
|
}
|
|
|
|
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
|
console.log(replyJSON["ERROR"]);
|
|
$("#error_message").text(replyJSON["ERROR"]);
|
|
return;
|
|
}
|
|
|
|
if(replyJSON["RESULT"] === "fail") {
|
|
console.log(replyJSON["RESULT"]);
|
|
$("#error_message").text(replyJSON["ERROR"]);
|
|
return;
|
|
}
|
|
|
|
loadMaestroList("");
|
|
$("#error_message").text("마에스트로 계정이 정상적으로 등록되었습니다.");
|
|
}
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
|
|
|
|
<body bgcolor="white">
|
|
|
|
<div id="wrapper">
|
|
|
|
<header id="header">
|
|
</header>
|
|
|
|
<section id="section">
|
|
<div id="error_message">
|
|
</div>
|
|
|
|
<div>
|
|
<span id="search_maestro_name">
|
|
<h1>검색</h1>
|
|
|
|
마에스트로 이름
|
|
<input type="text" id="search_name"><input type="submit" name="찾기" onClick="searchMaestro()"><br/>
|
|
<br/>
|
|
</span>
|
|
|
|
<span id="search_result">
|
|
검색 결과
|
|
<div id="maestro_list_result_contents">
|
|
</div>
|
|
</span>
|
|
</div>
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
</html> |