mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 17:21:41 +10:00
fix: documents and users count in the table
This commit is contained in:
@ -59,12 +59,12 @@ export const OrganisationInsightsTable = ({
|
||||
{
|
||||
header: _(msg`Members`),
|
||||
accessorKey: 'memberCount',
|
||||
cell: ({ row }) => row.getValue('memberCount'),
|
||||
cell: ({ row }) => Number(row.getValue('memberCount')),
|
||||
},
|
||||
{
|
||||
header: _(msg`Documents`),
|
||||
accessorKey: 'documentCount',
|
||||
cell: ({ row }) => row.getValue('documentCount'),
|
||||
cell: ({ row }) => Number(row.getValue('documentCount')),
|
||||
},
|
||||
{
|
||||
header: _(msg`Created`),
|
||||
@ -87,12 +87,12 @@ export const OrganisationInsightsTable = ({
|
||||
{
|
||||
header: _(msg`Documents Created`),
|
||||
accessorKey: 'documentCount',
|
||||
cell: ({ row }) => row.getValue('documentCount'),
|
||||
cell: ({ row }) => Number(row.getValue('documentCount')),
|
||||
},
|
||||
{
|
||||
header: _(msg`Documents Signed`),
|
||||
accessorKey: 'signedDocumentCount',
|
||||
cell: ({ row }) => row.getValue('signedDocumentCount'),
|
||||
cell: ({ row }) => Number(row.getValue('signedDocumentCount')),
|
||||
},
|
||||
{
|
||||
header: _(msg`Joined`),
|
||||
@ -170,14 +170,12 @@ export const OrganisationInsightsTable = ({
|
||||
value: number;
|
||||
subtitle?: string;
|
||||
}) => (
|
||||
<div className="bg-card rounded-lg border p-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
<Icon className="text-muted-foreground h-5 w-5" />
|
||||
<div className="flex-1">
|
||||
<p className="text-muted-foreground text-sm font-medium">{title}</p>
|
||||
<p className="text-2xl font-bold">{value}</p>
|
||||
{subtitle && <p className="text-muted-foreground text-xs">{subtitle}</p>}
|
||||
</div>
|
||||
<div className="bg-card flex items-start gap-x-2 rounded-lg border px-4 py-3">
|
||||
<Icon className="text-muted-foreground h-4 w-4 items-start" />
|
||||
<div className="-mt-0.5 space-y-1">
|
||||
<p className="text-muted-foreground text-sm font-medium">{title}</p>
|
||||
<p className="text-2xl font-bold">{value}</p>
|
||||
{subtitle && <p className="text-muted-foreground text-xs">{subtitle}</p>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { Trans } from '@lingui/react/macro';
|
||||
|
||||
import { getOrganisationDetailedInsights } from '@documenso/lib/server-only/admin/get-organisation-detailed-insights';
|
||||
import { getAdminOrganisation } from '@documenso/trpc/server/admin-router/get-admin-organisation';
|
||||
|
||||
import { OrganisationInsightsTable } from '~/components/tables/organisation-insights-table';
|
||||
|
||||
@ -19,16 +20,20 @@ export async function loader({ params, request }: Route.LoaderArgs) {
|
||||
| 'allTime';
|
||||
const view = (url.searchParams.get('view') || 'teams') as 'teams' | 'users' | 'documents';
|
||||
|
||||
const insights = await getOrganisationDetailedInsights({
|
||||
organisationId: id,
|
||||
page,
|
||||
perPage,
|
||||
dateRange,
|
||||
view,
|
||||
});
|
||||
const [insights, organisation] = await Promise.all([
|
||||
getOrganisationDetailedInsights({
|
||||
organisationId: id,
|
||||
page,
|
||||
perPage,
|
||||
dateRange,
|
||||
view,
|
||||
}),
|
||||
getAdminOrganisation({ organisationId: id }),
|
||||
]);
|
||||
|
||||
return {
|
||||
organisationId: id,
|
||||
organisationName: organisation.name,
|
||||
insights,
|
||||
page,
|
||||
perPage,
|
||||
@ -38,13 +43,13 @@ export async function loader({ params, request }: Route.LoaderArgs) {
|
||||
}
|
||||
|
||||
export default function OrganisationInsights({ loaderData }: Route.ComponentProps) {
|
||||
const { organisationId, insights, page, perPage, dateRange, view } = loaderData;
|
||||
const { insights, page, perPage, dateRange, view, organisationName } = loaderData;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex items-center justify-between">
|
||||
<h2 className="text-4xl font-semibold">
|
||||
<Trans>Organisation Insights</Trans>
|
||||
<Trans>{organisationName}</Trans>
|
||||
</h2>
|
||||
</div>
|
||||
<div className="mt-8">
|
||||
|
||||
Reference in New Issue
Block a user