# Project plan — ipw-frontend

Evidence date: 2026-10-11.

Source of implementation truth: `git@bitbucket.org:overdrive/ipw-frontend.git`, branch `main`, commit `798bd76` (2025-06-03, Jason Wandrag, "Fix document upload naming convention"). The scan-host path `~/projects/sonar_scan/repos/ipw-frontend` was not on this machine. The tree was read from that git revision.

There was no existing `silicon_ark/ipw-frontend/` set. The application repository contains `README.md`, `.env.template`, and `nuxt_runtime_keys.readme`. The README describes a GitHub monorepo layout (`cd client/`) and npm scripts that are not in `package.json`. This plan treats the Nuxt tree at the repository root as what is implemented, and marks the README when it describes a different layout.

## Product

**Documented** in `README.md` and `package.json`: this is the "IPW client application" (`ipw-client` 0.0.2, author Craig van Tonder, license `UNLICENSED`, `private: true`). The README lists public information routes and a small set of authenticated member routes.

**Implemented.** A Nuxt 3 static client (`ssr: false`, `target: 'static'`) for the Integrated Production of Wine (IPW) public site and member/staff portal. It does not contain a server, a database, or a deploy script. API calls go to `NUXT_API_LOCATION`.

**Related Silicon Ark sets, not this repository:**

- `ipw_new` documents a NestJS API plus a Nuxt client whose `package.json` also names `ipw-client` 0.0.2 with the same author. That set's tip is `111772e` (2025-05-26). This frontend's application import is `37208b5` (2025-05-28), and its tip is one commit later. A file-by-file diff against `ipw_new/client` was not performed. Whether `ipw-frontend` is that client extracted to its own repository is **Unknown / Requires Confirmation**.
- `ipw-php` documents a CodeIgniter 4 IPW application whose `main` was still moving in September 2026. This frontend's last commit is 2025-06-03. Whether `ipw-frontend` is the live UI, a superseded rewrite, or unused is **Unknown / Requires Confirmation**.

This plan does not copy requirements from those sets.

## Branch reality

| Line | Tip | Date | What it is |
|---|---|---|---|
| `main` (the only branch in this clone) | `798bd76` | 2025-06-03 | Default line. 5 commits, all on 2025-05-28 except the last |

| Commit | Date | Author | What it changed |
|---|---|---|---|
| `ea2158b` | 2025-05-28 | Jaco Brits | Initial commit |
| `0595e8d` | 2025-05-28 | Jaco Brits | `bitbucket-pipelines.yml` created online with Bitbucket |
| `d90178e` | 2025-05-28 | Jaco Brits | `sonar-project.properties` created online with Bitbucket |
| `37208b5` | 2025-05-28 | Jaco Brits | "first commit" — the Nuxt application |
| `798bd76` | 2025-06-03 | Jason Wandrag | Download URL gains the document id. Empty-state rows on two evaluation-form screens are commented out |

Nothing in git is dated after 2025-06-03.

## Objectives visible in the repository

No project plan or issue export is in git. The behaviour the tree actually describes:

1. Publish public IPW pages (home, cellars, about, manuals, forms, literature, audit, contacts, courses, climate, greenhouse gas, environment, links, contact) in English and Afrikaans, with PDF downloads.
2. Sign an existing user in against `{NUXT_API_LOCATION}/api/auth/login`, keep access and refresh cookies, and send the visitor to whatever path the API returns as `body.redirect`.
3. Let a signed-in person update contact details, request group membership, and run a control-product report (table and CSV).
4. Let roles named `System Developer` or `IPW Administrator` open staff screens that list users, live sessions, member activity, members, and groups, and that create or edit users and members.
5. Let selected roles upload and download member documents for a farm or cellar category.
6. Show administration screens for evaluation forms, member forms, probation, certificates, and SAWIS. Those screens are markup and sample rows. They do not call the API.

## Scope

### In `main` at `798bd76`

1. Nuxt 3 pages, layouts, middleware, and an `api/` client for `auth`, `user`, `admin`, `upload`, `report`, and `role`.
2. English (`en`) and Afrikaans (`afr`) strings in `i18n.config.ts` and page-local `<i18n>` blocks.
3. Static PDFs and images under `public/`.
4. `bitbucket-pipelines.yml` — SonarQube scan on `main` only. It does not build or deploy.
5. `.env.template` — `ENV`, `HOST`, `PORT`, `NUXT_API_LOCATION`. No secrets.

### Out of scope / not in this repository

- The API server, database, SMTP, and file storage. This client only calls them.
- Tests. No test runner, spec, or e2e file is in the tree.
- A Dockerfile, PM2 config, or hosting manifest.
- `sonarqube_scan.bat`. The onboarding snapshot listed it beside the git files. It is not in this revision.
- A working registration or email/password confirmation submit. The pages exist. The handlers do not complete the request. See the PRD.
- Any reference to `ipw-php` or `ipw_new`.

## System shape

```text
Browser
  → Nuxt static client (README and .env.template: 127.0.0.1:8080)
      → public pages and PDFs (no API)
      → fetch {NUXT_API_LOCATION}/api/...
            auth, user, admin, upload, report, role, csrf
```

Build scripts set the API host:

| Script | `ENV` | `NUXT_API_LOCATION` |
|---|---|---|
| `build:dev` | `development` | from the environment (template: `http://127.0.0.1:9000`) |
| `build:staging` | `staging` | `https://staging.ipw.co.za` |
| `build:production` | `production` | `https://ipw.co.za` |

`nuxt.config.js` does not set `devServer`. Whether `HOST` and `PORT` from `.env.template` are read by Nuxt is **Unknown / Requires Confirmation**. The README says the dev URL is `http://localhost:8080`.

## Major components

| Area | Path | Role |
|---|---|---|
| Routes | `pages/` | Public pages, member pages, admin pages, upload, login |
| Shell | `layouts/default.vue`, `app.vue` | Navbar, banner, sidebar, toast, loading, page title |
| Navigation | `components/Sidebar.vue` | Public links, role-gated links, language, profile picker |
| API | `api/*.js` | `fetch` wrappers, CSRF, bearer token |
| Session | `composables/useJwt.js`, `useCookies.js`, `middleware/` | Cookie JWT, refresh, route gates |
| Roles | `composables/useRoles.js`, `useAuth.js` | Numeric role ids and `user_class_id` |
| Copy | `i18n.config.ts`, page `<i18n>` | `en` and `afr` |
| Unused older UI | `forms/`, `notifications/`, `modules/data/` | Imported only by each other, not by `pages/` |

## Milestones visible in git

There is no milestone document. From the commits:

1. **2025-05-28 — repository and scan.** Empty initial commit, then Bitbucket pipeline and Sonar properties, then the application import (`37208b5`).
2. **2025-06-03 — download path.** `GET /api/upload/download-document/{id}` instead of a body-less `GET /api/upload/download-document`. Two evaluation-form tables stop showing their empty-state row.

No later milestone is in this repository.

## Dependencies known from the tree

- Node `^18.0.0` (`package.json` `engines`).
- Nuxt `^3.17.4`, `@nuxtjs/i18n` `^8.0.0-rc.4`, Bootstrap `^5.3.6`, Sass `^1.89.0`.
- An HTTP API at `NUXT_API_LOCATION` that implements the paths in `api/`. The server is not in this repo. Which repository serves `https://ipw.co.za` is **Unknown / Requires Confirmation**.
- Bitbucket Pipelines and a SonarQube server (`SONAR_HOST_URL`, `SONAR_TOKEN`). The host URL is not in git.
- Adobe Reader download (`https://get.adobe.com/uk/reader/`) from `components/Adobe.vue`, shown on pages that link PDFs.
- SAWIS public forms (`https://www.sawis.co.za/forms/sawis.php`) linked from `pages/registration.vue`.
- SWSA site (`https://www.swsa.co.za/`) linked from the sidebar image.

## Current status

The client on `main` can render the public site and can call login, profile, groups, reports, documents, and a subset of admin user/member endpoints. Large admin areas (evaluation forms, member forms, probation, certificates, SAWIS) are screens with sample data. Registration, confirmation, and the password-reminder success path do not complete as written. The pipeline scans; it does not ship the site.

`package.json` still points `repository`, `bugs`, and `homepage` at `https://github.com/WeboonTechnologySolution/ipw.co.za.com`. The git remote of this clone is Bitbucket `overdrive/ipw-frontend`. Whether the GitHub remotes still exist is **Unknown / Requires Confirmation**.
