A comprehensive React-based police attendance management system with role-based access control, built with Vite and Supabase.
- โ Login with Badge ID + Password
- โ Punch In / Punch Out (with geofence and photo verification)
- โ View Attendance History (personal IN/OUT logs)
- โ Submit Leave Request (with date picker, reason, file upload)
- โ Track Leave Requests (Pending/Approved/Rejected status)
- โ Profile Management (view badge, name, rank, update contact info)
- โ All Staff Features (for self-management)
- โ Admin Dashboard (summary cards, charts, attendance trends)
- โ User Management (add/edit/remove staff, assign badge numbers)
- ๐ง Attendance Logs (staff entries with photos and location)
- ๐ง Leave Request Management (approve/reject with reasons)
- ๐ง Reports & Export (CSV/PDF export functionality)
- ๐ง Audit Logs (track admin actions)
- Navy Blue (#0a1f44): Headers, Sidebar, Buttons, Chart Titles
- White (#ffffff): Background, Cards, Table Cells
- Golden (#d4af37): Buttons, Highlights, Icons, Accents
- Light Gray (#f2f2f2): Table Borders, Card Backgrounds, Subtle Accents
- Green (#28a745): Approve Buttons, Success Alerts
- Red (#dc3545): Reject Buttons, Error Alerts
- Dark Gray (#6c757d): Text, Labels, Muted Elements
- Frontend: React 18 + Vite
- Backend: Supabase (PostgreSQL + Auth + Storage)
- Icons: Lucide React
- Styling: CSS with CSS Variables
- Authentication: Supabase Auth with RLS
- Database: PostgreSQL with PostGIS for location data
src/
โโโ components/
โ โโโ admin/
โ โ โโโ AdminDashboard.jsx โ
Complete
โ โ โโโ UserManagement.jsx โ
Complete
โ โโโ staff/
โ โ โโโ StaffDashboard.jsx โ
Complete
โ โ โโโ AttendanceView.jsx โ
Complete
โ โ โโโ LeaveRequestView.jsx โ
Complete
โ โโโ Login.jsx โ
Complete
โ โโโ Dashboard.jsx โ
Complete
โโโ lib/
โ โโโ supabase.js โ
Configured
โโโ styles/
โ โโโ theme.js โ
Complete
โโโ App.jsx โ
Complete
โโโ main.jsx โ
Complete
โโโ index.css โ
Complete
database/
โโโ schema.sql โ
Complete
โโโ setup-instructions.md โ
Complete
npm installYour .env file is already configured with Supabase credentials:
VITE_SUPABASE_URL=https://uospodcrrfnfhjwmbsrw.supabase.co
VITE_SUPABASE_ANON_KEY=your_anon_key- Go to your Supabase dashboard
- Navigate to SQL Editor
- Run the SQL script from
database/schema.sql - Follow instructions in
database/setup-instructions.md
npm run devVisit http://localhost:5173 in your browser
- Badge ID:
ADMIN001 - Password: Any password (mock auth)
- Features: Full admin dashboard, user management, all staff features
- Badge ID:
STAFF001(or any other badge ID) - Password: Any password (mock auth)
- Features: Staff dashboard, attendance, leave requests, profile
- Role-based authentication (Admin/Staff)
- Responsive design with police theme
- Navigation with role-based menu items
- Notification system
- Mock data for testing
- Staff dashboard with attendance summary
- Punch In/Out with geolocation and photo simulation
- Leave request form with file upload
- Leave request history with status tracking
- Profile information display
- Attendance history view
- Admin dashboard with statistics cards
- Attendance trends charts
- Leave request status pie chart
- Recent attendance logs table
- Pending leave requests management
- User management (add/edit/delete staff)
- Staff search and filtering
- Role and rank management
-
Real Supabase Authentication
- Replace mock auth with Supabase Auth
- Implement proper user registration
- Set up RLS policies
-
Data Integration
- Connect components to Supabase tables
- Implement CRUD operations
- Real-time data updates
-
Attendance Logs View (Admin)
- Complete staff attendance logs with photos
- Location mapping integration
- Export functionality
-
Leave Management (Admin)
- Approve/reject leave requests
- Email notifications
- Leave balance tracking
-
Reports & Export
- CSV/PDF export functionality
- Date range filtering
- Custom report generation
-
Photo Capture
- Real camera integration
- Image upload to Supabase Storage
- Photo verification
-
Geofencing
- Real GPS coordinates validation
- Police station boundary checking
- Location accuracy verification
-
Notifications
- Email notifications for leave requests
- SMS alerts for attendance
- Push notifications
- Professional Police Theme: Navy blue and golden color scheme
- Responsive Design: Works on desktop, tablet, and mobile
- Interactive Elements: Hover effects, smooth transitions
- Data Visualization: Charts for attendance trends and leave statistics
- User-Friendly Forms: Intuitive date pickers, file uploads
- Status Indicators: Color-coded badges for different states
- Search & Filter: Easy staff management with search functionality
The system uses a comprehensive PostgreSQL schema with:
- profiles: User information with badge numbers and roles
- attendance: Punch records with location and photo data
- leave_requests: Leave applications with approval workflow
- audit_logs: Admin action tracking for compliance
- Row Level Security (RLS): Database-level access control
- Role-based Access: Different UI and permissions for Admin/Staff
- Geofencing: Location-based attendance validation
- Photo Verification: Visual confirmation for punch records
- Audit Trail: Complete logging of admin actions
The application is fully responsive and works seamlessly on:
- Desktop computers
- Tablets
- Mobile phones
- Different screen orientations
Status: Core functionality complete, ready for database integration and advanced features implementation.