feat: add invoice template system with custom branding#262
Open
Jayrodri088 wants to merge 2 commits intodavedumto:mainfrom
Open
feat: add invoice template system with custom branding#262Jayrodri088 wants to merge 2 commits intodavedumto:mainfrom
Jayrodri088 wants to merge 2 commits intodavedumto:mainfrom
Conversation
|
@Jayrodri088 is attempting to deploy a commit to the david's projects Team on Vercel. A member of the Team first needs to authorize it. |
Owner
|
HI @Jayrodri088 FIX THE CI ERRORS |
Author
|
@davedumto errors fixed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an invoice template system so freelancers can customize invoice appearance (logo, colors, footer) and keep branding consistent across invoices, PDFs, and email notifications.
Changes
API
/api/routes-d/branding/templates– List templates, create template (max 5 per user, first or explicitly set default)./api/routes-d/branding/templates/[id]– Get, update, or delete a template; settingisDefault: trueclears default on others./api/routes-d/branding/logo-upload– Upload branding logo (images only, max 2MB). Returns path stored on template./api/routes-d/branding/logo?path=userId/filename– Authenticated serve for logo files (used by editor preview and PDF).Database
InvoiceTemplatemodel:id,userId,name,isDefault,logoUrl,primaryColor,accentColor,showLogo,showFooter,footerText,layout(modern | classic | minimal), timestamps. Index on(userId, isDefault).Userhas new relationinvoiceTemplates.Frontend
components/settings/TemplateEditor.tsx– Template list, create/edit form, hex color pickers for primary/accent, logo file upload, live invoice-style preview, set default, delete. Resolves/branding-logos/logo URLs via authenticated fetch for preview.PDF & email
lib/invoice-renderer.tsx– Branded invoice PDF with template config (logo, colors, layout, footer). Re-exported fromlib/pdf.tsxfor backward compatibility.BrandingSettingsfallback); resolves/branding-logos/to absolute path for server-side rendering.Other
lib/file-storage.ts–validateLogoFile,storeBrandingLogoFile,getBrandingLogoAbsolutePathfor branding logos underuploads/branding-logos/.lib/email-templates/invoice-auto-cancelled.tsx– Optionalbrandingprop for logo and colors.Acceptance criteria (from spec)
How to test
npm install,npx prisma generate,npx prisma migrate dev --name add-invoice-templates,npm run dev.<TemplateEditor />on a settings/branding page, log in, create a template, upload a logo, set default./api/routes-d/invoices/[id]/pdf(or use existing PDF action) – PDF should use template logo/colors/footer.Notes
logoUrlis a full public URL; stored/branding-logos/paths are used for in-app preview and PDF only.BrandingSettingsremains supported as fallback when no invoice template exists.Closes: #240