mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-11 22:30:58 +04:30
Polish public invoice layout: account grid, duration, and copy-to-clipboard.
Also preserve item description line breaks and use local ported invoice links in DEV. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
f21041b950
commit
2be3b3376d
@@ -5,3 +5,9 @@ VITE_API_BASE_URL=http://localhost:3000/api/v1
|
||||
# Leave unset for multi-tenant dev — tenant is resolved from hostname
|
||||
# (e.g. business.sanihome.ir → sanihome.ir, business.safeteb.com → safeteb.com).
|
||||
# VITE_BUSINESS_DOMAIN=sanihome.ir
|
||||
|
||||
# Local public invoice viewer runs on super-admin Vite (port 5174).
|
||||
# In DEV, copy/open links use https://meshkee.app:5174/invoices/{id} automatically.
|
||||
# VITE_INVOICE_PUBLIC_BASE_URL=https://meshkee.app:5174
|
||||
# VITE_INVOICE_PUBLIC_DEV_HOST=meshkee.app
|
||||
# VITE_INVOICE_PUBLIC_DEV_PORT=5174
|
||||
|
||||
@@ -39,6 +39,7 @@ export function getBusinessDomain(): string {
|
||||
* Fallback public invoice URL if the API response is missing `publicUrl`.
|
||||
* Prefer `invoice.publicUrl` returned by the API — this only covers edge cases.
|
||||
* Business invoices use the tenant domain (e.g. sanihome.ir), not meshkee.com.
|
||||
* Local/dev: public viewer lives on super-admin (`https://meshkee.app:5174`).
|
||||
*/
|
||||
export function getInvoicePublicUrlFallback(
|
||||
publicId: string,
|
||||
@@ -48,6 +49,13 @@ export function getInvoicePublicUrlFallback(
|
||||
if (baseOverride) {
|
||||
return `${baseOverride.replace(/\/$/, '')}/invoices/${publicId}`
|
||||
}
|
||||
if (import.meta.env.DEV) {
|
||||
const protocol = window.location.protocol === 'http:' ? 'http:' : 'https:'
|
||||
const host =
|
||||
import.meta.env.VITE_INVOICE_PUBLIC_DEV_HOST?.trim() || 'meshkee.app'
|
||||
const port = import.meta.env.VITE_INVOICE_PUBLIC_DEV_PORT?.trim() || '5174'
|
||||
return `${protocol}//${host}:${port}/invoices/${publicId}`
|
||||
}
|
||||
const domain =
|
||||
import.meta.env.VITE_INVOICE_PUBLIC_DOMAIN?.trim() ||
|
||||
businessDomain.trim() ||
|
||||
|
||||
@@ -456,6 +456,7 @@
|
||||
margin: 8px 0 0;
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
.strike {
|
||||
|
||||
@@ -196,6 +196,10 @@ export function InvoicesPage() {
|
||||
}
|
||||
|
||||
function invoicePublicUrl(invoice: Invoice) {
|
||||
// Local: public viewer is on super-admin Vite (port 5174), not the apex domain.
|
||||
if (import.meta.env.DEV || import.meta.env.VITE_INVOICE_PUBLIC_BASE_URL) {
|
||||
return getInvoicePublicUrlFallback(invoice.publicId, getActiveBusinessDomain())
|
||||
}
|
||||
return (
|
||||
invoice.publicUrl ||
|
||||
getInvoicePublicUrlFallback(invoice.publicId, getActiveBusinessDomain())
|
||||
|
||||
Reference in New Issue
Block a user