> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hitaji360.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Shifts

> Shifts describe when an employee is expected to work — the working window, the grace they're allowed at either end, and how their clock-ins should be…

Shifts describe *when* an employee is expected to work — the working window, the grace they're allowed at either end, and how their clock-ins should be read. Getting shifts right is what lets Hitaji 360 turn raw check-in punches into a meaningful daily attendance record automatically, flag late arrivals and early departures, and work out overtime. The shift module has four pieces that build on each other: **shift types** (the templates), **shift assignments** (a type given to an employee for a date range), **shift schedules** (recurring rotations that generate assignments), and **shift requests** (an employee asking for a particular shift).

This page covers all four and how they connect to attendance and overtime.

**You'll find this at:** the shift APIs live under `hr/shift-types`, `hr/shift-assignments`, `hr/shift-schedules`, and `hr/shift-requests`. See *Current state* for the UI position.

> Shifts, assignments, and the attendance they drive are all **per business** and tied to the **employment contract**. Confirm the business switcher before configuring shifts.

> 📷 *Screenshot: shift-type configuration — working window, grace periods, and the auto-attendance toggle — to be added.*

***

## Shift types (the templates)

A shift type is a reusable template for a working pattern. Its key settings:

| Setting                                    | What it does                                                                                                                        |
| ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| **Name**                                   | e.g. "Morning", "Night".                                                                                                            |
| **Start time / End time**                  | The working window. The end may wrap past midnight (a night shift).                                                                 |
| **Enable auto-attendance**                 | Turns on the hourly job that derives attendance from this shift's clock-ins.                                                        |
| **Working-hours threshold for Half Day**   | Below this many hours worked, the day is marked *Half Day*.                                                                         |
| **Working-hours threshold for Absent**     | Below this many hours, the day is marked *Absent*.                                                                                  |
| **Begin check-in before shift start**      | How many minutes early a punch still counts toward the shift (default 60).                                                          |
| **Allow check-out after shift end**        | How many minutes after the end a punch is still attributed to this shift (default 60).                                              |
| **Late-entry grace period**                | Minutes after start before a late arrival is flagged (default 0).                                                                   |
| **Early-exit grace period**                | Minutes before end before an early departure is flagged (default 0).                                                                |
| **Enable late-entry / early-exit marking** | Whether to actually stamp *late entry* / *early exit* on the derived attendance.                                                    |
| **Mark auto-attendance on holidays**       | Whether to derive attendance on public holidays.                                                                                    |
| **Holiday list**                           | An optional holiday list specific to this shift.                                                                                    |
| **Process attendance after**               | A floor date — auto-attendance and the absent backfill won't run for dates before it. **Required** once auto-attendance is enabled. |

> The way punches are paired and counted is also configurable — whether working hours come from *first-in to last-out* or from *every in/out pair*, and whether punches are paired by their stated in/out type or simply alternated.

***

## Shift assignments (a shift given to an employee)

A shift assignment ties a shift type to a specific employee for a date range:

| Field                   | Notes                                    |
| ----------------------- | ---------------------------------------- |
| **Employee / contract** | Who the shift is for.                    |
| **Shift type**          | The template being assigned.             |
| **Start date**          | When the shift begins for this person.   |
| **End date**            | When it ends — open-ended if left blank. |
| **Status**              | *Active*, *Inactive*, or *Cancelled*.    |

Assignments are *submittable documents* (Draft → Submitted → Cancelled). A **Submitted** assignment is the source of truth that auto-attendance and overtime read from when they decide which shift an employee's punches belong to.

***

## Shift schedules (recurring rotations)

A shift schedule automates assignment creation for rotating patterns. Instead of creating an assignment for every day by hand, you define a repeating pattern and let Hitaji generate the daily assignments:

* A **pattern** is a list of shift types (or rest days) — e.g. *\[Morning, Morning, Night, Night, rest, rest]* — that repeats. The cycle can be up to 28 days long.
* A **cycle start date** anchors the rotation, and employees are attached to the schedule over their own date ranges.
* A daily job walks each employee's place in the cycle and creates the next day's submitted shift assignment, picking up where it last left off. Rest days in the pattern simply produce no assignment.

***

## Shift requests (an employee asking for a shift)

A shift request lets an employee ask to be put on a particular shift for a date or range — a self-service way to request a shift change.

| Field                   | Notes                                    |
| ----------------------- | ---------------------------------------- |
| **Shift type**          | The requested shift.                     |
| **From date / To date** | The range (single day if *To* is blank). |
| **Reason**              | Context for the approver.                |

A request moves through **Draft → Pending → Approved / Rejected** (or **Cancelled** if withdrawn before approval). When **approved**, Hitaji creates a submitted shift assignment for the requested shift over the range, end-dating any overlapping existing assignment the day before so the new one takes over cleanly; it refuses if the dates clash with another already-approved request. As with attendance corrections, **approving or rejecting** a shift request needs the dedicated `hr-attendance:approve` permission — separate from the `hr:write` needed to raise one — so an employee can't approve their own shift change.

***

## How shifts connect to attendance and overtime

Shifts are the engine behind automatic attendance and overtime:

* **Attendance.** When a shift type has *auto-attendance* on, the hourly roll-up reads each employee's [check-ins](/hr/user/attendance/attendance-requests) against their active shift assignment, computes worked hours within the grace windows and the business time zone, and writes **Present / Half Day** attendance (using the shift's thresholds) — flagging late entry / early exit if those are enabled. The daily backfill marks **Absent** where a working day has no attendance and isn't covered by a holiday or leave.
* **Overtime.** The [overtime](/hr/user/attendance/overtime) calculation looks at how far an employee's last clock-out runs past their shift end (beyond the allowed grace) to work out overtime hours for the day.

***

## Permissions

| Action                                                | Permission              |
| ----------------------------------------------------- | ----------------------- |
| View shift types, schedules, assignments, requests    | `hr:read`               |
| Create / edit shift **types** and **schedules**       | `hr:admin`              |
| Create / edit / submit / cancel shift **assignments** | `hr:write`              |
| Raise / submit / cancel a shift **request**           | `hr:write`              |
| Approve or reject a shift request                     | `hr-attendance:approve` |

***

> ⚠️ **Current state.** The entire shift module — types, assignments, schedules with rotation generation, and the request/approval workflow — is implemented on the backend and wired into auto-attendance and overtime. However, there is currently **no web UI for shifts**: no screens to create shift types, build schedules, assign shifts, or approve shift requests. Today shifts are configured through the API. Because auto-attendance and overtime both depend on shift configuration, this is worth knowing before relying on automatic attendance. (Flagged for the team.)

***

## Related

* [Attendance](/hr/user/attendance/attendance) — the records shifts help generate
* [Attendance requests & check-in](/hr/user/attendance/attendance-requests) — the punches shifts read
* [Overtime](/hr/user/attendance/overtime) — hours beyond the shift
* [Holiday lists](/hr/user/leave/holiday-lists) — holidays the shift engine honours
