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

# PMS Templates

> The workspace's library of reusable multi-tab factory Excel templates the Style MO create wizard draws from to generate the factory's production-meeting-spec workbook.

The **PMS Templates** page — reached from the **Admin & configuration**
sidebar group — is the workspace's library of reusable multi-tab
factory Excel templates. Each template is an `.xlsx` workbook your team
has agreed is the right house-style layout for the multi-tab
production-spec workbook the workspace issues to the factory. When a
merchandiser opens the **Style MO** create wizard for an order's
style, the wizard's template picker reads from this library, the
chosen template's mapped sheets are filled with the style's data and
the customer's brand-tab attachments, and the result is the
<Tooltip tip="The factory-facing production-meeting-spec workbook generated for a style's MO, filled from a PMS template.">[PMS document](/reference/glossary#pms-document)</Tooltip>
the factory works to.

A workspace can hold as many templates as it needs — one per factory,
one per customer house style, one for short runs versus full runs — and
the team picks the right one at the point the MO is created.

## What it is

A single page under **Admin & configuration → PMS Templates** with two
regions:

* An **Upload Template** card for adding a new template.
* A **Saved Templates** list — one row per template — with the actions
  you take on it from here.

A **template** holds three things: the workbook itself, a name (and an
optional description), and a per-sheet mapping that tells the platform
which sheet in the workbook to fill against which kind of factory data.

## Why it exists

Factory production-spec workbooks are a strong house-style document.
Different customers, different factories, and different product lines
each want the workbook laid out differently — which sheet is on top,
which columns appear, which logo sits in the corner, which language
the labels are in. The team that built the workspace knows those
preferences; the platform should not.

PMS Templates lets your team curate the workbook layouts the workspace
actually uses, once, in one place. Each style MO then **picks** a
template instead of building one from scratch. The workbook stays the
team's; the platform fills it.

## When it is used

* **At workspace start-up**, to upload the first round of factory
  templates so the team has something to pick from when they start
  raising MOs.
* **When a new factory or customer joins** and the team agrees on a
  new house-style workbook for them.
* **When an existing template needs a refresh** — a new column, a
  reordered sheet, a refreshed logo — at which point a new template is
  uploaded (or an existing one is cloned and revised) and the team
  starts picking the new one going forward.
* **When the team retires a template** and wants to remove it from the
  picker.

You reach the page from the sidebar under **Admin & configuration →
PMS Templates**.

## Dependencies

* The `.xlsx` workbook itself, prepared offline by the team. The page
  is the upload point, not an editor — the workbook is built in Excel
  and uploaded here.

There are no upstream master records PMS Templates depends on; the
library is the upstream master itself.

## What depends on it

* The **Style MO create wizard** reads from this library when a
  merchandiser creates a new
  <Tooltip tip="The production document issued for a specific order's version of a style; its content is frozen when it is issued.">[manufacturing order](/reference/glossary#mo-manufacturing-order)</Tooltip>
  for an order's style. Picking a template is step one of the wizard.
  See [Production](/modules/production) for where MOs sit in the broader
  production flow.
* The **PMS document** the wizard generates — the workbook the factory
  actually opens — is filled against the chosen template's per-sheet
  mapping. The document keeps the template it was generated from on
  file for reference.

The PMS document the factory works to is the immediate downstream
artifact. Removing a template that is still referenced by a draft PMS
document is blocked (see [Business rules](#business-rules)).

## The five target slots

A template's workbook can contain any number of sheets, but each sheet
the platform fills must be mapped to one of five target slots. Each
slot corresponds to a kind of content the platform knows how to route
into the workbook:

* **Grading** — the per-order-style POM × size grid, rendered from the
  finalised
  <Tooltip tip="The per-style, per-order size-and-tolerance reference the team grades a sample to.">[grading table](/modules/grading)</Tooltip>
  built on the workspace's
  <Tooltip tip="The reusable catalog of measurement points used in grading and fitting specs.">[POM Library](/admin/pom-library)</Tooltip>.
* **Sample review** — the customer's sample review comments, attached
  on the MO create wizard from a brand-tab library item.
* **Packing** — the customer's packing instructions, attached on the
  MO create wizard from a brand-tab library item.
* **Production notes** — the customer's production notes, attached on
  the MO create wizard from a brand-tab library item.
* **Style detail** — the customer's style detail drawings, attached on
  the MO create wizard from a brand-tab library item.

The five slots are fixed by the platform; your team decides *which
sheet in your workbook* fills *which slot*. A workbook may include
sheets the platform does not fill (cover sheets, the platform-rendered
Order-quantities, BOM, and Spec tabs, legal appendices, blank pages),
and those sheets ride through to the factory workbook untouched.

## Uploading a template

To add a template:

1. In the **Upload Template** card, give the template a `Template Name`.
   Use a name the team will recognise on the picker — for example, the
   factory or house-style the workbook is for.
2. Pick the `.xlsx` workbook from your computer.
3. The platform runs a quick validation pass on the workbook and shows
   the result on the card — whether the workbook is in a shape the
   platform can fill, plus any warnings worth knowing about before you
   commit.
4. Choose "Upload" to commit the template to the library.

A freshly-uploaded template is in the library but is not yet mapped —
the platform does not know which sheet should hold which kind of data
until you open the sheet-name mapping editor and tell it (see below).
A template without a mapping can still be picked by the wizard, but
the platform will not fill any sheet until at least one mapping row
exists.

## Mapping sheets to target slots

Each saved template has a **Sheet Name Mapping** editor — opened from
the template's row in the list. The editor is where you tell the
platform which sheet in your workbook fills which target slot.

Each row in the editor is a pair:

* The **source sheet name** — the title of the sheet inside the
  workbook (for **Grading**) or inside a brand-tab library Excel
  (for the other four slots), typed **exactly** as it appears,
  including any leading or trailing spaces. The platform matches by
  exact title.
* The **target slot** — one of **Grading**, **Sample review**,
  **Packing**, **Production notes**, or **Style detail**, chosen from
  a dropdown.

<Warning>
  Sheet-name matching is exact, whitespace included. `包裝資料` and
  `包裝資料 ` (with a trailing space) are two different names to the
  platform. A brand-tab Excel whose source sheet name differs from the
  mapping by so much as a trailing space will not attach, and the
  target tab on the generated workbook will render header only.
</Warning>

Add as many rows as the workbook has sheets you want filled. A sheet
not listed in the mapping is left alone — useful for cover pages,
platform-rendered tabs (Order quantities, BOM, Spec), or appendices
you do not want the platform to touch. "Save" commits the mapping to
the template.

A mapping can be edited at any time. Editing a template's mapping does
**not** rewrite any PMS document already generated from that template —
each document keeps the mapping that was on the template at the moment
it was generated.

## Cloning a template

The **Clone** action on a template's row makes a copy of the template
under a new name you type. The clone keeps the original workbook and
the original mapping; the team can then tweak either independently of
the source. Cloning is how the team forks a template — typically when
a new customer wants the same house-style with a different logo or one
column added.

The clone is tagged on the list so the team can see at a glance which
templates were forked from which.

## Marking a template active or inactive

A template carries an **Active** / **Inactive** flag. An inactive
template stays in the library — it does not vanish, and any PMS
document already generated from it still references it — but it is
not offered to the wizard's picker when a new MO is being created.
Inactivating a template is how the team retires it from new use
without losing the history of what was generated from it.

## Marking one template default

One template can be tagged **Default**. The default is what the
wizard's template picker pre-selects when a merchandiser opens the
MO create wizard — the team can still pick a different template for
the specific MO, but the default is the "if no one says otherwise"
choice for the workspace.

## Deleting a template

The **Delete** action removes a template from the library entirely.
It is destructive — the workbook itself is removed from the workspace
— and it cannot be applied to a template that is still in use:

* A template that is referenced by any PMS document still in
  **Draft** cannot be deleted. The delete is refused and the team is
  prompted to either inactivate the template instead or open the
  draft documents and finish or remove them first.
* A template that has only been used by issued PMS documents — that is,
  documents that have moved past **Draft** — *can* be deleted; the
  issued documents keep the template they were generated from on file,
  but no new MO can pick the template after it is gone.

In practice, the team's reflex is to **inactivate** rather than
delete: an inactive template can no longer be picked by the wizard,
but the audit trail of what the workspace used to use stays intact.
Delete is for templates that were uploaded by mistake or never
adopted.

## Who can manage templates

Template management is **role-gated**:

* **Administrators** and **Merchandisers** can upload, clone, edit, and
  inactivate templates.
* **Delete** is restricted to **administrators** only.

Other roles see the page but cannot change what it holds. The page is
intentionally narrow — most of the workspace only ever consumes
templates through the MO create wizard's picker, and the curation of
the library is one of the admin / merchandiser team's responsibilities.

## Business rules

1. **A template is an `.xlsx` workbook, a name, and a per-sheet
   mapping.** The workbook is built in Excel offline; the platform is
   not an editor for the workbook itself.
2. **Each mapped sheet has a target slot.** A slot is one of
   **Grading**, **Sample review**, **Packing**, **Production notes**,
   or **Style detail**. Sheets not listed in the mapping are left
   alone.
3. **Sheet-name matching is exact, whitespace included.** A leading
   or trailing space on a source sheet name is enough to prevent the
   attachment. Rename the sheet to match the mapping character for
   character.
4. **One template may be tagged Default.** The default is what the
   MO create wizard pre-selects.
5. **An inactive template stays in the library but is not offered to
   new MOs.** Documents already generated from it still reference it.
6. **A template referenced by any Draft PMS document cannot be
   deleted.** Inactivate it instead, or finish or remove the draft
   documents first.
7. **Administrators and Merchandisers manage templates; Delete is
   Administrator-only.** Other roles can see the page but not change
   it.
8. **Editing a template does not rewrite any PMS document already
   generated from it.** Each PMS document keeps the template (and the
   mapping at the moment of generation) it was filled from.

## Best practices

* **Name templates so the picker is self-explanatory.** A
  merchandiser opening the MO wizard sees the template name — make
  sure the name tells them which factory or house-style the template
  is for.
* **Map every sheet you want filled, and only those.** A sheet not in
  the mapping is left blank; a sheet mapped to the wrong slot is
  filled with the wrong data. The mapping editor is the small piece
  of plumbing that makes the workbook flow.
* **Watch for whitespace on source sheet names.** The single most
  common cause of a target tab rendering header only is a leading or
  trailing space on the source sheet name inside a brand-tab Excel.
  Copy the exact name from the mapping when you build or rename the
  sheet.
* **Use Clone to evolve a template.** Cloning preserves the team's
  audit trail of what changed and when, far better than overwriting
  a workbook in place.
* **Prefer Inactivate over Delete when retiring a template.** An
  inactive template stops appearing in the picker but keeps the
  history of every PMS document that was generated from it.
* **Curate the library — do not let it sprawl.** A picker with six
  good templates is more useful to the team than one with thirty
  near-duplicates. Inactivate the ones no one is picking any more.

## Related pages

* [Build a manufacturing order (MO)](/modules/build-an-mo)
* [Setting up your tenant](/admin/setting-up-your-tenant)
* [POM Library](/admin/pom-library)
* [Production](/modules/production)
* [Styles](/modules/styles)
