LawBot / src /apps /static /js /roleselection.js
Vishwanath77's picture
Upload 78 files
b82f276 verified
document.addEventListener("DOMContentLoaded", function () {
const rolePages = {
'Judge': 'judgedashboard.html',
'Advocate/Lawyer': 'advocatedashboard.html',
'Woman': 'woman.html',
'Citizen': 'citizen.html',
'Student': 'studentdashboard.html',
'Minor': 'minor.html'
};
function selectRole(role) {
if (!role || !rolePages[role]) {
console.error("❌ Invalid role selected:", role);
return;
}
console.log("✅ Role selected:", role);
// Redirect to login page with role parameter
window.location.href = `/login?role=${encodeURIComponent(role)}`;
}
document.querySelectorAll(".role").forEach(button => {
button.addEventListener("click", function () {
const role = this.getAttribute("data-role");
selectRole(role);
});
});
// Modified logout button (simple navigation)
document.getElementById("logoutBtn")?.addEventListener("click", function (e) {
e.preventDefault();
window.location.href = "/roleselection.html"; // Direct navigation back
});
});