feat(exit): manual-exit dialog + wording — styled modal replaces window.prompt; copy says 'manual exit' / 'dalje manuale'
Build & push images / images (push) Successful in 3m13s

- BoothScreen: the no-ticket open uses the app's Modal (explainer, optional reason,
  red confirm; Enter confirms, Escape/Cancel abort) instead of a browser prompt.
- en/sq: forgive/forgiven/forgone wording dropped from every user-facing string
  (buttons, dialog, results, live-feed reasons, shift figures); Albanian edited by the
  user, English aligned. Printed Z line is 'Dalje manuale (N)'. The signed English
  fallback sentences follow. Identifiers (exit.forgiven, forgoneMinor, barrier:create)
  unchanged.
- wiki: forgiven-exit §Wording, shift, log.
This commit is contained in:
2026-10-09 08:37:44 +02:00
parent 2e98167dba
commit 82e5833e4e
9 changed files with 99 additions and 42 deletions
+2 -2
View File
@@ -131,8 +131,8 @@ describe("forgiven exit (wiki/decisions/forgiven-exit.md)", () => {
expect(r.ok).toBe(true);
expect(exitsSigned("T1")).toHaveLength(1);
expect(exitsSigned("T1")[0]!.payload).toMatchObject({ reasonCode: "exit.forgiven" });
expect(anomalies("forgiven exit by owner")).toHaveLength(1);
expect(anomalies("forgiven exit by owner")[0]!.payload).toMatchObject({ forgiven: true, forgoneMinor: 20000, operator: "owner" });
expect(anomalies("manual exit by owner")).toHaveLength(1);
expect(anomalies("manual exit by owner")[0]!.payload).toMatchObject({ forgiven: true, forgoneMinor: 20000, operator: "owner" });
// The plain unpaid re-open path is still refused for the NEXT unpaid car.
await enter("T2", minutesAgo(90));
expect((await exit.reopenBarrier("T2", "owner")).ok).toBe(false);
+1 -1
View File
@@ -832,7 +832,7 @@ export class ShiftService {
// (older slips stay byte-identical). The takings above are already NET of it.
...(r.discountTotalMinor > 0 ? [`Zbritje (validime): ${money(r.discountTotalMinor)} ${cur}`] : []),
// Forgiven exits — fees waived by an operator; $0 payments, NOT in the takings.
...(r.forgoneCount > 0 ? [`Dalje të falura (${r.forgoneCount}): ${money(r.forgoneTotalMinor)} ${cur}`] : []),
...(r.forgoneCount > 0 ? [`Dalje manuale (${r.forgoneCount}): ${money(r.forgoneTotalMinor)} ${cur}`] : []),
"",
"-- Arka --",
`Gjëndje fillestare: ${money(r.openingFloatMinor)} ${cur}`,
+42 -7
View File
@@ -7,6 +7,7 @@ import { qk } from "./lib/query.js";
import { useLiveStore } from "./lib/live-store.js";
import { useShift } from "./lib/use-shift.js";
import { useScanner } from "./lib/use-scanner.js";
import { Modal } from "./ui/Modal.js";
import { Panel } from "./ui/Panel.js";
import { StatusDot } from "./ui/StatusDot.js";
import { BoothPayModal } from "./BoothPayModal.js";
@@ -217,25 +218,26 @@ function LaneIndicators() {
}
// FORGIVEN exit for a car with NO ticket (barrier:create; wiki/decisions/forgiven-exit.md):
// signed anomaly + exit snapshot + pulse, no money, nothing printed. Reason optional
// (Cancel in the prompt aborts; an empty answer proceeds).
// signed anomaly + exit snapshot + pulse, no money, nothing printed. A small styled
// dialog (same chrome as every other form) asks for an OPTIONAL reason, then confirms.
const canForgive = can(user, "barrier:create") && shiftOpen && isMine;
const [forgiveOpen, setForgiveOpen] = useState(false);
const [forgiveNote, setForgiveNote] = useState("");
const forgive = useMutation({
mutationFn: (note: string) => forgiveExit(null, note),
onSuccess: (r) => {
setForgiveOpen(false);
setForgiveNote("");
setMsg({ ok: r.opened, text: r.opened ? t("booth.forgiveExitOk") : t("booth.forgiveExitNotOpened", { reason: r.reason ?? "" }) });
void qc.invalidateQueries({ queryKey: qk.events });
setTimeout(() => setMsg(null), 5000);
},
onError: (e) => {
setForgiveOpen(false);
setMsg({ ok: false, text: (e as Error).message });
setTimeout(() => setMsg(null), 5000);
},
});
function onForgiveNoTicket() {
const note = window.prompt(t("booth.forgiveExitPrompt"));
if (note !== null) forgive.mutate(note.trim());
}
return (
<div className="flex items-center gap-2">
@@ -252,7 +254,7 @@ function LaneIndicators() {
{canForgive && (
<button
type="button"
onClick={onForgiveNoTicket}
onClick={() => setForgiveOpen(true)}
disabled={forgive.isPending}
className="btn btn-ghost btn-sm text-term-red"
title={t("booth.forgiveExitTitle")}
@@ -260,6 +262,39 @@ function LaneIndicators() {
{t("booth.forgiveExit")}
</button>
)}
{/* Forgiven-exit dialog (no ticket): what it does, an optional reason, a deliberate red
confirm. Enter in the field confirms; Escape / ✕ / Cancel abort. */}
<Modal open={forgiveOpen} onClose={() => setForgiveOpen(false)} title={t("booth.forgiveDialogTitle")} width="max-w-md">
<form
onSubmit={(e) => {
e.preventDefault();
if (!forgive.isPending) forgive.mutate(forgiveNote.trim());
}}
className="flex flex-col gap-3"
>
<div className="rounded-term border border-term-red/50 bg-term-red/5 px-3 py-2 text-[0.75rem] text-term-text">
{t("booth.forgiveDialogBody")}
</div>
<label className="flex flex-col gap-1 text-[0.6875rem] uppercase tracking-wider text-term-muted">
{t("booth.forgiveDialogReason")}
<input
className="input w-full normal-case tracking-normal"
value={forgiveNote}
onChange={(e) => setForgiveNote(e.target.value)}
placeholder={t("booth.forgiveDialogReasonPlaceholder")}
autoFocus
/>
</label>
<div className="flex items-center justify-end gap-2">
<button type="button" onClick={() => setForgiveOpen(false)} className="btn btn-ghost btn-sm">
{t("common.cancel")}
</button>
<button type="submit" disabled={forgive.isPending} className="btn btn-danger">
{forgive.isPending ? t("booth.forgiveDialogWorking") : t("booth.forgiveDialogConfirm")}
</button>
</div>
</form>
</Modal>
{msg && (
<span className={`text-[0.6875rem] ${msg.ok ? "text-term-green" : "text-term-red"}`}>{msg.text}</span>
)}
+18 -13
View File
@@ -317,11 +317,16 @@ export const en: Catalog = {
issueEntryTitle: "Issue an entry ticket & open the barrier (physical button broken)",
issueEntryConfirm: "A vehicle is at the entry. Issue an entry ticket and open the barrier?",
issueEntryOk: "Entry ticket {{ticket}} issued.",
forgiveExit: "Forgive & open exit",
forgiveExit: "Open exit manually",
forgiveExitTitle: "Open the exit barrier for a car with NO ticket — no money, signed and flagged",
forgiveExitPrompt: "Reason for opening the exit with no ticket (optional — OK to leave empty):",
forgiveExitOk: "Exit opened — forgiven, no payment.",
forgiveExitOk: "Exit opened manually, no payment.",
forgiveExitNotOpened: "Recorded, but the barrier did not open: {{reason}}",
forgiveDialogTitle: "Manual exit",
forgiveDialogBody: "Opens the EXIT barrier for a car with no ticket. No money is taken and nothing is printed; the open is signed under your name with the exit camera's snapshot and shows on your shift report.",
forgiveDialogReason: "Reason (optional)",
forgiveDialogReasonPlaceholder: "e.g. came in while the barriers were up…",
forgiveDialogConfirm: "Open exit — no payment",
forgiveDialogWorking: "opening…",
exitedGrace: "exited · grace",
exitedGraceLeft: "exited · {{time}}",
exitedGraceTitle: "Paid and exited — barrier not confirmed; waiting out the grace period.",
@@ -424,8 +429,8 @@ export const en: Catalog = {
"exit.open.failed": "Exit recorded, but the barrier did not open — open manually",
"exit.freeGrace": "Free entry-grace (no charge)",
"exit.manualOpen": "Manual barrier open (human intervention)",
"exit.forgiven": "Forgiven exit by {{operator}} — fee of {{forgone}} {{currency}} waived: {{note}}",
"exit.forgiven.noSession": "Forgiven exit by {{operator}} — no ticket / no session: {{note}}",
"exit.forgiven": "Manual exit by {{operator}} — fee of {{forgone}} {{currency}}, no payment: {{note}}",
"exit.forgiven.noSession": "Manual exit by {{operator}} — no ticket / no session: {{note}}",
"exit.plateSwapSuspected": "Possible ticket swap — plate {{plate}} is already inside under ticket {{otherIdentity}}",
"exit.plateSwapOverride": "Operator {{operator}} released a suspected ticket-swap exit (plate {{plate}}, also open under {{otherIdentity}})",
"sub.refused.notFound": "Subscription refused — not found",
@@ -998,7 +1003,7 @@ export const en: Catalog = {
srcSubscriptions: "Subscriptions:",
srcOnTicket: "{{module}} (on ticket):",
srcSubWindow: "out-of-window",
srcForgone: "Forgiven exits ({{count}}):",
srcForgone: "Manual exits ({{count}}):",
drawerSection: "— Drawer —",
openingFloat: "Opening cash:",
cashTaken: "Daily takings:",
@@ -1047,7 +1052,7 @@ export const en: Catalog = {
srcTickets: "Tickets",
srcSubscriptions: "Subscriptions",
srcSubWindow: "out-of-window",
srcForgone: "Forgiven exits ({{count}})",
srcForgone: "Manual exits ({{count}})",
expectedDrawer: "Expected drawer",
filterFrom: "From",
filterTo: "To",
@@ -1255,14 +1260,14 @@ export const en: Catalog = {
confirmCancelTicket: "Confirm cancellation",
cancelling: "cancelling…",
ticketCancelled: "Ticket cancelled.",
forgiveExit: "Forgive & open",
forgiveTitle: "Forgive this exit",
forgiveHint: "Lets the car out with NO payment. The fee owed ({{amount}}) is recorded as forgone on your shift report — never as cash. A reason is optional; nothing is printed.",
forgiveReasonPlaceholder: "Reason for forgiving (optional)…",
forgiveExit: "Open manually",
forgiveTitle: "Open this exit manually",
forgiveHint: "Lets the car out with NO payment. The fee owed ({{amount}}) is recorded as a manual exit on your shift report, not as money. A reason is optional; nothing is printed.",
forgiveReasonPlaceholder: "Reason (optional)…",
confirmForgive: "Confirm — open exit, no payment",
forgiving: "opening…",
exitForgiven: "Exit forgiven — {{amount}} waived, barrier opened.",
exitForgivenNotOpened: "Exit forgiven — {{amount}} waived, but the barrier did not open: {{reason}}",
exitForgiven: "Manual exit — {{amount}}, barrier opened.",
exitForgivenNotOpened: "Manual exit — {{amount}}, barrier did not open: {{reason}}",
noSnapshots: "no snapshots",
loadingSnapshots: "loading snapshots…",
snapEntry: "entry",
+18 -13
View File
@@ -319,11 +319,16 @@ export const sq = {
issueEntryTitle: "Lësho një biletë hyrjeje & hap barrierën (butoni fizik i prishur)",
issueEntryConfirm: "Një automjet është te hyrja. Të lëshohet një biletë hyrjeje dhe të hapet barriera?",
issueEntryOk: "Bileta e hyrjes {{ticket}} u lëshua.",
forgiveExit: "Fal & hap daljen",
forgiveExit: "Hap daljen manualisht",
forgiveExitTitle: "Hap barrierën e daljes për një automjet PA biletë — pa para, e nënshkruar dhe e shënuar",
forgiveExitPrompt: "Arsyeja e hapjes së daljes pa biletë (opsionale — mund të lihet bosh):",
forgiveExitOk: "Dalja u hap — e falur, pa pagesë.",
forgiveExitOk: "Dalja u hap manualisht, pa pagesë.",
forgiveExitNotOpened: "U regjistrua, por barriera nuk u hap: {{reason}}",
forgiveDialogTitle: "Hapje manuale",
forgiveDialogBody: "Hap barrierën e DALJES për një automjet pa biletë. Nuk merret asnjë pagesë dhe nuk printohet asgjë; hapja nënshkruhet me emrin tënd bashkë me foton e kamerës së daljes dhe shfaqet në raportin e turnit tënd.",
forgiveDialogReason: "Arsyeja (opsionale)",
forgiveDialogReasonPlaceholder: "p.sh. hyri kur barrierat ishin të hapura…",
forgiveDialogConfirm: "Hap daljen — pa pagesë",
forgiveDialogWorking: "duke hapur…",
exitedGrace: "doli · në afat",
exitedGraceLeft: "doli · {{time}}",
exitedGraceTitle: "Paguar dhe dalur — barriera nuk u konfirmua; po pret afatin kohor.",
@@ -427,8 +432,8 @@ export const sq = {
"exit.open.failed": "Dalja u regjistrua, por barriera nuk u hap — hape manualisht",
"exit.freeGrace": "Periudhë pa pagesë në hyrje (pa tarifë)",
"exit.manualOpen": "Hapje manuale e barrierës (ndërhyrje njerëzore)",
"exit.forgiven": "Dalje e falur nga {{operator}} — tarifa {{forgone}} {{currency}} u fal: {{note}}",
"exit.forgiven.noSession": "Dalje e falur nga {{operator}} — pa biletë / pa seancë: {{note}}",
"exit.forgiven": "Dalje manuale nga {{operator}} — tarifa {{forgone}} {{currency}}: {{note}}",
"exit.forgiven.noSession": "Dalje manuale nga {{operator}} — pa biletë / pa seancë: {{note}}",
"exit.plateSwapSuspected": "Mundësi ndërrimi biletash — targa {{plate}} është tashmë brenda me biletën {{otherIdentity}}",
"exit.plateSwapOverride": "Operatori {{operator}} lëshoi një dalje me dyshim ndërrimi biletash (targa {{plate}}, edhe e hapur me {{otherIdentity}})",
"sub.refused.notFound": "Abonimi u refuzua — nuk u gjet",
@@ -1011,7 +1016,7 @@ export const sq = {
srcSubscriptions: "Abonime:",
srcOnTicket: "{{module}} (në biletë):",
srcSubWindow: "jashtë orarit",
srcForgone: "Dalje të falura ({{count}}):",
srcForgone: "Dalje manuale ({{count}}):",
drawerSection: "— Arka —",
openingFloat: "Arka fillestare:",
cashTaken: "Xhiro ditore:",
@@ -1060,7 +1065,7 @@ export const sq = {
srcTickets: "Bileta",
srcSubscriptions: "Abonime",
srcSubWindow: "jashtë orarit",
srcForgone: "Dalje të falura ({{count}})",
srcForgone: "Dalje manuale ({{count}})",
expectedDrawer: "Gjëndje arke",
// Filter (admin only).
filterFrom: "Nga",
@@ -1271,14 +1276,14 @@ export const sq = {
confirmCancelTicket: "Konfirmo anulimin",
cancelling: "duke anuluar…",
ticketCancelled: "Bileta u anulua.",
forgiveExit: "Fal & hap",
forgiveTitle: "Fal këtë dalje",
forgiveHint: "E lë automjetin të dalë PA pagesë. Shuma e detyruar ({{amount}}) regjistrohet si e falur në raportin e turnit — kurrë si para. Arsyeja është opsionale; nuk printohet asgjë.",
forgiveReasonPlaceholder: "Arsyeja e faljes (opsionale)…",
forgiveExit: "Hap Manualisht",
forgiveTitle: "Hap manualisht këtë dalje",
forgiveHint: "E lë automjetin të dalë PA pagesë. Shuma e detyruar ({{amount}}) regjistrohet si dalje manuale në raportin e turnit, jo si para. Arsyeja është opsionale; nuk printohet asgjë.",
forgiveReasonPlaceholder: "Arsyeja (opsionale)…",
confirmForgive: "Konfirmo — hap daljen, pa pagesë",
forgiving: "duke hapur…",
exitForgiven: "Dalja u fal — {{amount}} u fal, barriera u hap.",
exitForgivenNotOpened: "Dalja u fal — {{amount}} u fal, por barriera nuk u hap: {{reason}}",
exitForgiven: "Dalje manuale — {{amount}}, barriera u hap.",
exitForgivenNotOpened: "Dalje manuale — {{amount}}, barriera nuk u hap: {{reason}}",
// snapshots
noSnapshots: "asnjë foto",
loadingSnapshots: "duke ngarkuar fotot…",
+2 -2
View File
@@ -529,8 +529,8 @@ export const REASON_EN: Record<ReasonCode, string> = {
"exit.open.failed": "exit recorded, but the barrier did not open — open manually",
"exit.freeGrace": "free entry-grace (no charge)",
"exit.manualOpen": "manual barrier open (human intervention)",
"exit.forgiven": "forgiven exit by {operator} — fee of {forgone} {currency} waived: {note}",
"exit.forgiven.noSession": "forgiven exit by {operator} — no ticket / no session: {note}",
"exit.forgiven": "manual exit by {operator} — fee of {forgone} {currency}, no payment: {note}",
"exit.forgiven.noSession": "manual exit by {operator} — no ticket / no session: {note}",
"exit.plateSwapSuspected": "possible ticket swap — plate {plate} is already inside under ticket {otherIdentity}",
"exit.plateSwapOverride": "operator {operator} released a suspected ticket-swap exit (plate {plate}, also open under {otherIdentity})",
"sub.refused.notFound": "subscription refused — not found",
+1 -1
View File
@@ -120,7 +120,7 @@ waived, no tender. It adds **nothing** to cash, card, the ticket bucket or the d
tender sums add 0), so the shift total is untouched by construction. The Z-report sums
`forgoneMinor` into `forgoneTotalMinor` + `forgoneCount`, stamps them on the signed
`shift_z_report` (only when > 0, so older payloads stay identical) and prints one line
`Dalje të falura (N): X` after the merchant-validation leakage line — a separate figure on
`Dalje manuale (N): X` after the merchant-validation leakage line — a separate figure on
purpose, so the owner can tell "the bar validated it" from "the operator let it out".
### Shift history UI + permission scoping (2026-06-19)
+9 -3
View File
@@ -77,7 +77,7 @@ unchanged) and on the ticket being closed.
role from Setup → Roles — "the owner can give permission to other operators" (user).
- **`PayStation.forgive(identity, { operator, note })`** — quotes the fee as the pay flow
would, signs `payment { amountMinor: 0, forgoneMinor: <quote>, operator, reasonCode:
"exit.forgiven", reason: "forgiven exit by X — fee of N CUR waived: <note>" }` with **no
"exit.forgiven", reason: "manual exit by X — fee of N CUR, no payment: <note>" }` with **no
tender** (nothing was tendered), marks the projection paid. Refuses (409) when the quote
carries module charge lines (a wash on the ticket): parking is forgiven, a wash is not.
- **`ExitFlow.reopenBarrier(id, operator, { forgiven })`** — the existing human-intervention
@@ -91,13 +91,19 @@ unchanged) and on the ticket being closed.
gate (`409 no_shift`); the note is optional; no identity = the no-session path.
- **Z-report**: `forgoneTotalMinor` + `forgoneCount` summed from `forgoneMinor` (never into
cash/card; `discountTotalMinor` untouched), on the signed `shift_z_report` only when > 0, one
print line `Dalje të falura (N): X`, shown in the X-report, the close confirm and history.
print line `Dalje manuale (N): X`, shown in the X-report, the close confirm and history.
- **Web**: in the pay/exit modal a red ghost "Forgive & open" for an OPEN transient that owes
money (unpaid or overstay) → reason box → "Confirm — open exit, no payment"; on the booth
header a "Forgive & open exit" next to the exit lane light for the no-ticket case
(`window.prompt` for the reason — Cancel aborts, empty proceeds). Both only render with
(a small styled dialog, same chrome as every other form — optional reason, red confirm). Both only render with
`barrier:create` + own open shift.
Live-feed reason texts in en/sq. **Nothing is printed.**
- Tests: exit-flow (ticketed + no-session), pay-station (`forgive`), shift-service (totals
untouched, own line, history), routes (403 without the permission, 409 no shift, 400 no
note accepted, ledger sequence entry→payment→anomaly→exit, report figures).
**Wording (user, 2026-10-09).** The user-facing words are **"manual exit" / "dalje manuale"**,
not forgive/forgiven/forgone — too much "fal, falur, falje" (user). Applies to both language
files, the printed Z-report line (`Dalje manuale (N)`) and the signed English fallback
sentences. Internal names stay (`exit.forgiven`, `forgoneMinor`, `barrier:create`) — they
are code identifiers, not copy.
+6
View File
@@ -3490,3 +3490,9 @@ Pages: [[forgiven-exit]], [[booth-exit-flow]] §Forgiven exit, [[shift]] §Forgi
"We don't need to force the user to write a reason." Route no longer 400s without a note; an
empty note is signed as "(no reason given)"; modal confirm enabled with an empty box; booth
prompt: Cancel aborts, empty proceeds; en/sq texts say optional. [[forgiven-exit]] §5 updated.
## [2026-10-09] decision | Forgiven exit wording → "manual exit" / "dalje manuale"
User trimmed the Albanian copy ("Too much fal, falur, falje") and asked for the same in
English: buttons, dialog, results, live-feed reasons, shift figures, the printed Z line and the
signed English fallback now say manual exit; identifiers unchanged. [[forgiven-exit]] §Wording.