feat: Add package type support and per-intake takenBy (#89)

## Package Type Feature
- Add 'blister' and 'bottle' package types for medications
- Bottle type uses totalPills for capacity and looseTablets for current stock
- Blister type continues to use packCount/blistersPerPack/pillsPerBlister
- Add doseUnit field for flexible dosing (mg, ml, IU, etc.)
- Full UI support in medication form and detail modal

## Per-Intake TakenBy
- Move takenBy from medication level to individual intakes
- Each intake schedule can now be assigned to a different person
- Update scheduler-utils to handle per-intake takenBy
- Update SharedSchedule to filter by per-intake takenBy
- Backward compatible with existing medication data

## UI Improvements
- Add PasswordInput component with show/hide toggle
- Centralize stockThresholds in AppContext for consistent status display
- Fix SharedSchedule sync issues with per-intake takenBy
- Improve mobile editing experience

## Technical
- Add migrations 0004 and 0005 for schema changes
- Update all relevant tests (1064 tests passing)
- Maintain backward compatibility with ALTER migrations
This commit is contained in:
Daniel Volz
2026-01-31 23:49:11 +01:00
committed by GitHub
parent ac4b8151e4
commit 571d94bf7e
37 changed files with 2896 additions and 990 deletions
@@ -139,6 +139,13 @@ const createMockAppContext = (overrides = {}) => ({
coverage: { all: [], low: [] },
coverageByMed: {},
depletionByMed: {},
stockThresholds: {
lowStockDays: 7,
normalStockDays: 30,
highStockDays: 90,
criticalStockDays: 7,
expiryWarningDays: 30,
},
manuallyExpandedDays: new Set(),
manuallyCollapsedDays: new Set(),
toggleDayCollapse: vi.fn(),
@@ -400,8 +407,8 @@ describe("DashboardPage structure", () => {
// Should have all expected table columns
expect(screen.getByText(/table\.name/i)).toBeInTheDocument();
expect(screen.getByText(/table\.fullBlisters/i)).toBeInTheDocument();
expect(screen.getByText(/table\.openBlister/i)).toBeInTheDocument();
expect(screen.getByText(/table\.stock(?!Details)/i)).toBeInTheDocument();
expect(screen.getByText(/table\.stockDetails/i)).toBeInTheDocument();
expect(screen.getByText(/table\.daysLeft/i)).toBeInTheDocument();
expect(screen.getByText(/table\.runsOut/i)).toBeInTheDocument();
expect(screen.getByText(/table\.expiry/i)).toBeInTheDocument();