Add: maestro_upgrade DB

This commit is contained in:
2018-08-03 07:06:35 +09:00
parent 4a5fbca980
commit d32db6493a
3 changed files with 104 additions and 12 deletions
+29 -12
View File
@@ -1,7 +1,6 @@
<script>
let registeredAccountType = -1;
let newAccountType = -1;
$(document).ready(function() {
@@ -14,7 +13,7 @@ function loadMaestroInfo(maestroID) {
"maestro_id=" + maestroID,
(jsonData) => {
console.log(jsonData);
// console.log(jsonData);
registeredAccountType = jsonData.accountType;
updateCards(registeredAccountType);
},
@@ -47,12 +46,12 @@ function updateCards(accountType) {
break;
case 2:
$("#account_type_1").addClass("border-warning");
// $("#account_type_1").addClass("border-warning");
$("#account_type_1_btn").addClass("btn-secondary disabled");
$("#account_type_1_footer").addClass("text-muted");
$("#account_type_1_footer").text("낮은 요금제로 내릴 수는 없습니다.");
$("#account_type_2").addClass("border-primary");
$("#account_type_2").addClass("border-warning");
$("#account_type_2_btn").addClass("btn-secondary disabled");
$("#account_type_2_footer").addClass("text-warning");
$("#account_type_2_footer").text("현재 적용된 요금제입니다.");
@@ -64,17 +63,17 @@ function updateCards(accountType) {
break;
case 3:
$("#account_type_1").addClass("border-warning");
// $("#account_type_1").addClass("border-warning");
$("#account_type_1_btn").addClass("btn-secondary disabled");
$("#account_type_1_footer").addClass("text-muted");
$("#account_type_1_footer").text("낮은 요금제로 내릴 수는 없습니다.");
$("#account_type_2").addClass("border-primary");
// $("#account_type_2").addClass("border-primary");
$("#account_type_2_btn").addClass("btn-secondary disabled");
$("#account_type_2_footer").addClass("text-muted");
$("#account_type_2_footer").text("낮은 요금제로 내릴 수는 없습니다.");
$("#account_type_3").addClass("border-primary");
$("#account_type_3").addClass("border-warning");
$("#account_type_3_btn").addClass("btn-secondary disabled");
$("#account_type_3_footer").addClass("text-warning");
$("#account_type_3_footer").text("현재 적용된 요금제입니다.");
@@ -84,8 +83,26 @@ function updateCards(accountType) {
}
}
function changeMaestroInfo() {
location.href="main_menu.html";
function upgradeMaestroInfo(accountType) {
console.log("upgrade to " + accountType);
let newAccountType = accountType;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/maestro/upgrade_maestro.php",
"maestro_id=" + maestroID + "&registered_account_type=" + registeredAccountType + "&new_account_type=" + newAccountType,
(jsonData) => {
// console.log(jsonData);
alert("업그레이드 요청이 등록되었습니다.");
location.href="main_menu.html";
},
(errorMessage, errorCode) => {
showErrorMessage(errorMessage, "error");
}
);
}
</script>
@@ -112,7 +129,7 @@ function changeMaestroInfo() {
<li>모든 요금제의 기능은 동일합니다.</li>
<li>1년동안 유효합니다.</li>
</ul>
<a id="account_type_1_btn" class="btn" href="#">업그레이드</a>
<a id="account_type_1_btn" class="btn" href="javascript:void(0);">업그레이드</a>
</div>
<div class="card-footer">
<small id="account_type_1_footer" class="">낮은 요금제로 내릴 수는 없습니다.</small>
@@ -127,7 +144,7 @@ function changeMaestroInfo() {
<li>모든 요금제의 기능은 동일합니다.</li>
<li>1년동안 유효합니다.</li>
</ul>
<a id="account_type_2_btn" class="btn" href="#">업그레이드</a>
<a id="account_type_2_btn" class="btn" href="javascript:void(0);" onclick="upgradeMaestroInfo(2);">업그레이드</a>
</div>
<div class="card-footer">
<small id="account_type_2_footer" class="">현재 적용된 요금제입니다.</small>
@@ -142,7 +159,7 @@ function changeMaestroInfo() {
<li>모든 요금제의 기능은 동일합니다.</li>
<li>1년동안 유효합니다.</li>
</ul>
<a id="account_type_3_btn" class="btn" href="#">업그레이드</a>
<a id="account_type_3_btn" class="btn" href="javascript:void(0);" onclick="upgradeMaestroInfo(3);">업그레이드</a>
</div>
<div class="card-footer">
<small id="account_type_3_footer" class="">이 요금제로 업그레이드가 가능합니다.</small>