feat(booth): the exit lane light is the manual-exit control — two tiles, Hyrje and Dalje Manuale
Build & push images / images (push) Successful in 3m20s
Build & push images / images (push) Successful in 3m20s
BarrierLight gains onOpen/opening (not presence-gated). For an operator with barrier:create + own shift the exit tile is labelled 'manual exit', clickable and opens the manual-exit dialog while still showing the lane state; for everyone else it stays the plain 'Dalje' light. The separate ghost button is removed. Wiki as-built note.
This commit is contained in:
@@ -131,6 +131,8 @@ function BarrierLight({
|
||||
issuing,
|
||||
bypassRadar,
|
||||
bypassCamera,
|
||||
onOpen,
|
||||
opening,
|
||||
}: {
|
||||
label: string;
|
||||
busy: boolean;
|
||||
@@ -142,6 +144,11 @@ function BarrierLight({
|
||||
/** Admin bypass of a faulty device: a bypassed signal counts as present (server re-checks). */
|
||||
bypassRadar?: boolean;
|
||||
bypassCamera?: boolean;
|
||||
/** When set (exit light + barrier:create + own shift), clicking opens the manual-exit
|
||||
* dialog — NOT presence-gated (the car may be anywhere in the lane, or the lane may be
|
||||
* empty while the operator prepares). The light keeps showing the lane state. */
|
||||
onOpen?: () => void;
|
||||
opening?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
// Blink only when the radar sees something the camera hasn't confirmed.
|
||||
@@ -152,14 +159,15 @@ function BarrierLight({
|
||||
const radarOk = radar || !!bypassRadar;
|
||||
const cameraOk = busy || !!bypassCamera;
|
||||
const canIssue = !!onIssue && radarOk && cameraOk && !issuing;
|
||||
const clickable = !!onIssue && radarOk && cameraOk;
|
||||
const clickable = (!!onIssue && radarOk && cameraOk) || !!onOpen;
|
||||
const onClick = canIssue ? onIssue : onOpen && !opening ? onOpen : undefined;
|
||||
return (
|
||||
<div
|
||||
className={`flex items-center gap-2 rounded-term border px-3 py-2 ${blinking ? "lane-blink" : solid} ${
|
||||
clickable ? "cursor-pointer hover:brightness-125" : ""
|
||||
}`}
|
||||
title={clickable ? t("booth.issueEntryTitle") : label}
|
||||
onClick={canIssue ? onIssue : undefined}
|
||||
title={onOpen ? t("booth.forgiveExitTitle") : clickable ? t("booth.issueEntryTitle") : label}
|
||||
onClick={onClick}
|
||||
role={clickable ? "button" : undefined}
|
||||
>
|
||||
{/* Barrier glyph: a post + an arm. `currentColor` follows the (possibly blinking) state. */}
|
||||
@@ -171,7 +179,7 @@ function BarrierLight({
|
||||
<div className="leading-tight">
|
||||
<div className="text-[0.625rem] uppercase tracking-wider text-term-muted">{label}</div>
|
||||
<div className="text-xs font-bold">
|
||||
{issuing ? "…" : clickable ? t("booth.issueEntry") : busy ? "●" : blinking ? "◐" : "○"}
|
||||
{issuing || opening ? "…" : onIssue && clickable ? t("booth.issueEntry") : busy ? "●" : blinking ? "◐" : "○"}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -250,18 +258,16 @@ function LaneIndicators() {
|
||||
bypassRadar={site?.bypassPresenceRadar ?? false}
|
||||
bypassCamera={site?.bypassPresenceCamera ?? false}
|
||||
/>
|
||||
<BarrierLight label={t("booth.laneExit")} busy={lanes?.exit ?? false} radar={radar?.exit ?? false} />
|
||||
{canForgive && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setForgiveOpen(true)}
|
||||
disabled={forgive.isPending}
|
||||
className="btn btn-ghost btn-sm text-term-red"
|
||||
title={t("booth.forgiveExitTitle")}
|
||||
>
|
||||
{t("booth.forgiveExit")}
|
||||
</button>
|
||||
)}
|
||||
{/* The exit light IS the manual-exit control for whoever may use it (barrier:create +
|
||||
own shift): same chrome as the entry light, still showing the lane state, labelled
|
||||
"manual exit" and clickable. For everyone else it is the plain exit lane light. */}
|
||||
<BarrierLight
|
||||
label={canForgive ? t("booth.forgiveExit") : t("booth.laneExit")}
|
||||
busy={lanes?.exit ?? false}
|
||||
radar={radar?.exit ?? false}
|
||||
onOpen={canForgive ? () => setForgiveOpen(true) : undefined}
|
||||
opening={forgive.isPending}
|
||||
/>
|
||||
{/* 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">
|
||||
|
||||
@@ -94,9 +94,11 @@ unchanged) and on the ticket being closed.
|
||||
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
|
||||
(a small styled dialog, same chrome as every other form — optional reason, red confirm). Both only render with
|
||||
`barrier:create` + own open shift.
|
||||
header the **exit lane light itself is the control** for the no-ticket case (user,
|
||||
2026-10-09: "only Hyrje and Dalje Manuale") — same chrome as the entry light, still showing
|
||||
the lane state, labelled "Dalje manuale" and clickable → a small styled dialog (optional
|
||||
reason, red confirm). For anyone without `barrier:create` + own open shift it is the plain
|
||||
"Dalje" light. The modal button likewise only renders with the permission + 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
|
||||
|
||||
Reference in New Issue
Block a user