Skip to content

feat(invoice): add 'Copy Invoice URL' button in InvoiceRead#719

Draft
augmentcode[bot] wants to merge 1 commit into
mainfrom
hammads-turing/copy-invoice-url-button
Draft

feat(invoice): add 'Copy Invoice URL' button in InvoiceRead#719
augmentcode[bot] wants to merge 1 commit into
mainfrom
hammads-turing/copy-invoice-url-button

Conversation

@augmentcode
Copy link
Copy Markdown

@augmentcode augmentcode Bot commented May 27, 2026

Summary

Adds a Copy Invoice URL button to the invoice read view (InvoiceRead.jsxReadInvoiceModuleReadItem). Clicking it copies a tokenized public link — served by the existing unauthenticated /public backend route — to the clipboard and shows a success toast.

Changes

frontend/src/config/serverApiConfig.js

  • Exports a new PUBLIC_BASE_URL constant pointing at the backend's unauthenticated /public/ route (mirrors the existing DOWNLOAD_BASE_URL pattern; respects VITE_BACKEND_SERVER in prod).

frontend/src/modules/ErpPanelModule/ReadItem.jsx

  • Imports message from antd and LinkOutlined from @ant-design/icons.
  • Imports PUBLIC_BASE_URL from the config.
  • Adds a Copy Invoice URL button in the PageHeader extra array, hidden for all entities except invoice (same pattern as the existing Convert to Invoice button that hides for non-quote entities).
  • On click: constructs the public URL PUBLIC_BASE_URL + download/invoice/invoice-{id}.pdf, writes it to the clipboard via navigator.clipboard.writeText, then shows message.success('Invoice URL Copied To Clipboard').

Public URL format

http://<backend>/public/download/invoice/invoice-<id>.pdf

This is served by corePublicRouter (/public route in app.js) with no auth middleware — no auth changes required.

Note: The PDF file must have been generated at least once (via the Download PDF button) before the public link returns a file. The /public route is a static file server over src/public/; the PDF is written there by the /download route handler.


Pull Request opened by Augment Code | View session

Add a 'Copy Invoice URL' button to the invoice read view that copies
a public link from the /public route to the clipboard and shows a
success toast.

- Export PUBLIC_BASE_URL constant from serverApiConfig.js pointing to
  the unauthenticated /public backend route
- Add 'Copy Invoice URL' button in ReadItem.jsx (visible only for the
  invoice entity) using LinkOutlined icon and Ant Design message.success
- Public URL format: /public/download/invoice/invoice-{id}.pdf which
  is served by corePublicRouter without any auth middleware
- No auth changes; surfaces the existing unauthenticated /public route
@augmentcode
Copy link
Copy Markdown
Author

augmentcode Bot commented May 27, 2026

PR Author Agent

👋 I've got this PR — here's what I'll handle for you:

  • Review feedback — implement suggestions, answer questions, fix what comes up
  • CI failures — I get pinged when checks fail and try to fix them
  • Merge conflicts — bring the PR back up to date when it falls behind
  • Merge gates — watch CI, reviews, and verification
  • Ping you the moment it's ready to merge

Marking it ready and picking reviewers are your call — I'll leave both alone.

Drop a comment anytime!

@augmentcode
Copy link
Copy Markdown
Author

augmentcode Bot commented May 28, 2026

PR Author Agent

All blocking gates are green on c269801 — ready to flip to ready-for-review whenever you are. Reply mark ready here, or use the Ready for review button on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant