# TechZone Admin Dashboard Guide ## Admin Credentials - **Email:** - **Password:** admin123 ## How to Access Admin Dashboard ### Option 1: Direct Route 1. Open your browser and navigate to: `http://localhost:5300/login` 2. Enter the admin credentials above 3. After successful login, navigate to: `http://localhost:5300/admin` ### Option 2: Via User Menu 1. Open your browser and navigate to: `http://localhost:5300/login` 2. Enter the admin credentials above 3. After successful login, click on the **User icon** (top right corner) 4. Click on **"Admin Dashboard"** in the dropdown menu ## Available Admin Features ### 1. **Dashboard** 📊 - View comprehensive statistics: - Total Revenue - Total Orders - Total Products - Total Users - Today's Performance (Orders & Revenue) - Monthly Stats - **Low Stock Alerts**: Automatic alerts for products below threshold - **Recent Orders**: View latest 5 orders with status ### 2. **Products Management** 📦 - **Create**: Add new products with details (name, price, stock, category, brand, image) - **Read**: View all products (including inactive ones) - **Update**: Edit product details, adjust pricing, update stock - **Delete**: Soft delete (deactivate) products - Categories: Phones, Laptops, Tablets, Wearables, Accessories ### 3. **Services Management** 🔧 - **Create**: Add new services (repair, data recovery, etc.) - **Read**: View all services - **Update**: Modify service details, pricing, duration - **Delete**: Deactivate services - Categories: Repair, Data, Software, Upgrade, Setup ### 4. **Orders Management** 🛒 - View all orders with filtering by status - Update order status (Pending → Processing → Shipped → Delivered) - Add tracking numbers - Status notes for each update - View order history and status changes - Automatic stock restoration on refunds - Supported Statuses: - Pending - Processing - Layaway - Shipped - Delivered - Cancelled - Refunded - On Hold ### 5. **Inventory Management** 📋 - View complete inventory with stock levels - Low stock alerts (customizable thresholds) - Adjust stock quantities with notes - View inventory adjustment history - Track all stock movements ### 6. **Service Bookings** 📅 - View all service booking requests - Update booking status - Manage service appointments - Filter bookings by status ### 7. **Sales Reports** 📈 - Generate reports for different periods: - **Daily**: Last 30 days - **Weekly**: Last 12 weeks - **Monthly**: Last 12 months - View detailed metrics: - Total orders - Total revenue - Products sold - Services booked - Average order value - Period-by-period breakdown ### 8. **Export Functionality** 📄 - **CSV Export**: Export data in spreadsheet format - Sales reports - Inventory reports - Orders reports - **PDF Export**: Generate professional PDF reports - Formatted tables - Summary statistics - Suitable for printing/sharing ## API Endpoints All admin endpoints are protected and require JWT authentication: ``` GET /api/admin/dashboard - Dashboard stats GET /api/admin/products - List products POST /api/admin/products - Create product PUT /api/admin/products/{id} - Update product DELETE /api/admin/products/{id} - Delete product GET /api/admin/services - List services POST /api/admin/services - Create service PUT /api/admin/services/{id} - Update service DELETE /api/admin/services/{id} - Delete service GET /api/admin/orders - List orders PUT /api/admin/orders/{id}/status - Update order status GET /api/admin/inventory - View inventory POST /api/admin/inventory/{id}/adjust - Adjust stock GET /api/admin/inventory/{id}/logs - View stock history GET /api/admin/bookings - List bookings PUT /api/admin/bookings/{id}/status - Update booking status GET /api/admin/users - List users GET /api/admin/reports/sales - Sales reports GET /api/admin/reports/export/csv - Export CSV GET /api/admin/reports/export/pdf - Export PDF ``` ## Security Features - **JWT Authentication**: All admin routes require valid JWT token - **Role-Based Access**: Only users with `admin` role can access - **Access Denied Page**: Non-admin users see access denied message - **Session Management**: Automatic token validation ## Current Status ✅ All features fully implemented and tested ✅ Backend API: 100% functional (53 endpoints tested) ✅ Frontend UI: 100% functional ✅ Dashboard issue: FIXED (duplicate return statement removed) ✅ Database: PostgreSQL with proper relationships ✅ Authentication: JWT-based with bcrypt password hashing ## Need Help? - Backend running on: `http://localhost:8181` - Frontend running on: `http://localhost:5300` - Backend logs: `/backend/server.log` - Frontend logs: `/frontend/frontend.log`