From 1a54f7ab8e7a7717c7c65753dae0c283f396056b Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Wed, 13 Aug 2025 06:44:26 +0700 Subject: [PATCH] Invitation user interface preparation --- pages/public/users.html | 27 ++++++++++++++++++++++++++- static/js/users.js | 25 ++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/pages/public/users.html b/pages/public/users.html index 189df73..346cf9d 100644 --- a/pages/public/users.html +++ b/pages/public/users.html @@ -1,5 +1,30 @@ - + +

Invitation

+ +
+
+
+ + + +
+ +
+

You need to insert your password for confirm the invitation

+
+
+ +
+ + + +

User List

+ + +

diff --git a/static/js/users.js b/static/js/users.js index 5541226..5fefbe4 100644 --- a/static/js/users.js +++ b/static/js/users.js @@ -1,5 +1,6 @@ -var token = document.getElementById("form-token" ).value; -const lister = document.getElementById("lister"); +var token = document.getElementById("form-token" ).value; +const listerUser = document.getElementById("lister-user" ); +const listerRoles = document.getElementById("lister-roles" ); sendHttpRequest("/api/auth/users/list", "POST", null, function (error, response) { @@ -27,9 +28,27 @@ sendHttpRequest("/api/auth/users/list", "POST", null, `; - lister.appendChild(itemElement); + listerUser.appendChild(itemElement); }); } }, "application/json", `Bearer ${token}` ); +function invite() { + const checkedRoles = Array + .from(document.querySelectorAll('input[name="roles"]:checked')) + .map(cb => Number(cb.value)); // Convert into number + const email = document.getElementById('form-email').value; + const username = document.getElementById('form-username').value; + const password = document.getElementById('form-password').value; + + console.log({ + email, + username, + password, + roles: checkedRoles // Example: [2, 3] + }); + + // Next command here +} +