Overview
The Huellitas Admin Panel provides a centralized interface for managing the pet shop’s operations, analyzing customer behavior, and monitoring inventory. Built with React, the dashboard features a modern, responsive design with collapsible navigation. Key Features:- Strategic business analytics
- User management
- Stock control
- Looker Studio integration for data visualization
Accessing the Admin Panel
URL
- Local Development:
http://localhost:5173/Admin - Production:
https://yourusername.github.io/petshopHuellitas/Admin
Authentication
Admins must authenticate with role-based access:Dashboard Layout
Component Structure
The admin panel uses a grid-based layout:Grid Layout
Top Bar Features
Brand Section
- Company logo (150x150px recommended)
- Panel title
- Subtitle for context
User Info Display
- User avatar with initial
- Display name from authentication context
- Visual confirmation of logged-in user
Navigation Buttons
Implement logout functionality by calling the authentication service:
Sidebar Navigation
Collapsible Menu
The sidebar supports collapsing to save screen space:- Expanded: Full menu with text labels
- Collapsed: Icon-only menu
Menu Sections
Three main sections for different admin tasks:1. Strategic Analysis
- Sales trends
- Customer segmentation analysis
- Product performance metrics
- Revenue forecasting
2. User Management
- View all registered users
- Edit user details
- Assign customer segments (CatLover, DogLover, Aves, Exóticos)
- Manage roles (Admin, User)
- Suspend/activate accounts
3. Stock Control
- Real-time stock levels
- Low stock alerts
- Product categories overview
- Restock recommendations
Main Dashboard Area
Looker Studio Integration
Embedding Looker Reports
Replace the placeholder with an actual Looker Studio embed:Creating Looker Reports
-
Connect Data Source
- Go to Looker Studio
- Click Create → Data Source
- Select PostgreSQL connector
- Enter Huellitas database credentials
-
Build Report
- Create visualizations:
- Sales by customer segment (pie chart)
- Product category performance (bar chart)
- Monthly revenue trend (line chart)
- User growth (area chart)
- Create visualizations:
-
Configure Sharing
- Click Share → Embed report
- Copy embed code
- Paste into dashboard
Sample Report Metrics
Customer Segmentation:Styling and Customization
CSS Classes
The admin panel uses these key CSS classes:Responsive Design
Data Visualization Examples
Customer Segment Distribution
Sales Trend Line Chart
Security Considerations
Role-Based Access Control
API Authentication
All admin API calls should include JWT token:Data Validation
Validate all form inputs before submission:Performance Optimization
Lazy Loading Sections
Data Caching
Future Enhancements
Planned Features
- Real-time notifications for low stock and new orders
- Export functionality for reports (CSV, PDF)
- Advanced filtering in user and product tables
- Bulk operations for user management
- Order management section with fulfillment tracking
- Customer support chat integration
- Email campaign builder for marketing
Analytics Expansion
- Predictive analytics for stock management
- Customer lifetime value (CLV) calculations
- A/B testing framework for product recommendations
- Cohort analysis for user retention
Troubleshooting
Common Issues
Dashboard not loading:- Check authentication token validity
- Verify user has admin role (idRol === 1)
- Inspect browser console for errors
- Confirm embed URL is correct
- Check iframe sandbox permissions
- Verify report sharing settings in Looker Studio
- Ensure backend is deployed and running
- Check CORS configuration in API
- Verify JWT token is included in headers
- Check state management for
collapsedvariable - Verify CSS classes are applied correctly
- Inspect event handlers in DevTools
Next Steps
API Reference
Explore API endpoints used by the admin panel
Deployment Guide
Learn how to deploy the admin panel to production