Birthdays Report
1. What does this feature do? (High-Level Overview)
Section titled “1. What does this feature do? (High-Level Overview)”This feature provides a Birthdays reporting table where users can review birthday records for clients and employees. It supports server-side filtering, sorting, and pagination, helping teams quickly identify upcoming, past, or all birthdays by month and entity type.
2. Who is this for? (Roles & Permissions)
Section titled “2. Who is this for? (Roles & Permissions)”- Users who can access Reports and meet the Birthdays Report card requirements in Reports Access.
- In Reports Access, the Birthdays Report card is configured with both permissions: view_all_clients and view_employees.
- Users with those permissions can navigate to /reports/birthdays from the report card.
- Inside this component, row links are permission-aware:
- Client names link to profile only if view_all_clients is available.
- Employee names link to profile only if view_employees is available.
- Without those permissions, names are displayed as plain text.
Required permissions used by this feature path:
- view_all_clients: required by Reports Access card visibility and client profile link behavior.
- view_employees: required by Reports Access card visibility and employee profile link behavior.
3. Business Rules & Enforcements
Section titled “3. Business Rules & Enforcements”- Rule 1: The report loads data automatically when the page opens.
- Rule 2: The report starts with these defaults:
- Period: Upcoming
- Type: All
- Month: Not selected
- Page: 1
- Rows per page: 100
- Sort: Days Left (ascending)
- Rule 3: Search text is cleaned before sending (extra spaces removed, converted to lowercase).
- Rule 4: Search and filter changes are applied after a short pause (about 300ms) to avoid constant reloading.
- Rule 5: When any filter changes, results go back to page 1.
- Rule 6: Reset returns everything to the original defaults and reloads data.
- Rule 7: Sorting is handled by the server. If no sort is selected, it uses Days Left (ascending).
- Rule 8: Pagination is handled by the server using current page and rows per page.
- Rule 9: Pagination stays compact:
- If total pages are 5 or fewer, show all page numbers.
- If total pages are more than 5, show the current page plus one page before and after.
- Rule 10: If a current location exists, it is included in the request.
- Rule 11: While loading, the table shows skeleton rows.
- Rule 12: If no data is found, show: Data not available.
- Rule 13: If loading fails, show: Unable to load birthdays report. Please try again., and clear table/pagination data.
- Rule 14: If Period is Upcoming and the selected month is already past, show an informational message because results may be empty.
4. UI Placement
Section titled “4. UI Placement”- Reports entry path:
- Main app -> Reports.
- Reports Access -> Human Resources -> Birthdays Report card.
- Navigates to primary route: /reports/birthdays.
- Main screen sections in this feature:
- Back button (returns browser history).
- Search input (by name text).
- Type filter (All, Clients, Employees).
- Period filter (Upcoming, Past, All).
- Month filter (January to December).
- Reset button (restores default state).
- Informational alert for Upcoming + past month combinations.
- Error alert when API load fails.
- Birthdays table (sortable columns: Full Name, Birth Date, Days Left).
- Footer controls (record range and pagination with Previous/Next and page buttons).
5. How-To Guide (Step-by-Step)
Section titled “5. How-To Guide (Step-by-Step)”Scenario A: Review upcoming birthdays
Section titled “Scenario A: Review upcoming birthdays”- Open Reports and enter Birthdays Report.
- Keep Period as Upcoming (default) or adjust as needed.
- Optionally type a name in Search.
- Optionally choose Type (All, Clients, Employees).
- Optionally choose a Month.
- Review matching rows with Full Name, Birth Date, and Days Left.
Scenario B: Narrow results to employees or clients
Section titled “Scenario B: Narrow results to employees or clients”- Use Type filter to select Clients or Employees.
- Optionally add Search text and Month.
- Use sorting on Full Name, Birth Date, or Days Left.
- Navigate through pages with Previous/Next or direct page buttons.
Scenario C: Reset and start over
Section titled “Scenario C: Reset and start over”- Click Reset.
- Confirm filters return to defaults (Upcoming, All, no month).
- Confirm pagination and sorting also return to defaults.
- Continue filtering from a clean state.
6. What happens if…? (Edge Cases / FAQ)
Section titled “6. What happens if…? (Edge Cases / FAQ)”-
Q: What happens if no filters are changed?
-
A: The component loads immediately using defaults (upcoming period, all entity types, page 1, per_page 100, sorted by days_until_birthday asc).
-
Q: What if the user types spaces or mixed-case text in Search?
-
A: Input is normalized to trimmed lowercase before being sent to API.
-
Q: What if the user changes filters rapidly?
-
A: Requests are debounced by 300ms, so rapid changes coalesce into a single load.
-
Q: What if Upcoming period is selected with a month already in the past?
-
A: An info alert is displayed warning that results can be empty.
-
Q: What if API returns no data?
-
A: The table displays Data not available.
-
Q: What if API fails while loading?
-
A: Loading stops, an error alert is shown, and rows/pagination are cleared.
-
Q: What if user lacks permission for profile navigation links?
-
A: Names are shown as plain text instead of clickable links.
-
Q: What if backend response shape changes?
-
A: The component attempts normalization from supported shapes (array, data array, or object values containing row entities).