Files
TapTrack-Hub/.paul/STATE.md
kevin-asprec 0e0803e417 feat(phase-8): billing engine + invoice PDF + mark-paid + overdue escalation
Backend:
- app/services/invoice_pdf.py: Jinja2+WeasyPrint PDF generation, saves to
  /app/data/invoices/{id}.pdf, updates Invoice.pdf_path
- app/templates/invoice.html: professional branded A4 invoice template with
  school details, line items table, totals, payment instructions, paid receipt
- routers/billing.py: GET /invoices/{id}/pdf (auto-generate on demand, FileResponse),
  POST /invoices/{id}/mark-paid (payment_method + reference → status=paid),
  POST /trigger-generate-invoices (manual trigger), school_name in invoice list
- tasks/billing.py: fix missing func import in generate_monthly_invoices,
  new billing.generate_invoice_pdf Celery task, auto-send email after
  invoice creation, check_overdue upgraded with 7-day warning emails and
  30-day school suspension + suspension email

Frontend:
- BillingPage.vue: full rewrite — status filter tabs, school names (not UUIDs),
  PDF download button, mail icon, Mark Paid modal with method/reference fields,
  overdue rows highlighted, pagination, Generate Invoices trigger button
- api.ts: markInvoicePaid, downloadInvoicePdf, triggerGenerateInvoices
2026-03-16 13:46:33 +08:00

2.8 KiB

TapTrack Hub — PAUL State

Current Position

Milestone: v1.0 — Foundation & Core Services Phase: 8 of 15 (Billing Engine + Invoice PDF — complete) Plan: Phase 8 complete — Phase 9 next Status: Phase 8 applied — ready to begin Phase 9 Last activity: 2026-03-16 — Phase 8 complete (invoice PDF via Jinja2+WeasyPrint, mark-paid modal, overdue escalation with 7d warning + 30d suspension, bug fix in billing task)

Loop Position

PLAN ──▶ APPLY ──▶ UNIFY
  ·        ·        ·     [No active plan — Phase 9 planning next]

Progress

v1.0 Foundation

  • Phase 1 (Project Setup & Infrastructure): [██████████] 100% ✓
  • Phase 2 (School Registry + License Mgmt): [██████████] 100% ✓
  • Phase 3 (On-Prem License Validation): [██████████] 100% ✓
  • Phase 4 (SMS Gateway): [██████████] 100% ✓
  • Phase 5 (On-Prem SMS Polling Agent): [██████████] 100% ✓
  • Phase 6 (Super Admin Dashboard UI): [██████████] 100% ✓
  • Phase 7 (School Admin Portal UI): [██████████] 100% ✓
  • Phase 8 (Billing Engine + Invoice PDF): [██████████] 100% ✓
  • Phase 9 (Email Dispatcher): [░░░░░░░░░░] 0%
  • Phase 10 (Support Ticket System): [░░░░░░░░░░] 0%
  • Phase 11 (Monthly Report Generation): [░░░░░░░░░░] 0%
  • Phase 12 (On-Prem Monthly Report Pull): [░░░░░░░░░░] 0%
  • Phase 13 (Feature Flags + Suspension): [░░░░░░░░░░] 0%
  • Phase 14 (Onboarding Wizard): [░░░░░░░░░░] 0%
  • Phase 15 (UX Polish + Ops Tools): [░░░░░░░░░░] 0%

Next Action

Run: /paul:plan for Phase 9 — Email Dispatcher Resume file: .paul/ROADMAP.md → Phase 9

Repo

Remote: TBD (new Gitea repo) Branch: master Last commit: initial scaffold

Tech Stack

  • Backend: FastAPI 0.115 + SQLAlchemy 2 async + PostgreSQL 15 + Redis 7
  • Worker: Celery 5.4 + celery-beat
  • Email: SMTP via smtplib + Jinja2 HTML templates
  • SMS: Semaphore PH API (single account, proxied for all schools)
  • Frontend: Vue 3.5 + Vite + Pinia + Vue Router + Tailwind CSS 3
  • Infra: Docker Compose + Nginx reverse proxy

Architecture Notes

  • Two user roles: super_admin (operator) + school_admin (client)
  • Two frontend layouts: AppLayout (super admin nav) + PortalLayout (school portal nav)
  • SMS flow: on-prem polls /api/sync/poll every 30s → Hub queues/sends via Semaphore
  • License flow: on-prem calls /api/licenses/validate on startup + every 6h
  • No inbound firewall rules needed — all communication is on-prem → Hub outbound