Add: maestro_available_date.js
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<script>
|
||||
|
||||
var maestroAvailableDate = new MaestroAvailableDate();
|
||||
|
||||
var registeredAccountType = -1;
|
||||
var availableDate = "";
|
||||
var newAvailableDate = "";
|
||||
@@ -14,10 +16,12 @@ function loadMaestroInfo(maestroID) {
|
||||
"maestro_id=" + maestroID,
|
||||
|
||||
(function(jsonData) {
|
||||
// console.log(jsonData);
|
||||
registeredAccountType = jsonData.accountType;
|
||||
|
||||
showEndDate(jsonData.availableActivateDateTime);
|
||||
maestroAvailableDate.setEndDateTime(jsonData.availableActivateDateTime);
|
||||
maestroAvailableDate.showEndDate();
|
||||
maestroAvailableDate.showMaestroExtensionMessage(jsonData.name);
|
||||
|
||||
showPrice();
|
||||
showMaestroName(jsonData.name);
|
||||
}),
|
||||
@@ -29,30 +33,6 @@ function loadMaestroInfo(maestroID) {
|
||||
);
|
||||
}
|
||||
|
||||
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);
|
||||
availableDate = endDate;
|
||||
var newDate = new Date(endDay.setFullYear(endDay.getFullYear() + 1));
|
||||
// newAvailableDate = newDate.toISOString().substring(0, 10);
|
||||
newAvailableDate = newDate.getFullYear() + "-" + ("0"+(newDate.getMonth()+1)).slice(-2) + "-" + ("0" + newDate.getDate()).slice(-2);
|
||||
|
||||
$("#maestro_count_down_date").html("유효 기간 : ~ " + endDate + " <span id='countdown_day'>(남은 기간 : " + Math.ceil(diffDay) + "일)</span>");
|
||||
if(diffDay < 30)
|
||||
$("#countdown_day").addClass("text-danger");
|
||||
else if(diffDay < 10)
|
||||
$("#countdown_day").addClass("bg-danger text-light");
|
||||
else if(diffDay < 0)
|
||||
$("#countdown_day").addClass("bg-secondary text-light");
|
||||
else
|
||||
$("#countdown_day").addClass("text-muted");
|
||||
|
||||
$("#end_day").html(endDate);
|
||||
}
|
||||
|
||||
function showPrice() {
|
||||
$("#price_account").html(
|
||||
@@ -68,11 +48,11 @@ function showMaestroName(maestroName) {
|
||||
function extendMaestroAccount() {
|
||||
// console.log("extend maestro account");
|
||||
|
||||
// console.log("maestroID : " + maestroID);
|
||||
// console.log("availableDate : " + availableDate);
|
||||
// console.log("newAvailableDate : " + newAvailableDate);
|
||||
// console.log("registeredAccountType : " + registeredAccountType);
|
||||
// return;
|
||||
console.log("maestroID : " + maestroID);
|
||||
console.log("availableDate : " + availableDate);
|
||||
console.log("newAvailableDate : " + newAvailableDate);
|
||||
console.log("registeredAccountType : " + registeredAccountType);
|
||||
return;
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/maestro/request_extension_maestro.php",
|
||||
@@ -101,6 +81,17 @@ function extendMaestroAccount() {
|
||||
|
||||
|
||||
<div class="container py-3">
|
||||
<div id="maestro_extension" class="alert alert-danger d-none" role="alert">
|
||||
<div class="row mx-0">
|
||||
<div id="maestro_extension_message" class="col-sm my-auto px-0">
|
||||
message
|
||||
</div>
|
||||
<div class="col-sm-offset my-auto">
|
||||
<a class="btn btn-primary pull-right" role="button" href="./../maestro/extension.html" style="float:right;">유효기간 연장</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row border rounded border-dark py-2 mx-0 mb-3">
|
||||
<div id="maestro_count_down_date" class="col-sm-6 my-auto text-left"></div>
|
||||
|
||||
@@ -128,8 +119,8 @@ function extendMaestroAccount() {
|
||||
<div class="px-2 mb-4">
|
||||
<h5 class="card-title">유효 기간을 <span class="text-primary">+1년 연장</span>합니다.</h5>
|
||||
<ul>
|
||||
<li>만료일(<span id="end_day"></span>) 기준으로 1년이 추가됩니다.</li>
|
||||
<li>연장 신청한 날짜, 입금한 날짜와는 무관합니다.</li>
|
||||
<li>만료일 이내 : 유효 기간 만료일(<span id="end_day"></span>) 기준으로 1년이 추가됩니다.</li>
|
||||
<li>만료일 경과 : 연장 결재가 이루어진 날을 기준으로 1년이 추가됩니다</li>
|
||||
</ul>
|
||||
|
||||
<h5 class="card-title">연장 신청 방법</h5>
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
var maestroInfo = new MaestroInfo();
|
||||
var isMaestroInfoLoaded = false;
|
||||
|
||||
var maestroAvailableDate = new MaestroAvailableDate();
|
||||
|
||||
var addPlayerListManager = null;
|
||||
var searchPlayerListManager = null;
|
||||
|
||||
@@ -30,62 +32,19 @@ $(document).ready(function() {
|
||||
|
||||
function isExperienceMaestroAccount() {
|
||||
var maestroAccountType = maestroInfo.accountType;
|
||||
console.log("maestroAccountType : " + maestroAccountType);
|
||||
// console.log("maestroAccountType : " + maestroAccountType);
|
||||
if(maestroAccountType == 101)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getDiffDay(endDay, today) {
|
||||
var diffDay = (endDay.getTime() - today.getTime()) / (1000 * 60 * 60 * 24);
|
||||
return Math.ceil(diffDay);
|
||||
}
|
||||
|
||||
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 = getDiffDay(endDay, today);
|
||||
|
||||
$("#maestro_count_down_date").html("유효기간 : ~ " + endDate + " <span id='countdown_day'>(남은 기간 : " + Math.ceil(diffDay) + "일)</span>");
|
||||
if(diffDay < 30)
|
||||
$("#countdown_day").addClass("text-danger");
|
||||
else if(diffDay < 10)
|
||||
$("#countdown_day").addClass("bg-danger text-light");
|
||||
else if(diffDay < 0)
|
||||
$("#countdown_day").addClass("bg-secondary text-light");
|
||||
else
|
||||
$("#countdown_day").addClass("text-muted");
|
||||
}
|
||||
|
||||
|
||||
function showMaestroExtensionMessage(maestroName, date) {
|
||||
var endDateArray = date.split(" ");
|
||||
var endDate = endDateArray[0]; // "YY-MM_DD"
|
||||
|
||||
var today = new Date();
|
||||
var endDay = new Date(endDate);
|
||||
var diffDay = getDiffDay(endDay, today);
|
||||
|
||||
if(diffDay > 30)
|
||||
return;
|
||||
|
||||
$("#maestro_extension").removeClass("d-none");
|
||||
var message = "<span class='font-weight-bold'>" + maestroName + "</span> 계정의 유효기간이 얼마 남지 않았습니다.<br/>1년 더 사용을 원하신다면 우측의 [유효기간 연장] 버튼을 눌러주세요.";
|
||||
if(diffDay < 0)
|
||||
message = "<span class='font-weight-bold'>" + maestroName + "</span> 계정의 유효기간이 지났습니다. 등록된 학생들의 정보는 유지되지만, 로그인이 제한됩니다.<br/>유효기간 연장을 하시면 다시 로그인하고 사용할 수 있게 됩니다.";
|
||||
|
||||
$("#maestro_extension_message").html(message);
|
||||
}
|
||||
|
||||
|
||||
function onLoadSuccessMaestroInfo() {
|
||||
showMaestroExtensionMessage(maestroInfo.maestroName, maestroInfo.availableActivateDateTime);
|
||||
maestroAvailableDate.setEndDateTime(maestroInfo.availableActivateDateTime);
|
||||
maestroAvailableDate.showEndDate();
|
||||
maestroAvailableDate.showMaestroExtensionMessage(maestroInfo.maestroName);
|
||||
|
||||
showEndDate(maestroInfo.availableActivateDateTime);
|
||||
$("#maestro_info_player_count").val("학생수 : " + maestroInfo.getRegisteredPlayerCount() + " / " + maestroInfo.getMaxPlayerCount());
|
||||
|
||||
if(maestroInfo.getRegisteredPlayerCount() === maestroInfo.getMaxPlayerCount()) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<script>
|
||||
|
||||
var maestroAvailableDate = new MaestroAvailableDate();
|
||||
|
||||
var isChangedIDName = false;
|
||||
var isAvailableIDName = false;
|
||||
var registeredMaestroIDName = "";
|
||||
@@ -30,7 +32,11 @@ function loadMaestroInfo(maestroID) {
|
||||
(function(jsonData) {
|
||||
// console.log(jsonData);
|
||||
|
||||
showEndDate(jsonData.availableActivateDateTime);
|
||||
// showEndDate(jsonData.availableActivateDateTime);
|
||||
maestroAvailableDate.setEndDateTime(jsonData.availableActivateDateTime);
|
||||
maestroAvailableDate.showEndDate();
|
||||
maestroAvailableDate.showMaestroExtensionMessage(jsonData.name);
|
||||
|
||||
showPlayerCount(jsonData.accountType, jsonData.playerCount);
|
||||
|
||||
registeredMaestroIDName = jsonData.name;
|
||||
@@ -49,25 +55,6 @@ function loadMaestroInfo(maestroID) {
|
||||
);
|
||||
}
|
||||
|
||||
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 + " <span id='countdown_day'>(남은 기간 : " + Math.ceil(diffDay) + "일)</span>");
|
||||
if(diffDay < 30)
|
||||
$("#countdown_day").addClass("text-danger");
|
||||
else if(diffDay < 10)
|
||||
$("#countdown_day").addClass("bg-danger text-light");
|
||||
else if(diffDay < 0)
|
||||
$("#countdown_day").addClass("bg-secondary text-light");
|
||||
else
|
||||
$("#countdown_day").addClass("text-muted");
|
||||
}
|
||||
|
||||
function showPlayerCount(accountType, playerCount) {
|
||||
$("#maestro_info_player_count").val("학생수 : " + playerCount + " / " + accountTypePlayerCount(accountType));
|
||||
}
|
||||
@@ -237,6 +224,17 @@ function changeMaestroPassword() {
|
||||
|
||||
|
||||
<div class="container py-3">
|
||||
<div id="maestro_extension" class="alert alert-danger d-none" role="alert">
|
||||
<div class="row mx-0">
|
||||
<div id="maestro_extension_message" class="col-sm my-auto px-0">
|
||||
message
|
||||
</div>
|
||||
<div class="col-sm-offset my-auto">
|
||||
<a class="btn btn-primary pull-right" role="button" href="./../maestro/extension.html" style="float:right;">유효기간 연장</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row border rounded border-dark py-2 mx-0 mb-3">
|
||||
<div id="maestro_count_down_date" class="col-sm-6 my-auto text-left"></div>
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<script>
|
||||
|
||||
var maestroAvailableDate = new MaestroAvailableDate();
|
||||
|
||||
var registeredAccountType = -1;
|
||||
|
||||
|
||||
@@ -15,7 +17,12 @@ function loadMaestroInfo(maestroID) {
|
||||
(function(jsonData) {
|
||||
// console.log(jsonData);
|
||||
registeredAccountType = jsonData.accountType;
|
||||
showEndDate(jsonData.availableActivateDateTime);
|
||||
|
||||
// showEndDate(jsonData.availableActivateDateTime);
|
||||
maestroAvailableDate.setEndDateTime(jsonData.availableActivateDateTime);
|
||||
maestroAvailableDate.showEndDate();
|
||||
maestroAvailableDate.showMaestroExtensionMessage(jsonData.name);
|
||||
|
||||
showPlayerCount(jsonData.accountType, jsonData.playerCount);
|
||||
updateCards(registeredAccountType);
|
||||
}),
|
||||
@@ -27,24 +34,6 @@ function loadMaestroInfo(maestroID) {
|
||||
);
|
||||
}
|
||||
|
||||
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 + " <span id='countdown_day'>(남은 기간 : " + Math.ceil(diffDay) + "일)</span>");
|
||||
if(diffDay < 30)
|
||||
$("#countdown_day").addClass("text-danger");
|
||||
else if(diffDay < 10)
|
||||
$("#countdown_day").addClass("bg-danger text-light");
|
||||
else if(diffDay < 0)
|
||||
$("#countdown_day").addClass("bg-secondary text-light");
|
||||
else
|
||||
$("#countdown_day").addClass("text-muted");
|
||||
}
|
||||
|
||||
function showPlayerCount(accountType, playerCount) {
|
||||
$("#maestro_info_player_count").val("학생수 : " + playerCount + " / " + accountTypePlayerCount(accountType));
|
||||
@@ -174,6 +163,17 @@ function upgradeMaestroInfo(accountType) {
|
||||
|
||||
|
||||
<div class="container py-3">
|
||||
<div id="maestro_extension" class="alert alert-danger d-none" role="alert">
|
||||
<div class="row mx-0">
|
||||
<div id="maestro_extension_message" class="col-sm my-auto px-0">
|
||||
message
|
||||
</div>
|
||||
<div class="col-sm-offset my-auto">
|
||||
<a class="btn btn-primary pull-right" role="button" href="./../maestro/extension.html" style="float:right;">유효기간 연장</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row border rounded border-dark py-2 mx-0 mb-3">
|
||||
<div id="maestro_count_down_date" class="col-sm-6 my-auto text-left"></div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user