feat(phase-4b): Health Records UI — ClearanceSummaryCard + HealthRecordForm #37

Closed
jason wants to merge 0 commits from feat/phase-4b-health-genetics into master
Owner

Phase 4b — Health & Genetics (Step 1 of 2)

Summary

Adds OFA health clearance tracking to the Dog Detail page via two new components and an updated DogDetail view.


New Components

ClearanceSummaryCard.jsx

  • Fetches /api/health/dog/:id/clearance-summary on mount
  • Displays 4 clearance chips: Hips / Elbows / Heart / Eyes — color-coded green/amber/red/grey
  • Header badges: GRCA Eligible, Under 24mo, CHIC #xxxxx
  • 90-day expiry warning banner auto-renders when a clearance is near expiry
  • Shows + Add Health Record button wired to onAddRecord prop
  • Gracefully handles missing data (null return, no flash/error on new dogs)

HealthRecordForm.jsx

  • OFA Clearance mode (default): test type dropdown, OFA result, OFA number, performed by, test date, expires at
  • General mode (vaccination, exam, etc.): name, date, next due, result, vet name
  • Form type switches dynamically when Record Type changes
  • Document URL + notes fields on all types
  • POST for new records, PUT for edits — errors display inline

Updated

DogDetail.jsx

  • Imports and renders ClearanceSummaryCard above health records list
  • Health records list with inline Edit button per row
  • fetchHealth() called on mount and after every save/edit to keep list fresh
  • openAddHealth / openEditHealth / closeHealthForm handlers wired cleanly

Testing Checklist

  • Add a new OFA clearance record to a dog
  • Edit an existing health record
  • Verify clearance chips update after save
  • Test 90-day expiry warning banner appears for near-expiry records
  • CHIC badge displays when CHIC number exists
  • GRCA Eligible badge logic is correct
  • No errors on dogs with zero health records
  • General record type (vaccination) form fields render correctly

API Dependencies

Requires these endpoints to already be available (from backend health routes):

  • GET /api/health/dog/:id — list all health records for a dog
  • GET /api/health/dog/:id/clearance-summary — OFA summary object
  • POST /api/health — create new record
  • PUT /api/health/:id — update record

Branch

feat/phase-4b-health-geneticsmaster

Next Step

GeneticPanelCard component (Phase 4b Step 2)

## Phase 4b — Health & Genetics (Step 1 of 2) ### Summary Adds OFA health clearance tracking to the Dog Detail page via two new components and an updated DogDetail view. --- ### New Components #### `ClearanceSummaryCard.jsx` - Fetches `/api/health/dog/:id/clearance-summary` on mount - Displays 4 clearance chips: **Hips / Elbows / Heart / Eyes** — color-coded green/amber/red/grey - Header badges: **GRCA Eligible**, **Under 24mo**, **CHIC #xxxxx** - 90-day expiry warning banner auto-renders when a clearance is near expiry - Shows `+ Add Health Record` button wired to `onAddRecord` prop - Gracefully handles missing data (null return, no flash/error on new dogs) #### `HealthRecordForm.jsx` - **OFA Clearance mode** (default): test type dropdown, OFA result, OFA number, performed by, test date, expires at - **General mode** (vaccination, exam, etc.): name, date, next due, result, vet name - Form type switches dynamically when Record Type changes - Document URL + notes fields on all types - `POST` for new records, `PUT` for edits — errors display inline ### Updated #### `DogDetail.jsx` - Imports and renders `ClearanceSummaryCard` above health records list - Health records list with inline **Edit** button per row - `fetchHealth()` called on mount and after every save/edit to keep list fresh - `openAddHealth` / `openEditHealth` / `closeHealthForm` handlers wired cleanly --- ### Testing Checklist - [ ] Add a new OFA clearance record to a dog - [ ] Edit an existing health record - [ ] Verify clearance chips update after save - [ ] Test 90-day expiry warning banner appears for near-expiry records - [ ] CHIC badge displays when CHIC number exists - [ ] GRCA Eligible badge logic is correct - [ ] No errors on dogs with zero health records - [ ] General record type (vaccination) form fields render correctly --- ### API Dependencies Requires these endpoints to already be available (from backend health routes): - `GET /api/health/dog/:id` — list all health records for a dog - `GET /api/health/dog/:id/clearance-summary` — OFA summary object - `POST /api/health` — create new record - `PUT /api/health/:id` — update record --- ### Branch `feat/phase-4b-health-genetics` → `master` ### Next Step `GeneticPanelCard` component (Phase 4b Step 2)
jason closed this pull request 2026-03-10 12:51:41 -05:00

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jason/breedr#37