# HR, employee portal (`/me`), travel, and attendance

Staff-facing **HR** features live under authenticated API groups with `module:hr` where applicable. The **employee portal** aggregates self-service widgets and forms; **travel** and **attendance** are separate module chains gated in `config/modules.php`.

## High-level module placement

```mermaid
flowchart TB
  subgraph HR["module hr"]
    DIR[Directory / employees]
    LEAVE[Leave types + requests]
    TIME[Time entries]
    CAL[Work calendars]
    BANK[Bank detail change requests]
  end

  subgraph Me["/api/me/* under org.member"]
    OV[overview]
    WF[wfh mileage overtime etc]
    AT[attendance records sites QR]
  end

  subgraph Travel["module travel"]
    BT[business trips]
  end

  subgraph Att["attendance_core + submodules"]
    CH[check-in]
    QR[QR personal + kiosk public]
    FACE[face enrollment]
  end

  HR --> Me
  Att --> Me
```

## Employee overview (conceptual)

```mermaid
flowchart LR
  U[User session] --> O[GET /api/me/overview]
  O --> A[Aggregated widgets]
  A --> W1[Leave balance snippet]
  A --> W2[Upcoming travel]
  A --> W3[Attendance summary]
```

## Leave request flow (simplified)

```mermaid
sequenceDiagram
  participant E as Employee
  participant API as LeaveRequestController
  participant P as OperationalDatePolicy optional

  E->>API: POST leave request dates
  API->>P: if org disallows backdating
  P-->>API: ok or ValidationException
  API-->>E: created / errors
```

## Travel trip

```mermaid
stateDiagram-v2
  [*] --> Draft: create trip
  Draft --> Submitted: user submits
  Submitted --> Approved: workflow optional
  Approved --> [*]
```

## Attendance surfaces

```mermaid
flowchart TB
  subgraph Authenticated["Staff session"]
    CI[POST attendance check-in]
    QR1[POST personal QR payload]
  end

  subgraph Public["No staff session"]
    KIOSK[POST public kiosk check-in]
  end

  CI --> S[(attendance records)]
  QR1 --> S
  KIOSK --> S
```

Operational date floors may apply to check-in dates when org policy is enabled (see `OperationalDatePolicy`).
