diff --git a/backend/src/routes/medications.ts b/backend/src/routes/medications.ts index ebb6392..3d391e1 100644 --- a/backend/src/routes/medications.ts +++ b/backend/src/routes/medications.ts @@ -261,6 +261,7 @@ export async function medicationRoutes(app: FastifyInstance) { const packCount = row.packCount ?? 1; const stripsPerPack = row.stripsPerPack ?? row.strips ?? 1; const looseTablets = row.looseTablets ?? 0; + const totalPills = row.count; const stripsNeeded = tabsPerStrip > 0 ? Math.ceil(usageTotal / tabsPerStrip) : 0; const stripsAvailable = packCount * stripsPerPack + (tabsPerStrip > 0 ? looseTablets / tabsPerStrip : 0); @@ -268,6 +269,7 @@ export async function medicationRoutes(app: FastifyInstance) { return { medicationId: row.id, medicationName: row.name, + totalPills, plannerUsage: usageTotal, stripSize: tabsPerStrip, stripsNeeded, diff --git a/backend/src/routes/planner.ts b/backend/src/routes/planner.ts index d5e0e0a..87cdc24 100644 --- a/backend/src/routes/planner.ts +++ b/backend/src/routes/planner.ts @@ -5,6 +5,7 @@ import { updateReminderSentTime } from "../services/reminder-scheduler.js"; type PlannerRow = { medicationId: number; medicationName: string; + totalPills: number; plannerUsage: number; stripSize: number; stripsNeeded: number; @@ -68,7 +69,8 @@ export async function plannerRoutes(app: FastifyInstance) { (row) => ` ${row.medicationName} - ${row.plannerUsage} pills + ${row.totalPills} + ${row.plannerUsage} ${row.stripsNeeded} × ${row.stripSize} ${row.stripsAvailable} @@ -77,7 +79,7 @@ export async function plannerRoutes(app: FastifyInstance) { ? "background: #d1fae5; color: #065f46;" : "background: #fee2e2; color: #991b1b;" }"> - ${row.enough ? "✓ OK" : "⚠ Low"} + ${row.enough ? "✓ OK" : "✗ Out of Stock"} @@ -108,10 +110,11 @@ export async function plannerRoutes(app: FastifyInstance) {
- +
+ @@ -135,7 +138,7 @@ Supply overview from ${fromDate} to ${untilDate} ${summaryText} -${rows.map((r) => `${r.medicationName}: ${r.plannerUsage} pills needed, ${r.stripsAvailable} blisters available (${r.stripsNeeded} needed) - ${r.enough ? "Enough" : "OUT OF STOCK"}`).join("\n")} +${rows.map((r) => `${r.medicationName}: ${r.totalPills} pills in stock, ${r.plannerUsage} pills needed, ${r.stripsAvailable} blisters available (${r.stripsNeeded} needed) - ${r.enough ? "Enough" : "OUT OF STOCK"}`).join("\n")} --- Sent from MedAssist Medication Planner`; diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 440b3a4..217e27c 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -28,6 +28,7 @@ type Medication = { type PlannerRow = { medicationId: number; medicationName: string; + totalPills: number; plannerUsage: number; stripSize: number; stripsNeeded: number; @@ -495,12 +496,20 @@ export default function App() { setTheme((prev) => (prev === "dark" ? "light" : "dark")); } + // Page titles based on current route + const pageInfo = { + "/dashboard": { eyebrow: "MedAssist · Overview", title: "Dashboard" }, + "/medications": { eyebrow: "MedAssist · Inventory", title: "Manage Medications" }, + "/planner": { eyebrow: "MedAssist · Planner", title: "Demand Calculator" }, + "/settings": { eyebrow: "MedAssist · Configuration", title: "Settings" }, + }[currentPath] || { eyebrow: "MedAssist · Overview", title: "Dashboard" }; + return (
-

Medassist · Planner

-

Manage medication plans

+

{pageInfo.eyebrow}

+

{pageInfo.title}

MedicationStock Usage Needed Available