8c86c988c1
Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from 2d04e45 on 2026-09-15. Licensed under the Functional Source License (FSL-1.1-ALv2).
15 lines
794 B
TypeScript
15 lines
794 B
TypeScript
/* Filters on the Stock tabs live in the address, so a link or the help mark lands on the same view.
|
||
replaceState keeps typing out of the history and Next keeps useSearchParams in step with it. */
|
||
export function setQuery(updates: Record<string, string | null | undefined>) {
|
||
if (typeof window === "undefined") return;
|
||
const u = new URL(window.location.href);
|
||
for (const [k, v] of Object.entries(updates)) {
|
||
if (v === null || v === undefined || v === "") u.searchParams.delete(k);
|
||
else u.searchParams.set(k, v);
|
||
}
|
||
window.history.replaceState(null, "", u.pathname + u.search + u.hash);
|
||
}
|
||
|
||
/** Whole dollars for the stock table and totals: $1,008. */
|
||
export const wholeMoney = (n: number) => (n < 0 ? "−" : "") + "$" + Math.round(Math.abs(n || 0)).toLocaleString("en-AU");
|