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

# HVC Management

> The repair loop for serialised components.

When a serialised component comes off a vehicle, it does not simply vanish into a store. It
goes to a supplier, gets repaired, and comes back. This page tracks that journey.

The page is a single grid of components in the loop, with a repair drawer for each. It
deliberately **excludes mounted components** — it shows what is out of service and being
worked on.

It has no component record of its own: it drives the status and location of the component on
the [Components](/pages/components) page, so repair state is visible wherever the component
appears.

## The loop

```mermaid theme={null}
stateDiagram-v2
    MOUNTED --> DISMOUNTED: import
    DISMOUNTED --> IN_TRANSIT: send to supplier
    IN_TRANSIT --> UNDER_REPAIR: receive at supplier
    UNDER_REPAIR --> IN_TRANSIT_BACK: send back
    IN_TRANSIT_BACK --> IN_STORE: receive in stock
    DISMOUNTED --> IN_STORE: receive in stock
    IN_STORE --> MOUNTED: import
    DISMOUNTED --> SCRAPPED: scrap
    IN_TRANSIT --> SCRAPPED: scrap
    UNDER_REPAIR --> SCRAPPED: scrap
    IN_TRANSIT_BACK --> SCRAPPED: scrap
```

| Action                  | Transition                                                                             |
| ----------------------- | -------------------------------------------------------------------------------------- |
| **Send to supplier**    | `DISMOUNTED` → `IN_TRANSIT`                                                            |
| **Receive at supplier** | `IN_TRANSIT` → `UNDER_REPAIR`                                                          |
| **Send back**           | `UNDER_REPAIR` → `IN_TRANSIT_BACK`                                                     |
| **Receive in stock**    | `IN_TRANSIT_BACK` → `IN_STORE`, or `DISMOUNTED` → `IN_STORE` when no repair was needed |
| **Scrap**               | From any of the four in-loop states. A comment is **required**                         |

Every transition writes an entry in the component's history, recording who moved it, when,
and any comment.

## Where the manual loop begins and ends

`MOUNTED` and the initial `DISMOUNTED` are **not** manual transitions. They are set by the
daily [`vehicle_configurations`](/data/files/vehicle-configurations) import, which is what
knows whether a component is fitted.

So the loop is entered when an import dismounts a component, and it ends at `IN_STORE`, which
has no manual successor. The component returns to service only when a later import mounts it
again. `SCRAPPED` is terminal.

<Warning>
  The import **rejects the entire file** if it tries to mount or dismount a component that is
  `IN_TRANSIT`, `IN_TRANSIT_BACK`, `UNDER_REPAIR` or `SCRAPPED` — a part in those states cannot
  physically be on a vehicle. If a configuration file fails on this, the fix is to complete or
  correct the repair-loop state first.
</Warning>

## Location

`current_location` answers "where is this thing right now", and it is set from two directions:

* **Send to supplier** and **receive in stock** set it to whatever location you supply.
* **Mount and dismount imports** set it to the vehicle number when fitted and the depot when
  dismounted.

`Receive at supplier`, `send back` and `scrap` leave it unchanged, so a component
`UNDER_REPAIR` continues to show the supplier recorded when it was sent.

<Note>
  Location is **optional** on the two actions that set it, and omitting it **clears** the field
  rather than preserving the previous value. If you want to keep a location, re-enter it.
</Note>

<Card title="Field reference" icon="table" href="/data/tables/high-value-components">
  `component_status_update`, `component_comment` and `component_attachment`. The status
  itself lives on [`assets_component`](/data/tables/assets).
</Card>

## Comments and documents

Components carry a timeline of status changes, comments and uploaded documents, in the same
shape as warranty claims. Status entries are immutable; comments and attachments can be
edited or removed by their author.

## Who can do what

| Role                  | Capabilities                                                                                                                     |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **Component Manager** | Every transition in the loop, plus comments and documents                                                                        |
| **Asset Manager**     | Read the repair list, detail and history; **may post comments and upload documents**, but cannot move a component between states |
| **Project Admin**     | Everything above                                                                                                                 |
