# Set Up for Maintenance

Before you raise work orders, agree the lists that classify them. They drive the filters, the KPIs and the backlog. A
standard install already has a working set, so most of this lesson is review.

## Know the Four Lookups

| Lookup | Classifies | Out of the box |
| --- | --- | --- |
| Maintenance type | The work order | Corrective, Inspection, Predictive, Preventive, Project |
| Work type | A technician's labor on a work order | Added under a maintenance type, such as Corrective\Forklift Damage |
| Priority | How urgent the work order is | Low, Medium, High, Urgent |
| Status | Where the work order is in its workflow | Open, Assigned, In Progress, On Hold, Completed, Cancelled |

Maintenance types and work types are separate on purpose. A Preventive work order can still have one technician log Repair
time and another log Inspection time.

## Open the Lookups

1. Open **Configuration → Maintenance → Work Orders**.
2. Use the tabs across the top: **Work Orders**, **Version Status**, **Types**, **Priority** and **Status**.
3. On the **Types** tab, review the maintenance types and their work types.
4. On the **Priority** tab, review the priorities.
5. On the **Status** tab, review the statuses and the category each one belongs to.

You can change a priority or add a new one, and add custom maintenance types and statuses.

{/*
TODO: Confirm on a gateway how to add a maintenance type, work type, priority or status (buttons and fields). The docs
only say they can be added. The Developer Training adds work types on the Types tab. Also confirm where each lookup's color
and enabled flag are set, since the docs say Work Types have a name, enabled flag, color and sort order.
*/}

## Keep Statuses in the Right Category

Statuses fall under categories. This lets several statuses count as the same thing, such as two states that both mean
Closed, or two that both mean Waiting. You can add your own statuses and the analytics still work, as long as each one is in
the right category.

![Work order statuses and their categories](https://docs.kanoa.ai/img/cmms/states.png)

::embed-section{src="../../kanoa-cmms/workOrderTemplate.md#work-flow-status" collapsed="true" summary="Reference Materials: Work Flow Status - Statuses and their categories."}

::embed-section{src="../../kanoa-cmms/workOrderTemplate.md#priority" collapsed="true" summary="Reference Materials: Priority - The default priorities and how to change them."}

::embed-section{src="../../kanoa-cmms/workOrderTemplate.md#maintenance-types" collapsed="true" summary="Reference Materials: Maintenance Types - Types and the work types under them."}

## Add Technicians

Technicians are Kanoa users. They log in, they're assigned work orders, and each one logs their own time against a work
order. The work types they choose come from the Work Type lookup.

### What You Need: Configure Security

Adding a user and giving them a role both need the **Configure Security** security function. Out of the box, the
**Maintenance Manager** role doesn't have it, so an administrator adds technicians for you. If your plant wants you
to add your own technicians, your administrator can add Configure Security to the Maintenance Manager role. They only
need to do this once.

:::action[Give the Maintenance Manager role Configure Security (administrator)]

1. Open **Configuration → Users**, and go to the **Roles** tab.
2. Find the **Maintenance Manager** row and tick **Configure Security**. The change is saved as soon as you tick the box.
3. Make sure each Maintenance Manager has the **Maintenance Manager** role on the assets their technicians look after,
   such as their area. The Users screen only lets you give roles on the assets where you have Configure Security.

:::

:::warning[Configure Security is more than adding technicians]
Kanoa has no narrower function just for adding technicians. Configure Security also lets the user:

- edit and delete users, and give them any role on their assets, including **Administrator**;
- create and delete roles, and change which functions a role has, for every user who has that role, on every asset.

Only a Gateway Admin can make someone a Gateway Admin. If that's more than a Maintenance Manager should have, leave the
role as it is and keep adding technicians through your administrator. Another option is a custom role, such as
**Maintenance Lead**, that has Configure Security, given only to the people who need it. See
[Users and Roles](../1-administrator/1-users-and-roles.md).
:::

### Add a Technician

Once you have Configure Security:

:::action[Add a technician]

1. Open **Configuration → Users**, and go to the **Users** tab.
2. Click the **+** button, enter the technician's **first name** and **last name**, and save the user.
3. Select the new user and click the edit button, or double-click the user.
4. Open the **Roles** tab, select **Maintenance Technician**, and use the asset selector to pick the assets they look
   after.

:::

The technician can now sign in, and you can assign them work orders on those assets. When someone leaves, take away
their roles, or delete the user. The Administrator track's [Users and Roles](../1-administrator/1-users-and-roles.md)
lesson covers each step in more detail.

{/*
TODO: Confirm on a gateway that a user with only the Maintenance Manager role plus Configure Security sees the + button
on the Users tab, sees only the users and assets of their own area, and can give the Maintenance Technician role. The
code (securityTable userAction, userEdit asset picker, SecurityAuthorization) says yes. Also confirm that a user with
only the Maintenance Technician role (Enter Work Orders) can sign in, see the asset and be assigned and work its work
orders.
*/}

::embed-section{src="../../kanoa-cmms/workOrderTechnicians.md#work-types" collapsed="true" summary="Reference Materials: Work Types - The lookup that describes a technician's labor."}

## Worked Example

The CoreForge sample plant adds three work types, the same as Developer Training. It also adds a `technician` user with
the Maintenance Technician role on Machine 1.

::embed-section{src="../../training/7-training-maintenance/01-maintenance-setup/1-lookups-and-technicians.md#review-and-extend-the-lookups"}

## Check Your Understanding

1. What is the difference between a maintenance type and a work type?
2. Why does each status belong to a category?
3. Where do you review the priorities?
4. What security function do you need to add a technician, and what else does it let you do?

<details>
<summary>Answers</summary>

1. A maintenance type classifies the work order. A work type describes the labor a technician logs against it.
2. Categories let several statuses count as the same thing, such as Closed or Waiting, for filtering, KPIs and backlog analysis.
3. On the **Priority** tab in **Configuration → Maintenance → Work Orders**.
4. **Configure Security**. It also lets you edit and delete users, give them any role on your assets, and change which
   functions each role has.

</details>
