Files
ThreadCount 0910bc32c1 ThreadCount Community edition
Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from 38e16eb on 2026-09-15. Licensed under the Functional Source License (FSL-1.1-ALv2).
2026-09-16 07:57:54 +10:00

15 lines
794 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* 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");