mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-11 22:30:58 +04:30
Ship invoice templates, public viewer, and print-ready show page.
Move template/issue editors to full pages, add public invoice SPA with PDF print, and local-aware public URLs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
8f4af7a16c
commit
cbffb23ec3
+40
-18
@@ -3,7 +3,7 @@
|
||||
> **For AI agents:** Read this file at the start of a new chat before making changes.
|
||||
> Update this document when a major feature is completed or architecture changes.
|
||||
|
||||
Last updated: July 24, 2026
|
||||
Last updated: July 26, 2026
|
||||
|
||||
---
|
||||
|
||||
@@ -139,10 +139,14 @@ Add to `/etc/hosts` (one line per tenant):
|
||||
| `/login` | Login |
|
||||
| `/` | Home |
|
||||
| `/businesses` | Businesses list |
|
||||
| `/businesses/:businessId/invoices` | Business invoices (list + issue) |
|
||||
| `/businesses/:businessId/invoices` | Business invoices list |
|
||||
| `/businesses/:businessId/invoices/new` | Issue invoice (full page) |
|
||||
| `/users` | Users |
|
||||
| `/websites` | Websites / domains |
|
||||
| `/settings` | Platform settings (invoice item templates) |
|
||||
| `/settings` | Platform settings (invoice templates + item templates) |
|
||||
| `/settings/invoice-templates/new` | Create invoice template |
|
||||
| `/settings/invoice-templates/:templateId` | Edit invoice template |
|
||||
| `/invoices/:invoiceId` | Public invoice viewer (no auth; print to PDF) |
|
||||
| `/profile` | Profile |
|
||||
|
||||
### Customer (`apps/customer`)
|
||||
@@ -311,35 +315,49 @@ Run in order from `MeshkeeApp Backend/database/migrations/`:
|
||||
| `010_category_variations.sql` | variation tables |
|
||||
| `016_product_variation_values.sql` | product variation values |
|
||||
| `036_invoices.sql` | Platform/business invoices + invoice item templates |
|
||||
| `037_invoice_name.sql` | Optional invoice name |
|
||||
| `038_invoice_templates.sql` | Full invoice templates + key points / accounts |
|
||||
| `039_invoice_account_holder.sql` | Account holder name on bank accounts |
|
||||
|
||||
After schema changes: `npx prisma generate` and restart the backend.
|
||||
|
||||
### Invoices (super-admin)
|
||||
|
||||
Platform billing invoices issued **to** a business. Schema supports a future `owner_scope=business` mode (business-issued invoices); UI is super-admin only for now.
|
||||
Two template layers + issued invoices:
|
||||
|
||||
| Layer | Purpose |
|
||||
|-------|---------|
|
||||
| **Invoice item templates** | Reusable line items (title, duration, worktime, desc, price, discounted) |
|
||||
| **Invoice templates** | Full blueprints: name, top text, items (from item templates or custom), duplicatable key points, duplicatable bank accounts (bank name, account holder, card, IBAN) |
|
||||
| **Invoices** | Issued to a business — start from an invoice template (editable) or blank |
|
||||
|
||||
| Endpoint | Purpose |
|
||||
|----------|---------|
|
||||
| `GET/POST /invoice-item-templates` | Platform predefined line items (Settings) |
|
||||
| `PATCH/DELETE /invoice-item-templates/:id` | Update/remove template |
|
||||
| `GET/POST /invoice-item-templates` | Platform line-item presets |
|
||||
| `PATCH/DELETE /invoice-item-templates/:id` | Update/remove line-item preset |
|
||||
| `GET/POST /invoice-templates` | Platform full invoice templates |
|
||||
| `GET/PATCH/DELETE /invoice-templates/:id` | Get / update / delete invoice template |
|
||||
| `GET/POST /businesses/:businessId/invoices` | List / issue invoices for a business |
|
||||
| `GET/PATCH/DELETE /businesses/:businessId/invoices/:invoiceId` | Detail, status update, delete |
|
||||
| `GET /public/invoices/:id` | Public show payload (issued/paid, no auth) |
|
||||
|
||||
**Invoice fields:** optional `name`, `notes`, `status` (`draft` \| `issued` \| `paid` \| `cancelled`), `publicUrl`.
|
||||
**Invoice fields:** optional `name`, `topText`, `notes`, `invoiceTemplateId`, `status`, `publicUrl`, nested `items`, `keyPoints`, `accounts` (bank name, account holder, card, IBAN).
|
||||
|
||||
**Line item fields:** `title`, `duration`, `worktime`, `description`, `price`, `discountedPrice` (IRT). Create flow can mix predefined templates + custom lines.
|
||||
**Public invoice viewer (platform):**
|
||||
- Route: super-admin SPA `/invoices/:id` (`PublicInvoicePage`) — glass layout, print-to-PDF, “Issued by” Meshkee footer
|
||||
- Local/dev link: current Vite origin (e.g. `https://meshkee.app:5174/invoices/{id}`)
|
||||
- Production link domain: `VITE_INVOICE_PUBLIC_DOMAIN` / `INVOICE_PUBLIC_DOMAIN` (default `meshkee.com`) — optional full origin override via `*_PUBLIC_BASE_URL`
|
||||
- Until `meshkee.com` proxies or hosts `/invoices/*`, production links may need that DNS/nginx wiring (viewer code ships with super-admin build)
|
||||
|
||||
**Public link (platform invoices):** `https://meshkee.com/invoices/{id}`
|
||||
- Backend: `INVOICE_PUBLIC_DOMAIN` (default `meshkee.com`) → response field `publicUrl`
|
||||
- Super Admin UI: `VITE_INVOICE_PUBLIC_DOMAIN` fallback helper in `lib/config.ts`
|
||||
- Public viewer page at that URL is **not** implemented yet — link is issued/copied only.
|
||||
|
||||
**Migrations:** `036_invoices.sql`, `037_invoice_name.sql`
|
||||
**Migrations:** `036_invoices.sql`, `037_invoice_name.sql`, `038_invoice_templates.sql`, `039_invoice_account_holder.sql`
|
||||
|
||||
**Super Admin UI:**
|
||||
- `/settings` — Invoices section (CRUD templates)
|
||||
- `/businesses/:businessId/invoices` — list, issue (extra-wide modal), view/copy link, update status, delete
|
||||
- Businesses table row → FileText control opens invoices page
|
||||
- `/settings` — Invoice templates list + item templates (top text preview = one-line ellipsis)
|
||||
- `/settings/invoice-templates/new` · `/settings/invoice-templates/:id` — full-page template editor (not modal)
|
||||
- `/businesses/:businessId/invoices` — list + view modal
|
||||
- `/businesses/:businessId/invoices/new` — full-page issue form
|
||||
- `/invoices/:id` — public viewer (no auth)
|
||||
- Schema supports future `owner_scope=business` (business-owned templates)
|
||||
|
||||
---
|
||||
|
||||
@@ -375,8 +393,12 @@ Platform billing invoices issued **to** a business. Schema supports a future `ow
|
||||
| Area | Path |
|
||||
|------|------|
|
||||
| Settings / invoice templates | `apps/super-admin/src/pages/SettingsPage.tsx` |
|
||||
| Template / issue editors | `InvoiceTemplateEditorPage.tsx`, `IssueInvoicePage.tsx` |
|
||||
| Shared draft fields | `apps/super-admin/src/components/InvoiceDraftFields.tsx` |
|
||||
| Public invoice viewer | `apps/super-admin/src/pages/PublicInvoicePage.tsx` |
|
||||
| Business invoices | `apps/super-admin/src/pages/BusinessInvoicesPage.tsx` |
|
||||
| Invoice API client | `apps/super-admin/src/services/invoiceService.ts` |
|
||||
| Invoice URL helpers | `apps/super-admin/src/lib/config.ts` |
|
||||
|
||||
---
|
||||
|
||||
@@ -472,7 +494,7 @@ SSL: Certbot cert `meshkee-dashboards` + cron `ssl-sync.sh` every 2h (option A:
|
||||
|
||||
## Suggested next work
|
||||
|
||||
- Public invoice page at `meshkee.com/invoices/{id}` (platform invoices)
|
||||
- Point `meshkee.com/invoices/*` at the public invoice viewer (proxy or dedicated host)
|
||||
- Business-dashboard invoice templates + issue flow (`owner_scope=business`)
|
||||
- Migrate business and super-admin to `@meshkee/dashboard-core` / `@meshkee/dashboard-ui`
|
||||
- Connect product comments to backend
|
||||
|
||||
Reference in New Issue
Block a user