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

# Shift templates

> Define the time policy a working day is judged against — hours, breaks, grace, weekly offs and overtime rules.

export const PermissionNote = ({perm}) => <Info>
    Requires the <code>{perm}</code> permission. Ask your administrator if an
    action described here is missing from your screen — see
    [Roles & permissions](/help/concepts/roles-and-permissions).
  </Info>;

<PermissionNote perm="shift:write" />

A **shift template** is the policy the day engine measures against. Without one, a day record has no expected start time, no grace period, no half-day cutoff and no overtime threshold — so getting templates right is a precondition for attendance meaning anything.

**Shifts & rosters → Templates.**

## Anatomy of a template

<AccordionGroup>
  <Accordion title="Identity" icon="tag">
    * **Code** — the reconciler's category: `G` general, `M` morning, `E` evening, `N` night, `F` flexi.
    * **Name** — what people see, e.g. "General 9–6".
    * **Type** — fixed, flexible, rotational, field or custom.
    * **Tags** and an optional **SKU** for your own classification.
    * **Effective from** — the date this template's policy starts applying.
  </Accordion>

  <Accordion title="Timing" icon="clock">
    * **Start** and **end time**, and the **working hours** they come to.
    * **Unpaid break minutes**, with an optional **break window** naming when it falls.
    * **Auto break deduct** — whether the break is deducted automatically rather than requiring punches around it.
    * **Auto checkout after** — a time at which an unclosed shift is closed off, so a forgotten punch-out does not run overnight.
  </Accordion>

  <Accordion title="Grace and half days" icon="timer">
    * **Grace period minutes** — how late someone can arrive before the day records late minutes.
    * **Grace arrival mode** — `soft` or `hard`.
    * **Grace departure minutes** — the equivalent allowance at the end of the shift.
    * **Half-day cutoff hours** — work below this many hours makes the day a `Half`.
  </Accordion>

  <Accordion title="Weekly off" icon="calendar-x">
    Which days of the week are rest days for anyone on this template. These become `WeeklyOff` day records, and they are what makes overtime on those days earn comp-off.
  </Accordion>

  <Accordion title="Overtime" icon="timer-reset">
    * **Eligible after** — minutes worked before overtime starts accruing (default 570, i.e. 9h30m).
    * **Cap per day** — the most overtime one day can produce (default 180 minutes).
    * **Weekday multiplier** — the rate for ordinary overtime (default 1.5×).
    * **Holiday / rest-day multiplier** — the rate when overtime falls on a holiday or weekly off (default 2×).
    * **Approval threshold** — the point beyond which overtime needs explicit approval (default 120 minutes).
  </Accordion>

  <Accordion title="Location scope" icon="map-pin">
    A template applies to **all locations** by default, or to a named subset. Use the subset when a site genuinely runs different hours rather than creating near-duplicate templates.
  </Accordion>
</AccordionGroup>

## Draft and published

A template starts as a **draft**. Drafts can be edited freely and are invisible to the rest of the system.

<Warning>
  **A draft template cannot be rostered.** Publish it before you try to assign anyone to it, or the roster will not offer it.
</Warning>

Publishing makes it available for assignment. Published templates remain editable — changes apply from the moment they are saved, and days already reconciled are not retroactively re-judged unless something else causes them to re-derive.

## Building one

<Steps>
  <Step title="Start from an existing template if you can">
    **Duplicate** copies every field into a new draft. Two shifts that differ only in start time should be a duplicate-and-edit, not two hand-built templates that will drift apart.
  </Step>

  <Step title="Set the timing">
    Start, end, break and working hours. The editor shows a **daily timeline** you can drag — the grace and overtime zones update live as you move the handles, which is the fastest way to sanity-check a shift.
  </Step>

  <Step title="Set the policy numbers">
    Grace, half-day cutoff, weekly offs, overtime thresholds and multipliers.
  </Step>

  <Step title="Scope it">
    All locations, or a named subset.
  </Step>

  <Step title="Publish">
    Only then can it be assigned.
  </Step>
</Steps>

<Note>
  **Overnight shifts render the timeline read-only.** A shift crossing midnight cannot be dragged; set its times numerically.
</Note>

## Insights

An existing template's editor carries side panels driven by real data:

* **Assigned employees**, broken down by location.
* **Impact preview** and a **compliance check**, derived from the template's own policy fields — working hours against statutory expectations, break adequacy, overtime caps.
* **Recent edits**, from the audit log.

A brand-new, unsaved template shows empty states rather than fetching.

## Deleting

Deleting a template that employees are assigned to, or that day records reference, is refused. Reassign first.

<Tip>
  The template list's toolbar is deliberately minimal — there is no CSV import/export of templates, and the grid/list toggle and search chips are not wired. Templates are a small, slow-changing set; build them in the editor.
</Tip>
