Skip to content

Conversation

@codeunia-dev
Copy link
Owner

@codeunia-dev codeunia-dev commented Dec 12, 2025

This PR introduces a full Staff Leave Management feature to the system.
It allows staff members to apply for leave, view their leave history, and ensures admins have consistent navigation to access these new pages.
Additionally, an attendance backfill script has been added to improve data integrity for older attendance records.

Key Features

Leave Application Page

  • Staff can submit new leave requests
  • Includes leave type, dates, description, and attachment support
  • Validations for overlapping or invalid date ranges

Leave History Page

  • Shows list of past leave applications
  • Status indicators: Pending, Approved, Rejected
  • Clean UI aligned with existing staff dashboard design

Navigation Updates

  • Staff navigation sidebar updated
  • New entries: Apply Leave, Leave History
  • Icons + route integration included

Attendance Backfill Script

  • Script to automatically recompute or backfill missing attendance entries
  • Helps maintain correct historical attendance data
  • Useful for migration and legacy fixes

Files Updated

  • 7 files updated
  • 1 new script added
  • New page components for leave management

Testing

  • Local manual testing done
  • Form validations verified
  • Backfill script tested with sample dataset

Additional Notes

  • No breaking changes
  • No existing routes affected
  • Safe to merge and deploy

Funny Note 🤓

Leave management is finally here —
now your staff can officially take leave instead of “bro I’ll WFH today” disappearing acts. 🚶💨


Authored by: @akshay0611

Summary by CodeRabbit

Release Notes

New Features

  • Staff Attendance History dashboard displaying total hours, days present, and detailed attendance logs
  • Leave Management system: view leave requests and apply for new leaves
  • Enhanced staff dashboard with real-time weekly hours, attendance rate, and next shift information
  • Updated Weekly Overview to visualize actual attendance data with daily breakdown
  • Added "My Leaves" navigation item in staff menu

✏️ Tip: You can customize this high-level summary in your review settings.

…ages, update staff navigation, and add an attendance backfill script.
@vercel
Copy link

vercel bot commented Dec 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
codeunia Ready Ready Preview Comment Dec 12, 2025 11:42am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces staff attendance history and leave management features, including new pages to display attendance records and leave requests, an interactive leave application dialog, and updates to existing dashboard components to fetch real data from Supabase instead of mock data.

Changes

Cohort / File(s) Summary
Attendance & History
app/staff/history/page.tsx
New client page rendering staff attendance dashboard with aggregate statistics (total hours, days present, average hours) and detailed history table with loading states and formatted dates/times.
Leave Management
app/staff/layout.tsx, app/staff/leaves/page.tsx
Added navigation item linking to leaves page. New client page fetches and displays leave requests with computed business day duration, status badges, and empty state.
Leave Application Dialog
components/staff/ApplyLeaveDialog.tsx
New modal form component for submitting leave requests with fields for leave type, start/end dates, and reason; handles validation, Supabase insertion, and success/error toast notifications.
Dashboard Data Integration
components/staff/DashboardStats.tsx, components/staff/QuickActions.tsx, components/staff/WeeklyOverview.tsx
Updated DashboardStats to compute weekly hours, attendance rate (9:05 AM on-time cutoff over 30 days), and next shift logic. QuickActions wired ApplyLeaveDialog trigger. WeeklyOverview refactored to fetch real attendance data, aggregate by day, and render dynamic bar chart with tooltips.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • DashboardStats.tsx: Verify attendance rate calculation logic (9:05 AM cutoff handling and 30-day windowing)
  • WeeklyOverview.tsx: Validate business day aggregation and date range boundary handling
  • ApplyLeaveDialog.tsx: Review form validation, error handling, and Supabase error propagation
  • Leave-related pages: Confirm database query filters and date/duration computations

Poem

🐰 Staff records now bloom so bright,
Leaves and hours tracked just right,
Dashboards dance with real-time grace,
Attendance histories find their place!
From mock to data, truth takes flight 🎉

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/staff-admin-attendance-routing

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 846ef7d and b12659c.

📒 Files selected for processing (7)
  • app/staff/history/page.tsx (1 hunks)
  • app/staff/layout.tsx (1 hunks)
  • app/staff/leaves/page.tsx (1 hunks)
  • components/staff/ApplyLeaveDialog.tsx (1 hunks)
  • components/staff/DashboardStats.tsx (4 hunks)
  • components/staff/QuickActions.tsx (3 hunks)
  • components/staff/WeeklyOverview.tsx (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeunia-dev codeunia-dev merged commit 93f7eb7 into main Dec 12, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants