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

# Schedule Templates

> Define and manage reusable recurring activity templates for Recovery Housing programs, including activity type, day of week, time, and mandatory status.

The Schedule Templates screen lets staff define recurring activity patterns for Recovery Housing at `/rh/schedule-templates`.

## Overview

The Schedule Templates screen fetches all `rh_schedule_templates` records (excluding soft-deleted rows) scoped to the current organization, ordered by `template_name`. Records are displayed as a card grid. Each card shows the template name, activity type badge, day-of-week badge (Sun–Sat), a "Mandatory" badge when `is_mandatory` is true, and the `activity_time`. The "New Template" button opens an inline `ScheduleTemplateDialog` to create a new template. Filtering by program, site, activity type, mandatory status, and active status is supported at the hook level.

## Who it's for

Protected by `RH_PERMISSIONS.DASHBOARD_VIEW` (`rh.dashboard.view`) via the shared `RHViewGuard` on all RH routes. No additional per-route permission gate exists for `/rh/schedule-templates`.

## Before you start

* Your account must have the `rh.dashboard.view` permission.
* At least one program (`rh_programs`) must exist to associate templates with a program.

## Steps

<Steps>
  <Step title="Navigate to Schedule Templates">
    Open Recovery Housing and select Schedule Templates from the navigation, or go directly to `/rh/schedule-templates`.
  </Step>

  <Step title="Review existing templates">
    Browse the card grid. Each card shows the template name, activity type, day of the week, scheduled time, and whether the activity is mandatory.
  </Step>

  <Step title="Create a new template">
    Click "New Template" to open the template creation dialog. Fill in the template name, activity type, day of week, activity time, and mandatory status.
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="Day of week">
    The `day_of_week` field stores an integer (0 = Sunday through 6 = Saturday). The card display maps these to three-letter abbreviations (Sun, Mon, Tue, Wed, Thu, Fri, Sat). A `null` value renders as "N/A".
  </Accordion>

  <Accordion title="Mandatory activities">
    Templates with `is_mandatory = true` are highlighted with a Mandatory badge. Confirm with your SME whether mandatory designation has enforcement logic in attendance or compliance tracking.
  </Accordion>

  <Accordion title="Soft delete">
    Templates are soft-deleted via a `deleted_at` timestamp. The query excludes records where `deleted_at` is not null; deleted templates do not appear on this screen.
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Recovery Housing" icon="house" href="/rh/references">
    Recovery Housing references and overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/rh.tsx
  * src/cores/rh/pages/ScheduleTemplatesPage.tsx
  * src/cores/rh/hooks/useScheduleTemplates.ts
  * src/platform/permissions/constants.ts
</Accordion>
