Skip to content

Contract Template System #301

@Starefossen

Description

@Starefossen

Summary

Create tier-based contract templates with variable substitution and PDF generation.

Changes

Schema

  • Create sanity/schemaTypes/contractTemplate.ts
    • title (string)
    • content (portable text with variable placeholders)
    • tiers - array of tier references this template applies to
    • include_addons - boolean

Variables Supported

  • {{sponsor.name}}, {{sponsor.org_number}}
  • {{tier.name}}, {{tier.benefits}}
  • {{contract_value}}, {{contract_currency}}
  • {{addons}} - list of selected addons
  • {{conference.name}}, {{conference.dates}}

Implementation

  • src/lib/sponsor-crm/contract-generator.ts - template engine
  • PDF generation using @react-pdf/renderer
  • tRPC endpoint crm.contract.generatePdf

Admin UI

  • Template management at /admin/sponsors/templates
  • Preview/download generated PDF

Acceptance Criteria

  • Admin can create/edit contract templates
  • Templates can be assigned to specific tiers
  • PDF generates with correct variable substitution
  • Addons section included when configured

Dependencies

None - can start immediately

Part of

Epic: CRM Phase 2 - Sponsor Contract Signing & Automation

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions