249 lines
5.5 KiB
Markdown
249 lines
5.5 KiB
Markdown
# Edu-Space Admin Panel
|
|
|
|
A comprehensive web-based administration interface for the Edu-Space Classroom Reservation System built with Flask.
|
|
|
|
## Features
|
|
|
|
### 🔐 Authentication & Security
|
|
- Secure login system with hashed passwords
|
|
- Role-based access control
|
|
- Session management with Flask-Login
|
|
- Password change functionality
|
|
|
|
### 🏫 Classroom Management
|
|
- Create, edit, and delete classrooms
|
|
- Campus and building organization
|
|
- Capacity and resource tracking
|
|
- Real-time availability checking
|
|
|
|
### 📅 Schedule Management
|
|
- Interactive calendar view (FullCalendar)
|
|
- Reservation creation and management
|
|
- Conflict detection and prevention
|
|
- Status tracking (Pending, Confirmed, Cancelled)
|
|
- Today's schedule overview
|
|
|
|
### 📊 Dashboard & Analytics
|
|
- Real-time statistics
|
|
- Monthly reservation charts
|
|
- Quick actions interface
|
|
- Upcoming reservations overview
|
|
|
|
### 🎨 Modern UI/UX
|
|
- Responsive Bootstrap 5 design
|
|
- Dark theme support
|
|
- Mobile-friendly interface
|
|
- Interactive components and charts
|
|
|
|
## Tech Stack
|
|
|
|
- **Backend**: Flask (Python)
|
|
- **Database**: SQLAlchemy (SQLite/PostgreSQL)
|
|
- **Frontend**: Bootstrap 5, jQuery, Chart.js
|
|
- **Authentication**: Flask-Login, Werkzeug
|
|
- **Forms**: Flask-WTF
|
|
- **Calendar**: FullCalendar.js
|
|
|
|
## Installation
|
|
|
|
### Prerequisites
|
|
- Python 3.8+
|
|
- pip package manager
|
|
|
|
### Setup
|
|
|
|
1. **Clone or setup the project:**
|
|
```bash
|
|
cd /Users/alejandro.v/PycharmProjects/admin-edu-space
|
|
```
|
|
|
|
2. **Create virtual environment:**
|
|
```bash
|
|
python -m venv venv
|
|
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
```
|
|
|
|
3. **Install dependencies:**
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
4. **Setup environment variables:**
|
|
```bash
|
|
cp .env.example .env
|
|
# Edit .env with your configuration
|
|
```
|
|
|
|
5. **Initialize database:**
|
|
```bash
|
|
python app.py
|
|
```
|
|
|
|
## Configuration
|
|
|
|
### Environment Variables (.env)
|
|
|
|
```env
|
|
FLASK_APP=app.py
|
|
FLASK_ENV=development
|
|
SECRET_KEY=your-secret-key-here-please-change-in-production
|
|
DATABASE_URL=sqlite:///edu_space.db
|
|
API_BASE_URL=http://localhost:8080/api
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Start the Application
|
|
|
|
```bash
|
|
python app.py
|
|
```
|
|
|
|
The application will be available at: `http://localhost:5000`
|
|
|
|
### Default Login
|
|
|
|
- **Email**: admin@edu-space.com
|
|
- **Password**: admin123
|
|
|
|
### Main Features
|
|
|
|
1. **Dashboard**: Overview of system statistics and upcoming reservations
|
|
2. **Classrooms**: Manage classroom information, capacity, and resources
|
|
3. **Schedule**: View and manage reservations with calendar interface
|
|
4. **Profile**: User profile and password management
|
|
|
|
## API Integration
|
|
|
|
The admin panel integrates with the Spring Boot API at `http://localhost:8080/api`. Make sure the Java microservice is running for full functionality.
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
admin-edu-space/
|
|
├── app/
|
|
│ ├── __init__.py # Flask app factory
|
|
│ ├── models/ # Database models
|
|
│ │ ├── user.py
|
|
│ │ ├── classroom.py
|
|
│ │ ├── subject.py
|
|
│ │ └── reservation.py
|
|
│ ├── routes/ # Application routes
|
|
│ │ ├── auth.py
|
|
│ │ ├── main.py
|
|
│ │ ├── classrooms.py
|
|
│ │ └── schedule.py
|
|
│ ├── forms/ # WTForms classes
|
|
│ │ ├── auth.py
|
|
│ │ ├── classroom.py
|
|
│ │ └── reservation.py
|
|
│ ├── templates/ # Jinja2 templates
|
|
│ ├── static/ # Static files
|
|
├── config/ # Configuration files
|
|
├── requirements.txt
|
|
├── .env
|
|
├── app.py
|
|
└── README.md
|
|
```
|
|
|
|
## Database Schema
|
|
|
|
### Users Table
|
|
- User authentication and authorization
|
|
- Role management (admin, staff)
|
|
|
|
### Classrooms Table
|
|
- Classroom information
|
|
- Capacity and location details
|
|
- Resource management
|
|
|
|
### Reservations Table
|
|
- Booking management
|
|
- Time slot scheduling
|
|
- Status tracking
|
|
|
|
### Subjects + Commissions Tables
|
|
- Academic information
|
|
- Teacher assignments
|
|
- Student enrollment tracking
|
|
|
|
## Security Features
|
|
|
|
- Password hashing with bcrypt
|
|
- Session management
|
|
- CSRF protection
|
|
- Input validation and sanitization
|
|
- SQL injection prevention with SQLAlchemy ORM
|
|
|
|
## Development
|
|
|
|
### Running in Development Mode
|
|
|
|
```bash
|
|
export FLASK_ENV=development
|
|
python app.py
|
|
```
|
|
|
|
### Adding New Features
|
|
|
|
1. Create models in `app/models/`
|
|
2. Add routes in `app/routes/`
|
|
3. Create forms if needed in `app/forms/`
|
|
4. Update templates in `app/templates/`
|
|
|
|
## Production Deployment
|
|
|
|
### Environment Setup
|
|
|
|
1. **Set production variables:**
|
|
```env
|
|
FLASK_ENV=production
|
|
SECRET_KEY=<strong-random-string>
|
|
DATABASE_URL=<production-database-url>
|
|
```
|
|
|
|
2. **Use production WSGI server:**
|
|
```bash
|
|
pip install gunicorn
|
|
gunicorn -w 4 -b 0.0.0.0:5000 app:app
|
|
```
|
|
|
|
3. **Configure reverse proxy** (nginx/Apache)
|
|
|
|
## Troubleshooting
|
|
|
|
### Common Issues
|
|
|
|
1. **Database connection errors:**
|
|
- Check DATABASE_URL string
|
|
- Ensure directory permissions
|
|
|
|
2. **Login issues:**
|
|
- Verify admin user exists
|
|
- Check password hash
|
|
|
|
3. **Static files not loading:**
|
|
- Ensure blueprint route registration
|
|
- Check file permissions
|
|
|
|
## Contributing
|
|
|
|
1. Fork the repository
|
|
2. Create feature branch
|
|
3. Make changes
|
|
4. Test thoroughly
|
|
5. Submit pull request
|
|
|
|
## License
|
|
|
|
This project is part of the Edu-Space educational management system.
|
|
|
|
## Support
|
|
|
|
For support and questions:
|
|
- Email: admin@edu-space.com
|
|
- Documentation: Check inline comments and README files
|
|
|
|
---
|
|
|
|
**Note**: This admin panel is designed to work alongside the Spring Boot microservice. Ensure both services are running for complete functionality. |