nadiraouf commited on
Commit
bcb5f4a
·
verified ·
1 Parent(s): 8759f47

I want the application to consist of two interfaces: an admin interface and a client interface. - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +17 -10
index.html CHANGED
@@ -59,10 +59,10 @@
59
  </div>
60
  <div id="navButtons" class="flex space-x-4">
61
  <button onclick="showLogin()" class="glass-effect px-4 py-2 rounded-lg hover:bg-white/20 transition">
62
- <i class="fas fa-sign-in-alt mr-2"></i>Login
63
  </button>
64
- <button onclick="showRegister()" class="bg-white text-purple-600 px-4 py-2 rounded-lg font-semibold hover:bg-gray-100 transition">
65
- <i class="fas fa-user-plus mr-2"></i>Register
66
  </button>
67
  </div>
68
  </div>
@@ -76,7 +76,7 @@
76
  <div id="loginForm" class="bg-white shadow-2xl rounded-xl p-8 slide-in">
77
  <div class="text-center">
78
  <i class="fas fa-exchange-alt text-4xl text-purple-600 mb-4"></i>
79
- <h2 class="text-3xl font-bold text-gray-900">Welcome Back</h2>
80
  <p class="mt-2 text-gray-600">Sign in to your account</p>
81
  </div>
82
  <form class="mt-8 space-y-6" onsubmit="handleLogin(event)">
@@ -579,19 +579,26 @@
579
  e.preventDefault();
580
  const phone = document.getElementById('loginPhone').value;
581
 
582
- const user = users.find(u => u.phone === phone);
583
  if (user) {
584
  currentUser = user;
585
- if (user.type === 'admin') {
586
- showAdminDashboard();
587
- } else {
588
- showCustomerDashboard();
589
- }
590
  } else {
591
  alert('User not found');
592
  }
593
  }
594
 
 
 
 
 
 
 
 
 
 
 
 
595
  function handleRegister(e) {
596
  e.preventDefault();
597
  const name = document.getElementById('regName').value;
 
59
  </div>
60
  <div id="navButtons" class="flex space-x-4">
61
  <button onclick="showLogin()" class="glass-effect px-4 py-2 rounded-lg hover:bg-white/20 transition">
62
+ <i class="fas fa-sign-in-alt mr-2"></i>Client Login
63
  </button>
64
+ <button onclick="showAdminLogin()" class="bg-white text-purple-600 px-4 py-2 rounded-lg font-semibold hover:bg-gray-100 transition">
65
+ <i class="fas fa-user-cog mr-2"></i>Admin Login
66
  </button>
67
  </div>
68
  </div>
 
76
  <div id="loginForm" class="bg-white shadow-2xl rounded-xl p-8 slide-in">
77
  <div class="text-center">
78
  <i class="fas fa-exchange-alt text-4xl text-purple-600 mb-4"></i>
79
+ <h2 class="text-3xl font-bold text-gray-900">Client Login</h2>
80
  <p class="mt-2 text-gray-600">Sign in to your account</p>
81
  </div>
82
  <form class="mt-8 space-y-6" onsubmit="handleLogin(event)">
 
579
  e.preventDefault();
580
  const phone = document.getElementById('loginPhone').value;
581
 
582
+ const user = users.find(u => u.phone === phone && u.type !== 'admin');
583
  if (user) {
584
  currentUser = user;
585
+ showCustomerDashboard();
 
 
 
 
586
  } else {
587
  alert('User not found');
588
  }
589
  }
590
 
591
+ function showAdminLogin() {
592
+ // Hard-coded admin login
593
+ const admin = users.find(u => u.phone === '+213555000000');
594
+ if (admin) {
595
+ currentUser = admin;
596
+ showAdminDashboard();
597
+ } else {
598
+ alert('Admin account not found');
599
+ }
600
+ }
601
+
602
  function handleRegister(e) {
603
  e.preventDefault();
604
  const name = document.getElementById('regName').value;