229 lines
6.0 KiB
HTML
229 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/request_server.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
|
$("#header").load("admin_header.html");
|
|
|
|
loadMaestroUpgradeList("");
|
|
});
|
|
|
|
|
|
function loadMaestroUpgradeList(maestroName) {
|
|
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
|
"./../server/admin/maestro_upgrade_list.php",
|
|
"maestro_name=" + maestroName,
|
|
|
|
function(jsonData) {
|
|
updateMaestroUpgradeList(jsonData["maestroUpgradeList"]);
|
|
},
|
|
|
|
function(errorMessage, errorCode) {
|
|
console.log(errorMessage);
|
|
if($("#error_message").length) {
|
|
$("#error_message").text(errorMessage);
|
|
}
|
|
}
|
|
|
|
);
|
|
}
|
|
|
|
function updateMaestroUpgradeList(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>"
|
|
+ " <span class='maestro_account_type'>신청한 요금제</span>"
|
|
+ " <span class='maestro_account_type'>금액</span>"
|
|
+ " <span class='maestro_account_type'>요청 날짜</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_upgrade_id hide'>" + jsonList[i].maestroUpgradeID + "</span>"
|
|
+ " <span class='maestro_id hide'>" + jsonList[i].maestroID + "</span>"
|
|
+ " <input type='text' value='" + jsonList[i].maestroName + "' class='maestro_name'>"
|
|
+ " <input type='text' value='" + accoutType(jsonList[i].registeredAccountType) + "' class='registered_account_type'>"
|
|
+ " <input type='text' value='" + accoutType(jsonList[i].requestedAccountType) + "' class='requested_account_type'>"
|
|
+ " <input type='text' value='" + price(jsonList[i].requestedAccountType, jsonList[i].registeredAccountType) + "' class='price'>"
|
|
+ " <input type='text' value='" + jsonList[i].requestedDateTime + "' class='requested_date_time'>"
|
|
+ " <input type='text' value='" + status(jsonList[i].status) + "' class='status'>"
|
|
+ " <input type='button' class='maestro_upgrade' value='업그레이드' onClick='upgrade(this)'>"
|
|
+ "</li>"
|
|
);
|
|
}
|
|
}
|
|
|
|
function accoutType(accountType) {
|
|
switch(accountType) {
|
|
case 1:
|
|
return "20명, 1만원";
|
|
|
|
case 2:
|
|
return "50명, 2만원";
|
|
|
|
case 3:
|
|
return "100명, 3만원";
|
|
}
|
|
|
|
return accountType + "? (N/A)";
|
|
}
|
|
|
|
function accountTypePrice(accountType) {
|
|
switch(accountType) {
|
|
case 1:
|
|
return 10000;
|
|
|
|
case 2:
|
|
return 20000;
|
|
|
|
case 3:
|
|
return 30000;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
function accoutTypeValue(accountType) {
|
|
switch(accountType) {
|
|
case "20명, 1만원":
|
|
return 1;
|
|
|
|
case "50명, 2만원":
|
|
return 2;
|
|
|
|
case "100명, 3만원":
|
|
return 3;
|
|
}
|
|
|
|
return accountType + "? (N/A)";
|
|
}
|
|
|
|
function price(requestedAccountType, registeredAccountType) {
|
|
let priceRequested = accountTypePrice(requestedAccountType);
|
|
let priceRegistered = accountTypePrice(registeredAccountType);
|
|
|
|
return priceRequested - priceRegistered;
|
|
}
|
|
|
|
function status(status) {
|
|
switch(status) {
|
|
case 1:
|
|
return "요청";
|
|
|
|
case 2:
|
|
return "취소";
|
|
|
|
case 3:
|
|
return "업그레이드 적용";
|
|
}
|
|
|
|
return status + "? (N/A)";
|
|
}
|
|
|
|
function printFooter() {
|
|
$("#maestro_list_result_contents").append("</ul>");
|
|
}
|
|
|
|
function searchMaestroUpgrade() {
|
|
let maestroName = $("#search_name").val();
|
|
|
|
if(maestroName.length === 0) {
|
|
$("#error_message").text("마에스트로 아이디를 입력하세요.");
|
|
$("#search_name").focus();
|
|
}
|
|
|
|
loadMaestroUpgradeList(maestroName);
|
|
}
|
|
|
|
function upgrade(inputButton) {
|
|
let upgradeID = $(inputButton).siblings(".maestro_upgrade_id");
|
|
let maestroUpgradeID = upgradeID.text();
|
|
let maestroID = $(inputButton).siblings(".maestro_id");
|
|
let id = maestroID.text();
|
|
let accountType = $(inputButton).siblings(".requested_account_type");
|
|
let newAccountType = accoutTypeValue(accountType.val());
|
|
|
|
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
|
"./../server/admin/upgrade_maestro.php",
|
|
"maestro_upgrade_id=" + maestroUpgradeID + "&maestro_id=" + id + "&new_account_type=" + newAccountType,
|
|
|
|
function(jsonData) {
|
|
loadMaestroUpgradeList("");
|
|
$("#error_message").text("마에스트로 계정이 정상적으로 등록되었습니다.");
|
|
},
|
|
|
|
function(errorMessage, errorCode) {
|
|
if($("#error_message").length) {
|
|
$("#error_message").text(errorMessage);
|
|
}
|
|
}
|
|
|
|
);
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
|
|
|
|
<body bgcolor="white">
|
|
|
|
<div id="wrapper">
|
|
|
|
<header id="header">
|
|
</header>
|
|
|
|
<section id="section">
|
|
<div>
|
|
<span id="search_maestro_name">
|
|
<h1>검색</h1>
|
|
|
|
마에스트로 아이디
|
|
<input type="text" id="search_name"><input type="submit" name="찾기" onClick="searchMaestroUpgrade()"><br/>
|
|
<br/>
|
|
</span>
|
|
|
|
<span id="search_result">
|
|
검색 결과
|
|
<div id="maestro_list_result_contents">
|
|
</div>
|
|
</span>
|
|
</div>
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
</html> |