PhoenixKitBilling.Web.ProjectBillingLive (PhoenixKitBilling v0.7.2)

Copy Markdown View Source

The Customer billing tab for the phoenix_kit_projects hub — this module's phoenix_kit_project_extensions/0 contribution.

HONEST LABELING (the design consult's hard requirement): this tab is the linked CUSTOMER's money — every invoice and order on their billing profile, across everything they buy — NOT a per-project P&L. The per-project money story is the projects-side ledger→invoice bridge, which WRITES through this module's public API; this tab is the read-only rollup where those drafts (and everything else) appear.

Config: billing_profile_uuid links the customer; rate_cents_per_hour is read by the projects-side bridge when generating drafts from logged effort (stored here so both money settings live on one extension). Hub session contract as usual; read-only, so can_write is unused.

Off-router-mountable: no handle_params/3 (the hub's hard requirement). Because that rules out the usual "query in handle_params" split, the reads sit behind a connected?/1 guard so the throwaway static mount does not run them.

Visibility

The hub authorizes: it only renders this pane for a viewer it has already admitted to the project, and an admin has to paste a profile UUID into the project's config before anything is linked. Everyone who can see the project therefore sees the linked customer's invoice list. That is the feature. What this tab must never do is widen that to customers the project was NOT linked to — hence the unlinked state links out to the billing admin instead of enumerating profiles.