# Corrective Actions Module

The Corrective Actions module tracks follow up tasks for Occupational Health & Safety incidents. Each action records what needs to be done, who is responsible and when it should be completed. Sign‑offs can be captured as evidence that the work was performed.

## Database Schema

### ohs_actions
- `id` SERIAL primary key
- `incident_id` reference to `ohs_incidents`
- `description` TEXT
- `responsible_user_id` INT nullable
- `target_date` DATE nullable
- `status` VARCHAR(50) nullable
- `completed_at` TIMESTAMP nullable
- standard `tenant_id`, `branch_id`, `isDeleted`, `updatedAt`

### ohs_action_signoffs
- `id` SERIAL primary key
- `item_id` INT – id of the action or root cause
- `item_type` VARCHAR(20) (`action` or `root_cause`)
- `user_id` INT
- `signature` TEXT nullable
- `document_id` INT nullable
- `signed_at` TIMESTAMP
- audit columns as above

### ohs_incident_logs
- `id` SERIAL primary key
- `incident_id` INT
- `action` VARCHAR(50)
- `details` TEXT nullable
- `user_id` INT nullable
- `logged_at` TIMESTAMP
- tenant/branch/audit columns

## Controllers
- **OhsActionsController** – CRUD for `ohs_actions` and `/signoff` endpoint.
- **OhsActionSignoffsController** – standard CRUD on `ohs_action_signoffs`.
- **OhsDashboardController** – `action_status` report summarising open and overdue actions.
- **OhsIncidentsController** – checks that all actions are signed off before an incident can be closed.

## Incident Options

The "Add Action" form stored in `forms` references the `incident_id` field with `options_table: "ohs_incidents"`. This means the Incident drop‑down is populated from the OHS Incidents table so users can link each corrective action to an existing incident.

Open the **OHS Actions** modal from the dashboard to list current actions and create new ones.
