# Project plan — pwa (1 for the Road)

Evidence date: 2026-09-28.

Source repository: `git@bitbucket.org:overdrive/pwa.git`.

Inspected revision: `master` at `50d7009` (2021-11-29, Russel, "blank form validation"). The scan-host path `~/projects/sonar_scan/repos/pwa` was not on this machine. The tree below was read from that git revision. Credential values in `api/config.php`, `scripts/1fortheroad.js`, `api/callback.php`, and the Google Maps key in `index.html` are omitted from this document.

This plan describes what the repository contains. It does not decide what the product should become.

## Product

**1 for the Road** (`1FortheRoad` in the page title and web-app manifest) is a mobile web page for booking a lift. A person enters a mobile number and either books as an existing client ("Member") or books with a voucher ("Non Member"). The page then stores a booking row and emails a trip summary.

Provenance: **Implemented** in `index.html` and `scripts/1fortheroad.js`. The success panel copy says "Thanks for booking with 1 FOR THE ROAD". No separate product brief or README exists in the repository.

The manifest `short_name` is still `AppKit`. The page shell, `scripts/custom.js`, SCSS, highlight themes, starter HTML files, and `plugins/` are a mobile PWA template. The booking behaviour sits on top of that template. Provenance: **Implemented**.

## Branch reality

| Line | Tip | Date | What it is |
|---|---|---|---|
| `master` (default; `origin/HEAD`) | `50d7009` | 2021-11-29 | The only branch. Booking page, PHP JSON API, template assets, Bitbucket FTP pipeline |

There are no other remote branches. History runs from `9349f17` (2021-04-02, "Initial commit") to `50d7009`. The last three product commits on 2021-11-29 are SMTP details changed to Gmail (`c034812`) and blank-form validation (`50d7009`).

Commit `60c4a92` (2021-05-14) is "init - pipeline setup app.1fortheroad.co.za". That is the only place the host name `app.1fortheroad.co.za` appears. The pipeline file itself uses `$FTP_HOST` and does not name the host. Whether that site still serves this tree is **Unknown / Requires Confirmation**.

The task-creation scan listed `sonar-project.properties` and `sonarqube_scan.bat` at the repository root. Neither file is in this clone. `sonar-scanner.bat` is present and is the stock SonarScanner 4.6.2.2472 Windows launcher; it does not name a Sonar project. Provenance: **Unknown** whether the two missing files were untracked on the scan host.

## Objectives (inferred from the page and API, not from a written plan)

No project plan or requirements document exists in the repository. The following objectives are **Inferred** from the screens and the SQL the API runs:

- Let an existing client identify themselves with a mobile number and book a pickup, drop-off, date, and time.
- Let a person who is not already a client book the same kind of trip if they supply a voucher code the server accepts.
- Create a client row when a voucher booking uses a cellphone that is not already in `tblClient`.
- Email `bookings@1fortheroad.co.za` a trip summary from the browser.
- Offer the page as an installable fullscreen web app, with the install prompts currently commented out of `index.html`.

A code comment in `api/api.php` says "voucher section needs to be build in webadmin". No web-admin application is in this repository. Provenance: **Planned** relative to this repo, and **Unknown** whether that admin exists elsewhere.

## Scope

### In this repository

- Single booking page `index.html`.
- Booking script `scripts/1fortheroad.js`.
- JSON API `api/api.php` with actions `one_CheckLogin`, `one_GetClientDetails`, `one_BookRide`, and `one_BookRideWithVoucher`.
- MySQL connection settings in `api/config.php` (database name `1fortheroad`).
- Browser email via `scripts/smtp.js` (SmtpJS.com v3.0.0).
- Google Maps Places search boxes on the address fields.
- Matomo page view to `analytics.siliconsoftware.net`, site id `4`.
- Web-app manifest `_manifest.json` and service worker `_service-worker.js`.
- Template shell: `scripts/custom.js`, Bootstrap and theme CSS, SCSS sources, fonts, images, starter HTML (`_starter_cover.html`, `_starter_large.html`, `_starter_scroll.html`, `_starter_simple.html`), and `plugins/`.
- Deploy pipeline `bitbucket-pipelines.yml` (`git ftp push` on `master`).
- Older or unused PHP still in the tree: `api/api_old.php`, `api/callback.php`, `api/dumbdb.php`, `api/db_functions.php`, `api/class.snapscan.php`, `api/class.qrcode.php`, `php/contact.php`.

### Not in this repository

- Database schema, migrations, or seed data. Table and column names are known only from the SQL strings.
- A web-admin, driver app, or staff login.
- An SMS sender, even though the success panel says a confirmation SMS will arrive shortly.
- Automated tests, a README, or a dependency manifest (`composer.json` / `package.json` are absent).
- Pipeline secret values (`FTP_USERNAME`, `FTP_PASSWORD`, `FTP_HOST`).

## Architecture

```text
Browser (index.html)
  ├─ scripts/custom.js          template: preloader, service worker, install prompt
  ├─ scripts/1fortheroad.js     login, booking, Places, email
  ├─ scripts/smtp.js            POST to smtpjs.com
  ├─ Google Maps Places         maps.googleapis.com
  └─ Matomo                     analytics.siliconsoftware.net

api/api.php  (PHP, mysqli)
  └─ MySQL database 1fortheroad on sql24.jnb1.host-h.net
       ├─ tblClient
       └─ tblBooking

Bitbucket Pipelines on master
  └─ git-ftp push to ftp://$FTP_HOST
```

`api/callback.php` is a separate PHP script. It reads a `payments` table and calls SnapScan. Nothing in `index.html` or `scripts/1fortheroad.js` requests it. The payment reference prefix in that file is `MOMSTAXI`. Provenance: **Inferred** leftover, not part of the booking flow on this page.

## Major components

| Component | Role | Evidence |
|---|---|---|
| Login screen | Mobile number, Member and Non Member buttons | `index.html` `#loginScreen` |
| Member booking | Pickup, drop-off, time, date, map | `#alreadyBooked` |
| Voucher booking | Name, pickup, drop-off, time, date, voucher | `#copounBooked` (spelling in the id) |
| Success panel | "SUCCESS" and a ride summary | `#responseResult` |
| `api/api.php` | Token-gated JSON actions against MySQL | The four `one_*` cases |
| `api/config.php` | Host, user, password, database name | Constants `DB_*` |
| Service worker | Caches `index.html` only | `_service-worker.js` cache name `Cache-Version-v1` |

## Milestones visible in git

There is no milestone document. The commit sequence is the only timeline:

| When | Commit | What landed |
|---|---|---|
| 2021-04-02 | `9349f17` | Initial commit |
| 2021-04-03 | `613a722` | "latest app" |
| 2021-05-14 | `60c4a92` | Pipeline described as setup for `app.1fortheroad.co.za` |
| 2021-05-14 | `ea503ba` | Pipeline changed from `git ftp init` to `git ftp push` |
| 2021-05-21 to 2021-06-03 | `4884b65`, `20edbc0` | "Update new flow", "Api Functions" |
| 2021-06 to 2021-09 | styling, install, app-selection commits | Install screens and styling |
| 2021-09-26 | `4fd2a24` | "update hiding install screens" |
| 2021-10-25 | `21037ab` | Notification email set back to the 1 for the Road address |
| 2021-11-29 | `c034812`, `50d7009` | Gmail SMTP details; blank form validation |

No commit after 2021-11-29 is on `origin/master`. Current project status in git: **unchanged since 29 November 2021**. Whether the FTP target still deploys this commit is **Unknown / Requires Confirmation**.

## Known dependencies

- PHP with `mysqli`, enough to run `api/api.php`. PHP version is **Unknown**. No Composer file.
- MySQL database `1fortheroad` at host `sql24.jnb1.host-h.net`.
- A web server that can serve the static files and execute PHP under `api/`.
- Bitbucket Pipelines variables `FTP_USERNAME`, `FTP_PASSWORD`, `FTP_HOST`.
- Browser reachability of `smtpjs.com`, `maps.googleapis.com`, `fonts.googleapis.com`, and `analytics.siliconsoftware.net`.
- A Gmail mailbox used as the SmtpJS username. The address is `info.1fortheroad@gmail.com`. The password is in the script and is not repeated here.

## Implementation plan

No forward plan is written in the repository. The only stated unfinished piece inside the code is the voucher section "needs to be build in webadmin" (`api/api.php`, `one_BookRideWithVoucher`). Building that admin is **not started in this repository**.

## Current status

| Item | State |
|---|---|
| Booking page and four API actions | Present on `master` `50d7009` |
| Documentation inside the source repo | None |
| Tests | None |
| Branches other than `master` | None |
| Activity after November 2021 | None in git |
| Live deployment | **Unknown / Requires Confirmation** |
| Web-admin for vouchers | Named in a comment; not in this repo |
