// Settings screen — Conta + Histórico de cobrança.
// (API keys são internas/B2B — gerenciadas pelo admin, não aparecem aqui.)
function SettingsScreen({ tenant, onTenantUpdate, billing }) {
const [tab, setTab] = useState('conta');
const tabs = [
{ id: 'conta', label: 'Conta' },
{ id: 'cobranca', label: 'Histórico de cobranças' },
];
return (
Configurações
Conta do escritório e histórico de cobranças.
{tab === 'conta' && }
{tab === 'cobranca' && }
);
}
function ContaTab({ tenant, onTenantUpdate }) {
const [name, setName] = useState(tenant.name);
const [email, setEmail] = useState(tenant.billing_email);
const [saved, setSaved] = useState(false);
const dirty = name !== tenant.name || email !== tenant.billing_email;
const save = () => {
onTenantUpdate({ ...tenant, name, billing_email: email });
setSaved(true);
setTimeout(() => setSaved(false), 2400);
};
const planLabel = tenant.plan_label || (tenant.plan_code ? tenant.plan_code.toUpperCase() : '—');
return (
setName(e.target.value)} />
setEmail(e.target.value)} />
} hint="Conta apta a criar novas análises" />
{saved && Alterações salvas.}
);
}
function Section({ title, subtitle, children }) {
return (
{title}
{subtitle &&
{subtitle}
}
{children}
);
}
function InfoBlock({ label, value, hint }) {
return (
{label}
{value}
{hint &&
{hint}
}
);
}
// ─── Billing tab ─────────────────────────────────────────────────────────────
function CobrancaTab({ billing }) {
return (
Histórico de cobranças
Pagamentos e recargas de crédito.
| Data |
Valor |
Método |
Status |
Comprovante |
{billing.map((b) => (
| {fmtDate.format(new Date(b.date))} |
{fmtBRL.format(b.amount)} |
{b.method} |
{b.status}
|
{b.status === 'PAGO'
?
: —}
|
))}
);
}
window.SettingsScreen = SettingsScreen;