# Create a compliance document template

A compliance document template holds the wording and layout of one document — an indemnity, a permit, a medical declaration or a contract. You write it once, choose the editor style, drop in context variables like {{ student_full_name }}, and PiGi renders a signed PDF from it every time the document is issued.

Source: https://help.pigi.io/guides/compliance/documents/document-templates

## Quick answers

**Where do I create a document template?**
**Compliance → Templates**, at /school/admin/compliance/documents/templates, then
press **+ Template**. Reading the list is open to any signed-in member; creating and
editing needs the company admin role.

**What are the four template types?**
**Indemnity**, **Permit**, **Contract** and **Medical**. The Type is what decides
which context variables the finished PDF can fill, and permits render with no page
margins so they fit a fixed provider layout.

**What does Purpose mean?**
**Activity Compliance** — the document burns a provider code (a permit or indemnity
tied to an activity). **General Contract** — an agreement with an instructor; picking
it forces Type to Contract. **Training** — a course document with no code.
Activity Compliance additionally asks for an **Activity** and a **Provider**.

**Can I change the editor style after I have saved?**
No. The style picker ("1 · Choose a template style") only appears while creating.
The hint on the step says so: "sets how you'll build the document. You can't change
this later."

**What are the five editor styles?**
**Rich Text** (word-processor, best for contracts), **Custom HTML** (full control,
best for permits and branded layouts), **Marketing / Visual** (drag-and-drop blocks),
**Markdown** (text-focused policies), and **Plain Text**.

**How do I insert a variable like the student's name?**
Use the **Context variables** panel on the right of the editor and click the variable.
In Custom HTML, Plain Text and Rich Text it is inserted at the cursor; in Markdown it
is appended to the end; in the block editor it is copied to your clipboard instead.

**What is the Background color swatch row for?**
It sets a colour applied behind the rendered document wherever the template contains
`{{ background_color }}`. The first swatch (a red diagonal line) means none.

**How do I get a starting template?**
When the list is empty a green **Load default templates** button appears. It offers
**SanParks Permit** and **SAHPA Indemnity**. Both are created as Activity Compliance
templates for the "Tandem Paragliding" activity and are locked from editing.

**Why is a template read-only?**
Either its **Scope** is **System** (a platform-owned template shared across schools —
a school gets a preview only), or it was created by "Load default templates", which
sets Can edit to No.

**Can I let people print and hand-complete the document instead?**
Yes. Switch on **Allow offline form** in the template details panel and attach a
blank PDF or Word file with **Upload blank form (PDF / Word)**. See "Offline forms".

## Steps

1. Open **Compliance → Templates** and press **+ Template**.
2. Step 1 — **Choose a template style**. Pick the editor you want; you cannot change
   it later.
3. In the **Template details** panel on the left, enter a **Name** and pick a
   **Purpose**. Both are required.
4. Pick a **Type**. The choices are filtered by Purpose: Activity Compliance hides
   Contract, General Contract forces Contract, Training offers all four.
5. For Activity Compliance, choose the **Activity**, then the **Provider** (the
   Provider field stays disabled until an Activity is picked).
6. Optionally pick a **Background color**.
7. Write the document in the centre editor, inserting variables from the **Context
   variables** panel on the right.
8. Use the eye icon in the editor toolbar to **Preview**, and the arrows icon for
   fullscreen.
9. Save. The template appears in the list with its Provider, Activity, Type, Scope,
   Company, Can edit and Purpose columns.

## Fields

| Field | Required | What to enter |
|---|---|---|
| Name | Yes | What the document is called, e.g. SAHPA Indemnity |
| Purpose | Yes | Activity Compliance, General Contract or Training |
| Type | Yes | Indemnity, Permit, Contract or Medical — drives the variables |
| Activity | Activity Compliance only | The activity the document covers |
| Provider | Activity Compliance only | The code-issuing authority, e.g. SAHPA |
| Background color | No | Swatch printed behind the document |
| Allow offline form | Switch | Lets people download, complete and re-upload a printed form |
| Upload blank form | With the switch on | The blank PDF / Word file people download |

## Known limitations

- **An unrecognised Type produces a blank PDF.** Only Indemnity, Permit, Contract and
  Medical resolve variables. Anything else renders every placeholder empty while the
  on-screen preview still looks correct.
- **The block ("Marketing / Visual") editor auto-exports every 10 seconds** and again
  on save; if you close the page very quickly after an edit the last change can be lost.
- **Deleting a template shows a confirmation that says "pilot recon"** — a wrong label
  on the delete dialog. It does delete the template.
- **The list filter is labelled "Code provider name"** and filters on the provider, not
  on the template name; use the search box for names.

## Related

- [Template variables](template-variables.md)
- [Compliance requirements](compliance-requirements.md)
- [Offline forms](offline-forms.md)
