mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 11:39:00 +00:00
- SH-336: add the dispatcher-scope picker (All / My WOs / individual) for Scheduler/Admin via a new viewAllDispatchersOnDashboard role gate, a static 'My WOs' label for Dispatcher, and hide the dispatcher tables (and skip their queries) when the viewer cannot see all dispatchers. Scope drives dispatcherId on stats, workload, performance, and regions (SH-347 contract). - SH-352: add the Status Distribution module with its empty state and status drill-down. - SH-347: show Assigned/Completed counts and colour the completion rate (green >=90, amber 70-89, red <70) on Dispatcher Performance. - SH-348: drill a region bar into the board region filter; hold the unconfirmed 'Unmapped/Other' bucket off the chart. - SH-349: label Vendor Insights as all-time, company-wide. - Make the drilldown-filters effect fire only on URL change; add a deterministic clock to the status-drilldown test; add the dashboard visual regression spec and baselines.
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import { useNavigate } from "react-router";
|
|
import { ALL_WIZARD_STATUSES } from "@/domain/work-orders/types/work-order-wizard";
|
|
import type { DashboardRangeKey } from "@/domain/dashboard/types/dashboard-range";
|
|
import type { DashboardStatusBucketRow } from "@/domain/dashboard/types/dashboard-stats";
|
|
import {
|
|
workOrderDrilldownUrl,
|
|
workOrderStatusDrilldownSearch,
|
|
} from "@/domain/dashboard/utils/work-order-drilldown-links";
|
|
import { DashboardBarList } from "./dashboard-bar-list";
|
|
import { DashboardCard } from "./dashboard-card";
|
|
|
|
const EMPTY_MESSAGE = "No work orders match the current filters.";
|
|
|
|
const DRILLABLE_STATUSES = new Set<string>(ALL_WIZARD_STATUSES);
|
|
|
|
interface StatusDistributionCardProps {
|
|
rows: DashboardStatusBucketRow[];
|
|
range: DashboardRangeKey;
|
|
isLoading?: boolean;
|
|
error?: unknown;
|
|
}
|
|
|
|
export function StatusDistributionCard({
|
|
rows,
|
|
range,
|
|
isLoading = false,
|
|
error,
|
|
}: StatusDistributionCardProps) {
|
|
const navigate = useNavigate();
|
|
|
|
return (
|
|
<DashboardCard
|
|
title="Status Distribution"
|
|
isLoading={isLoading}
|
|
error={error}
|
|
isEmpty={!isLoading && !error && rows.length === 0}
|
|
emptyMessage={EMPTY_MESSAGE}
|
|
>
|
|
<DashboardBarList
|
|
ariaLabel="Status Distribution"
|
|
rows={rows.map((row) => ({
|
|
id: row.status,
|
|
label: row.status,
|
|
count: row.count,
|
|
}))}
|
|
// Lifecycle labels the board can filter on are drillable; the "Unknown"
|
|
// bucket (unparseable statuses) has no board filter, so leave it inert.
|
|
isSelectable={(row) => DRILLABLE_STATUSES.has(row.id)}
|
|
onSelectRow={(row) =>
|
|
navigate(workOrderDrilldownUrl(workOrderStatusDrilldownSearch(row.id, range)))
|
|
}
|
|
/>
|
|
</DashboardCard>
|
|
);
|
|
}
|