Fix: maestro search bug
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
function PlayerListManager(docList, docNav) {
|
||||
var self = this;
|
||||
this.docList = docList;
|
||||
this.docNav = docNav;
|
||||
this.playerListID = $(docList).attr("id");
|
||||
@@ -17,20 +16,18 @@
|
||||
|
||||
|
||||
PlayerListManager.prototype.setupAddPlayerList = function() {
|
||||
var self = this;
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/player/registered_player_count.php",
|
||||
"maestro_id=" + maestroID,
|
||||
|
||||
function(jsonData) {
|
||||
self.playerCount = jsonData["playerCount"];
|
||||
self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 );
|
||||
self.activePageNo = 1;
|
||||
(function(jsonData) {
|
||||
this.playerCount = jsonData["playerCount"];
|
||||
this.lastPageNo = Math.ceil( (this.playerCount + 1) / 10 );
|
||||
this.activePageNo = 1;
|
||||
|
||||
self.loadAddPlayerListPage(self.activePageNo);
|
||||
self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
|
||||
},
|
||||
this.loadAddPlayerListPage(this.activePageNo);
|
||||
this.listNavigator.updateNavigator(this.activePageNo, this.lastPageNo);
|
||||
}).bind(this),
|
||||
|
||||
function(errorMessage, errorCode) {
|
||||
showErrorMessage(errorMessage, "error");
|
||||
@@ -40,7 +37,6 @@ PlayerListManager.prototype.setupAddPlayerList = function() {
|
||||
}
|
||||
|
||||
PlayerListManager.prototype.loadAddPlayerListPage = function(pageNo) {
|
||||
var self = this;
|
||||
this.activePageNo = pageNo;
|
||||
|
||||
var pageIndex = pageNo - 1;
|
||||
@@ -51,10 +47,10 @@ PlayerListManager.prototype.loadAddPlayerListPage = function(pageNo) {
|
||||
"./../server/player/registered_player_list.php",
|
||||
"maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo,
|
||||
|
||||
function(jsonData) {
|
||||
self.playerCount = jsonData["playerList"].length;
|
||||
self.list.updatePlayerList(jsonData["playerList"]);
|
||||
},
|
||||
(function(jsonData) {
|
||||
this.playerCount = jsonData["playerList"].length;
|
||||
this.list.updatePlayerList(jsonData["playerList"]);
|
||||
}).bind(this),
|
||||
|
||||
function(errorMessage, errorCode) {
|
||||
showErrorMessage(errorMessage, "error");
|
||||
@@ -65,7 +61,6 @@ PlayerListManager.prototype.loadAddPlayerListPage = function(pageNo) {
|
||||
|
||||
|
||||
PlayerListManager.prototype.updateAddPlayerListPage = function(pageNo) {
|
||||
var self = this;
|
||||
this.playerListPage = pageNo;
|
||||
|
||||
var pageIndex = pageNo - 1;
|
||||
@@ -76,11 +71,11 @@ PlayerListManager.prototype.updateAddPlayerListPage = function(pageNo) {
|
||||
"./../server/player/registered_player_list.php",
|
||||
"maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo,
|
||||
|
||||
function(jsonData) {
|
||||
self.playerCount = jsonData["playerList"].length;
|
||||
self.list.updatePlayerList(jsonData["playerList"]);
|
||||
self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
|
||||
},
|
||||
(function(jsonData) {
|
||||
this.playerCount = jsonData["playerList"].length;
|
||||
this.list.updatePlayerList(jsonData["playerList"]);
|
||||
this.listNavigator.updateNavigator(this.activePageNo, this.lastPageNo);
|
||||
}).bind(this),
|
||||
|
||||
function(errorMessage, errorCode) {
|
||||
showErrorMessage(errorMessage, "error");
|
||||
@@ -92,23 +87,22 @@ PlayerListManager.prototype.updateAddPlayerListPage = function(pageNo) {
|
||||
|
||||
|
||||
PlayerListManager.prototype.setupSearchPlayerList = function(playerName) {
|
||||
var self = this;
|
||||
this.searchPlayerName = playerName;
|
||||
|
||||
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
||||
"./../server/player/search_player_count.php",
|
||||
"maestro_id=" + maestroID + "&player_name=" + this.searchPlayerName,
|
||||
|
||||
function(jsonData) {
|
||||
self.playerCount = jsonData["playerCount"];
|
||||
self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 );
|
||||
self.activePageNo = 1;
|
||||
(function(jsonData) {
|
||||
this.playerCount = jsonData["playerCount"];
|
||||
this.lastPageNo = Math.ceil( (this.playerCount + 1) / 10 );
|
||||
this.activePageNo = 1;
|
||||
|
||||
self.updateSearchPlayerListPage(this.searchPlayerName, 1);
|
||||
this.updateSearchPlayerListPage(this.searchPlayerName, 1);
|
||||
|
||||
if(self.playerCount === 0)
|
||||
if(this.playerCount === 0)
|
||||
showErrorMessage(this.searchPlayerName + " : 검색 결과가 없습니다.", "info");
|
||||
},
|
||||
}).bind(this),
|
||||
|
||||
function(errorMessage, errorCode) {
|
||||
showErrorMessage(errorMessage, "error");
|
||||
@@ -118,7 +112,6 @@ PlayerListManager.prototype.setupSearchPlayerList = function(playerName) {
|
||||
}
|
||||
|
||||
PlayerListManager.prototype.updateSearchPlayerListPage = function(playerName, pageNo) {
|
||||
var self = this;
|
||||
this.playerListPage = pageNo;
|
||||
|
||||
var pageIndex = pageNo - 1;
|
||||
@@ -129,11 +122,11 @@ PlayerListManager.prototype.updateSearchPlayerListPage = function(playerName, pa
|
||||
"./../server/player/search_player_list.php",
|
||||
"maestro_id=" + maestroID + "&player_name=" + playerName + "&start_no=" + startNo + "&end_no=" + endNo,
|
||||
|
||||
function(jsonData) {
|
||||
self.playerCount = jsonData["playerList"].length;
|
||||
self.list.updatePlayerList(jsonData["playerList"]);
|
||||
self.listNavigator.updateNavigator(self.activePageNo, self.lastPageNo);
|
||||
},
|
||||
(function(jsonData) {
|
||||
this.playerCount = jsonData["playerList"].length;
|
||||
this.list.updatePlayerList(jsonData["playerList"]);
|
||||
this.listNavigator.updateNavigator(this.activePageNo, this.lastPageNo);
|
||||
}).bind(this),
|
||||
|
||||
function(errorMessage, errorCode) {
|
||||
showErrorMessage(errorMessage, "error");
|
||||
@@ -146,8 +139,7 @@ PlayerListManager.prototype.updateSearchPlayerListPage = function(playerName, pa
|
||||
|
||||
|
||||
PlayerListManager.prototype.editPlayer = function(inputButton) {
|
||||
var self = this;
|
||||
console.log(inputButton);
|
||||
// console.log(inputButton);
|
||||
// var clickedObjectID = this.getClickedObjectID(inputButton);
|
||||
|
||||
|
||||
@@ -167,15 +159,15 @@ PlayerListManager.prototype.editPlayer = function(inputButton) {
|
||||
"./../server/player/edit_player.php",
|
||||
"maestro_id=" + maestroID + "&player_id=" + playerID + "&player_name=" + playerName + "&enter_code=" + playerEnterCode,
|
||||
|
||||
function(jsonData) {
|
||||
(function(jsonData) {
|
||||
// console.log(jsonData);
|
||||
if(this.playerListID === "add_player_list") {
|
||||
self.setupAddPlayerList();
|
||||
this.setupAddPlayerList();
|
||||
} else if(this.playerListID === "search_player_list") {
|
||||
self.setupSearchPlayerList(this.searchPlayerName);
|
||||
this.setupSearchPlayerList(this.searchPlayerName);
|
||||
}
|
||||
showErrorMessage("학생 데이터가 [ " + playerName + " / " + playerEnterCode + " ] 으로 변경되었습니다.", "success");
|
||||
},
|
||||
}).bind(this),
|
||||
|
||||
function(errorMessage, errorCode) {
|
||||
showErrorMessage(errorMessage, "error");
|
||||
@@ -185,8 +177,6 @@ PlayerListManager.prototype.editPlayer = function(inputButton) {
|
||||
}
|
||||
|
||||
PlayerListManager.prototype.deletePlayer = function(inputButton) {
|
||||
var self = this;
|
||||
|
||||
var id = $(inputButton).siblings(".player_id");
|
||||
var playerID = id.text();
|
||||
|
||||
@@ -203,16 +193,16 @@ PlayerListManager.prototype.deletePlayer = function(inputButton) {
|
||||
"./../server/player/delete_player.php",
|
||||
"maestro_id=" + maestroID + "&player_id=" + playerID,
|
||||
|
||||
function(jsonData) {
|
||||
(function(jsonData) {
|
||||
if(this.playerListID === "add_player_list") {
|
||||
self.setupAddPlayerList();
|
||||
this.setupAddPlayerList();
|
||||
} else if(this.playerListID === "search_player_list") {
|
||||
self.setupSearchPlayerList(this.searchPlayerName);
|
||||
this.setupSearchPlayerList(this.searchPlayerName);
|
||||
}
|
||||
showErrorMessage("[ " + playerName + "] 학생 데이터가 삭제되었습니다.", "success");
|
||||
|
||||
onChangePlayerCount();
|
||||
},
|
||||
}).bind(this),
|
||||
|
||||
function(errorMessage, errorCode) {
|
||||
showErrorMessage(errorMessage, "error");
|
||||
@@ -222,13 +212,11 @@ PlayerListManager.prototype.deletePlayer = function(inputButton) {
|
||||
}
|
||||
|
||||
PlayerListManager.prototype.onClickPageNo = function(pageNo) {
|
||||
var self = this;
|
||||
|
||||
self.activePageNo = pageNo;
|
||||
this.activePageNo = pageNo;
|
||||
if(this.playerListID === "add_player_list") {
|
||||
self.updateAddPlayerListPage(self.activePageNo);
|
||||
this.updateAddPlayerListPage(this.activePageNo);
|
||||
} else if(this.playerListID === "search_player_list") {
|
||||
self.updateSearchPlayerListPage(this.searchPlayerName, self.activePageNo);
|
||||
this.updateSearchPlayerListPage(this.searchPlayerName, this.activePageNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,7 +49,7 @@ function searchPlayer() {
|
||||
</div> <!-- 학생 검색 -->
|
||||
|
||||
|
||||
<div class="col-7 rounded " style="background-color: #ffce54">
|
||||
<div class="col-7 border border-warning rounded" style="background-color: #ffeab6">
|
||||
<h5 class="my-3">검색 결과</h5>
|
||||
|
||||
<form id="search_player_list">
|
||||
|
||||
Reference in New Issue
Block a user