"use client"; import { useEffect, useState } from "react"; import { Download } from "lucide-react"; import { api, apiBase } from "@/lib/api"; export default function Utilization() { const [orgs, setOrgs] = useState([]); useEffect(() => { api("/admin/organizations").then(setOrgs).catch(() => {}); }, []); const totals = orgs.reduce((a, o) => ({ products: a.products + o.products_used, qrs: a.qrs + o.qr_codes, scans: a.scans + o.total_scans, revenue: a.revenue + (o.plan_price || 0), }), { products: 0, qrs: 0, scans: 0, revenue: 0 }); return (

Utilization Report

CSV PDF
{orgs.map((o) => ( ))}
Organization Plan Products Users Storage QRs Scans Revenue Status
{o.name} {o.plan ?? "—"} {o.products_used} / {o.product_limit ?? "∞"} {o.users_used} / {o.user_limit ?? "∞"} {o.storage_used_gb} GB {o.qr_codes} {o.total_scans} ₹{o.plan_price} {o.subscription_status}
Totals ({orgs.length} orgs) {totals.products} {totals.qrs} {totals.scans} ₹{totals.revenue}
); }