Hub 2.0 step 4: billing per customer
- One invoice per customer per period for all its products; the schedule moves from Licence to Customer (migration copies it, so billing carries on unchanged); licences get billedFrom / billedUntil - Website (R99, 5 GB) and App (on active members) prices next to the Events tiers; founding prices per product, then bundles (15% two, 25% three); extra website storage R20 per 5 GB, never discounted - A product added to a billed customer starts after its free month; days before its first full period are prorated, never charged twice - Annual review per product (Events income, App members), one notice of licence change per product; invoices, PDFs and emails name products - Customer page: schedule, per-product billing, next-invoice preview - Invoices from before 2.0 kept as they were (still recalculable) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import { useParams } from "next/navigation";
|
||||
import { ArrowLeft, Copy, KeyRound } from "lucide-react";
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { ago, fmtDate } from "@/lib/format";
|
||||
import { PLANS } from "@/lib/tiers";
|
||||
import { PLANS_BY_PRODUCT } from "@/lib/tiers";
|
||||
import { KEY_WHERE, PRODUCTS, PRODUCT_NAMES, byProduct, type Product } from "@/lib/products";
|
||||
import type { Customer, Licence, LicenceStatus } from "@/lib/types";
|
||||
import { Badge, Loading, Message, PageTitle } from "@/components/ui";
|
||||
@@ -76,15 +76,13 @@ function LicenceCard({ licence, onSaved, setMsg }: { licence: Licence; onSaved:
|
||||
<div className="grid gap-3 sm:grid-cols-6">
|
||||
<div>
|
||||
<label className="label" htmlFor={`plan-${licence.id}`}>Plan</label>
|
||||
{licence.product === "events" ? (
|
||||
<select id={`plan-${licence.id}`} className="input" value={form.plan} onChange={e => setForm({ ...form, plan: e.target.value })}>
|
||||
{!PLANS.includes(form.plan) && <option value={form.plan}>{form.plan}</option>}
|
||||
{PLANS.map(p => <option key={p} value={p}>{p}</option>)}
|
||||
</select>
|
||||
) : licence.product === "accounts" ? (
|
||||
{licence.product === "accounts" ? (
|
||||
<input id={`plan-${licence.id}`} className="input" value="Included" disabled />
|
||||
) : (
|
||||
<input id={`plan-${licence.id}`} className="input" value={form.plan} onChange={e => setForm({ ...form, plan: e.target.value })} />
|
||||
<select id={`plan-${licence.id}`} className="input" value={form.plan} onChange={e => setForm({ ...form, plan: e.target.value })}>
|
||||
{!PLANS_BY_PRODUCT[licence.product].includes(form.plan) && <option value={form.plan}>{form.plan}</option>}
|
||||
{PLANS_BY_PRODUCT[licence.product].map(p => <option key={p} value={p}>{p}</option>)}
|
||||
</select>
|
||||
)}
|
||||
<p className="mt-1 text-xs text-slate-500">
|
||||
{licence.product === "accounts"
|
||||
|
||||
Reference in New Issue
Block a user