diff --git a/core/scripts/webpanel/templates/users.html b/core/scripts/webpanel/templates/users.html index 92522ca..57070fd 100644 --- a/core/scripts/webpanel/templates/users.html +++ b/core/scripts/webpanel/templates/users.html @@ -17,10 +17,9 @@
-

User List

+

User List {% if users %}({{ users|length }}){% endif %}

-
-
@@ -51,11 +49,9 @@
- - @@ -73,6 +69,7 @@ + # Status Username Traffic Usage @@ -84,11 +81,12 @@ - {% for user in users %} + {% for user in users|sort(attribute='username', case_sensitive=false) %} + {{ loop.index }} {% if user['status'] == "Online" %} Online @@ -293,16 +291,16 @@ switch (filter) { case "all": - showRow = true; // Show all users + showRow = true; break; case "not-active": - showRow = $(this).find("td:eq(1) i").hasClass("text-danger"); + showRow = $(this).find("td:eq(2) i").hasClass("text-danger"); break; case "enable": - showRow = $(this).find("td:eq(6) i").hasClass("text-success"); + showRow = $(this).find("td:eq(7) i").hasClass("text-success"); break; case "disable": - showRow = $(this).find("td:eq(6) i").hasClass("text-danger"); + showRow = $(this).find("td:eq(7) i").hasClass("text-danger"); break; } @@ -311,14 +309,11 @@ } else { $(this).hide(); } - //Deselect checkbox when is not visible after sorting $(this).find(".user-checkbox").prop("checked", false); }); }); - // Multi Delete Functionality $("#selectAll").on("change", function () { - // Only select checkboxes in visible rows $("#userTable tbody tr:visible .user-checkbox").prop("checked", $(this).prop("checked")); }); @@ -444,10 +439,9 @@ $(document).on("click", ".edit-user", function () { const username = $(this).data("user"); const row = $(this).closest("tr"); - const quota = row.find("td:eq(3)").text().trim(); - const expiry = row.find("td:eq(4)").text().trim(); - const expiry_days = row.find("td:eq(5)").text().trim(); - const blocked = row.find("td:eq(6) i").hasClass("text-danger"); + const quota = row.find("td:eq(4)").text().trim(); + const expiry_days = row.find("td:eq(6)").text().trim(); + const blocked = row.find("td:eq(7) i").hasClass("text-danger"); const quotaMatch = quota.match(/\/\s*([\d.]+)/); const quotaValue = quotaMatch ? parseFloat(quotaMatch[1]) : 0; @@ -457,6 +451,9 @@ $("#editTrafficLimit").val(quotaValue); $("#editExpirationDays").val(expiry_days); $("#editBlocked").prop("checked", blocked); + + const isValid = validateUsername(username, "editUsernameError"); + $("#editUserForm button[type='submit']").prop("disabled", !isValid); }); $("#editUserForm").on("submit", function (e) { @@ -755,7 +752,7 @@ const searchText = $("#searchInput").val().toLowerCase(); $("#userTable tbody tr").each(function () { - const username = $(this).find("td:eq(2)").text().toLowerCase(); + const username = $(this).find("td:eq(3)").text().toLowerCase(); if (username.includes(searchText)) { $(this).show(); } else {