ThreadCount Community edition

Uniform stock management for healthcare linen rooms. Licensed under the GNU AGPL v3.
This commit is contained in:
ThreadCount
2026-09-13 08:45:19 +10:00
commit 1bc2de655a
505 changed files with 56223 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
import { requireOperator } from "@/lib/ops/session";
import { overview } from "@/lib/ops/projections";
import { switches } from "@/lib/switches";
import Controls from "./Controls";
/* Controls: the two platform switches and the demo reset. Reads the switch row through the
* product's own reader so what is shown is exactly what the sign-up route and the demo see —
* the row, with the environment's override on top. */
export const dynamic = "force-dynamic";
export default async function OpsControls() {
const op = await requireOperator();
const [sw, o] = await Promise.all([switches(), overview()]);
const fmt = (d: Date) => d.toLocaleString("en-AU", { timeZone: "Australia/Brisbane", dateStyle: "medium", timeStyle: "short" });
return (
<>
<div className="page-head">
<div>
<div className="sec" style={{ border: 0, padding: 0 }}>Controls</div>
<h1 className="h1">Switches</h1>
<div style={{ fontSize: 13, color: "var(--color-neutral-700)", marginTop: 4 }}>
{sw.row.updatedAt ? `Last changed ${fmt(sw.row.updatedAt)}` : "Never changed from here"} · every change is written to the trail
</div>
</div>
</div>
<div className="tc-panel" style={{ marginTop: 20, maxWidth: 720 }}>
<div className="tc-panel-head"><span>Platform</span><span className="tc-panel-aside">{o.facilities} facilities · {o.live} live</span></div>
<Controls
sw={{ signupsDisabled: sw.row.signupsDisabled, demoDisabled: sw.row.demoDisabled, plansLive: sw.row.plansLive, signupsByEnv: sw.signupsByEnv, demoByEnv: sw.demoByEnv, plansByEnv: sw.plansByEnv, updatedAt: sw.row.updatedAt?.toISOString() ?? null }}
owner={op.role === "OWNER"}
demoAgoMin={o.demoRebuiltAgoMin}
/>
</div>
<div className="tc-panel" style={{ marginTop: 24, maxWidth: 720 }}>
<div className="tc-panel-head"><span>Deleting a facility</span></div>
<div className="tc-panel-body" style={{ fontSize: 13, color: "var(--color-neutral-700)" }}>
Lives on the facilitys own page, at the bottom. Owner, the facilitys exact name typed, and a live code from your second factor. It cannot be undone.
</div>
</div>
</>
);
}