Skip to content

Conversation

@kasvith
Copy link
Contributor

@kasvith kasvith commented Jan 19, 2026

Summary

  • Visual Print Template Builder: Add a drag-and-drop template editor for creating custom print layouts with live preview
  • Template Selection: Users can choose which template to use when printing surgery records
  • Template Management: Edit descriptions, reset templates to defaults, and manage multiple templates
  • Print Dialog Improvements: Skip template selection when only one exists, remove loading flash
  • Page Break Handling: Improved print layout to prevent blank pages and keep sections together
  • UI Fixes: Better Community section layout, cleaner dialog animations, merged DoA/DoD into main data table

Changes

  • New template builder with block-based editing (header, content, table, spacer blocks)
  • Template field system with 50+ available fields for surgery data
  • Live preview with actual surgery data
  • Print CSS improvements for cleaner output
  • Database migrations for print_templates table
  • Settings page integration for template management

Test plan

  • Create a new print template using the visual builder
  • Add various block types and configure fields
  • Preview template with real surgery data
  • Print a surgery record and verify layout
  • Test template selection dialog with multiple templates
  • Verify page breaks work correctly for long content

Replace Handlebars templates with a block-based visual template builder
that allows non-technical staff to customize print layouts.

Key changes:
- Add print_templates and default_print_templates database tables
- Implement drag-and-drop template builder with @dnd-kit
- Support 11 block types: header, text, data-field, data-table,
  rich-content, divider, spacer, doctors-list, conditional, two-column, image
- Add live preview with sample patient/surgery data
- Update print dialog to use new template renderer
- Add template management UI (create, edit, duplicate, delete, restore)
- Fix backup/restore to properly handle WAL mode (checkpoint before
  backup, delete WAL files before restore)
- Fix updateSetting to use upsert for missing settings after restore
- Remove Handlebars dependency and old template files
…page

- Merge DoA/DoD fields into the main patient info table in print templates
  instead of using a separate conditional table (removes visual gap)
- Add clickable link to surgery view from BHT number on edit surgery page
Move Print Templates from standalone page to Settings tab for
consistent navigation. Add refined card design with horizontal
layout, gradient icons, hover states, and polished dropdown menus.

- Create PrintTemplatesSettings component for Settings integration
- Add print-templates as fourth Settings tab
- Redirect /settings/print-templates to /settings?tab=print-templates
- Design TemplateCard as clickable list item with hover animations
- Add consistent icons to all dropdown menu items
- Add description input field to template editor header
- Add resetPrintTemplatesToDefaults function that deletes all templates
  and recreates from default_print_templates table
- Change "Restore Default" to "Reset to Defaults" button with
  confirmation dialog
- Simplify UI by removing per-template restore dropdown
- Create PrintDialog component with template dropdown
- If only one template exists, print directly without dialog
- If multiple templates exist, show selection dialog
- Pre-selects default template in dropdown
- Update view-surgery.tsx to use PrintDialog for both
  surgery and follow-up printing
- Reorganize layout with QR code and button in same row
- Add "Why Join?" benefits panel on the right side
- Better responsive behavior at different screen widths
@kasvith kasvith merged commit 017aac7 into main Jan 19, 2026
2 checks passed
@kasvith kasvith deleted the feat/template-builder branch January 19, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants