HrContract Docs

Predefined Prompts

Copy-paste prompts for the receiving developer

Copy/paste these into Cursor (or similar) when extending HrContract.


Prompt 1 — Wire real PDF rendering

In D:\Repos\HrContract, replace the HTML-as-base64 placeholder in
`src/app/api/emzagar/document/route.ts` and mock-complete with a real PDF
renderer. Prefer puppeteer-core HTML→PDF using wrapContractHtmlDocument output.
Keep Emzagar response shape `{ pdf: base64 }`. Do **not** persist unsigned
PDFs under `unsigned/` — generate from frozen `contentHtml` on demand
(download + Emzagar document pull). Persist only canonical `signed/` and
rebuildable `signed-pdf-with-qr/` after sign completion.
Do not send QR-stamped PDFs to Emzagar.

Prompt 2 — Add attachment contracts

Extend HrContract so Template.type=ATTACHMENT works end-to-end: use
HR_GENERATION_OVERLAYS.attachment in the generate UI, store attachment overlay
keys on HrContract, and set documentKind=attachment in QR payload. Mirror
performance-web attachment generate modal fields (date, start, price, description)
but keep the abstract VariableRegistry — no tariff variables.

Prompt 3 — Port CEO multi-sign

Add dashboard batch sign for the ceo role using Emzagar multiSignCount /
partCount like performance-web `dashboard-batch-sign.ts`. Max 30 contracts per
batch. Reuse createEmzagarClient.getGatewayLink and ContractSignSession.batchId.
After each callback, completeContractSignSession must upsert certs and rebuild
all role QRs onto canonical signed PDF.

Prompt 4 — Swap SQLite → SQL Server

Change prisma/schema.prisma datasource to SQL Server using the same connection
string style as performance-web. Keep model names. Ask me before running
prisma db push. Update .env.example DATABASE_URL docs.

Prompt 5 — TinyMCE template editor

Replace the plain textarea on /dashboard/templates with @tinymce/tinymce-react
and a variables sidebar that inserts {{key}} chips from
api.templates.listVariables. Reuse UX patterns from performance-web
variables-sidebar.tsx but bind to HR_DOCUMENT_VARIABLES only.

Prompt 6 — Public OTP gate

Add optional OTP login in front of /contract similar to UserRasaSettings.force_login
in performance-web. Keep it feature-flagged via a new Settings singleton
(id=global). Do not copy tariff or upload_date logic.

Prompt 7 — Explain architecture to a new teammate

Read docs/CONTRACT_ENGINE.md, docs/EMZAGAR.md, docs/SIGNATURE_QR.md and
src/lib/contract-engine/*. Summarize for me: how a template becomes a signed
QR PDF, which seams I should implement for a new "lease agreement" product,
and which folders I must not send back to Hovita (canonical signed/ only —
never signed-pdf-with-qr/; there is no first-backup folder).

Prompt 8 — Remove first-backup from performance-web

See the dedicated copy-paste prompt in docs/PROMPTS_REMOVE_QR_FIRST_BACKUP.md (repo markdown; obsolete first-backup flow) (work main then feat/v2-rewrite separately; never merge the branches).