feat(reports): partner and platform analytics
Partner reports — health cohorts, revenue-by-plan, top customers, signup/churn cohorts, plus saved custom reports (create/list/delete). Operator platform-wide reports (MRR, revenue by plan, top tenants, growth). Replaces the reports fixtures in both apps.
This commit is contained in:
@@ -4,7 +4,22 @@
|
||||
// recipients + format + live summary.
|
||||
|
||||
defineProps<{ open: boolean }>()
|
||||
const emit = defineEmits<{ close: []; created: [name: string] }>()
|
||||
const emit = defineEmits<{
|
||||
close: []
|
||||
created: [
|
||||
payload: {
|
||||
name: string
|
||||
description: string
|
||||
metrics: string[]
|
||||
filterPlan: string
|
||||
filterStatus: string
|
||||
groupBy: string
|
||||
schedule: string
|
||||
recipients: string[]
|
||||
format: string
|
||||
},
|
||||
]
|
||||
}>()
|
||||
|
||||
const METRICS = [
|
||||
{ id: 'mrr', label: 'MRR', group: 'Revenue' },
|
||||
@@ -42,7 +57,7 @@ const grouped = computed(() => {
|
||||
const out: Record<string, typeof METRICS[number][]> = {}
|
||||
for (const m of METRICS) {
|
||||
out[m.group] = out[m.group] || []
|
||||
out[m.group].push(m)
|
||||
out[m.group]!.push(m)
|
||||
}
|
||||
return out
|
||||
})
|
||||
@@ -184,7 +199,7 @@ function toggle(id: string) {
|
||||
<UiButton
|
||||
variant="primary"
|
||||
:disabled="!name || metrics.length === 0"
|
||||
@click="emit('created', name); emit('close')"
|
||||
@click="emit('created', { name, description, metrics, filterPlan, filterStatus, groupBy, schedule, recipients: recipients.split(',').map((r) => r.trim()).filter(Boolean), format }); emit('close')"
|
||||
>
|
||||
<template #leading><UiIcon name="check" :size="14" /></template>
|
||||
Create report
|
||||
|
||||
Reference in New Issue
Block a user