mirror of
https://github.com/temetro/temetro.git
synced 2026-08-18 06:13:14 +00:00
307cc3cc64
- chat composer: attach works with text (sr-only file input); lighter bordered input box - messages: defer "+" menu actions past close so file/appointment pickers fire - tasks: top-level New task button - chat: condensed appointment card with "View in calendar" deep-link; appointments page auto-opens the month calendar from ?calendar=&date= - lab: work-queue rows expand to show task detail + complete - inventory: clickable item detail dialog - pharmacy: Dispense action records a dispense + "Recently dispensed" feed; expiring badge uses endDate and only flags <=2 days left - prescriptions: keyboard nav in patient search, inventory-backed medication combobox (free-text fallback), optional start/end dates; thread dates through - sidebar: whole nav scrolls as one - i18n keys for all new strings Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { apiFetch } from "@/lib/api-client";
|
|
|
|
// A dispensing event — the record of a medication handed to a patient at the
|
|
// pharmacy. Mirrors the backend `src/types/dispense.ts`. Scoped to the active
|
|
// clinic; patient + dispenser fields are denormalized for display.
|
|
export type Dispense = {
|
|
id: string;
|
|
fileNumber: string;
|
|
name: string;
|
|
initials: string;
|
|
medication: string;
|
|
dose: string;
|
|
quantity: number;
|
|
unit: string;
|
|
prescriptionId: string | null;
|
|
dispensedBy: string | null;
|
|
dispensedByName: string;
|
|
dispensedAt: string; // ISO timestamp
|
|
notes: string | null;
|
|
createdAt: string;
|
|
};
|
|
|
|
// The fields the dispense action collects; the backend fills the dispenser
|
|
// identity (from the signed-in user) and the timestamp.
|
|
export type DispenseInput = {
|
|
fileNumber: string;
|
|
name: string;
|
|
initials?: string;
|
|
medication: string;
|
|
dose?: string;
|
|
quantity?: number;
|
|
unit?: string;
|
|
prescriptionId?: string | null;
|
|
notes?: string | null;
|
|
};
|
|
|
|
export function listDispenses(): Promise<Dispense[]> {
|
|
return apiFetch<Dispense[]>("/api/dispenses");
|
|
}
|
|
|
|
export function createDispense(input: DispenseInput): Promise<Dispense> {
|
|
return apiFetch<Dispense>("/api/dispenses", {
|
|
method: "POST",
|
|
body: JSON.stringify(input),
|
|
});
|
|
}
|