# Phase 6 — Invoice Management UI/API Report

**Status:** Complete — awaiting approval to start Phase 7  
**Date:** 2026-10-07  

---

## Backend additions

| Endpoint | Purpose |
|----------|---------|
| `GET /api/v1/project/contracts/{id}/invoice-summary` | Ceiling, invoiced/paid/outstanding, split by type |
| Contract resource | Exposes `auto_invoice_on_milestone_approval` |

Existing list/show/create APIs unchanged.

---

## Frontend

| Surface | Path / location |
|---------|-----------------|
| Invoices list page | `/project/invoices` (+ sidebar nav) |
| Contract drawer → **Milestones** | Create / approve / remaining amounts |
| Contract drawer → **Invoices** | Summary cards, list, create, detail |
| Create Invoice drawer | Explicit **Contract-wise** vs **Milestone-wise** |
| Invoice detail drawer | Type badge; milestone allocation table only when milestone-wise; payment summary (paid/outstanding) |

### UX distinction

- Contract-wise: amount only; detail shows “no milestone allocations”
- Milestone-wise: multi-select approved milestones + per-row amounts + line total

---

## Tests

`ProjectInvoiceApiTest` — **12 passed** (includes summary endpoint)  
Frontend `tsc -b` — clean

---

## Explicitly NOT done

- Customer payment recording UI / AR settlement (Phase 7)  
- Toggle `auto_invoice_on_milestone_approval` in contract form (field exposed on API; still set via DB/model for now)  

---

## STOP

Phase 6 complete. **Awaiting explicit approval for Phase 7 — Payment.**
