# zeitkort-web-only POC

A self-contained web-only proof-of-concept version of **zeitkort**.

This package does **not** use the `zeitkort-api` service, PostgreSQL, SQLite, or
any other backend database. The Go web process serves the UI and stores all POC
records in memory.

## Important POC behavior

- Companies, assignments, tasks, work sessions, and invoice-number records are
  held in process memory only.
- Settings edited from the UI are also in-memory only.
- Everything resets automatically every **10 minutes** after the process starts.
- A sticky, high-visibility countdown banner shows exactly when the next reset will happen.
- Restarting the process also clears everything immediately.
- `config.json` is read only at startup for the listen address and initial
  invoice defaults; the app never writes it.

## What it does

- Pick a company → assignment → task, run a live timer, and stop it manually.
- Add / edit / delete companies, assignments, tasks, and work sessions.
- Add manual time entries.
- Generate the Faroese invoice PDF directly from the in-memory data.
- Edit sender/company invoice defaults for the current 10-minute in-memory run.
- Open the **About** menu item for a concise explanation of the POC features and implementation.

## Build

Requires Go 1.26+ as declared by the original project.

```sh
go mod download
go build -o zeitkort-web .
```

## Configure

```sh
cp config.example.json config.json
# edit config.json if needed
```

Only these fields are used:

- `listen_addr`
- `company_*`
- `tax_id`
- `bank_info`
- `payment_terms_days`
- `mvg_percent`

There are no API URL, username, or password fields in this version.

## Run

```sh
./zeitkort-web -config config.json
```

The app logs a reset message every 10 minutes when the in-memory POC state is
cleared. The browser also shows a large countdown and reloads shortly after the
reset so the cleared state is visible.

## As a service

```sh
sudo useradd --system --no-create-home zeitkort   # if not already present
sudo mkdir -p /opt/zeitkort-web
sudo cp zeitkort-web config.json /opt/zeitkort-web/
sudo chown -R zeitkort:zeitkort /opt/zeitkort-web
sudo cp zeitkort-web.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now zeitkort-web
```

## Notes

- This is intentionally not durable. Do not use it for real time tracking.
- Deletes are not cascading: remove work sessions before tasks, tasks before
  assignments, and assignments before companies.
- The timer stops only when you click **Stop**, unless the 10-minute POC reset
  happens first.
