feat(po): per-company logo, stamp & brand bar on exported POs #48

Merged
shad0w merged 2 commits from feat/company-header-logo-branding into master 2026-06-20 20:01:47 +00:00
Owner

What & why

Companies can now upload a logo and a stamp/seal that render on exported purchase orders, and every export gets a fixed brand-colour bar along the bottom — matching the shared sample PO.

Changes

  • Schema: Company.logoKey, Company.stampKey (+ migration 20260621000000_company_branding_assets).
  • Storage: buildCompanyAssetKey(companyId, "logo"|"stamp", ext)company-assets/<id>/{logo,stamp}.<ext> (deterministic, overwrite-in-place).
  • Server actions: uploadCompanyAsset / removeCompanyAssetmanage_vessels_accounts gated, ≤ 4 MB, PNG/JPG/WebP.
  • Admin UI: CompanyBrandingUploader in the company Edit dialog (logo + stamp, live previews, remove). Uploads available once the company exists.
  • Export (/api/po/[id]/export, both XLSX + PDF):
    • logo floats top-left of the header,
    • stamp overlays the approver's signatory block,
    • fixed #92D050 brand bar full-width at the bottom (always drawn),
    • signatory "For, …" line now uses the actual company name.

Tests

  • Unit: tests/unit/storage-keys.test.ts (key namespacing/determinism).
  • Integration: tests/integration/company-branding.test.ts (upload/remove, type/mime/size validation, permission gating) — 8 tests, all green.
  • pnpm type-check clean; pnpm test green. ExcelJS generation smoke-tested with the real anchor/bar code.

Docs

Wiki updated (separate repo): File-Storage, Purchase-Orders, Data-Model.

Notes

  • The brand colour is intentionally a fixed constant (per request), not per-company configurable.
  • A migration is included; pnpm db:migrate:deploy already applied locally.

🤖 Generated with Claude Code

## What & why Companies can now upload a **logo** and a **stamp/seal** that render on exported purchase orders, and every export gets a fixed brand-colour bar along the bottom — matching the shared sample PO. ## Changes - **Schema**: `Company.logoKey`, `Company.stampKey` (+ migration `20260621000000_company_branding_assets`). - **Storage**: `buildCompanyAssetKey(companyId, "logo"|"stamp", ext)` → `company-assets/<id>/{logo,stamp}.<ext>` (deterministic, overwrite-in-place). - **Server actions**: `uploadCompanyAsset` / `removeCompanyAsset` — `manage_vessels_accounts` gated, ≤ 4 MB, PNG/JPG/WebP. - **Admin UI**: `CompanyBrandingUploader` in the company Edit dialog (logo + stamp, live previews, remove). Uploads available once the company exists. - **Export** (`/api/po/[id]/export`, both XLSX + PDF): - logo floats **top-left** of the header, - stamp overlays the **approver's signatory block**, - fixed **`#92D050` brand bar** full-width at the bottom (always drawn), - signatory "For, …" line now uses the actual company name. ## Tests - Unit: `tests/unit/storage-keys.test.ts` (key namespacing/determinism). - Integration: `tests/integration/company-branding.test.ts` (upload/remove, type/mime/size validation, permission gating) — 8 tests, all green. - `pnpm type-check` clean; `pnpm test` green. ExcelJS generation smoke-tested with the real anchor/bar code. ## Docs Wiki updated (separate repo): File-Storage, Purchase-Orders, Data-Model. ## Notes - The brand colour is intentionally a fixed constant (per request), not per-company configurable. - A migration is included; `pnpm db:migrate:deploy` already applied locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
shad0w added 1 commit 2026-06-20 20:00:02 +00:00
feat(po): per-company logo, stamp & brand bar on exported POs
All checks were successful
PR checks / checks (pull_request) Successful in 31s
1071cb226f
Companies can upload a logo and a stamp/seal (Admin → Companies → Edit →
Branding); both render on exported PDF and XLSX purchase orders. A fixed
brand-colour bar (#92D050, matching the sample PO) runs along the bottom of
every export.

- Company.logoKey / stampKey + migration
- buildCompanyAssetKey() deterministic storage keys (overwrite-in-place)
- uploadCompanyAsset / removeCompanyAsset server actions (≤4MB PNG/JPG/WebP,
  manage_vessels_accounts gated)
- CompanyBrandingUploader in the company edit dialog with live previews
- Export route embeds logo (top-left), stamp (signatory block) and brand bar
  in both ExcelJS and print-HTML paths
- Unit test (storage keys) + integration test (branding actions)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
shad0w added 1 commit 2026-06-20 20:01:34 +00:00
Merge branch 'master' into feat/company-header-logo-branding
All checks were successful
PR checks / checks (pull_request) Successful in 32s
467f0ddea4
shad0w merged commit 74d20cd452 into master 2026-06-20 20:01:47 +00:00
Sign in to join this conversation.
No description provided.