Leave Tool
Overview
Section titled “Overview”The Leave tool replaces direct Xero leave submissions with an in-app workflow. Employees submit leave requests, which go through a two-tier approval process (manager → executive). On final approval, the leave is automatically synced to Xero, Productive.io, the Tribe Google Calendar, and posted to Slack.
Features
Section titled “Features”- Leave balances — Cached from Xero, shown before submitting a request
- Two-tier approval — Manager approval then executive approval (with shortcuts for managers and executives)
- External integrations — Xero LeaveApplication, Productive booking, Google Calendar event, Slack notification
- Cancellation — Reverses all external integrations when approved leave is cancelled
- Pending badge — Sidebar badge showing count of requests awaiting your approval
- Audit trail — Full history of every action on a request
Approval Flow
Section titled “Approval Flow”Employee submits → pending_manager → Manager approves → pending_exec → Executive approves → approvedManager/Head submits → pending_exec → Executive approves → approvedExecutive submits → approved (auto)- pending_manager: Approver must be
is_manager=1in a shared squad, or an executive - pending_exec: Approver must have
access_level = 'executive'
Permissions
Section titled “Permissions”| Level | View | Submit/Approve | Manage (retry integrations) |
|---|---|---|---|
| Executive | All requests | Yes + auto-approve own | Yes |
| Head | All requests | Yes | No |
| Manager | Own + squad | Yes | No |
| Lead | Own only | Submit only | No |
| Employee | Own only | Submit only | No |
Post-Approval Integrations
Section titled “Post-Approval Integrations”On executive approval (or auto-approval for executives), the following run independently:
- Xero — Creates a LeaveApplication via Payroll AU API
- Productive — Creates a time-off booking
- Google Calendar — Creates an all-day event on the Tribe calendar
- Slack — Posts to #company-leave with leave details
Each integration runs independently — a failure in one doesn’t block the others. Failed integrations are stored and can be retried by executives.
Components
Section titled “Components”| Component | Purpose |
|---|---|
leave-page.tsx | Main page: tabs (My Leave, Pending, All), balance card, form/detail sheets |
leave-request-form.tsx | Submit leave: type, dates, hours, notes |
leave-request-list.tsx | List of requests with status, type, dates |
leave-request-detail.tsx | Full detail with actions, integration status, history timeline |
leave-balances-card.tsx | Leave balance grid with refresh button |
leave-status-badge.tsx | Coloured status badge (pending/approved/rejected/cancelled) |
leave-integration-status.tsx | Per-integration success/failure indicators with retry button |
URL State
Section titled “URL State”?tab=mine|pending|all— active tab?id=<leave-request-id>— selected request detail view
Data Model
Section titled “Data Model”| Table | Purpose |
|---|---|
leave_types | Cached from Xero PayItems (ID, name, is_paid) |
leave_balances | Per-user balances cached from Xero (1hr TTL) |
leave_requests | Core table: user, type, dates, hours, status, external IDs, integration errors |
leave_request_history | Audit trail: action, actor, comment, timestamp |