Add: show availableActivateDateTime of maestro
This commit is contained in:
@@ -2,6 +2,7 @@ function MaestroInfo() {
|
||||
this.maestroID = sessionStorage.getItem("maestroID");
|
||||
this.maestroName = "";
|
||||
this.accountType = 0;
|
||||
this.availableActivateDateTime = "";
|
||||
this.playerCount = 0;
|
||||
}
|
||||
|
||||
@@ -15,6 +16,7 @@ MaestroInfo.prototype.loadMaestroInfo = function(onSuccess, onFail) {
|
||||
function(jsonData) {
|
||||
self.maestroName = jsonData["name"];
|
||||
self.accountType = jsonData["accountType"];
|
||||
self.availableActivateDateTime = jsonData["availableActivateDateTime"];
|
||||
self.playerCount = jsonData["playerCount"];
|
||||
|
||||
onSuccess();
|
||||
|
||||
@@ -22,9 +22,26 @@ function isExperienceMaestroAccount() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function showEndDate(date) {
|
||||
var endDateArray = date.split(" ");
|
||||
var endDate = endDateArray[0]; // "YY-MM_DD"
|
||||
|
||||
var today = new Date();
|
||||
var endDay = new Date(endDate);
|
||||
var diffDay = (endDay.getTime() - today.getTime()) / (1000 * 60 * 60 * 24);
|
||||
|
||||
$("#maestro_count_down_date").html("~ " + endDate + "<br/>유효 기간 : " + Math.ceil(diffDay) + "일");
|
||||
if(diffDay < 30)
|
||||
$("#maestro_count_down_date").addClass("text-danger");
|
||||
else if(diffDay < 10)
|
||||
$("#maestro_count_down_date").addClass("bg-danger text-light");
|
||||
else if(diffDay < 0)
|
||||
$("#maestro_count_down_date").addClass("bg-secondary text-light");
|
||||
}
|
||||
|
||||
function onLoadSuccessMaestroInfo() {
|
||||
$("#maestro_info_id").text(maestroInfo.maestroName + "님, 환영합니다.");
|
||||
$("#maestro_info_id").text("[ " + maestroInfo.maestroName + " ] 님, 환영합니다.");
|
||||
showEndDate(maestroInfo.availableActivateDateTime);
|
||||
$("#maestro_info_player_count").val("학생수 : " + maestroInfo.getRegisteredPlayerCount() + " / " + maestroInfo.getMaxPlayerCount());
|
||||
|
||||
if(maestroInfo.getRegisteredPlayerCount() === maestroInfo.getMaxPlayerCount()) {
|
||||
@@ -120,8 +137,9 @@ function deactivateApp(appID) {
|
||||
|
||||
<div class="container">
|
||||
<div class="row border border-primary rounded py-2 mx-1 my-2">
|
||||
<div id="maestro_info_id" class="col my-auto"></div>
|
||||
<div id="maestro_url" class="col my-auto"></div>
|
||||
<div id="maestro_info_id" class="col-sm my-auto"></div>
|
||||
<!-- <div id="maestro_url" class="col my-auto"></div> -->
|
||||
<div id="maestro_count_down_date" class="col-sm-2 my-auto mx-1 text-center"></div>
|
||||
|
||||
<div class="eyebrow ml-auto mt-0 d-md-flex align-items-center">
|
||||
<div class="input-group my-auto">
|
||||
|
||||
@@ -18,6 +18,7 @@ $playerCount = getPlayerCount($maestroID);
|
||||
set_data("name", $info["name"]);
|
||||
set_data("email", $info["email"]);
|
||||
set_data("accountType", $info["accountType"]);
|
||||
set_data("availableActivateDateTime", $info["availableActivateDateTime"]);
|
||||
set_data("playerCount", $playerCount);
|
||||
send_result_success();
|
||||
exit;
|
||||
@@ -27,14 +28,14 @@ function get_maestro_info($maestroID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT Name, Email, AccountType, PlayerCount
|
||||
SELECT Name, Email, AccountType, AvailableActivateDateTime, PlayerCount
|
||||
FROM maestro
|
||||
WHERE MaestroID = ?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("s", $maestroID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($name, $email, $accountType, $playerCount);
|
||||
$stmt->bind_result($name, $email, $accountType, $availableActivateDateTime, $playerCount);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
@@ -42,6 +43,7 @@ function get_maestro_info($maestroID) {
|
||||
$info["name"] = $name;
|
||||
$info["email"] = $email;
|
||||
$info["accountType"] = $accountType;
|
||||
$info["availableActivateDateTime"] = $availableActivateDateTime;
|
||||
$info["playerCount"] = $playerCount;
|
||||
|
||||
return $info;
|
||||
|
||||
Reference in New Issue
Block a user