This guide explains how to access the admin panel and use its features.
-
Using Supabase Dashboard:
- Go to your Supabase project dashboard
- Navigate to the
profilestable - Find the user you want to make an admin
- Update the
rolefield to'admin' - Save the changes
-
Using SQL in Supabase:
UPDATE profiles SET role = 'admin' WHERE email = 'your-email@example.com';
-
Using Supabase Dashboard:
- Go to the
stafftable - Click "Insert" to add a new row
- Set
user_idto the user's ID (fromauth.usersorprofilestable) - Set
roleto any value (e.g., 'admin', 'manager') - Optionally set
stationif applicable - Save
- Go to the
-
Using SQL:
First, get your user information:
SELECT id, email, full_name FROM profiles WHERE id = 'a55e3419-9658-43bd-8c3a-196513feb30c';
Then insert into staff with all required fields:
INSERT INTO staff (user_id, full_name, email, role, station_name) VALUES ( 'a55e3419-9658-43bd-8c3a-196513feb30c', 'Your Full Name', -- Replace with your actual name from profiles 'your-email@example.com', -- Replace with your actual email from profiles 'admin', NULL );
Or use a single query that gets the data automatically:
INSERT INTO staff (user_id, full_name, email, role, station_name) SELECT id, COALESCE(full_name, 'Admin User'), email, 'admin', NULL FROM profiles WHERE id = 'a55e3419-9658-43bd-8c3a-196513feb30c';
Note: The
stafftable requiresfull_name,email, androlefields (they are NOT NULL). The column for station isstation_name, notstation.
Once you have admin privileges:
- Log in to your account at
/auth/login - Navigate to
/adminin your browser - The admin layout will verify your admin status and grant access
Note: If you're not an admin, you'll be redirected to /dashboard
- View total revenue, tickets, routes, and passes
- See recent payments
- View detailed ticket and pass statistics
- Breakdown by status and type
- Scan QR codes from tickets using your device camera
- View full ticket details including:
- User information (name, email, photo)
- Route details (origin, destination)
- Ticket status (active, used)
- Seat number and ticket type
- Validation timestamp
- Validate ticket authenticity in real-time
- View all registered users
- Search users by name, email, phone, or NIN
- View detailed user profiles including:
- Personal information
- NIN verification status
- User role
- All tickets purchased by the user
- All passes purchased by the user
- See user activity and purchase history
- View all routes and their current prices
- Edit ticket prices for any route
- Update base prices instantly
- See vehicle types for each route
- View revenue statistics
- See breakdown by tickets and passes
- View recent payment transactions
- Manage all train routes
- Add, edit, or delete routes
- Set route details (origin, destination, vehicle type)
- View and manage staff members
- Assign staff to stations
- Manage staff roles
- Register NFC/QR scanning devices
- Assign devices to stations
- Monitor device status
✅ Scan Tickets: Use the QR scanner to validate tickets and see full details
✅ View User Profiles: Access complete user information and purchase history
✅ Change Ticket Prices: Update route fares from the Fares page
✅ View Statistics: See totals of tickets purchased and passes
✅ Monitor Revenue: Track all payments and revenue streams
✅ Manage System: Control routes, staff, and devices
- Admin access is protected by role-based authentication
- Only users with
role = 'admin'in profiles or entries in thestafftable can access admin pages - All admin API functions verify admin status before executing
- Admin pages automatically redirect non-admin users to the dashboard
Can't access admin page?
- Verify your user has
role = 'admin'in theprofilestable OR - Verify your user ID exists in the
stafftable - Make sure you're logged in
- Clear browser cache and try again
Scanner not working?
- Ensure camera permissions are granted
- Use HTTPS (required for camera access)
- Try a different browser (Chrome/Firefox recommended)
Can't see user data?
- Verify you're accessing
/admin/users(not/dashboard/users) - Check that the user has made purchases (tickets/passes)
- Ensure database connections are working