2026-10-09 16:00:41 +00:00
|
|
|
|
import { EntityTable } from "@repo/rdx-ui/components/entity-list";
|
2026-10-24 23:19:17 +00:00
|
|
|
|
import { EntityListStatus } from "@repo/rdx-ui/components/entity-list-status";
|
2026-10-09 16:00:41 +00:00
|
|
|
|
import { FormDialog } from "@repo/rdx-ui/components/form-dialog";
|
|
|
|
|
|
import { entityListLabels } from "@repo/rdx-ui/lib/entity-list";
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
import { Button } from "@repo/shadcn-ui/components/button";
|
2026-10-24 23:19:17 +00:00
|
|
|
|
import { useRef } from "react";
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
|
|
|
2026-10-09 08:18:00 +00:00
|
|
|
|
import { CompanyIdentity } from "../../../companies/shared/ui/company-identity";
|
2026-10-24 23:19:17 +00:00
|
|
|
|
import { DashboardNavigationButton } from "../../shared";
|
2026-10-08 22:27:19 +00:00
|
|
|
|
import { useDashboardDetailsDialogController } from "../controllers";
|
|
|
|
|
|
import { detailsTitle } from "../helpers";
|
|
|
|
|
|
import type { DashboardDetailsDialogProps } from "../types";
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
|
2026-10-24 23:19:17 +00:00
|
|
|
|
import { DashboardRecordsTable } from "./dashboard-records-table";
|
|
|
|
|
|
|
2026-10-08 22:27:19 +00:00
|
|
|
|
export function DashboardDetailsDialog(props: DashboardDetailsDialogProps) {
|
|
|
|
|
|
const { details, onClose, onNavigate } = props;
|
2026-10-24 23:19:17 +00:00
|
|
|
|
const {
|
|
|
|
|
|
page,
|
|
|
|
|
|
setPage,
|
|
|
|
|
|
total,
|
|
|
|
|
|
state,
|
|
|
|
|
|
available,
|
|
|
|
|
|
onRetry,
|
|
|
|
|
|
companyItems,
|
|
|
|
|
|
entries,
|
|
|
|
|
|
paginationDisabled,
|
|
|
|
|
|
} = useDashboardDetailsDialogController(props);
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
const { t, i18n } = useTranslation("companies");
|
|
|
|
|
|
const title = t(detailsTitle(details));
|
|
|
|
|
|
const labels = entityListLabels(i18n.language);
|
2026-10-24 23:19:17 +00:00
|
|
|
|
const rootRef = useRef<HTMLDivElement>(null);
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
const range = labels.range(
|
|
|
|
|
|
total ? (page - 1) * 10 + 1 : 0,
|
|
|
|
|
|
Math.min(page * 10, total),
|
|
|
|
|
|
total,
|
|
|
|
|
|
t("dashboard.records")
|
|
|
|
|
|
);
|
2026-10-10 10:01:58 +00:00
|
|
|
|
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
return (
|
|
|
|
|
|
<FormDialog
|
|
|
|
|
|
cancelLabel={t("cancel")}
|
2026-10-24 23:19:17 +00:00
|
|
|
|
layout="stable"
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
onOpenChange={(open) => {
|
|
|
|
|
|
if (!open) {
|
|
|
|
|
|
onClose();
|
|
|
|
|
|
}
|
|
|
|
|
|
}}
|
|
|
|
|
|
open
|
|
|
|
|
|
title={title}
|
|
|
|
|
|
wide
|
|
|
|
|
|
>
|
2026-10-24 23:19:17 +00:00
|
|
|
|
<div className="flex min-w-0 flex-col gap-3" ref={rootRef} tabIndex={-1}>
|
|
|
|
|
|
{details.companies ? (
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
<EntityTable
|
|
|
|
|
|
columns={[
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "name",
|
2026-10-22 07:35:02 +00:00
|
|
|
|
hideable: false,
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
label: t("name"),
|
|
|
|
|
|
value: (item) => item.name,
|
|
|
|
|
|
render: (item) => (
|
2026-10-08 16:31:46 +00:00
|
|
|
|
<DashboardNavigationButton
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
onClick={() =>
|
|
|
|
|
|
onNavigate({ area: "company", id: item.id, section: "inventory" })
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2026-10-08 16:31:46 +00:00
|
|
|
|
<CompanyIdentity companyId={item.id} name={item.name} />
|
|
|
|
|
|
</DashboardNavigationButton>
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
),
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "assets",
|
|
|
|
|
|
label: t("dashboard.registeredAssets"),
|
|
|
|
|
|
value: (item) => item.assets,
|
|
|
|
|
|
render: (item) => item.assets,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "people",
|
|
|
|
|
|
label: t("people"),
|
|
|
|
|
|
value: (item) => item.people,
|
|
|
|
|
|
render: (item) => item.people,
|
|
|
|
|
|
},
|
|
|
|
|
|
]}
|
2026-10-24 23:19:17 +00:00
|
|
|
|
emptyMessage={t("noCompanies")}
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
entityLabel={t("title")}
|
2026-10-24 23:19:17 +00:00
|
|
|
|
items={companyItems}
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
locale={i18n.language}
|
2026-10-24 23:19:17 +00:00
|
|
|
|
onRetry={onRetry}
|
|
|
|
|
|
state={state}
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
title={title}
|
|
|
|
|
|
/>
|
2026-10-24 23:19:17 +00:00
|
|
|
|
) : (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<EntityListStatus
|
|
|
|
|
|
onRetry={onRetry}
|
|
|
|
|
|
retryFocus={() => rootRef.current}
|
|
|
|
|
|
retryLabel={t("retry")}
|
|
|
|
|
|
state={state}
|
|
|
|
|
|
>
|
|
|
|
|
|
{available ? range : null}
|
|
|
|
|
|
</EntityListStatus>
|
|
|
|
|
|
<DashboardRecordsTable
|
|
|
|
|
|
activity={Boolean(details.activity)}
|
|
|
|
|
|
items={entries}
|
|
|
|
|
|
onNavigate={onNavigate}
|
|
|
|
|
|
state={state}
|
|
|
|
|
|
title={title}
|
|
|
|
|
|
/>
|
|
|
|
|
|
{!details.activity && (
|
|
|
|
|
|
<footer className="flex flex-wrap items-center justify-between gap-3 border-t pt-4 text-sm">
|
|
|
|
|
|
<span>{available ? range : "—"}</span>
|
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
|
<Button
|
|
|
|
|
|
aria-label={labels.previous}
|
|
|
|
|
|
disabled={page === 1 || paginationDisabled}
|
|
|
|
|
|
onClick={() => setPage(page - 1)}
|
|
|
|
|
|
size="sm"
|
|
|
|
|
|
variant="outline"
|
|
|
|
|
|
>
|
|
|
|
|
|
‹
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<span>
|
|
|
|
|
|
{labels.page} {page}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
aria-label={labels.next}
|
|
|
|
|
|
disabled={page * 10 >= total || paginationDisabled}
|
|
|
|
|
|
onClick={() => setPage(page + 1)}
|
|
|
|
|
|
size="sm"
|
|
|
|
|
|
variant="outline"
|
|
|
|
|
|
>
|
|
|
|
|
|
›
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</footer>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
|
</FormDialog>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|