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
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:
@@ -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
@@ -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
@@ -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…",
|
||||
|
||||
Reference in New Issue
Block a user