mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-11 22:30:58 +04:30
Add super-admin invoices: settings templates and per-business issue flow.
Platform invoice templates live under Settings; each business can list and issue invoices with optional name and a meshkee.com public link. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
db52a83f98
commit
8f4af7a16c
+41
-1
@@ -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 2026
|
||||
Last updated: July 24, 2026
|
||||
|
||||
---
|
||||
|
||||
@@ -139,8 +139,10 @@ Add to `/etc/hosts` (one line per tenant):
|
||||
| `/login` | Login |
|
||||
| `/` | Home |
|
||||
| `/businesses` | Businesses list |
|
||||
| `/businesses/:businessId/invoices` | Business invoices (list + issue) |
|
||||
| `/users` | Users |
|
||||
| `/websites` | Websites / domains |
|
||||
| `/settings` | Platform settings (invoice item templates) |
|
||||
| `/profile` | Profile |
|
||||
|
||||
### Customer (`apps/customer`)
|
||||
@@ -308,9 +310,37 @@ Run in order from `MeshkeeApp Backend/database/migrations/`:
|
||||
| `009_categories_name_fa.sql` | `name_fa` on categories — **required** or categories 500 |
|
||||
| `010_category_variations.sql` | variation tables |
|
||||
| `016_product_variation_values.sql` | product variation values |
|
||||
| `036_invoices.sql` | Platform/business invoices + invoice item templates |
|
||||
|
||||
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.
|
||||
|
||||
| Endpoint | Purpose |
|
||||
|----------|---------|
|
||||
| `GET/POST /invoice-item-templates` | Platform predefined line items (Settings) |
|
||||
| `PATCH/DELETE /invoice-item-templates/:id` | Update/remove template |
|
||||
| `GET/POST /businesses/:businessId/invoices` | List / issue invoices for a business |
|
||||
| `GET/PATCH/DELETE /businesses/:businessId/invoices/:invoiceId` | Detail, status update, delete |
|
||||
|
||||
**Invoice fields:** optional `name`, `notes`, `status` (`draft` \| `issued` \| `paid` \| `cancelled`), `publicUrl`.
|
||||
|
||||
**Line item fields:** `title`, `duration`, `worktime`, `description`, `price`, `discountedPrice` (IRT). Create flow can mix predefined templates + custom lines.
|
||||
|
||||
**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`
|
||||
|
||||
**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
|
||||
|
||||
---
|
||||
|
||||
## Key files by area
|
||||
@@ -337,9 +367,17 @@ After schema changes: `npx prisma generate` and restart the backend.
|
||||
|------|------|
|
||||
| Products | `src/products/products.service.ts` |
|
||||
| Categories | `src/categories/categories.service.ts` |
|
||||
| Invoices | `src/invoices/` |
|
||||
| Media / S3 | `src/media/media.service.ts` |
|
||||
| Prisma schema | `prisma/schema.prisma` |
|
||||
|
||||
### Super Admin
|
||||
| Area | Path |
|
||||
|------|------|
|
||||
| Settings / invoice templates | `apps/super-admin/src/pages/SettingsPage.tsx` |
|
||||
| Business invoices | `apps/super-admin/src/pages/BusinessInvoicesPage.tsx` |
|
||||
| Invoice API client | `apps/super-admin/src/services/invoiceService.ts` |
|
||||
|
||||
---
|
||||
|
||||
## UI conventions
|
||||
@@ -434,6 +472,8 @@ 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)
|
||||
- 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
|
||||
- Wire order status transitions to store `orderProcessSteps`
|
||||
|
||||
Reference in New Issue
Block a user