Skip to content

Suppo94/leave-management-system

Repository files navigation

🏒 Tempo Leave Management System

A comprehensive leave management system built with Streamlit and Supabase for internal company use.

πŸš€ Features

For Employees:

  • βœ… Leave Balance Tracking: View all leave types and remaining balances
  • βœ… Leave Request Submission: Submit new leave requests with proper validation
  • βœ… Request History: View all past and current leave requests
  • βœ… Real-time Status: Track approval status of submitted requests
  • βœ… Employee Profile: View personal information and employment details

For Supervisors:

  • βœ… Team Dashboard: Overview of all team members and their leave status
  • βœ… Approval Workflow: Approve or reject leave requests with comments
  • βœ… Team Analytics: View team leave usage and patterns
  • βœ… Dual Interface: Access both employee and supervisor views
  • βœ… Real-time Notifications: See pending requests requiring approval

Leave Types Supported:

  • PTO: 21 days (regular) / 30 days (senior) - includes casual leave
  • PPTO: 21 days personal paid time off
  • Paternal Leave: 21 days maximum
  • Maternal Leave: 90 days maximum
  • Bereavement: 3 days per incident
  • Sick Leave: 19 days (12 @ 100%, 7 @ 50%)

πŸ› οΈ Technology Stack

  • Frontend: Streamlit (Python web framework)
  • Database: Supabase (PostgreSQL)
  • Authentication: Email-based with @tempo.fit domain restriction
  • Deployment: Streamlit Cloud
  • Data Visualization: Plotly charts and metrics

πŸ“‹ Prerequisites

  • Python 3.11+
  • Supabase account
  • @tempo.fit email addresses for users

πŸ”§ Installation & Setup

1. Clone the Repository

git clone <your-repo-url>
cd tempo-leave-management

2. Install Dependencies

pip install -r requirements.txt

3. Database Setup (Supabase)

  1. Go to supabase.com
  2. Create a new project
  3. Copy your database URL from Settings > Database
  4. Update the DATABASE_URL in .streamlit/secrets.toml

4. Local Testing

streamlit run app.py

πŸš€ Deployment to Streamlit Cloud

1. Push to GitHub

git add .
git commit -m "Initial commit"
git push origin main

2. Deploy to Streamlit Cloud

  1. Go to share.streamlit.io
  2. Connect your GitHub repository
  3. Set main file as app.py
  4. Add secrets in the Streamlit Cloud dashboard:
    DATABASE_URL = "your-supabase-database-url"

3. Environment Variables

In Streamlit Cloud secrets, add:

DATABASE_URL = "postgresql://postgres:password@host:5432/database"

πŸ“Š Database Schema

The application uses the following main tables:

  • users: Basic user information
  • user_profiles: Employee details and hierarchy
  • leave_types: Available leave types
  • leave_balances: Employee leave allocations
  • leave_requests: Leave applications and approvals

πŸ‘₯ User Management

Demo Accounts:

Adding New Users:

  1. Add user data to the create_initial_data() function in database.py
  2. Users must have @tempo.fit email addresses
  3. Set supervisor relationships in the user profiles

πŸ” Authentication

  • Domain Restriction: Only @tempo.fit email addresses
  • Role-Based Access: Employee and Supervisor roles
  • Session Management: Streamlit session state
  • Simple Login: Email-based authentication for demo

πŸ“± User Interface

Employee Dashboard:

  • Leave balance cards with progress indicators
  • Recent requests table with status colors
  • Quick action buttons for common tasks
  • Profile information and service years

Supervisor Dashboard:

  • Team metrics and statistics
  • Pending requests requiring approval
  • Team member overview table
  • Approval/rejection workflow

πŸ”„ Workflow

  1. Employee submits leave request
  2. System validates request (dates, balance, requirements)
  3. Request sent to supervisor for approval
  4. Supervisor reviews and approves/rejects
  5. Leave balance automatically updated on approval
  6. Employee receives status update

πŸ›‘οΈ Security Features

  • Domain-restricted email authentication
  • Role-based access control
  • Database connection security
  • Input validation and sanitization
  • Session management

πŸ“ˆ Analytics & Reporting

  • Real-time leave balance tracking
  • Team leave usage patterns
  • Department-wise analytics
  • Historical request data
  • Approval workflow metrics

🎨 UI/UX Features

  • Modern, clean interface
  • Responsive design
  • Color-coded status indicators
  • Interactive charts and metrics
  • Mobile-friendly layout

πŸ”§ Configuration

Leave Types Configuration:

Edit leave_types in database.py to modify:

  • Leave type names
  • Documentation requirements
  • Reason requirements
  • Approval workflow

Balance Allocation:

Modify create_initial_data() to adjust:

  • Default leave allocations
  • Senior employee benefits
  • Annual carry-over rules

🌐 Current Deployment Status

  • βœ… Local Development: Fully working with SQLite database
  • βœ… Database System: Smart fallback (SQLite local, PostgreSQL production)
  • βœ… Core Features: Employee dashboard, supervisor dashboard, leave management
  • βœ… Authentication: Email-based with @tempo.fit domain restriction
  • πŸ”„ Online Deployment: Ready for Streamlit Cloud, Heroku, or Railway

Quick Local Testing

# Install dependencies
pip install -r requirements.txt

# Initialize database
python -c "from database import init_database, create_initial_data; init_database(); create_initial_data()"

# Run application
python -m streamlit run app.py

πŸš€ Live Demo

Once deployed, the application will be available at: https://your-app-name.streamlit.app

πŸ“ž Support

For technical support or questions:

πŸ“„ License

Internal use only - Tempo.fit Company


Built with ❀️ for Tempo.fit Team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published