Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from 794bab5 on 2026-09-16. Licensed under the Functional Source License (FSL-1.1-ALv2).
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
import { currentStaff } from "@/lib/staffsession";
|
||||
import { bagLines, requestData } from "@/lib/staffdata";
|
||||
import CodeFullScreen from "@/components/screens/CodeFull";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
/* The full-screen collection code.
|
||||
*
|
||||
* Fenced more narrowly than the order it belongs to, on purpose. requestData() lets the wearer's
|
||||
* manager, the clerk who raised it and the ward desk read an order — none of them collect the bag,
|
||||
* and the code is what a bag is handed over against, so this screen is the wearer's alone. A
|
||||
* request that is no longer `ready` has no code to show either: it has been collected, or it never
|
||||
* reached the counter. Both are refusals rather than an empty screen, for the reason every refusal
|
||||
* under /my is one — explaining would confirm what exists.
|
||||
*/
|
||||
export default async function MyOrderCode({ params }: { params: Promise<{ id: string }> }) {
|
||||
const sess = await currentStaff();
|
||||
if (!sess) redirect("/my/signin");
|
||||
const { id } = await params;
|
||||
const data = await requestData(sess, id);
|
||||
if (!data) notFound();
|
||||
if (!data.mine || data.status !== "ready" || !data.collectCode) notFound();
|
||||
// What is actually in the bag: a declined line is not in it, and naming it at the counter starts
|
||||
// an argument with a clerk who cannot settle it.
|
||||
const lines = bagLines(data.lines).map((l) => ({ item: l.item, size: l.size, qty: l.qty }));
|
||||
return <CodeFullScreen id={data.id} code={data.collectCode} name={data.subjectName} lines={lines} />;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
import { currentStaff } from "@/lib/staffsession";
|
||||
import { requestData } from "@/lib/staffdata";
|
||||
import ThreadScreen from "@/components/screens/Thread";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function MyOrderThread({ params }: { params: Promise<{ id: string }> }) {
|
||||
const sess = await currentStaff();
|
||||
if (!sess) redirect("/my/signin");
|
||||
const { id } = await params;
|
||||
const data = await requestData(sess, id);
|
||||
if (!data) notFound();
|
||||
return <ThreadScreen data={data} />;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
import { currentStaff } from "@/lib/staffsession";
|
||||
import { requestData } from "@/lib/staffdata";
|
||||
import OrderScreen from "@/components/screens/Order";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function MyOrder({ params }: { params: Promise<{ id: string }> }) {
|
||||
const sess = await currentStaff();
|
||||
if (!sess) redirect("/my/signin");
|
||||
const { id } = await params;
|
||||
const data = await requestData(sess, id);
|
||||
// A request that isn't theirs, their team's, or one they raised is a 404 rather than a 403 —
|
||||
// "you may not see this" confirms it exists.
|
||||
if (!data) notFound();
|
||||
return <OrderScreen data={data} />;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { currentStaff } from "@/lib/staffsession";
|
||||
import { ordersData } from "@/lib/staffdata";
|
||||
import OrdersScreen from "@/components/screens/Orders";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function MyOrders({ searchParams }: { searchParams: Promise<{ tab?: string }> }) {
|
||||
const sess = await currentStaff();
|
||||
if (!sess) redirect("/my/signin");
|
||||
const { tab } = await searchParams;
|
||||
const { open, done, raised } = await ordersData(sess);
|
||||
// `?tab=` is honoured because other screens link straight to a view; anything else lands on Open,
|
||||
// which is the question this screen answers. `raised` is what this person typed in for somebody
|
||||
// else — the desk's whole day, and now a manager's too.
|
||||
return (
|
||||
<OrdersScreen
|
||||
open={open}
|
||||
done={done}
|
||||
raised={raised}
|
||||
initialTab={tab === "done" ? "done" : tab === "raised" ? "raised" : "open"}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user