Skip to main content

Leave Analytics & Reporting

Overview​

The Leave Analytics dashboard provides an organizational view of your team's time off. Rather than acting as a traditional chart-heavy dashboard, this feature serves as a Team Hierarchy & Leave History Explorer.

It allows you to navigate through your organizational structure, select specific team members, and view their complete historical leave records. It also provides "quick action" capabilities, allowing you to approve or reject pending requests directly from the history view.

Why This Feature Exists​

While the Approve Leave page gives you a list of pending requests, it lacks historical context. Leave Analytics solves this by allowing managers to:

  • See a full hierarchical view of everyone who reports to them.
  • Review an employee's past leave history before approving a new request.
  • Identify patterns (e.g., frequent short-notice absences).
  • Quickly identify how many pending requests exist deep within their team structure, not just direct reports.

Who Can Access Leave Analytics​

Access to Leave Analytics is tied to the leave approval system.

If you are a Manager or Team Lead: You can access this page, but your "Team Tree" will only populate with employees who report to you (either directly or indirectly). You cannot see the leave history of employees in other departments.

If you are an HR Administrator or Organization Owner: Your "Team Tree" will likely contain the entire organization, allowing you to audit the leave history of any employee.

[!NOTE] You cannot action (approve/reject) your own leave requests, even if they appear in your history view.


Understanding the Dashboard​

The dashboard is divided into three primary areas:

1. Summary Metrics (Top Row)​

Four statistic cards provide immediate context:

  • Team Global - Total Members: The total number of employees in your visibility tree (including indirect reports).
  • Team Global - Team Pending: The total number of pending leave requests across your entire visible team.
  • Selected Member - Total History: The total number of leave records (past and present) for the person currently selected in the tree.
  • Selected Member - Pending Review: The number of pending requests specifically for the selected person (on the current page of results).

2. Team Hierarchy Tree (Left Sidebar)​

The left sidebar displays your organization structure.

  • Click on a person's name to view their individual leave history on the right.
  • If a person has a small arrow next to them, they manage other people. Click the arrow to expand their subordinates.
  • Red notification badges indicate that a specific person has pending requests awaiting action.
  • Search: Use the search bar at the top of the tree to quickly find a specific employee by name or job title.

3. Leave History List (Main Content)​

When you select an employee from the tree, this area populates with their historical leave records, paginated 25 records at a time. Each record displays:

  • Leave Type (e.g., Earned Leave, Casual Leave)
  • Status (e.g., Pending, Approved, Rejected, Cancelled)
  • Subject / Reason
  • Date Range and Total Days
  • Location / Zone

How to Read This Dashboard​

  1. Check Team Health: Look at the "Team Pending" metric. If it is high, you or your subordinate managers have a backlog of leave requests to process.
  2. Find the Backlog: Look at the Team Tree for red notification badges. Expand the tree to see exactly which employees have pending requests.
  3. Review History: Click on an employee with a pending request. Look at their past approved and rejected leaves in the main content area to provide context before making your decision.
  4. Take Action: If the request is pending, you can approve or reject it directly from this screen.

Quick Actions (Approve / Reject)​

You do not need to navigate back to the Approve Leave page to process requests.

If you select an employee who has a Pending request, you will see green Approve and red Reject buttons directly on the history card.

  1. Click Approve or Reject.
  2. A confirmation modal will appear.
  3. You must enter a comment or reason. The system requires an explanation for audit purposes.
  4. Click Confirm. The list will automatically refresh.

Empty States​

If you select an employee who has never applied for leave, you will see an empty state graphic stating "No Records Found."

If you do not manage anyone (and do not have administrative privileges), your Team Tree will be empty, and you will be unable to view analytics data.


Exporting Reports​

Currently, the Export Sheet and Download Report buttons at the top right of the dashboard are in development. Clicking them will display a "Coming Soon" notification. In the future, these will allow you to download CSV and PDF copies of the selected employee's leave history.


The Complete Leave Lifecycle​

Leave Analytics serves as the final review stage of the time-off journey:

How Leave Analytics Connects to Other Features​

  • Apply Leave: Data originates when users submit applications via the Apply Leave interface.
  • Approve Leave: While Approve Leave is a flat to-do list of pending items, Leave Analytics provides the hierarchical and historical context behind those same items. Actions taken here use the exact same backend logic as the Approve Leave page.

Troubleshooting​

Why can't I see a specific employee? The hierarchy tree only displays employees who report to you according to the system's organizational chart. If an employee was recently transferred to a different manager, they will no longer appear in your tree.

Why can't I approve a pending request I see in the list? The Approve/Reject buttons will not appear if you are viewing your own pending request (you cannot approve your own leave). Furthermore, if the request requires approval from someone higher in the chain, you may only have read-only visibility.

The Total History number doesn't match the list? The list is paginated (showing 25 records per page). Use the arrows at the bottom right of the list to navigate to older records.


Frequently Asked Questions​

Does Leave Analytics show charts or graphs? Currently, Leave Analytics focuses on hierarchical navigation and raw historical data rather than graphical charts. It is designed to provide context for approvals rather than high-level trend visualizations.

Can I filter the history by date? The current iteration displays the employee's entire history in reverse chronological order. Specific date-range filtering is planned for a future update.

Do rejected or cancelled leaves appear here? Yes. Unlike some calendars that only show approved time off, Leave Analytics provides a complete audit trail, including requests that were rejected, cancelled, or revoked.


Technical Reference​

For administrators and developers, Leave Analytics operates on the following architecture:

  • Route: /org/leaves/report
  • Permission Required: org.lvhdcf.approveleave (The same permission required for the Approve Leave dashboard).
  • Component: src/components/leave/LeaveAnalytics.tsx
  • API Endpoints:
    • GET /org/leave-analytics/hierarchy - Fetches the user's permissible organizational tree (returns TeamMember[]).
    • GET /org/leave-analytics/history/{userId} - Fetches the paginated leave history for the selected user.
    • POST /org/leave-approvals/{id} - Processes inline approval/rejection actions.

Client-Side Filtering: The search bar above the Team Tree operates entirely client-side. It recursively filters the fetched hierarchy array by matching full_name or designation.

Implementation References​

  • src/routes/org/LeaveAnalyticsPage.tsx
  • src/components/leave/LeaveAnalytics.tsx
  • src/services/api/leaveManagement.ts
  • src/types/leaveManagement.ts (Defines TeamMember and LeaveAnalyticsHistory interfaces).
The leave report across the people who report to you.