forked from Adleraci/adlerka.top
78 lines
2.6 KiB
HTML
78 lines
2.6 KiB
HTML
<script>
|
|
async function addActivationCodes() {
|
|
const count = document.getElementById("activationCodeCount").value;
|
|
|
|
const data = new URLSearchParams();
|
|
data.append("action", "add_activation_codes");
|
|
data.append("count", count);
|
|
|
|
const result = await doAccountAction(data, "Activation codes added Successfully!", "Activation codes addition failed.");
|
|
|
|
displayList(result.ActivationCodes, "codeListTable", deleteActivationCode);
|
|
}
|
|
|
|
async function listUsers() {
|
|
const data = new URLSearchParams();
|
|
data.append("action", "list_users");
|
|
|
|
const result = await doAccountAction(data, "User list retrieved Successfully!", "User list retrieval failed.");
|
|
|
|
if (result && result.Status === "Success") {
|
|
displayList(result.Users, "userListTable", deleteUser);
|
|
}
|
|
}
|
|
|
|
|
|
async function listActivationCodes() {
|
|
const data = new URLSearchParams();
|
|
data.append("action", "list_activation_codes");
|
|
|
|
const result = await doAccountAction(data, "Activation code list retrieved Successfully!", "Activation code list retrieval failed.");
|
|
|
|
displayList(result.ActivationCodes, "codeListTable", deleteActivationCode);
|
|
}
|
|
|
|
function deleteUser(userId) {
|
|
|
|
const data = new URLSearchParams();
|
|
data.append("action", "delete_user");
|
|
data.append("user_id", userId);
|
|
|
|
doAccountAction(data, "User deleted Successfully!", "User deletion failed.");
|
|
listUsers();
|
|
}
|
|
|
|
function deleteActivationCode(activationCode) {
|
|
|
|
const data = new URLSearchParams();
|
|
data.append("action", "delete_activation_code");
|
|
data.append("activation_code", activationCode);
|
|
|
|
doAccountAction(data, "Activation code deleted Successfully!", "Activation code deletion failed.");
|
|
listActivationCodes();
|
|
}
|
|
</script>
|
|
|
|
|
|
<div class="form-container" id="addActivationCodesForm">
|
|
<h1>Activation Codes</h1>
|
|
|
|
<h2>List Activation Codes</h2>
|
|
<button type="button" onclick="listActivationCodes()">List Activation Codes</button><br>
|
|
<table id="codeListTable"></table>
|
|
|
|
<h2>Add Activation Codes</h2>
|
|
<label for="activationCodeCount">Activation Code Count:</label>
|
|
<input type="text" id="activationCodeCount" name="activationCodeCount" required><br>
|
|
<button type="button" onclick="addActivationCodes()">Add Activation Codes</button>
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<div class="form-container" id="listUsersForm">
|
|
<h1>List Users</h1>
|
|
<button type="button" onclick="listUsers()">List Users</button><br>
|
|
<table id="userListTable"></table>
|
|
</div>
|
|
|
|
<hr> |