Files
medreport_mrb2b/app/home/[account]/billing/page.tsx
Danel Kungla 2b79a9e401 Refactor team account statistics and health details
- Simplified the TeamAccountStatistics component by removing unused code and integrating translation for health details.
- Updated the load-team-account-health-details to calculate average BMI based on member parameters.
- Adjusted the billing page to correctly reference the number of team members.
- Enhanced the main account page to pass member parameters to the Dashboard component.
- Modified the admin account page to destructure member data from the API response.
- Updated the TeamAccountsApi to return member parameters alongside member data.
- Added new translations for health details in Estonian locale.
2025-08-18 16:50:26 +03:00

46 lines
1.4 KiB
TypeScript

import { createAccountsApi } from '@/packages/features/accounts/src/server/api';
import { createTeamAccountsApi } from '@/packages/features/team-accounts/src/server/api';
import { getSupabaseServerClient } from '@/packages/supabase/src/clients/server-client';
import { PageBody } from '@kit/ui/page';
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
import { withI18n } from '~/lib/i18n/with-i18n';
import HealthBenefitForm from './_components/health-benefit-form';
interface TeamAccountBillingPageProps {
params: Promise<{ account: string }>;
}
export const generateMetadata = async () => {
const i18n = await createI18nServerInstance();
const title = i18n.t('teams:billing.pageTitle');
return {
title,
};
};
async function TeamAccountBillingPage({ params }: TeamAccountBillingPageProps) {
const accountSlug = (await params).account;
const client = getSupabaseServerClient();
const api = createTeamAccountsApi(client);
const account = await api.getTeamAccount(accountSlug);
const companyParams = await api.getTeamAccountParams(account.id);
const { members } = await api.getMembers(accountSlug);
return (
<PageBody>
<HealthBenefitForm
account={account}
companyParams={companyParams}
employeeCount={members.length}
/>
</PageBody>
);
}
export default withI18n(TeamAccountBillingPage);