# Corrective actions

A React block (a whole screen) in [Beamline](https://beamline.io/)'s [Construction](https://beamline.io/components/apps/construction) app. Live demo: https://beamline.io/components/corrective-actions

A corrective action raised from a failed inspection answer, for food safety, facilities or quality teams. The answer, its photo and note are pinned above and frozen ("this answer stays as it was when the action is fixed"). Open actions at the site that may be about the same thing are offered first, to link instead of making a duplicate. The form asks what needs doing, who does it, the due date and time, the priority (high in the warning tint, critical in the danger tint) and who can see it, said back as a sentence naming the person, their team and the managers. The action is then followed: open, overdue in the danger tint, fixed with how; the fix shows beside the answer, which still reads as recorded. Wide: the answer and any open action that may be the same on the start side, the action on the other; priority and who can see it fold into one line ("High · seen by their team") that opens them.

## Use it for

- Turning a failed inspection answer into an owned fix with a due time, without rewriting what was found.
- Where duplicates of the same problem must be caught before another action is made.

## Not for

- Reviewing a whole unit's inspection ([inspection-review](https://beamline.io/components/inspection-review)).
- Photo checks against control points ([quality-checks](https://beamline.io/components/quality-checks)).
- Scheduling maintenance jobs ([work-orders](https://beamline.io/components/work-orders)).

## Anatomy

- header: the product's mark, the title, the inspection and site
- finding: the answer in its tone, the question, the photo, the note, who recorded it and when (frozen), the fix beside it once done
- similar open actions, each with Link to this one
- the form: what, details, who, due date and time, priority, who can see it and its sentence, Create the action
- the action: its id and title, open, overdue or fixed, who, due, priority, details, how it was fixed and Mark fixed

## States

- a failed answer, a passing one
- similar actions offered, linked (no new action made)
- the form: incomplete (Create waits), creating, created, refused (kept)
- the action: open, overdue, fixing, fixed (beside the answer, the answer unchanged)
- phone: one column
- right to left: mirrors

## Keyboard

- Tab through each Link to this one, the form's fields, priority and visibility, Create; then the fix note and Mark fixed

## Motion

None of its own.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `response` (required) | `InspectionResponse` | — |  |
| `similar` | `CorrectiveAction[]` | — | Open actions at this site that may be about the same thing. |
| `people` (required) | `ActionPerson[]` | — |  |
| `managers` | `string[]` | — | Managers who see every action, by name. |
| `onCreate` | `((draft: Omit<CorrectiveAction, "id" \| "status">) => Promise<CorrectiveAction>)` | — | Create the action from the draft; resolve with it as saved. |
| `onLink` | `((actionId: string) => Promise<void>)` | — | Link this answer to an action that already exists instead of making another. |
| `onFix` | `((actionId: string, note: string) => Promise<CorrectiveAction>)` | — | Record the fix; the inspection's answer is left as it was. |
| `defaultAction` | `CorrectiveAction \| null` | — | An action already made from this answer. |
| `now` | `string` | — |  |
| `product` | `string` | — |  |
| `className` | `string` | — | Classes on the documented visual root; no override by default. |
| `ref` | `Ref<HTMLDivElement>` | — | Receives the documented native target or imperative handle; omitted by default. |

## Built from

- collapsible

## Dependencies

`lucide-react`

## Import

```tsx
import { CorrectiveActions } from "@beamline/corrective-actions";
```

## Get it

Corrective actions is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. [Get Beamline](https://beamline.io/checkout?pack=complete) · [Connect your agent](https://beamline.io/connect)

## More in Construction

- [Submittal register](https://beamline.io/components/submittal-register): The documents a trade owes a project before its material is bought, on the clocks that matter: a log whose rows each draw their way to site on one shared…
- [Change orders](https://beamline.io/components/change-orders): Change orders against a contract, with the money drawn where it stands: one bar of the original contract, each approved change, a line at the current…
- [Inspection review](https://beamline.io/components/inspection-review): A unit's inspection, reviewed in three views. Findings: rooms and features with their condition, answers, notes and photos, and each feature's…
- [Work orders](https://beamline.io/components/work-orders): A maintenance work order that coordinates subtasks: the children's progress drawn by status with cancelled ones counted apart, the parent completed on…
- [Action center](https://beamline.io/components/action-center): Everything waiting on a person across projects: a strip of every open item on the days ahead, one lane per kind of owing (You submit, You answer, Tasks…
- [Company access](https://beamline.io/components/company-access): A project's companies as one board: No company first (office access waits for a company, and says so), then each company with its code and its people…
- [Condition checklist](https://beamline.io/components/condition-checklist): An inspection by area. Each item marked good (success), soon (warning) or needs work now (danger), or not checked yet and kept apart below; what was…
- [Quality checks](https://beamline.io/components/quality-checks): Quality checks by picture and the control points that make them. A check asks for one photo: an upload that fails keeps its file with Try again, and…
- [Maintenance plan](https://beamline.io/components/maintenance-plan): Maintenance of shared equipment. The instruments, most urgent first, each with its most pressing kind and how due it is (overdue, due soon, fine, never…
- [Maintenance plans](https://beamline.io/components/maintenance-plans): An operations team's maintenance plans. The queue lists every asset-plan pair (one machine can appear under two plans) with its last service, next due…
- [Equipment register](https://beamline.io/components/equipment-register): A business's machines and vehicles: a register filtered by status (in use, in repair, sold, each counted) with each machine's photo or type icon…
- [Asset workspace](https://beamline.io/components/asset-workspace): One physical asset: a machine, vehicle or piece of plant. Its header keeps the system id apart from the name and serial, with type, site, status and the…
- [Asset packs](https://beamline.io/components/asset-packs): Packs of assets (sounds, presets, fonts), the providers they come from and the storage they take. Download and install are two phases with their own…
- [Instrument use](https://beamline.io/components/instrument-use): Shared instruments. The slot search reads as one sentence (how long, which instrument type, the dates and the working hours with the lab's time zone)…
- [Job booking](https://beamline.io/components/job-booking): A customer books a home or field-service job on the company's own site, phone first. Services with how many units, each unit adding its time and price…
- [Job booking setup](https://beamline.io/components/job-booking-setup): Online booking for a field-service company, set up from three sides that feed one booking form. Services: each priced and timed per unit with whether it…
- [Rental availability](https://beamline.io/components/rental-availability): A rental shop's availability: a product's month for the quantity a customer wants (each day available, some left with the count, booked out or not known…
- [Rooms & equipment](https://beamline.io/components/resource-setup): A salon's or clinic's rooms and equipment and what its services need of them: resources by group at each location, how many appointments each holds at…
- [System pages](https://beamline.io/components/system-page): The four pages a product shows when the normal one cannot: page not found (search and the likely places), something broke (try again, an error id to…

Part of [Beamline UI: polished, editable React components and complete screens for custom applications](https://beamline.io/). [Build your own style from any look; tokens, fonts, radii, motion; not only colours](https://beamline.io/docs/customize).
