This project is a web-based application designed to help employees submit and manage their annual leave requests, while allowing managers to approve or reject leave applications. The system also prevents overlapping leave requests and tracks leave balances.
1. Installation Instructions
2. Environment Variables Configuration
3. Features
4. Technologies Used
5. Project Structure
6. Current Progress
7. Running the Project
8. Contributing
To get the project up and running locally on your machine, follow the steps below:
-
Clone the repository
git clone https://github.com/itmo-wad/Team4-AnualLeavePlanner.git cd annual-leave-planner
-
Set up a Python virtual environment
python3 -m venv venv source venv/bin/activate # For Windows, use `venv\Scripts\activate`
-
Install dependencies
pip install -r requirements.txt
-
Set up MongoDB Ensure MongoDB is running locally or start with docker
docker run --name mongodb -p 27017:27017 -d mongodb/mongodb:latest
-
Run the app
python app.py
-
Visit the application Open your browser and navigate to http://127.0.0.1:5000/
Before running the project, you will need to configure some environment variables. These values are used for email setup, authentication, and other configurations. The environment variables should be defined in a .env
file or set directly in your environment.
FLASK_ENV=production
MONGO_HOST=mongodb
MONGO_PORT=27017
MONGO_DB_NAME=leave_management
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your_email@gmail.com
SMTP_PASSWORD=your_email_password
SEND_EMAIL=True
FLASK_ENV
→production
ordebug
(turns flask debug on)MONGO_HOST
→ Mongodb hostMONGO_PORT
→ Mongodb portMONGO_DB_NAME
→ Mongodb database nameSMTP_SERVER
→ The SMTP server address used for sending emails (smtp.gmail.com
for Gmail).SMTP_PORT
→ The port number used for SMTP communication (587
for TLS).SMTP_USERNAME
→ The email address used for sending emails.SMTP_PASSWORD
→ The password or app-specific password for the sender's email account.SEND_EMAIL
→ A boolean value (True
orFalse
) that controls email sending:True
→ Emails will be sent as expected.False
→ Email sending will be skipped, and the manager's password will be shown instead (useful for development).
- Managers can create employee accounts, assign roles, and manage users.
- Employees can log in, submit leave requests, and view leave balances.
- Employees can submit leave requests with details such as leave type, start and end dates, and optional reasons.
- Leave requests are saved with statuses: Pending, Approved, Rejected.
- Managers can view and approve/reject leave requests with the option to add comments on rejections.
- A calendar displays upcoming leave requests and prevents overlapping leave submissions.
- Employees can see their remaining leave balance.
- Role-based access control ensures only managers can approve leave or manage employee accounts.
- Passwords are securely hashed and session management is in place.
- Backend: Flask (Python web framework)
- Database: MongoDB (NoSQL database)
- Frontend: HTML, CSS, JavaScript
- Authentication: Flask-Login for session management
- Deployment: Docker for containerization
The project follows a modular structure to separate concerns for better maintainability.
├── .gitignore
├── app.py # Main application file
├── docker-compose-debug.yml
├── docker-compose.yml
├── Dockerfile
├── README.md # This file
├── requirements.txt # Python dependencies
├── app/
│ ├── auth.py # Authentication-related logic
│ ├── calendar.py # Logic for leave calendar and conflict resolution
│ ├── employee.py # Employee leave request logic
│ ├── main.py # Main app routes
│ ├── models.py # Database models
│ ├── __init__.py # Application initialization
├── static/
│ ├── dashboard.css # Styles for dashboard
│ ├── manage_employee.css # Styles for employee management page
│ ├── manage_employee.js # JS for employee management page
├── templates/
│ ├── employee_dashboard.html # Employee dashboard page
│ ├── index.html # Homepage
│ ├── login.html # Login page
│ ├── manager_dashboard.html # Manager dashboard page
│ ├── manage_employee.html # Employee management page
│ ├── register.html # Registration page
- Login/Register (#1): Done ✅
- Manager Dashboard (#2): Done ✅
- Employee Dashboard (#3): Done ✅
- Manage Employees Dashboard (#4): Done ✅
- Leave Approvals (#5): Done ✅
- Login/Registration (#6): Done ✅
- Manager Employee Dashboard (#7): Done ✅
- Leave Request Form (#8): Done ✅
- Leave Approval Dashboard (#9): Done ✅
- Handle Conflicts (#10): Done ✅
- Implement new features
-
Local Development
Follow the steps in the 1. Installation Instructions section above to set up the environment and run the app locally
-
Docker Setup
To run the app in a containerized environment using Docker, use the following commands:
docker-compose up --build
This will build the necessary containers and start the application
We welcome contributions! If you'd like to improve the project, please follow these steps:
- Fork the repository
- Create a new branch
git checkout -b feature/your-feature
- Make your changes and commit them
git commit -am 'Add new feature'
- Push the changes
git push origin feature/your-feature
- Submit a pull request