Surface document matches on the detail page so users can navigate between matched documents (e.g., invoice ↔ contract).
DB query (db.document-matching/get-matches-for-document): Join document_match with document to return matched documents with type, id, and structured-data (for display name extraction). Handle canonical ordering (a < b) by querying both sides.
Handler (view/get-document): Call the matches query, pass results as :matches in opts to the renderer.
Tabs (shared/section-tabs-for-type): Accept matches parameter. Append "Matches" tab when (seq matches).
Section (shared/matches-section): Render at the top of the type-specific view. Each match is a card with type badge, display name, and link.
┌─────────────────────────────────────────┐
│ [Contract] Service Agreement 2025 │
│ ↗ View document │
└─────────────────────────────────────────┘
badge-{type} CSS classesPer document type:
src/com/getorcha/db/document_matching.clj — add/modify querysrc/com/getorcha/erp/http/documents/view.clj — handler fetches matchessrc/com/getorcha/erp/http/documents/view/shared.clj — tabs + matches section rendering