Appearance
Approval Detail View
General detail view for a specific pending approval, routing to the appropriate type-specific detail component.
Route
/organisations/:organisationId/pending-approvals/:approvalId
Layout
Close Button
A close button (btn-close) in the top-right (float-end, z-index 3, relatively positioned) navigates back to the originating list:
- If the URL contains
/workers/, navigates to the worker's type-specific tab based onapproval.requestType:RequestType.Expense--/workers/:eorId/expensesRequestType.Timesheet--/workers/:eorId/timesheetsRequestType.Holiday--/workers/:eorId/annual-leaveRequestType.Illness--/workers/:eorId/absences
- Otherwise, navigates to
/organisations/:organisationId/pending-approvalswith the current query string preserved.
Type-Specific Detail Component
Based on approval.requestType, renders one of:
ExpenseDetails-- forRequestType.ExpenseTimesheetDetails-- forRequestType.TimesheetAbsenceDetails-- forRequestType.IllnessorRequestType.Holiday
Each detail component receives the approval object and dispatches approve-request and decline-request events. TimesheetDetails also receives eorId. AbsenceDetails also receives refreshKey.
Approval Modal
A shared PendingApproval modal handles both approve and decline actions:
chosenApprovalis bound to theapprovalobject.isDeclineSelectedis bound to control decline-specific content.isModalOpenis bound to toggle the modal.- On approve: confirms the approval.
- On decline: sets
isDeclineSelectedand shows decline-specific content. - After entitlement changes (absences), the
refreshKeyis incremented via theentitlement-changeevent, triggering a re-initialisation of theAbsenceDetailscomponent.
Data Loading
Fetches the approval via getPendingApproval using the approvalId from the route params. The EOR ID is extracted from the approval ID by splitting on : and taking the first part (format: eorId:suffix).
Behavior notes
- A
Spinneris shown while the approval data loads (inside{#await pInit()}). - The detail component is re-rendered when the approval object changes (via
{#key approval}). - The
approveOrDeclineButtonClickedhelper setsisDeclineSelectedand opens the modal. It is called by both the Approve button (withfalse) and Decline button (withtrue).