@j3m-quantum/ui 1.11.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { twMerge } from 'tailwind-merge';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
9
9
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
10
- import { SearchIcon, TrashIcon, CheckIcon, CircleIcon, ChevronDownIcon, ChevronUpIcon, ChevronRightIcon, ChevronLeftIcon, ArrowLeft, ArrowRight, Check, Loader2Icon, OctagonXIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon, ChevronRight, MoreHorizontal, MoreHorizontalIcon, XIcon, GripVerticalIcon, PanelLeftIcon, ArrowDown, ArrowUp, ChevronsUpDown, EyeOff, ChevronsLeft, ChevronLeft, ChevronsRight, Settings2, FolderIcon, ShareIcon, ChevronsUpDownIcon, SparklesIcon, BadgeCheckIcon, CreditCardIcon, BellIcon, LogOutIcon, X, Flag, Factory, Truck, MessageSquare, ChevronDown, Plus, Send, MessageSquarePlus, AlertTriangle, CheckCircle, Calendar as Calendar$1, MapPin, Package, User, Clock, CalendarX2, List, Columns, Grid2x2, Grid3x3, CalendarRange, Settings, Info, Moon, PlusIcon, PencilIcon, CopyIcon, ArrowUpDown, CheckCircle2, XCircle } from 'lucide-react';
10
+ import { SearchIcon, TrashIcon, CheckIcon, CircleIcon, ChevronDownIcon, ChevronUpIcon, TrendingUp, AlertTriangle, Check, Truck, Factory, ChevronRightIcon, ChevronLeftIcon, ArrowLeft, ArrowRight, Loader2Icon, OctagonXIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon, ChevronRight, MoreHorizontal, MoreHorizontalIcon, XIcon, GripVerticalIcon, PanelLeftIcon, ArrowDown, ArrowUp, ChevronsUpDown, EyeOff, ChevronsLeft, ChevronLeft, ChevronsRight, Settings2, FolderIcon, ShareIcon, ChevronsUpDownIcon, SparklesIcon, BadgeCheckIcon, CreditCardIcon, BellIcon, LogOutIcon, X, Flag, MessageSquare, ChevronDown, Plus, Send, MessageSquarePlus, CheckCircle, Calendar as Calendar$1, MapPin, Package, User, Clock, CalendarX2, List, Columns, Grid2x2, Grid3x3, CalendarRange, Settings, Info, Moon, PlusIcon, PencilIcon, CopyIcon, ArrowUpDown, CheckCircle2, XCircle, Search, FileText } from 'lucide-react';
11
11
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
12
12
  import * as SwitchPrimitive from '@radix-ui/react-switch';
13
13
  import * as SliderPrimitive from '@radix-ui/react-slider';
@@ -72,6 +72,53 @@ function useIsMobile() {
72
72
  function cn(...inputs) {
73
73
  return twMerge(clsx(inputs));
74
74
  }
75
+ var statusCellFillClasses = {
76
+ // Green - complete/valid/ready state
77
+ complete: {
78
+ bg: "bg-green-50/50 dark:bg-green-950/30"},
79
+ ready: {
80
+ combined: "border-l-[3px] border-l-green-500 bg-green-50/50 dark:bg-green-950/30"
81
+ },
82
+ // Amber - warning/attention state
83
+ warning: {
84
+ bg: "bg-amber-50/50 dark:bg-amber-950/30"},
85
+ // Red - critical/risk state
86
+ critical: {
87
+ bg: "bg-red-50/50 dark:bg-red-950/30"},
88
+ risk: {
89
+ combined: "border-l-[3px] border-l-red-500 bg-red-50/50 dark:bg-red-950/30"
90
+ },
91
+ // Grey - normal/pending/neutral state (on track but not complete)
92
+ normal: {
93
+ combined: "border-l-[3px] border-l-muted-foreground/40 bg-muted/30 dark:bg-muted/20"
94
+ },
95
+ // Shipped - distinct muted state with green accent (greyed out + check)
96
+ shipped: {
97
+ combined: "border-l-[3px] border-l-green-500/50 bg-muted/50 dark:bg-muted/30"
98
+ }
99
+ };
100
+ var statusCellTextClasses = {
101
+ ready: {
102
+ title: "text-foreground",
103
+ subtitle: "text-green-700/80 dark:text-green-300/80",
104
+ icon: "text-green-600 dark:text-green-400"
105
+ },
106
+ risk: {
107
+ title: "text-foreground",
108
+ subtitle: "text-red-700/80 dark:text-red-300/80",
109
+ icon: "text-red-600 dark:text-red-400"
110
+ },
111
+ normal: {
112
+ title: "text-foreground",
113
+ subtitle: "text-muted-foreground",
114
+ icon: "text-muted-foreground"
115
+ },
116
+ shipped: {
117
+ title: "text-muted-foreground",
118
+ subtitle: "text-muted-foreground/70",
119
+ icon: "text-green-600/70 dark:text-green-400/70"
120
+ }
121
+ };
75
122
  var buttonVariants = cva(
76
123
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
77
124
  {
@@ -1546,6 +1593,166 @@ function FieldError({
1546
1593
  }
1547
1594
  );
1548
1595
  }
1596
+ var iconMap = {
1597
+ factory: Factory,
1598
+ truck: Truck,
1599
+ check: Check,
1600
+ alert: AlertTriangle,
1601
+ trending: TrendingUp
1602
+ };
1603
+ var statusColorMap = {
1604
+ normal: "text-muted-foreground",
1605
+ success: "text-green-600 dark:text-green-400",
1606
+ warning: "text-amber-600 dark:text-amber-400",
1607
+ critical: "text-red-600 dark:text-red-400"
1608
+ };
1609
+ function InsightBar({ metrics, className }) {
1610
+ return /* @__PURE__ */ jsx(
1611
+ "div",
1612
+ {
1613
+ "data-slot": "insight-bar",
1614
+ className: cn(
1615
+ "flex flex-wrap items-center gap-6 px-4 py-3",
1616
+ "border-b border-border bg-muted/20",
1617
+ className
1618
+ ),
1619
+ children: metrics.map((metric) => {
1620
+ const Icon2 = metric.icon ? iconMap[metric.icon] : null;
1621
+ const statusColor = metric.status ? statusColorMap[metric.status] : "text-foreground";
1622
+ return /* @__PURE__ */ jsxs(
1623
+ "div",
1624
+ {
1625
+ className: "flex items-center gap-2",
1626
+ children: [
1627
+ Icon2 && /* @__PURE__ */ jsx(Icon2, { className: cn("h-4 w-4", statusColor) }),
1628
+ /* @__PURE__ */ jsxs("div", { className: "flex items-baseline gap-1.5", children: [
1629
+ /* @__PURE__ */ jsx("span", { className: cn(
1630
+ "text-lg font-semibold tabular-nums",
1631
+ statusColor
1632
+ ), children: metric.isPercentage ? `${Math.round(metric.value)}%` : metric.value.toLocaleString(void 0, { maximumFractionDigits: 1 }) }),
1633
+ metric.unit && !metric.isPercentage && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: metric.unit }),
1634
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: metric.label })
1635
+ ] })
1636
+ ]
1637
+ },
1638
+ metric.key
1639
+ );
1640
+ })
1641
+ }
1642
+ );
1643
+ }
1644
+ var iconMap2 = {
1645
+ factory: Factory,
1646
+ truck: Truck,
1647
+ check: Check
1648
+ };
1649
+ var statusBgMap = {
1650
+ normal: "bg-muted/30",
1651
+ complete: statusCellFillClasses.complete.bg,
1652
+ warning: statusCellFillClasses.warning.bg,
1653
+ critical: statusCellFillClasses.critical.bg
1654
+ };
1655
+ var statusTextMap = {
1656
+ normal: "text-muted-foreground",
1657
+ complete: "text-green-700 dark:text-green-300",
1658
+ warning: "text-amber-700 dark:text-amber-300",
1659
+ critical: "text-red-700 dark:text-red-300"
1660
+ };
1661
+ function ColumnSummaryCell({
1662
+ data,
1663
+ widthClass = "min-w-[120px]",
1664
+ className
1665
+ }) {
1666
+ const status = data.status || "normal";
1667
+ const bgClass = statusBgMap[status];
1668
+ const textClass = statusTextMap[status];
1669
+ const isClickable = !!data.onClick;
1670
+ const PrimaryIcon = data.primary?.icon ? iconMap2[data.primary.icon] : null;
1671
+ const SecondaryIcon = data.secondary?.icon ? iconMap2[data.secondary.icon] : null;
1672
+ return /* @__PURE__ */ jsxs(
1673
+ "div",
1674
+ {
1675
+ role: isClickable ? "button" : void 0,
1676
+ tabIndex: isClickable ? 0 : void 0,
1677
+ onClick: data.onClick,
1678
+ onKeyDown: (e) => {
1679
+ if (isClickable && (e.key === "Enter" || e.key === " ")) {
1680
+ e.preventDefault();
1681
+ data.onClick?.();
1682
+ }
1683
+ },
1684
+ className: cn(
1685
+ // Base sizing
1686
+ widthClass,
1687
+ "flex flex-col gap-0.5 px-2 py-1.5",
1688
+ // Background based on status
1689
+ bgClass,
1690
+ // Clickable styles
1691
+ isClickable && "cursor-pointer hover:brightness-95 transition-all",
1692
+ isClickable && "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",
1693
+ className
1694
+ ),
1695
+ children: [
1696
+ data.primary && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
1697
+ PrimaryIcon && /* @__PURE__ */ jsx(PrimaryIcon, { className: cn("h-3 w-3", textClass) }),
1698
+ /* @__PURE__ */ jsx("span", { className: cn("text-xs font-medium tabular-nums", textClass), children: data.primary.value.toLocaleString(void 0, { maximumFractionDigits: 1 }) }),
1699
+ data.primary.unit && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: data.primary.unit })
1700
+ ] }),
1701
+ data.secondary && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
1702
+ SecondaryIcon && /* @__PURE__ */ jsx(SecondaryIcon, { className: cn("h-3 w-3 text-muted-foreground") }),
1703
+ /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground tabular-nums", children: [
1704
+ data.secondary.value.toLocaleString(void 0, { maximumFractionDigits: 1 }),
1705
+ data.secondary.unit && ` ${data.secondary.unit}`
1706
+ ] })
1707
+ ] }),
1708
+ data.tertiary && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground/70 tabular-nums", children: [
1709
+ data.tertiary.value.toLocaleString(void 0, { maximumFractionDigits: 1 }),
1710
+ data.tertiary.unit && ` ${data.tertiary.unit}`
1711
+ ] }) })
1712
+ ]
1713
+ }
1714
+ );
1715
+ }
1716
+ function ColumnSummaryStrip({
1717
+ columns,
1718
+ columnWidthClass = "min-w-[120px]",
1719
+ rowHeaderLabel,
1720
+ rowHeaderWidthClass = "min-w-[200px] w-[200px]",
1721
+ className
1722
+ }) {
1723
+ return /* @__PURE__ */ jsxs(
1724
+ "div",
1725
+ {
1726
+ "data-slot": "column-summary-strip",
1727
+ className: cn(
1728
+ "flex border-b border-border",
1729
+ className
1730
+ ),
1731
+ children: [
1732
+ rowHeaderLabel !== void 0 && /* @__PURE__ */ jsx(
1733
+ "div",
1734
+ {
1735
+ className: cn(
1736
+ "flex items-center px-3 py-1.5",
1737
+ "bg-muted/30 border-r border-border",
1738
+ "sticky left-0 z-10",
1739
+ rowHeaderWidthClass
1740
+ ),
1741
+ children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide", children: rowHeaderLabel })
1742
+ }
1743
+ ),
1744
+ /* @__PURE__ */ jsx("div", { className: "flex", children: columns.map((column) => /* @__PURE__ */ jsx(
1745
+ ColumnSummaryCell,
1746
+ {
1747
+ data: column,
1748
+ widthClass: columnWidthClass
1749
+ },
1750
+ column.columnKey
1751
+ )) })
1752
+ ]
1753
+ }
1754
+ );
1755
+ }
1549
1756
  var cardVariants = cva(
1550
1757
  "rounded-xl text-card-foreground",
1551
1758
  {
@@ -3408,6 +3615,144 @@ function CircularProgress({
3408
3615
  }
3409
3616
  );
3410
3617
  }
3618
+ function getVariantFromProgress(value) {
3619
+ if (value >= 100) return "complete";
3620
+ if (value >= 50) return "normal";
3621
+ if (value > 0) return "warning";
3622
+ return "critical";
3623
+ }
3624
+ function getStatusColors(variant) {
3625
+ switch (variant) {
3626
+ case "complete":
3627
+ return {
3628
+ track: "bg-green-500/20 dark:bg-green-500/10",
3629
+ fill: "bg-green-500",
3630
+ text: "text-green-600 dark:text-green-400",
3631
+ icon: "text-green-600 dark:text-green-400"
3632
+ };
3633
+ case "normal":
3634
+ return {
3635
+ track: "bg-green-500/20 dark:bg-green-500/10",
3636
+ fill: "bg-green-500",
3637
+ text: "text-green-600 dark:text-green-400",
3638
+ icon: "text-green-600 dark:text-green-400"
3639
+ };
3640
+ case "warning":
3641
+ return {
3642
+ track: "bg-amber-500/20 dark:bg-amber-500/10",
3643
+ fill: "bg-amber-500",
3644
+ text: "text-amber-600 dark:text-amber-400",
3645
+ icon: "text-amber-600 dark:text-amber-400"
3646
+ };
3647
+ case "critical":
3648
+ return {
3649
+ track: "bg-red-500/20 dark:bg-red-500/10",
3650
+ fill: "bg-red-500",
3651
+ text: "text-red-600 dark:text-red-400",
3652
+ icon: "text-red-600 dark:text-red-400"
3653
+ };
3654
+ }
3655
+ }
3656
+ function getSizeClasses(size) {
3657
+ switch (size) {
3658
+ case "sm":
3659
+ return {
3660
+ bar: "h-1",
3661
+ text: "text-[10px]",
3662
+ icon: "h-3 w-3",
3663
+ gap: "gap-1"
3664
+ };
3665
+ case "lg":
3666
+ return {
3667
+ bar: "h-3",
3668
+ text: "text-sm",
3669
+ icon: "h-5 w-5",
3670
+ gap: "gap-3"
3671
+ };
3672
+ default:
3673
+ return {
3674
+ bar: "h-2",
3675
+ text: "text-xs",
3676
+ icon: "h-4 w-4",
3677
+ gap: "gap-2"
3678
+ };
3679
+ }
3680
+ }
3681
+ function StatusProgress({
3682
+ className,
3683
+ value,
3684
+ currentCount,
3685
+ totalCount,
3686
+ unitLabel = "elements",
3687
+ showLabel = false,
3688
+ showCheckmark = true,
3689
+ size = "md",
3690
+ variant,
3691
+ ...props
3692
+ }) {
3693
+ const clampedValue = Math.min(100, Math.max(0, value));
3694
+ const isComplete = clampedValue >= 100;
3695
+ const resolvedVariant = variant ?? getVariantFromProgress(clampedValue);
3696
+ const colors = getStatusColors(resolvedVariant);
3697
+ const sizes = getSizeClasses(size);
3698
+ const labelText = React27.useMemo(() => {
3699
+ if (currentCount !== void 0 && totalCount !== void 0) {
3700
+ return `${currentCount} / ${totalCount} ${unitLabel}`;
3701
+ }
3702
+ return `${Math.round(clampedValue)}%`;
3703
+ }, [currentCount, totalCount, unitLabel, clampedValue]);
3704
+ return /* @__PURE__ */ jsxs(
3705
+ "div",
3706
+ {
3707
+ "data-slot": "status-progress",
3708
+ "data-value": clampedValue,
3709
+ "data-variant": resolvedVariant,
3710
+ "data-complete": isComplete,
3711
+ className: cn("flex flex-col w-full", sizes.gap, className),
3712
+ ...props,
3713
+ children: [
3714
+ showLabel && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between", sizes.gap), children: [
3715
+ /* @__PURE__ */ jsx("span", { className: cn("font-medium", sizes.text, colors.text), children: isComplete && showCheckmark ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
3716
+ /* @__PURE__ */ jsx(Check, { className: cn(sizes.icon, colors.icon) }),
3717
+ "Complete"
3718
+ ] }) : labelText }),
3719
+ !isComplete && /* @__PURE__ */ jsxs("span", { className: cn("tabular-nums text-muted-foreground", sizes.text), children: [
3720
+ Math.round(clampedValue),
3721
+ "%"
3722
+ ] })
3723
+ ] }),
3724
+ /* @__PURE__ */ jsx(
3725
+ "div",
3726
+ {
3727
+ className: cn(
3728
+ "w-full rounded-full overflow-hidden",
3729
+ colors.track,
3730
+ sizes.bar
3731
+ ),
3732
+ role: "progressbar",
3733
+ "aria-valuenow": clampedValue,
3734
+ "aria-valuemin": 0,
3735
+ "aria-valuemax": 100,
3736
+ children: /* @__PURE__ */ jsx(
3737
+ "div",
3738
+ {
3739
+ className: cn(
3740
+ "h-full rounded-full transition-all duration-300 ease-out",
3741
+ colors.fill
3742
+ ),
3743
+ style: { width: `${clampedValue}%` }
3744
+ }
3745
+ )
3746
+ }
3747
+ ),
3748
+ !showLabel && isComplete && showCheckmark && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center", sizes.gap), children: [
3749
+ /* @__PURE__ */ jsx(Check, { className: cn(sizes.icon, colors.icon) }),
3750
+ /* @__PURE__ */ jsx("span", { className: cn("font-medium", sizes.text, colors.text), children: "Complete" })
3751
+ ] })
3752
+ ]
3753
+ }
3754
+ );
3755
+ }
3411
3756
  function TooltipProvider({
3412
3757
  delayDuration = 0,
3413
3758
  ...props
@@ -6380,15 +6725,27 @@ function getCombinedRiskLevel(data) {
6380
6725
  if (productionStatus === "delayed" || hasDeliveryDelayed || data.hasWarning) {
6381
6726
  return "warning";
6382
6727
  }
6728
+ const productionProgress = data.production?.progress ?? data.progress ?? 0;
6729
+ const isProductionComplete = productionProgress >= 100;
6730
+ if (isProductionComplete) {
6731
+ return "complete";
6732
+ }
6383
6733
  return "normal";
6384
6734
  }
6385
- function getRowStatus(status) {
6735
+ function getRowStatus(status, progress) {
6386
6736
  if (status === "critical") return "critical";
6387
6737
  if (status === "delayed") return "warning";
6738
+ if (progress !== void 0 && progress >= 100) return "complete";
6388
6739
  return "normal";
6389
6740
  }
6390
6741
  var statusFillClasses = {
6391
6742
  normal: {
6743
+ // Grey/muted for "on track but not complete" - reduces visual noise
6744
+ border: "border-l-[3px] border-l-muted-foreground/40",
6745
+ bg: "bg-muted/30 dark:bg-muted/20"
6746
+ },
6747
+ complete: {
6748
+ // Green for "done/complete" - clear success signal
6392
6749
  border: "border-l-[3px] border-l-green-500",
6393
6750
  bg: "bg-green-50/50 dark:bg-green-950/30"
6394
6751
  },
@@ -6403,6 +6760,13 @@ var statusFillClasses = {
6403
6760
  };
6404
6761
  var statusColors = {
6405
6762
  normal: {
6763
+ // Grey/muted for "on track but not complete"
6764
+ icon: "text-muted-foreground",
6765
+ progress: "bg-muted-foreground/60",
6766
+ text: "text-muted-foreground"
6767
+ },
6768
+ complete: {
6769
+ // Green for "done/complete"
6406
6770
  icon: "text-green-600 dark:text-green-400",
6407
6771
  progress: "bg-green-500",
6408
6772
  text: "text-green-700 dark:text-green-300"
@@ -6430,19 +6794,20 @@ function WeekCell({
6430
6794
  const combinedRisk = data.type === "data" ? getCombinedRiskLevel(data) : "normal";
6431
6795
  const statusClasses = statusFillClasses[combinedRisk];
6432
6796
  const productionProgress = data.production?.progress ?? data.progress ?? 0;
6433
- const productionStatus = getRowStatus(data.production?.status);
6797
+ const productionStatus = getRowStatus(data.production?.status, productionProgress);
6434
6798
  const productionColors = statusColors[productionStatus];
6435
6799
  const deliveryCount = data.deliveries?.length ?? 0;
6436
- const worstDeliveryStatus = data.deliveries?.some((d) => d.status === "critical") ? "critical" : data.deliveries?.some((d) => d.status === "delayed") ? "warning" : "normal";
6800
+ const allDeliveriesComplete = data.deliveries?.every((d) => (d.progress ?? 0) >= 100) ?? false;
6801
+ const worstDeliveryStatus = data.deliveries?.some((d) => d.status === "critical") ? "critical" : data.deliveries?.some((d) => d.status === "delayed") ? "warning" : allDeliveriesComplete && deliveryCount > 0 ? "complete" : "normal";
6437
6802
  const deliveryColors = statusColors[worstDeliveryStatus];
6438
- const getDeliveryStatusColor = (status) => {
6439
- switch (status) {
6803
+ const getDeliveryStatusColor = (delivery) => {
6804
+ switch (delivery.status) {
6440
6805
  case "critical":
6441
6806
  return "bg-red-500";
6442
6807
  case "delayed":
6443
6808
  return "bg-amber-500";
6444
6809
  default:
6445
- return "bg-green-500";
6810
+ return (delivery.progress ?? 0) >= 100 ? "bg-green-500" : "bg-muted-foreground/60";
6446
6811
  }
6447
6812
  };
6448
6813
  const handleClick = () => {
@@ -6559,24 +6924,18 @@ function WeekCell({
6559
6924
  ] }) : /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "\u2014" })
6560
6925
  ] }),
6561
6926
  deliveryCount > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
6562
- data.deliveries?.slice(0, 5).map((delivery, index) => {
6563
- const deliveryProgress = delivery.progress ?? (delivery.status === "on-time" ? 100 : delivery.status === "delayed" ? 50 : 25);
6564
- return /* @__PURE__ */ jsx(
6565
- "div",
6566
- {
6567
- className: "flex-1 max-w-[24px]",
6568
- title: delivery.label || `Delivery ${index + 1}`,
6569
- children: /* @__PURE__ */ jsx("div", { className: "h-1 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
6570
- "div",
6571
- {
6572
- className: cn("h-full rounded-full transition-all", getDeliveryStatusColor(delivery.status)),
6573
- style: { width: `${deliveryProgress}%` }
6574
- }
6575
- ) })
6576
- },
6577
- delivery.id || index
6578
- );
6579
- }),
6927
+ data.deliveries?.slice(0, 5).map((delivery, index) => /* @__PURE__ */ jsx(
6928
+ "div",
6929
+ {
6930
+ className: cn(
6931
+ "flex-1 max-w-[24px] h-1.5 rounded-full",
6932
+ // Solid status color - grey=on-track, green=complete, amber=at-risk, red=critical
6933
+ getDeliveryStatusColor(delivery)
6934
+ ),
6935
+ title: delivery.label || `Delivery ${index + 1}`
6936
+ },
6937
+ delivery.id || index
6938
+ )),
6580
6939
  deliveryCount > 5 && /* @__PURE__ */ jsxs("span", { className: "text-[8px] text-muted-foreground", children: [
6581
6940
  "+",
6582
6941
  deliveryCount - 5
@@ -7190,12 +7549,95 @@ function PlanningTable({
7190
7549
  }
7191
7550
  }
7192
7551
  });
7552
+ const insightMetrics = React27.useMemo(() => {
7553
+ let totalProduced = 0;
7554
+ let totalRequired = 0;
7555
+ let totalDeliveries = 0;
7556
+ for (const supplier of suppliers) {
7557
+ for (const weekKey in supplier.weeks) {
7558
+ const weekData = supplier.weeks[weekKey];
7559
+ if (weekData.production) {
7560
+ totalProduced += weekData.production.produced;
7561
+ totalRequired += weekData.production.target;
7562
+ }
7563
+ totalDeliveries += weekData.deliveries?.length ?? 0;
7564
+ }
7565
+ }
7566
+ const productionPercent = totalRequired > 0 ? totalProduced / totalRequired * 100 : 0;
7567
+ return [
7568
+ {
7569
+ key: "produced",
7570
+ label: "produced",
7571
+ value: totalProduced,
7572
+ unit: "tons",
7573
+ icon: "factory",
7574
+ status: productionPercent >= 100 ? "success" : "normal"
7575
+ },
7576
+ {
7577
+ key: "deliveries",
7578
+ label: "planned deliveries",
7579
+ value: totalDeliveries,
7580
+ icon: "truck",
7581
+ status: "normal"
7582
+ },
7583
+ {
7584
+ key: "progress",
7585
+ label: "produced vs required",
7586
+ value: productionPercent,
7587
+ isPercentage: true,
7588
+ icon: "trending",
7589
+ status: productionPercent >= 100 ? "success" : productionPercent >= 50 ? "normal" : "warning"
7590
+ }
7591
+ ];
7592
+ }, [suppliers]);
7593
+ const columnSummaryData = React27.useMemo(() => {
7594
+ return weeks.map((week) => {
7595
+ const weekKey = getWeekKey(week.startDate);
7596
+ let producedTons = 0;
7597
+ let plannedDeliveries = 0;
7598
+ let sentDeliveries = 0;
7599
+ let hasWarning = false;
7600
+ let hasCritical = false;
7601
+ let allComplete = true;
7602
+ for (const supplier of suppliers) {
7603
+ const weekData = supplier.weeks[weekKey];
7604
+ if (weekData) {
7605
+ if (weekData.production) {
7606
+ producedTons += weekData.production.produced;
7607
+ if (weekData.production.progress !== void 0 && weekData.production.progress < 100) {
7608
+ allComplete = false;
7609
+ }
7610
+ }
7611
+ if (weekData.deliveries) {
7612
+ plannedDeliveries += weekData.deliveries.length;
7613
+ sentDeliveries += weekData.deliveries.filter(
7614
+ (d) => d.status === "on-time" && (d.progress ?? 0) >= 100
7615
+ ).length;
7616
+ }
7617
+ if (weekData.hasWarning) hasWarning = true;
7618
+ if (weekData.deliveries?.some((d) => d.status === "critical")) hasCritical = true;
7619
+ }
7620
+ }
7621
+ let status = "normal";
7622
+ if (hasCritical) status = "critical";
7623
+ else if (hasWarning) status = "warning";
7624
+ else if (allComplete && producedTons > 0) status = "complete";
7625
+ return {
7626
+ weekKey,
7627
+ producedTons,
7628
+ plannedDeliveries,
7629
+ sentDeliveries,
7630
+ status
7631
+ };
7632
+ });
7633
+ }, [weeks, suppliers]);
7193
7634
  return /* @__PURE__ */ jsxs(
7194
7635
  "div",
7195
7636
  {
7196
7637
  "data-slot": "planning-table",
7197
7638
  className: cn("flex flex-col gap-4", className),
7198
7639
  children: [
7640
+ /* @__PURE__ */ jsx(InsightBar, { metrics: insightMetrics }),
7199
7641
  showToolbar && /* @__PURE__ */ jsx(PlanningTableToolbar, { table }),
7200
7642
  /* @__PURE__ */ jsx("div", { className: "rounded-xl border bg-background shadow-sm overflow-hidden", children: /* @__PURE__ */ jsxs(
7201
7643
  ScrollArea,
@@ -7204,37 +7646,80 @@ function PlanningTable({
7204
7646
  style: { maxHeight },
7205
7647
  children: [
7206
7648
  /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse", children: [
7207
- /* @__PURE__ */ jsx("thead", { className: "sticky top-0 z-20", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(
7208
- "tr",
7209
- {
7210
- children: headerGroup.headers.map((header, index) => {
7211
- const isCurrentWeekColumn = header.id === currentWeekKey;
7649
+ /* @__PURE__ */ jsxs("thead", { className: "sticky top-0 z-20", children: [
7650
+ table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(
7651
+ "tr",
7652
+ {
7653
+ children: headerGroup.headers.map((header, index) => {
7654
+ const isCurrentWeekColumn = header.id === currentWeekKey;
7655
+ return /* @__PURE__ */ jsx(
7656
+ "th",
7657
+ {
7658
+ className: cn(
7659
+ "h-14 px-3 text-left align-middle font-semibold text-xs text-muted-foreground uppercase tracking-wide",
7660
+ "border-r border-b border-border last:border-r-0 bg-sidebar",
7661
+ // First column: sticky with right-edge shadow (Quantum token)
7662
+ index === 0 && stickySupplierColumn && [
7663
+ "sticky left-0 z-30 min-w-[200px]",
7664
+ "shadow-[var(--j3m-shadow-sticky-edge)]"
7665
+ ],
7666
+ index > 0 && "min-w-[140px]",
7667
+ // Current week: only highlight text/dot, not full background
7668
+ isCurrentWeekColumn && highlightCurrentWeek && "text-primary"
7669
+ ),
7670
+ children: header.isPlaceholder ? null : flexRender(
7671
+ header.column.columnDef.header,
7672
+ header.getContext()
7673
+ )
7674
+ },
7675
+ header.id
7676
+ );
7677
+ })
7678
+ },
7679
+ headerGroup.id
7680
+ )),
7681
+ /* @__PURE__ */ jsxs("tr", { children: [
7682
+ /* @__PURE__ */ jsx("th", { className: cn(
7683
+ "h-auto px-3 py-1.5 text-left align-middle",
7684
+ "border-r border-b border-border bg-muted/30",
7685
+ stickySupplierColumn && "sticky left-0 z-30 min-w-[200px]",
7686
+ stickySupplierColumn && "shadow-[var(--j3m-shadow-sticky-edge)]"
7687
+ ), children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide", children: "Summary" }) }),
7688
+ columnSummaryData.map((summary) => {
7689
+ const statusBg = summary.status === "complete" ? "bg-green-50/50 dark:bg-green-950/30" : summary.status === "critical" ? "bg-red-50/50 dark:bg-red-950/30" : summary.status === "warning" ? "bg-amber-50/50 dark:bg-amber-950/30" : "bg-muted/30";
7690
+ const statusText = summary.status === "complete" ? "text-green-700 dark:text-green-300" : summary.status === "critical" ? "text-red-700 dark:text-red-300" : summary.status === "warning" ? "text-amber-700 dark:text-amber-300" : "text-muted-foreground";
7212
7691
  return /* @__PURE__ */ jsx(
7213
7692
  "th",
7214
7693
  {
7215
7694
  className: cn(
7216
- "h-14 px-3 text-left align-middle font-semibold text-xs text-muted-foreground uppercase tracking-wide",
7217
- "border-r border-b border-border last:border-r-0 bg-sidebar",
7218
- // First column: sticky with right-edge shadow (Quantum token)
7219
- index === 0 && stickySupplierColumn && [
7220
- "sticky left-0 z-30 min-w-[200px]",
7221
- "shadow-[var(--j3m-shadow-sticky-edge)]"
7222
- ],
7223
- index > 0 && "min-w-[140px]",
7224
- // Current week: only highlight text/dot, not full background
7225
- isCurrentWeekColumn && highlightCurrentWeek && "text-primary"
7695
+ "h-auto px-2 py-1.5 text-left align-middle",
7696
+ "border-r border-b border-border last:border-r-0 min-w-[140px]",
7697
+ statusBg
7226
7698
  ),
7227
- children: header.isPlaceholder ? null : flexRender(
7228
- header.column.columnDef.header,
7229
- header.getContext()
7230
- )
7699
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
7700
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
7701
+ /* @__PURE__ */ jsx(Factory, { className: cn("h-3 w-3", statusText) }),
7702
+ /* @__PURE__ */ jsxs("span", { className: cn("text-xs font-medium tabular-nums", statusText), children: [
7703
+ summary.producedTons.toLocaleString(void 0, { maximumFractionDigits: 1 }),
7704
+ " t"
7705
+ ] })
7706
+ ] }),
7707
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
7708
+ /* @__PURE__ */ jsx(Truck, { className: "h-3 w-3 text-muted-foreground" }),
7709
+ /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground tabular-nums", children: [
7710
+ summary.sentDeliveries,
7711
+ "/",
7712
+ summary.plannedDeliveries,
7713
+ " sent"
7714
+ ] })
7715
+ ] })
7716
+ ] })
7231
7717
  },
7232
- header.id
7718
+ summary.weekKey
7233
7719
  );
7234
7720
  })
7235
- },
7236
- headerGroup.id
7237
- )) }),
7721
+ ] })
7722
+ ] }),
7238
7723
  /* @__PURE__ */ jsx("tbody", { className: "bg-background", children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(
7239
7724
  "tr",
7240
7725
  {
@@ -7289,10 +7774,12 @@ function PlanningTable({
7289
7774
  }
7290
7775
  );
7291
7776
  }
7292
- function getStatusBadgeVariant(status) {
7777
+ function getStatusBadgeVariant(status, isComplete) {
7778
+ if (isComplete) return "outline";
7293
7779
  switch (status) {
7294
7780
  case "on-time":
7295
7781
  return "outline";
7782
+ // Grey for on-track
7296
7783
  case "delayed":
7297
7784
  return "secondary";
7298
7785
  case "critical":
@@ -7301,19 +7788,24 @@ function getStatusBadgeVariant(status) {
7301
7788
  return "outline";
7302
7789
  }
7303
7790
  }
7304
- function getStatusBadgeClasses(status) {
7791
+ function getStatusBadgeClasses(status, isComplete) {
7792
+ if (isComplete) {
7793
+ return "border-green-500 text-green-600 bg-green-50 dark:bg-green-950/50";
7794
+ }
7305
7795
  switch (status) {
7306
7796
  case "on-time":
7307
- return "border-green-500 text-green-600 bg-green-50 dark:bg-green-950/50";
7797
+ return "border-muted-foreground/50 text-muted-foreground bg-muted/50";
7798
+ // Grey for on-track
7308
7799
  case "delayed":
7309
7800
  return "border-amber-500 text-amber-600 bg-amber-50 dark:bg-amber-950/50";
7310
7801
  case "critical":
7311
7802
  return "";
7312
7803
  default:
7313
- return "";
7804
+ return "border-muted-foreground/50 text-muted-foreground";
7314
7805
  }
7315
7806
  }
7316
- function getStatusLabel(status) {
7807
+ function getStatusLabel(status, isComplete) {
7808
+ if (isComplete) return "Complete";
7317
7809
  switch (status) {
7318
7810
  case "on-time":
7319
7811
  return "On Track";
@@ -7327,10 +7819,12 @@ function getStatusLabel(status) {
7327
7819
  return status;
7328
7820
  }
7329
7821
  }
7330
- function getProgressVariant(status) {
7822
+ function getProgressVariant(status, isComplete) {
7823
+ if (isComplete) return "success";
7331
7824
  switch (status) {
7332
7825
  case "on-time":
7333
- return "success";
7826
+ return "default";
7827
+ // Grey/default for on-track
7334
7828
  case "delayed":
7335
7829
  return "warning";
7336
7830
  case "critical":
@@ -7615,37 +8109,66 @@ function DeliveryListItem({
7615
8109
  onClick
7616
8110
  }) {
7617
8111
  const hasComments = (delivery.comments?.length ?? 0) > 0;
8112
+ const isComplete = (delivery.progress ?? 0) >= 100;
8113
+ const getCardStyles3 = () => {
8114
+ if (delivery.status === "critical") {
8115
+ return {
8116
+ card: "border-l-[3px] border-l-red-500 bg-red-50/50 dark:bg-red-950/30",
8117
+ icon: "text-red-600 dark:text-red-400",
8118
+ title: "text-foreground",
8119
+ subtitle: "text-red-700/70 dark:text-red-300/70",
8120
+ chevron: "text-red-600/60 dark:text-red-400/60"
8121
+ };
8122
+ }
8123
+ if (delivery.status === "delayed") {
8124
+ return {
8125
+ card: "border-l-[3px] border-l-amber-500 bg-amber-50/50 dark:bg-amber-950/30",
8126
+ icon: "text-amber-600 dark:text-amber-400",
8127
+ title: "text-foreground",
8128
+ subtitle: "text-amber-700/70 dark:text-amber-300/70",
8129
+ chevron: "text-amber-600/60 dark:text-amber-400/60"
8130
+ };
8131
+ }
8132
+ if (isComplete) {
8133
+ return {
8134
+ card: "border-l-[3px] border-l-green-500 bg-green-50/50 dark:bg-green-950/30",
8135
+ icon: "text-green-600 dark:text-green-400",
8136
+ title: "text-foreground",
8137
+ subtitle: "text-green-700/70 dark:text-green-300/70",
8138
+ chevron: "text-green-600/60 dark:text-green-400/60"
8139
+ };
8140
+ }
8141
+ return {
8142
+ card: "border-l-[3px] border-l-muted-foreground/40 bg-muted/30 dark:bg-muted/20",
8143
+ icon: "text-muted-foreground",
8144
+ title: "text-foreground",
8145
+ subtitle: "text-muted-foreground",
8146
+ chevron: "text-muted-foreground/60"
8147
+ };
8148
+ };
8149
+ const styles = getCardStyles3();
7618
8150
  return /* @__PURE__ */ jsxs(
7619
8151
  "button",
7620
8152
  {
7621
8153
  onClick,
7622
8154
  className: cn(
7623
8155
  "w-full flex items-center justify-between p-3 rounded-lg",
7624
- "bg-card border hover:bg-muted/50 transition-colors cursor-pointer",
7625
- "text-left"
8156
+ "transition-all duration-200 ease-out cursor-pointer text-left",
8157
+ "hover:-translate-y-0.5 hover:shadow-[var(--j3m-shadow-md)]",
8158
+ styles.card
7626
8159
  ),
7627
8160
  children: [
7628
8161
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
7629
- /* @__PURE__ */ jsx("div", { className: cn(
7630
- "flex items-center justify-center h-8 w-8 rounded-lg",
7631
- delivery.status === "on-time" && "bg-green-100 dark:bg-green-950/50",
7632
- delivery.status === "delayed" && "bg-amber-100 dark:bg-amber-950/50",
7633
- delivery.status === "critical" && "bg-red-100 dark:bg-red-950/50"
7634
- ), children: /* @__PURE__ */ jsx(Truck, { className: cn(
7635
- "h-4 w-4",
7636
- delivery.status === "on-time" && "text-green-600 dark:text-green-400",
7637
- delivery.status === "delayed" && "text-amber-600 dark:text-amber-400",
7638
- delivery.status === "critical" && "text-red-600 dark:text-red-400"
7639
- ) }) }),
8162
+ /* @__PURE__ */ jsx(Truck, { className: cn("h-5 w-5 shrink-0", styles.icon) }),
7640
8163
  /* @__PURE__ */ jsxs("div", { children: [
7641
8164
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
7642
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: delivery.label || `Delivery ${index + 1}` }),
8165
+ /* @__PURE__ */ jsx("span", { className: cn("text-sm font-medium", styles.title), children: delivery.label || `Delivery ${index + 1}` }),
7643
8166
  hasComments && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
7644
8167
  /* @__PURE__ */ jsx(MessageSquare, { className: "h-3 w-3 text-muted-foreground" }),
7645
8168
  /* @__PURE__ */ jsx("span", { className: "absolute -top-0.5 -right-0.5 h-1.5 w-1.5 rounded-full bg-primary" })
7646
8169
  ] })
7647
8170
  ] }),
7648
- delivery.destination && /* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground", children: [
8171
+ delivery.destination && /* @__PURE__ */ jsxs("div", { className: cn("text-xs", styles.subtitle), children: [
7649
8172
  "\u2192 ",
7650
8173
  delivery.destination
7651
8174
  ] })
@@ -7655,12 +8178,12 @@ function DeliveryListItem({
7655
8178
  /* @__PURE__ */ jsx(
7656
8179
  Badge,
7657
8180
  {
7658
- variant: getStatusBadgeVariant(delivery.status),
7659
- className: cn("text-xs", getStatusBadgeClasses(delivery.status)),
7660
- children: getStatusLabel(delivery.status)
8181
+ variant: getStatusBadgeVariant(delivery.status, isComplete),
8182
+ className: cn("text-xs", getStatusBadgeClasses(delivery.status, isComplete)),
8183
+ children: getStatusLabel(delivery.status, isComplete)
7661
8184
  }
7662
8185
  ),
7663
- /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 text-muted-foreground" })
8186
+ /* @__PURE__ */ jsx(ChevronRight, { className: cn("h-4 w-4", styles.chevron) })
7664
8187
  ] })
7665
8188
  ]
7666
8189
  }
@@ -7731,9 +8254,9 @@ function DeliveryDetailsView({
7731
8254
  /* @__PURE__ */ jsx(
7732
8255
  Badge,
7733
8256
  {
7734
- variant: getStatusBadgeVariant(delivery.status),
7735
- className: cn("text-xs", getStatusBadgeClasses(delivery.status)),
7736
- children: getStatusLabel(delivery.status)
8257
+ variant: getStatusBadgeVariant(delivery.status, sentCount === totalCount && totalCount > 0),
8258
+ className: cn("text-xs", getStatusBadgeClasses(delivery.status, sentCount === totalCount && totalCount > 0)),
8259
+ children: getStatusLabel(delivery.status, sentCount === totalCount && totalCount > 0)
7737
8260
  }
7738
8261
  )
7739
8262
  ] })
@@ -7906,9 +8429,9 @@ function MainView({
7906
8429
  /* @__PURE__ */ jsx(
7907
8430
  Badge,
7908
8431
  {
7909
- variant: getStatusBadgeVariant(productionStatus),
7910
- className: cn("text-xs ml-auto", getStatusBadgeClasses(productionStatus)),
7911
- children: getStatusLabel(productionStatus)
8432
+ variant: getStatusBadgeVariant(productionStatus, isComplete),
8433
+ className: cn("text-xs ml-auto", getStatusBadgeClasses(productionStatus, isComplete)),
8434
+ children: getStatusLabel(productionStatus, isComplete)
7912
8435
  }
7913
8436
  )
7914
8437
  ] }),
@@ -7919,7 +8442,7 @@ function MainView({
7919
8442
  value: productionProgress,
7920
8443
  size: 100,
7921
8444
  strokeWidth: 10,
7922
- variant: getProgressVariant(productionStatus),
8445
+ variant: getProgressVariant(productionStatus, isComplete),
7923
8446
  showCheckmark: isComplete,
7924
8447
  children: isComplete ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
7925
8448
  /* @__PURE__ */ jsx(Check, { className: "h-6 w-6 text-green-600" }),
@@ -8100,46 +8623,1083 @@ function WeekDetailDialog({
8100
8623
  }
8101
8624
  ) }) });
8102
8625
  }
8103
- function RowHeaderCell({
8104
- className,
8105
- data,
8106
- showProgress = true,
8107
- ...props
8108
- }) {
8109
- const progressPercent = data.totalRequired > 0 ? Math.min(data.totalBooked / data.totalRequired * 100, 100) : 0;
8110
- return /* @__PURE__ */ jsxs(
8111
- "div",
8112
- {
8113
- "data-slot": "row-header-cell",
8114
- className: cn(
8115
- "flex flex-col justify-center gap-1.5 py-2 px-3 min-w-[200px] h-[100px] bg-background",
8116
- className
8117
- ),
8118
- ...props,
8119
- children: [
8120
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
8121
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
8122
- /* @__PURE__ */ jsx("span", { className: "text-sm font-bold leading-tight text-foreground truncate", children: data.name }),
8123
- /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: data.typeCode })
8124
- ] }),
8125
- /* @__PURE__ */ jsxs(
8126
- Badge,
8127
- {
8128
- variant: "outline",
8129
- className: "text-[10px] px-2 py-0.5 h-[19px] font-medium shrink-0 gap-1 bg-background border-border",
8130
- children: [
8131
- /* @__PURE__ */ jsx(Flag, { className: "h-2.5 w-2.5" }),
8132
- "Paint"
8133
- ]
8134
- }
8135
- )
8136
- ] }),
8137
- showProgress && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
8138
- /* @__PURE__ */ jsx("div", { className: "h-1.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
8139
- "div",
8140
- {
8141
- className: "h-full bg-primary rounded-full transition-all",
8142
- style: { width: `${progressPercent}%` }
8626
+ function getStatusBadgeVariant2(status, isComplete) {
8627
+ if (isComplete) return "outline";
8628
+ switch (status) {
8629
+ case "on-time":
8630
+ return "outline";
8631
+ // Grey for on-track
8632
+ case "delayed":
8633
+ return "secondary";
8634
+ case "critical":
8635
+ return "destructive";
8636
+ default:
8637
+ return "outline";
8638
+ }
8639
+ }
8640
+ function getStatusBadgeClasses2(status, isComplete) {
8641
+ if (isComplete) {
8642
+ return "border-green-500 text-green-600 bg-green-50 dark:bg-green-950/50";
8643
+ }
8644
+ switch (status) {
8645
+ case "on-time":
8646
+ return "border-muted-foreground/50 text-muted-foreground bg-muted/50";
8647
+ // Grey for on-track
8648
+ case "delayed":
8649
+ return "border-amber-500 text-amber-600 bg-amber-50 dark:bg-amber-950/50";
8650
+ case "critical":
8651
+ return "";
8652
+ default:
8653
+ return "border-muted-foreground/50 text-muted-foreground";
8654
+ }
8655
+ }
8656
+ function getStatusLabel2(status, isComplete) {
8657
+ if (isComplete) return "Complete";
8658
+ switch (status) {
8659
+ case "on-time":
8660
+ return "On Track";
8661
+ case "delayed":
8662
+ return "At Risk";
8663
+ case "critical":
8664
+ return "Critical";
8665
+ case "pending":
8666
+ return "Pending";
8667
+ default:
8668
+ return status;
8669
+ }
8670
+ }
8671
+ function getShipmentStatusBadgeClasses2(status) {
8672
+ switch (status) {
8673
+ case "sent":
8674
+ return "border-green-500 text-green-600 bg-green-50 dark:bg-green-950/50";
8675
+ case "not-sent":
8676
+ return "border-muted-foreground/50 text-muted-foreground bg-muted/50";
8677
+ case "moved":
8678
+ return "border-blue-500 text-blue-600 bg-blue-50 dark:bg-blue-950/50";
8679
+ case "addon":
8680
+ return "border-purple-500 text-purple-600 bg-purple-50 dark:bg-purple-950/50";
8681
+ case "planned":
8682
+ default:
8683
+ return "border-muted-foreground/50 text-muted-foreground";
8684
+ }
8685
+ }
8686
+ function getShipmentStatusRowBg2(status) {
8687
+ switch (status) {
8688
+ case "sent":
8689
+ return "bg-green-50/30 dark:bg-green-950/10";
8690
+ case "not-sent":
8691
+ return "bg-muted/30";
8692
+ case "moved":
8693
+ return "bg-blue-50/30 dark:bg-blue-950/10";
8694
+ case "addon":
8695
+ return "bg-purple-50/30 dark:bg-purple-950/10";
8696
+ default:
8697
+ return "";
8698
+ }
8699
+ }
8700
+ function ElementProductionDialog({
8701
+ open,
8702
+ onOpenChange,
8703
+ elements,
8704
+ onSave
8705
+ }) {
8706
+ const [searchQuery, setSearchQuery] = React27.useState("");
8707
+ const [selectedIds, setSelectedIds] = React27.useState(
8708
+ new Set(elements.filter((e) => e.isProduced).map((e) => e.id))
8709
+ );
8710
+ React27.useEffect(() => {
8711
+ if (open) {
8712
+ setSelectedIds(new Set(elements.filter((e) => e.isProduced).map((e) => e.id)));
8713
+ setSearchQuery("");
8714
+ }
8715
+ }, [open, elements]);
8716
+ const filteredElements = React27.useMemo(() => {
8717
+ if (!searchQuery.trim()) return elements;
8718
+ const query = searchQuery.toLowerCase();
8719
+ return elements.filter(
8720
+ (e) => e.name.toLowerCase().includes(query) || e.prefix?.toLowerCase().includes(query) || e.type?.toLowerCase().includes(query)
8721
+ );
8722
+ }, [elements, searchQuery]);
8723
+ React27.useMemo(() => {
8724
+ const prefixes = /* @__PURE__ */ new Set();
8725
+ elements.forEach((e) => {
8726
+ if (e.prefix) prefixes.add(e.prefix);
8727
+ });
8728
+ return Array.from(prefixes).sort();
8729
+ }, [elements]);
8730
+ const toggleElement = (id) => {
8731
+ setSelectedIds((prev) => {
8732
+ const next = new Set(prev);
8733
+ if (next.has(id)) {
8734
+ next.delete(id);
8735
+ } else {
8736
+ next.add(id);
8737
+ }
8738
+ return next;
8739
+ });
8740
+ };
8741
+ const selectAll = () => {
8742
+ setSelectedIds(new Set(filteredElements.map((e) => e.id)));
8743
+ };
8744
+ const deselectAll = () => {
8745
+ setSelectedIds(/* @__PURE__ */ new Set());
8746
+ };
8747
+ const handleSave = () => {
8748
+ onSave(Array.from(selectedIds));
8749
+ onOpenChange(false);
8750
+ };
8751
+ const selectedCount = selectedIds.size;
8752
+ const totalCount = elements.length;
8753
+ const selectedWeight = elements.filter((e) => selectedIds.has(e.id)).reduce((sum, e) => sum + (e.weight ?? 0), 0);
8754
+ const totalWeight = elements.reduce((sum, e) => sum + (e.weight ?? 0), 0);
8755
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-fit max-w-[950px] w-fit max-h-[85vh] flex flex-col gap-0 p-0 overflow-hidden", children: [
8756
+ /* @__PURE__ */ jsxs(DialogHeader, { className: "w-full p-6 pb-0 shrink-0", children: [
8757
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Enter production progress" }),
8758
+ /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
8759
+ "Mark elements as produced (",
8760
+ selectedCount,
8761
+ " / ",
8762
+ totalCount,
8763
+ " selected)"
8764
+ ] })
8765
+ ] }),
8766
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-h-0 flex flex-col p-6 pt-4 gap-4 overflow-hidden w-fit", children: [
8767
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row gap-3 shrink-0", children: [
8768
+ /* @__PURE__ */ jsxs("div", { className: "relative flex-1", children: [
8769
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
8770
+ /* @__PURE__ */ jsx(
8771
+ Input,
8772
+ {
8773
+ placeholder: "Search elements...",
8774
+ value: searchQuery,
8775
+ onChange: (e) => setSearchQuery(e.target.value),
8776
+ className: "pl-9 w-full"
8777
+ }
8778
+ )
8779
+ ] }),
8780
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
8781
+ /* @__PURE__ */ jsx(
8782
+ Button,
8783
+ {
8784
+ variant: "outline",
8785
+ size: "sm",
8786
+ onClick: selectAll,
8787
+ children: "Select all"
8788
+ }
8789
+ ),
8790
+ /* @__PURE__ */ jsx(
8791
+ Button,
8792
+ {
8793
+ variant: "outline",
8794
+ size: "sm",
8795
+ onClick: deselectAll,
8796
+ children: "Deselect all"
8797
+ }
8798
+ )
8799
+ ] })
8800
+ ] }),
8801
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 rounded-lg border bg-card overflow-hidden", children: filteredElements.length > 0 ? /* @__PURE__ */ jsx(ScrollArea, { className: "h-full w-fit", children: /* @__PURE__ */ jsxs(Table, { children: [
8802
+ /* @__PURE__ */ jsx(TableHeader, { className: "sticky top-0 z-10", children: /* @__PURE__ */ jsxs(TableRow, { className: "bg-muted/50 hover:bg-muted/50", children: [
8803
+ /* @__PURE__ */ jsx(TableHead, { className: "w-[44px] bg-muted/50", children: /* @__PURE__ */ jsx(
8804
+ Checkbox,
8805
+ {
8806
+ checked: selectedIds.size === filteredElements.length && filteredElements.length > 0,
8807
+ onCheckedChange: (checked) => {
8808
+ if (checked) {
8809
+ selectAll();
8810
+ } else {
8811
+ deselectAll();
8812
+ }
8813
+ },
8814
+ "aria-label": "Select all elements"
8815
+ }
8816
+ ) }),
8817
+ /* @__PURE__ */ jsx(TableHead, { className: "bg-muted/50", children: "Element" }),
8818
+ /* @__PURE__ */ jsx(TableHead, { className: "bg-muted/50 w-[80px]", children: "Type" }),
8819
+ /* @__PURE__ */ jsx(TableHead, { className: "bg-muted/50 text-right w-[90px]", children: "Weight" }),
8820
+ /* @__PURE__ */ jsx(TableHead, { className: "bg-muted/50 text-right w-[80px]", children: "Size" }),
8821
+ /* @__PURE__ */ jsx(TableHead, { className: "bg-muted/50 text-center w-[100px]", children: "Status" })
8822
+ ] }) }),
8823
+ /* @__PURE__ */ jsx(TableBody, { children: filteredElements.map((element) => {
8824
+ const isSelected = selectedIds.has(element.id);
8825
+ return /* @__PURE__ */ jsxs(
8826
+ TableRow,
8827
+ {
8828
+ className: cn(
8829
+ "cursor-pointer transition-colors",
8830
+ isSelected && "bg-green-50/50 dark:bg-green-950/20"
8831
+ ),
8832
+ onClick: () => toggleElement(element.id),
8833
+ children: [
8834
+ /* @__PURE__ */ jsx(TableCell, { className: "w-[44px]", children: /* @__PURE__ */ jsx(
8835
+ Checkbox,
8836
+ {
8837
+ checked: isSelected,
8838
+ onCheckedChange: () => toggleElement(element.id),
8839
+ onClick: (e) => e.stopPropagation(),
8840
+ "aria-label": `Mark ${element.name} as produced`
8841
+ }
8842
+ ) }),
8843
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
8844
+ element.prefix && /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "text-[10px] h-5 shrink-0 font-mono", children: element.prefix }),
8845
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: element.name })
8846
+ ] }) }),
8847
+ /* @__PURE__ */ jsx(TableCell, { className: "text-muted-foreground w-[80px]", children: element.type || "\u2014" }),
8848
+ /* @__PURE__ */ jsx(TableCell, { className: "text-right tabular-nums text-muted-foreground w-[90px]", children: element.weight != null ? `${element.weight.toLocaleString()} kg` : "\u2014" }),
8849
+ /* @__PURE__ */ jsx(TableCell, { className: "text-right tabular-nums text-muted-foreground w-[80px]", children: element.size != null ? `${element.size.toLocaleString()} ${element.sizeUnit || "sqm"}` : "\u2014" }),
8850
+ /* @__PURE__ */ jsx(TableCell, { className: "text-center w-[100px]", children: isSelected ? /* @__PURE__ */ jsxs(
8851
+ Badge,
8852
+ {
8853
+ variant: "outline",
8854
+ className: "border-green-500 text-green-600 bg-green-50 dark:bg-green-950/50",
8855
+ children: [
8856
+ /* @__PURE__ */ jsx(Check, { className: "h-3 w-3 mr-1" }),
8857
+ "Produced"
8858
+ ]
8859
+ }
8860
+ ) : /* @__PURE__ */ jsx(
8861
+ Badge,
8862
+ {
8863
+ variant: "outline",
8864
+ className: "border-muted-foreground/50 text-muted-foreground",
8865
+ children: "Not produced"
8866
+ }
8867
+ ) })
8868
+ ]
8869
+ },
8870
+ element.id
8871
+ );
8872
+ }) })
8873
+ ] }) }) : /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-full min-h-[200px] text-muted-foreground", children: /* @__PURE__ */ jsxs("div", { className: "text-center py-12", children: [
8874
+ /* @__PURE__ */ jsx(Package, { className: "h-10 w-10 mx-auto mb-3 opacity-50" }),
8875
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "No elements found" }),
8876
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: "Try adjusting your search" })
8877
+ ] }) }) })
8878
+ ] }),
8879
+ /* @__PURE__ */ jsx(DialogFooter, { className: "w-full p-6 pt-4 border-t shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full gap-4", children: [
8880
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-sm text-muted-foreground", children: [
8881
+ /* @__PURE__ */ jsxs("span", { children: [
8882
+ selectedCount,
8883
+ " / ",
8884
+ totalCount,
8885
+ " elements"
8886
+ ] }),
8887
+ totalWeight > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
8888
+ /* @__PURE__ */ jsx("span", { children: "\u2022" }),
8889
+ /* @__PURE__ */ jsxs("span", { className: "tabular-nums font-medium text-foreground", children: [
8890
+ (selectedWeight / 1e3).toLocaleString(void 0, { maximumFractionDigits: 1 }),
8891
+ " / ",
8892
+ (totalWeight / 1e3).toLocaleString(void 0, { maximumFractionDigits: 1 }),
8893
+ " ton"
8894
+ ] })
8895
+ ] })
8896
+ ] }),
8897
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
8898
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
8899
+ /* @__PURE__ */ jsx(Button, { onClick: handleSave, children: "Save progress" })
8900
+ ] })
8901
+ ] }) })
8902
+ ] }) });
8903
+ }
8904
+ function DeliveryCommentPopover2({
8905
+ comments = [],
8906
+ onAddComment,
8907
+ deliveryLabel
8908
+ }) {
8909
+ const [open, setOpen] = React27.useState(false);
8910
+ const [newCommentText, setNewCommentText] = React27.useState("");
8911
+ const [viewCommentsOpen, setViewCommentsOpen] = React27.useState(true);
8912
+ const [showAddForm, setShowAddForm] = React27.useState(false);
8913
+ const handleSubmit = () => {
8914
+ if (newCommentText.trim() && onAddComment) {
8915
+ onAddComment(newCommentText.trim());
8916
+ setNewCommentText("");
8917
+ setShowAddForm(false);
8918
+ setViewCommentsOpen(true);
8919
+ }
8920
+ };
8921
+ const handleKeyDown = (e) => {
8922
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
8923
+ e.preventDefault();
8924
+ handleSubmit();
8925
+ }
8926
+ if (e.key === "Escape") {
8927
+ setShowAddForm(false);
8928
+ setNewCommentText("");
8929
+ }
8930
+ };
8931
+ const formatDate3 = (date) => {
8932
+ return new Intl.DateTimeFormat("en-US", {
8933
+ month: "short",
8934
+ day: "numeric",
8935
+ hour: "numeric",
8936
+ minute: "2-digit"
8937
+ }).format(date);
8938
+ };
8939
+ React27.useEffect(() => {
8940
+ if (!open) {
8941
+ setShowAddForm(false);
8942
+ setNewCommentText("");
8943
+ }
8944
+ }, [open]);
8945
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
8946
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(CommentButton, { size: "sm", commentCount: comments.length }) }),
8947
+ /* @__PURE__ */ jsxs(
8948
+ PopoverContent,
8949
+ {
8950
+ className: "w-80 p-0 z-[100]",
8951
+ align: "end",
8952
+ sideOffset: 8,
8953
+ collisionPadding: 16,
8954
+ children: [
8955
+ /* @__PURE__ */ jsxs("div", { className: "px-4 py-3 border-b border-border", children: [
8956
+ /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold", children: "Comments" }),
8957
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: deliveryLabel })
8958
+ ] }),
8959
+ /* @__PURE__ */ jsxs("div", { className: "p-2 space-y-2 h-fit overflow-y-auto", children: [
8960
+ /* @__PURE__ */ jsxs(Collapsible, { open: viewCommentsOpen, onOpenChange: setViewCommentsOpen, children: [
8961
+ /* @__PURE__ */ jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", className: "w-full justify-between h-8 px-2", children: [
8962
+ /* @__PURE__ */ jsxs("span", { className: "text-xs font-medium", children: [
8963
+ "Comments ",
8964
+ comments.length > 0 && `(${comments.length})`
8965
+ ] }),
8966
+ /* @__PURE__ */ jsx(ChevronDown, { className: cn(
8967
+ "h-4 w-4 transition-transform duration-200",
8968
+ viewCommentsOpen && "rotate-180"
8969
+ ) })
8970
+ ] }) }),
8971
+ /* @__PURE__ */ jsx(CollapsibleContent2, { className: "space-y-2 pt-2", children: comments.length > 0 ? comments.map((comment) => /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-muted/50 p-3 space-y-2", children: [
8972
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
8973
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: comment.author }),
8974
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: formatDate3(comment.createdAt) })
8975
+ ] }),
8976
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground", children: comment.text })
8977
+ ] }, comment.id)) : /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground text-center py-2", children: "No comments yet" }) })
8978
+ ] }),
8979
+ /* @__PURE__ */ jsx(Separator, { className: "my-2" }),
8980
+ !showAddForm ? /* @__PURE__ */ jsxs(
8981
+ Button,
8982
+ {
8983
+ variant: "outline",
8984
+ size: "sm",
8985
+ className: "w-full justify-center gap-2 h-8",
8986
+ onClick: () => setShowAddForm(true),
8987
+ children: [
8988
+ /* @__PURE__ */ jsx(Plus, { className: "h-3.5 w-3.5" }),
8989
+ "Add comment"
8990
+ ]
8991
+ }
8992
+ ) : /* @__PURE__ */ jsxs("div", { className: cn(
8993
+ "space-y-3 p-3 rounded-lg border border-border bg-muted/30",
8994
+ "animate-in fade-in-0 slide-in-from-top-2 duration-200"
8995
+ ), children: [
8996
+ /* @__PURE__ */ jsx(
8997
+ Textarea,
8998
+ {
8999
+ placeholder: "Type your comment...",
9000
+ value: newCommentText,
9001
+ onChange: (e) => setNewCommentText(e.target.value),
9002
+ onKeyDown: handleKeyDown,
9003
+ className: "min-h-[80px] text-sm resize-none",
9004
+ autoFocus: true
9005
+ }
9006
+ ),
9007
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
9008
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "\u2318+Enter to send \xB7 Esc to cancel" }),
9009
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9010
+ /* @__PURE__ */ jsx(
9011
+ Button,
9012
+ {
9013
+ variant: "ghost",
9014
+ size: "sm",
9015
+ className: "h-7",
9016
+ onClick: () => {
9017
+ setShowAddForm(false);
9018
+ setNewCommentText("");
9019
+ },
9020
+ children: "Cancel"
9021
+ }
9022
+ ),
9023
+ /* @__PURE__ */ jsxs(
9024
+ Button,
9025
+ {
9026
+ size: "sm",
9027
+ className: "h-7 gap-1",
9028
+ onClick: handleSubmit,
9029
+ disabled: !newCommentText.trim(),
9030
+ children: [
9031
+ /* @__PURE__ */ jsx(Send, { className: "h-3 w-3" }),
9032
+ "Save"
9033
+ ]
9034
+ }
9035
+ )
9036
+ ] })
9037
+ ] })
9038
+ ] })
9039
+ ] })
9040
+ ]
9041
+ }
9042
+ )
9043
+ ] });
9044
+ }
9045
+ function ProductionCommentSection2({
9046
+ comments = [],
9047
+ onAddComment
9048
+ }) {
9049
+ const [showAddForm, setShowAddForm] = React27.useState(false);
9050
+ const [newComment, setNewComment] = React27.useState("");
9051
+ const handleSubmit = () => {
9052
+ if (newComment.trim() && onAddComment) {
9053
+ onAddComment(newComment.trim());
9054
+ setNewComment("");
9055
+ setShowAddForm(false);
9056
+ }
9057
+ };
9058
+ const handleKeyDown = (e) => {
9059
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
9060
+ e.preventDefault();
9061
+ handleSubmit();
9062
+ }
9063
+ if (e.key === "Escape") {
9064
+ setShowAddForm(false);
9065
+ setNewComment("");
9066
+ }
9067
+ };
9068
+ const formatDate3 = (date) => {
9069
+ return new Intl.DateTimeFormat("en-US", {
9070
+ month: "short",
9071
+ day: "numeric",
9072
+ hour: "numeric",
9073
+ minute: "2-digit"
9074
+ }).format(date);
9075
+ };
9076
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
9077
+ comments.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: comments.map((comment) => /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-muted/50 p-2.5 space-y-1", children: [
9078
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
9079
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: comment.author }),
9080
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: formatDate3(comment.createdAt) })
9081
+ ] }),
9082
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground", children: comment.text })
9083
+ ] }, comment.id)) }),
9084
+ !showAddForm ? /* @__PURE__ */ jsxs(
9085
+ Button,
9086
+ {
9087
+ variant: "ghost",
9088
+ size: "sm",
9089
+ className: "w-full justify-start gap-2 h-8 text-muted-foreground",
9090
+ onClick: () => setShowAddForm(true),
9091
+ children: [
9092
+ /* @__PURE__ */ jsx(MessageSquare, { className: "h-3.5 w-3.5" }),
9093
+ comments.length > 0 ? "Add another comment" : "Add a comment..."
9094
+ ]
9095
+ }
9096
+ ) : /* @__PURE__ */ jsxs("div", { className: "space-y-2 animate-in fade-in-0 slide-in-from-top-2 duration-200", children: [
9097
+ /* @__PURE__ */ jsx(
9098
+ Textarea,
9099
+ {
9100
+ placeholder: "Add a comment...",
9101
+ value: newComment,
9102
+ onChange: (e) => setNewComment(e.target.value),
9103
+ onKeyDown: handleKeyDown,
9104
+ className: "min-h-[60px] text-sm resize-none",
9105
+ autoFocus: true
9106
+ }
9107
+ ),
9108
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
9109
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "\u2318+Enter to send" }),
9110
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9111
+ /* @__PURE__ */ jsx(
9112
+ Button,
9113
+ {
9114
+ variant: "ghost",
9115
+ size: "sm",
9116
+ className: "h-7",
9117
+ onClick: () => {
9118
+ setShowAddForm(false);
9119
+ setNewComment("");
9120
+ },
9121
+ children: "Cancel"
9122
+ }
9123
+ ),
9124
+ /* @__PURE__ */ jsxs(
9125
+ Button,
9126
+ {
9127
+ size: "sm",
9128
+ className: "h-7 gap-1",
9129
+ onClick: handleSubmit,
9130
+ disabled: !newComment.trim(),
9131
+ children: [
9132
+ /* @__PURE__ */ jsx(Send, { className: "h-3 w-3" }),
9133
+ "Save"
9134
+ ]
9135
+ }
9136
+ )
9137
+ ] })
9138
+ ] })
9139
+ ] })
9140
+ ] });
9141
+ }
9142
+ function DeliveryListItem2({
9143
+ delivery,
9144
+ index,
9145
+ onClick
9146
+ }) {
9147
+ const hasComments = (delivery.comments?.length ?? 0) > 0;
9148
+ const isComplete = (delivery.progress ?? 0) >= 100;
9149
+ const getCardStyles3 = () => {
9150
+ if (delivery.status === "critical") {
9151
+ return {
9152
+ card: "border-l-[3px] border-l-red-500 bg-red-50/50 dark:bg-red-950/30",
9153
+ icon: "text-red-600 dark:text-red-400",
9154
+ title: "text-foreground",
9155
+ subtitle: "text-red-700/70 dark:text-red-300/70",
9156
+ chevron: "text-red-600/60 dark:text-red-400/60"
9157
+ };
9158
+ }
9159
+ if (delivery.status === "delayed") {
9160
+ return {
9161
+ card: "border-l-[3px] border-l-amber-500 bg-amber-50/50 dark:bg-amber-950/30",
9162
+ icon: "text-amber-600 dark:text-amber-400",
9163
+ title: "text-foreground",
9164
+ subtitle: "text-amber-700/70 dark:text-amber-300/70",
9165
+ chevron: "text-amber-600/60 dark:text-amber-400/60"
9166
+ };
9167
+ }
9168
+ if (isComplete) {
9169
+ return {
9170
+ card: "border-l-[3px] border-l-green-500 bg-green-50/50 dark:bg-green-950/30",
9171
+ icon: "text-green-600 dark:text-green-400",
9172
+ title: "text-foreground",
9173
+ subtitle: "text-green-700/70 dark:text-green-300/70",
9174
+ chevron: "text-green-600/60 dark:text-green-400/60"
9175
+ };
9176
+ }
9177
+ return {
9178
+ card: "border-l-[3px] border-l-muted-foreground/40 bg-muted/30 dark:bg-muted/20",
9179
+ icon: "text-muted-foreground",
9180
+ title: "text-foreground",
9181
+ subtitle: "text-muted-foreground",
9182
+ chevron: "text-muted-foreground/60"
9183
+ };
9184
+ };
9185
+ const styles = getCardStyles3();
9186
+ return /* @__PURE__ */ jsxs(
9187
+ "button",
9188
+ {
9189
+ onClick,
9190
+ className: cn(
9191
+ "w-full flex items-center justify-between p-3 rounded-lg",
9192
+ "transition-all duration-200 ease-out cursor-pointer text-left",
9193
+ "hover:-translate-y-0.5 hover:shadow-[var(--j3m-shadow-md)]",
9194
+ styles.card
9195
+ ),
9196
+ children: [
9197
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
9198
+ /* @__PURE__ */ jsx(Truck, { className: cn("h-5 w-5 shrink-0", styles.icon) }),
9199
+ /* @__PURE__ */ jsxs("div", { children: [
9200
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9201
+ /* @__PURE__ */ jsx("span", { className: cn("text-sm font-medium", styles.title), children: delivery.label || `Delivery ${index + 1}` }),
9202
+ hasComments && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
9203
+ /* @__PURE__ */ jsx(MessageSquare, { className: "h-3 w-3 text-muted-foreground" }),
9204
+ /* @__PURE__ */ jsx("span", { className: "absolute -top-0.5 -right-0.5 h-1.5 w-1.5 rounded-full bg-primary" })
9205
+ ] })
9206
+ ] }),
9207
+ delivery.destination && /* @__PURE__ */ jsxs("div", { className: cn("text-xs", styles.subtitle), children: [
9208
+ "\u2192 ",
9209
+ delivery.destination
9210
+ ] })
9211
+ ] })
9212
+ ] }),
9213
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9214
+ /* @__PURE__ */ jsx(
9215
+ Badge,
9216
+ {
9217
+ variant: getStatusBadgeVariant2(delivery.status, isComplete),
9218
+ className: cn("text-xs", getStatusBadgeClasses2(delivery.status, isComplete)),
9219
+ children: getStatusLabel2(delivery.status, isComplete)
9220
+ }
9221
+ ),
9222
+ /* @__PURE__ */ jsx(ChevronRight, { className: cn("h-4 w-4", styles.chevron) })
9223
+ ] })
9224
+ ]
9225
+ }
9226
+ );
9227
+ }
9228
+ function DeliveryDetailsView2({
9229
+ delivery,
9230
+ week,
9231
+ onBack,
9232
+ onAddComment
9233
+ }) {
9234
+ const elements = delivery.elements ?? [];
9235
+ const categorizedElements = React27.useMemo(() => {
9236
+ const sent = [];
9237
+ const notSent = [];
9238
+ const moved = [];
9239
+ const addons = [];
9240
+ elements.forEach((element) => {
9241
+ const status = getElementShipmentStatus(element, delivery.id);
9242
+ switch (status) {
9243
+ case "sent":
9244
+ sent.push(element);
9245
+ break;
9246
+ case "not-sent":
9247
+ notSent.push(element);
9248
+ break;
9249
+ case "moved":
9250
+ moved.push(element);
9251
+ break;
9252
+ case "addon":
9253
+ addons.push(element);
9254
+ break;
9255
+ default:
9256
+ notSent.push(element);
9257
+ }
9258
+ });
9259
+ return { sent, notSent, moved, addons };
9260
+ }, [elements, delivery.id]);
9261
+ const totalCount = elements.length;
9262
+ const sentCount = categorizedElements.sent.length;
9263
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full animate-in slide-in-from-right-4 duration-200", children: [
9264
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 px-4 py-3 border-b", children: /* @__PURE__ */ jsxs(
9265
+ Button,
9266
+ {
9267
+ variant: "ghost",
9268
+ size: "sm",
9269
+ className: "gap-1 -ml-2",
9270
+ onClick: onBack,
9271
+ children: [
9272
+ /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
9273
+ "Back"
9274
+ ]
9275
+ }
9276
+ ) }),
9277
+ /* @__PURE__ */ jsxs("div", { className: "px-4 py-4 space-y-2", children: [
9278
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
9279
+ /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold", children: delivery.label || "Delivery Details" }),
9280
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9281
+ /* @__PURE__ */ jsx(
9282
+ DeliveryCommentPopover2,
9283
+ {
9284
+ comments: delivery.comments,
9285
+ onAddComment,
9286
+ deliveryLabel: delivery.label || "Delivery"
9287
+ }
9288
+ ),
9289
+ /* @__PURE__ */ jsx(
9290
+ Badge,
9291
+ {
9292
+ variant: getStatusBadgeVariant2(delivery.status, sentCount === totalCount && totalCount > 0),
9293
+ className: cn("text-xs", getStatusBadgeClasses2(delivery.status, sentCount === totalCount && totalCount > 0)),
9294
+ children: getStatusLabel2(delivery.status, sentCount === totalCount && totalCount > 0)
9295
+ }
9296
+ )
9297
+ ] })
9298
+ ] }),
9299
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-sm text-muted-foreground", children: [
9300
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
9301
+ /* @__PURE__ */ jsx(Calendar$1, { className: "h-3.5 w-3.5" }),
9302
+ /* @__PURE__ */ jsxs("span", { children: [
9303
+ week.label,
9304
+ " \u2022 ",
9305
+ week.dateRange
9306
+ ] })
9307
+ ] }),
9308
+ delivery.destination && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
9309
+ /* @__PURE__ */ jsx(Truck, { className: "h-3.5 w-3.5" }),
9310
+ /* @__PURE__ */ jsxs("span", { children: [
9311
+ "\u2192 ",
9312
+ delivery.destination
9313
+ ] })
9314
+ ] })
9315
+ ] })
9316
+ ] }),
9317
+ /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 px-4 pb-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
9318
+ totalCount > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-muted/50 p-4 space-y-3", children: [
9319
+ /* @__PURE__ */ jsx(
9320
+ StatusProgress,
9321
+ {
9322
+ value: totalCount > 0 ? sentCount / totalCount * 100 : 0,
9323
+ currentCount: sentCount,
9324
+ totalCount,
9325
+ unitLabel: "shipped",
9326
+ showLabel: true,
9327
+ showCheckmark: true,
9328
+ size: "md"
9329
+ }
9330
+ ),
9331
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 flex-wrap", children: [
9332
+ categorizedElements.sent.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs", children: [
9333
+ /* @__PURE__ */ jsx(CheckCircle2, { className: "h-3 w-3 text-green-600" }),
9334
+ /* @__PURE__ */ jsxs("span", { className: "text-green-700 dark:text-green-300", children: [
9335
+ categorizedElements.sent.length,
9336
+ " Sent"
9337
+ ] })
9338
+ ] }),
9339
+ categorizedElements.notSent.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs", children: [
9340
+ /* @__PURE__ */ jsx(XCircle, { className: "h-3 w-3 text-muted-foreground" }),
9341
+ /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
9342
+ categorizedElements.notSent.length,
9343
+ " Missing"
9344
+ ] })
9345
+ ] }),
9346
+ categorizedElements.moved.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs", children: [
9347
+ /* @__PURE__ */ jsx(ArrowRight, { className: "h-3 w-3 text-blue-600" }),
9348
+ /* @__PURE__ */ jsxs("span", { className: "text-blue-700 dark:text-blue-300", children: [
9349
+ categorizedElements.moved.length,
9350
+ " Moved"
9351
+ ] })
9352
+ ] }),
9353
+ categorizedElements.addons.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs", children: [
9354
+ /* @__PURE__ */ jsx(Plus, { className: "h-3 w-3 text-purple-600" }),
9355
+ /* @__PURE__ */ jsxs("span", { className: "text-purple-700 dark:text-purple-300", children: [
9356
+ categorizedElements.addons.length,
9357
+ " Add-on"
9358
+ ] })
9359
+ ] })
9360
+ ] })
9361
+ ] }),
9362
+ elements.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
9363
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Elements" }),
9364
+ /* @__PURE__ */ jsx("div", { className: "rounded-lg border overflow-hidden", children: /* @__PURE__ */ jsxs(Table, { children: [
9365
+ /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { className: "bg-sidebar hover:bg-sidebar", children: [
9366
+ /* @__PURE__ */ jsx(TableHead, { className: "font-semibold", children: "Prefix" }),
9367
+ /* @__PURE__ */ jsx(TableHead, { className: "font-semibold", children: "Type" }),
9368
+ /* @__PURE__ */ jsx(TableHead, { className: "font-semibold text-right", children: "Weight" }),
9369
+ /* @__PURE__ */ jsx(TableHead, { className: "font-semibold text-center", children: "Status" })
9370
+ ] }) }),
9371
+ /* @__PURE__ */ jsx(TableBody, { children: elements.map((element) => {
9372
+ const shipmentStatus = getElementShipmentStatus(element, delivery.id);
9373
+ const statusLabel = getShipmentStatusLabel(shipmentStatus);
9374
+ return /* @__PURE__ */ jsxs(
9375
+ TableRow,
9376
+ {
9377
+ className: getShipmentStatusRowBg2(shipmentStatus),
9378
+ children: [
9379
+ /* @__PURE__ */ jsx(TableCell, { className: "font-medium", children: element.prefix || "\u2014" }),
9380
+ /* @__PURE__ */ jsx(TableCell, { children: element.type || element.name || "\u2014" }),
9381
+ /* @__PURE__ */ jsx(TableCell, { className: "text-right tabular-nums", children: element.weight ? `${element.weight} ${element.weightUnit || "kg"}` : "\u2014" }),
9382
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
9383
+ /* @__PURE__ */ jsx(
9384
+ Badge,
9385
+ {
9386
+ variant: "outline",
9387
+ className: cn("text-[10px] h-5", getShipmentStatusBadgeClasses2(shipmentStatus)),
9388
+ children: statusLabel
9389
+ }
9390
+ ),
9391
+ shipmentStatus === "moved" && element.actualDeliveryLabel && /* @__PURE__ */ jsxs("span", { className: "text-[9px] text-blue-600 dark:text-blue-400", children: [
9392
+ "\u2192 ",
9393
+ element.actualDeliveryLabel
9394
+ ] }),
9395
+ shipmentStatus === "addon" && element.originalDeliveryLabel && /* @__PURE__ */ jsxs("span", { className: "text-[9px] text-purple-600 dark:text-purple-400", children: [
9396
+ "from ",
9397
+ element.originalDeliveryLabel
9398
+ ] })
9399
+ ] }) })
9400
+ ]
9401
+ },
9402
+ element.id
9403
+ );
9404
+ }) })
9405
+ ] }) })
9406
+ ] }),
9407
+ elements.length === 0 && /* @__PURE__ */ jsxs("div", { className: "text-center py-8 text-muted-foreground", children: [
9408
+ /* @__PURE__ */ jsx(Package, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
9409
+ /* @__PURE__ */ jsx("p", { className: "text-sm", children: "No elements in this delivery" })
9410
+ ] })
9411
+ ] }) })
9412
+ ] });
9413
+ }
9414
+ function MainView2({
9415
+ supplier,
9416
+ week,
9417
+ data,
9418
+ productionElements,
9419
+ previousProducedCount,
9420
+ onOpenProductionDialog,
9421
+ onSelectDelivery,
9422
+ onAddProductionComment
9423
+ }) {
9424
+ const production = data?.production;
9425
+ const producedCount = productionElements.filter((e) => e.isProduced).length;
9426
+ const totalCount = productionElements.length;
9427
+ const productionProgress = totalCount > 0 ? Math.round(producedCount / totalCount * 100) : 0;
9428
+ const isComplete = productionProgress >= 100;
9429
+ const hasProductionComments = (production?.comments?.length ?? 0) > 0;
9430
+ const showPreviousProgress = !isComplete && previousProducedCount !== void 0 && previousProducedCount !== producedCount;
9431
+ return /* @__PURE__ */ jsxs("div", { className: "animate-in fade-in-0 duration-200", children: [
9432
+ /* @__PURE__ */ jsxs(SheetHeader, { className: "px-4 pt-4 pb-3 border-b", children: [
9433
+ /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
9434
+ supplier.name,
9435
+ /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs font-normal", children: supplier.badgeType })
9436
+ ] }),
9437
+ /* @__PURE__ */ jsxs(SheetDescription, { className: "flex items-center gap-2", children: [
9438
+ /* @__PURE__ */ jsx(Calendar$1, { className: "h-4 w-4" }),
9439
+ week.label,
9440
+ " \u2022 ",
9441
+ week.dateRange
9442
+ ] })
9443
+ ] }),
9444
+ /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 px-4 pb-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-6 pt-4", children: [
9445
+ data.type !== "empty" && /* @__PURE__ */ jsxs("section", { className: "space-y-4", children: [
9446
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9447
+ /* @__PURE__ */ jsx(Factory, { className: "h-4 w-4 text-muted-foreground" }),
9448
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: "Production" })
9449
+ ] }),
9450
+ totalCount > 0 ? /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
9451
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center py-4", children: [
9452
+ /* @__PURE__ */ jsx(
9453
+ CircularProgress,
9454
+ {
9455
+ value: productionProgress,
9456
+ size: 88,
9457
+ strokeWidth: 8,
9458
+ variant: productionProgress >= 100 ? "success" : productionProgress >= 50 ? "success" : productionProgress > 0 ? "warning" : "destructive",
9459
+ showCheckmark: true,
9460
+ children: productionProgress < 100 && /* @__PURE__ */ jsxs("span", { className: "text-lg font-bold tabular-nums", children: [
9461
+ Math.round(productionProgress),
9462
+ "%"
9463
+ ] })
9464
+ }
9465
+ ),
9466
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 text-center", children: [
9467
+ /* @__PURE__ */ jsxs("span", { className: "text-sm font-semibold text-foreground", children: [
9468
+ producedCount,
9469
+ " / ",
9470
+ totalCount,
9471
+ " elements"
9472
+ ] }),
9473
+ showPreviousProgress && /* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground mt-1", children: [
9474
+ "Previously: ",
9475
+ previousProducedCount,
9476
+ " / ",
9477
+ totalCount
9478
+ ] })
9479
+ ] })
9480
+ ] }),
9481
+ /* @__PURE__ */ jsx(
9482
+ Button,
9483
+ {
9484
+ className: "w-full",
9485
+ onClick: onOpenProductionDialog,
9486
+ children: "Enter production progress"
9487
+ }
9488
+ )
9489
+ ] }) : (
9490
+ /* No elements - show placeholder with button still available */
9491
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
9492
+ /* @__PURE__ */ jsxs("div", { className: "text-center py-6 text-muted-foreground bg-muted/30 rounded-lg", children: [
9493
+ /* @__PURE__ */ jsx(Package, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
9494
+ /* @__PURE__ */ jsx("p", { className: "text-sm", children: "No elements to track" })
9495
+ ] }),
9496
+ /* @__PURE__ */ jsx(
9497
+ Button,
9498
+ {
9499
+ className: "w-full",
9500
+ variant: "outline",
9501
+ onClick: onOpenProductionDialog,
9502
+ children: "Enter production progress"
9503
+ }
9504
+ )
9505
+ ] })
9506
+ ),
9507
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
9508
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9509
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Comments" }),
9510
+ hasProductionComments && /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground", children: [
9511
+ "(",
9512
+ production?.comments?.length,
9513
+ ")"
9514
+ ] })
9515
+ ] }),
9516
+ /* @__PURE__ */ jsx(
9517
+ ProductionCommentSection2,
9518
+ {
9519
+ comments: production?.comments,
9520
+ onAddComment: onAddProductionComment
9521
+ }
9522
+ )
9523
+ ] })
9524
+ ] }),
9525
+ data.deliveries && data.deliveries.length > 0 && /* @__PURE__ */ jsxs("section", { className: "space-y-4", children: [
9526
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9527
+ /* @__PURE__ */ jsx(Truck, { className: "h-4 w-4 text-muted-foreground" }),
9528
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: "Deliveries" }),
9529
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground ml-auto", children: [
9530
+ data.deliveries.length,
9531
+ " scheduled"
9532
+ ] })
9533
+ ] }),
9534
+ /* @__PURE__ */ jsx("div", { className: "space-y-2", children: data.deliveries.map((delivery, index) => /* @__PURE__ */ jsx(
9535
+ DeliveryListItem2,
9536
+ {
9537
+ delivery,
9538
+ index,
9539
+ onClick: () => onSelectDelivery(delivery)
9540
+ },
9541
+ delivery.id
9542
+ )) })
9543
+ ] }),
9544
+ data.type === "no-logistics" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground p-3 bg-muted/50 rounded-lg", children: [
9545
+ /* @__PURE__ */ jsx(Truck, { className: "h-4 w-4" }),
9546
+ /* @__PURE__ */ jsx("span", { className: "text-sm", children: "No logistics scheduled for this week" })
9547
+ ] }),
9548
+ data.hasWarning && data.warningMessage && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 rounded-lg bg-amber-50 dark:bg-amber-950/50 p-3 text-amber-700 dark:text-amber-300", children: [
9549
+ /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4 mt-0.5 shrink-0" }),
9550
+ /* @__PURE__ */ jsx("div", { className: "text-sm", children: data.warningMessage })
9551
+ ] }),
9552
+ data.notes && /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
9553
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Notes" }),
9554
+ /* @__PURE__ */ jsx("p", { className: "text-sm", children: data.notes })
9555
+ ] })
9556
+ ] }) })
9557
+ ] });
9558
+ }
9559
+ function WeekDetailSheet({
9560
+ open,
9561
+ onOpenChange,
9562
+ supplier,
9563
+ week,
9564
+ data,
9565
+ onProductionUpdate,
9566
+ onAddProductionComment,
9567
+ onAddDeliveryComment
9568
+ }) {
9569
+ const [selectedDelivery, setSelectedDelivery] = React27.useState(null);
9570
+ const [productionDialogOpen, setProductionDialogOpen] = React27.useState(false);
9571
+ const [previousProducedCount, setPreviousProducedCount] = React27.useState(void 0);
9572
+ const productionElements = React27.useMemo(() => {
9573
+ if (!data?.deliveries) return [];
9574
+ const elements = [];
9575
+ const seenIds = /* @__PURE__ */ new Set();
9576
+ data.deliveries.forEach((delivery) => {
9577
+ delivery.elements?.forEach((element) => {
9578
+ if (!seenIds.has(element.id)) {
9579
+ seenIds.add(element.id);
9580
+ elements.push({
9581
+ id: element.id,
9582
+ name: element.name,
9583
+ prefix: element.prefix,
9584
+ type: element.type,
9585
+ weight: element.weight,
9586
+ size: element.sizeSqm,
9587
+ sizeUnit: "sqm",
9588
+ isProduced: element.isProduced
9589
+ });
9590
+ }
9591
+ });
9592
+ });
9593
+ return elements;
9594
+ }, [data?.deliveries]);
9595
+ const currentProducedCount = productionElements.filter((e) => e.isProduced).length;
9596
+ React27.useEffect(() => {
9597
+ if (open && data?.deliveries) {
9598
+ setPreviousProducedCount(currentProducedCount);
9599
+ }
9600
+ }, [open]);
9601
+ React27.useEffect(() => {
9602
+ if (!open) {
9603
+ setSelectedDelivery(null);
9604
+ setProductionDialogOpen(false);
9605
+ setPreviousProducedCount(void 0);
9606
+ }
9607
+ }, [open]);
9608
+ const handleProductionSave = (producedIds) => {
9609
+ if (!supplier || !week || !onProductionUpdate) return;
9610
+ const weekKey = `${week.year}-W${week.weekNumber.toString().padStart(2, "0")}`;
9611
+ onProductionUpdate(supplier.id, weekKey, producedIds);
9612
+ setPreviousProducedCount(producedIds.length);
9613
+ };
9614
+ if (!supplier || !week || !data) {
9615
+ return null;
9616
+ }
9617
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
9618
+ /* @__PURE__ */ jsx(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsx(
9619
+ SheetContent,
9620
+ {
9621
+ side: "right",
9622
+ className: "w-full sm:max-w-lg p-0 overflow-hidden",
9623
+ children: selectedDelivery ? /* @__PURE__ */ jsx(
9624
+ DeliveryDetailsView2,
9625
+ {
9626
+ delivery: selectedDelivery,
9627
+ week,
9628
+ onBack: () => setSelectedDelivery(null),
9629
+ onAddComment: onAddDeliveryComment ? (text) => {
9630
+ const weekKey = `${week.year}-W${week.weekNumber.toString().padStart(2, "0")}`;
9631
+ onAddDeliveryComment(supplier.id, weekKey, selectedDelivery.id, text);
9632
+ } : void 0
9633
+ }
9634
+ ) : /* @__PURE__ */ jsx(
9635
+ MainView2,
9636
+ {
9637
+ supplier,
9638
+ week,
9639
+ data,
9640
+ productionElements,
9641
+ previousProducedCount,
9642
+ onOpenProductionDialog: () => setProductionDialogOpen(true),
9643
+ onSelectDelivery: setSelectedDelivery,
9644
+ onAddProductionComment: onAddProductionComment ? (text) => {
9645
+ const weekKey = `${week.year}-W${week.weekNumber.toString().padStart(2, "0")}`;
9646
+ onAddProductionComment(supplier.id, weekKey, text);
9647
+ } : void 0
9648
+ }
9649
+ )
9650
+ }
9651
+ ) }),
9652
+ /* @__PURE__ */ jsx(
9653
+ ElementProductionDialog,
9654
+ {
9655
+ open: productionDialogOpen,
9656
+ onOpenChange: setProductionDialogOpen,
9657
+ elements: productionElements,
9658
+ onSave: handleProductionSave
9659
+ }
9660
+ )
9661
+ ] });
9662
+ }
9663
+ function RowHeaderCell({
9664
+ className,
9665
+ data,
9666
+ showProgress = true,
9667
+ ...props
9668
+ }) {
9669
+ const progressPercent = data.totalRequired > 0 ? Math.min(data.totalBooked / data.totalRequired * 100, 100) : 0;
9670
+ return /* @__PURE__ */ jsxs(
9671
+ "div",
9672
+ {
9673
+ "data-slot": "row-header-cell",
9674
+ className: cn(
9675
+ "flex flex-col justify-center gap-1.5 py-2 px-3 min-w-[200px] h-[100px] bg-background",
9676
+ className
9677
+ ),
9678
+ ...props,
9679
+ children: [
9680
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
9681
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
9682
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-bold leading-tight text-foreground truncate", children: data.name }),
9683
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: data.typeCode })
9684
+ ] }),
9685
+ /* @__PURE__ */ jsxs(
9686
+ Badge,
9687
+ {
9688
+ variant: "outline",
9689
+ className: "text-[10px] px-2 py-0.5 h-[19px] font-medium shrink-0 gap-1 bg-background border-border",
9690
+ children: [
9691
+ /* @__PURE__ */ jsx(Flag, { className: "h-2.5 w-2.5" }),
9692
+ "Paint"
9693
+ ]
9694
+ }
9695
+ )
9696
+ ] }),
9697
+ showProgress && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
9698
+ /* @__PURE__ */ jsx("div", { className: "h-1.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
9699
+ "div",
9700
+ {
9701
+ className: "h-full bg-primary rounded-full transition-all",
9702
+ style: { width: `${progressPercent}%` }
8143
9703
  }
8144
9704
  ) }),
8145
9705
  /* @__PURE__ */ jsxs("span", { className: "text-[10px] font-medium text-primary", children: [
@@ -8802,6 +10362,84 @@ function CalibrationTable({
8802
10362
  () => prefixes.map((p) => ({ id: p.id, name: p.name })),
8803
10363
  [prefixes]
8804
10364
  );
10365
+ const insightMetrics = React27.useMemo(() => {
10366
+ let totalCalibrated = 0;
10367
+ let totalRequired = 0;
10368
+ for (const prefix of prefixes) {
10369
+ for (const weekKey in prefix.weeks) {
10370
+ const cell = prefix.weeks[weekKey];
10371
+ if (cell.planned > 0) {
10372
+ totalRequired += cell.planned;
10373
+ totalCalibrated += cell.entered ?? 0;
10374
+ }
10375
+ }
10376
+ }
10377
+ const completeness = totalRequired > 0 ? totalCalibrated / totalRequired * 100 : 0;
10378
+ const remaining = Math.max(0, totalRequired - totalCalibrated);
10379
+ return [
10380
+ {
10381
+ key: "calibrated",
10382
+ label: "calibrated",
10383
+ value: totalCalibrated,
10384
+ unit: "tons",
10385
+ icon: "factory",
10386
+ status: completeness >= 100 ? "success" : "normal"
10387
+ },
10388
+ {
10389
+ key: "remaining",
10390
+ label: "remaining",
10391
+ value: remaining,
10392
+ unit: "tons",
10393
+ icon: "factory",
10394
+ status: remaining > 0 ? "warning" : "success"
10395
+ },
10396
+ {
10397
+ key: "completeness",
10398
+ label: "complete",
10399
+ value: completeness,
10400
+ isPercentage: true,
10401
+ icon: "trending",
10402
+ status: completeness >= 100 ? "success" : completeness >= 50 ? "normal" : "warning"
10403
+ }
10404
+ ];
10405
+ }, [prefixes]);
10406
+ const columnSummaryData = React27.useMemo(() => {
10407
+ return weeks.map((week) => {
10408
+ const weekKey = getWeekKey(week.startDate);
10409
+ let calibratedTons = 0;
10410
+ let requiredTons = 0;
10411
+ let hasShortfall = false;
10412
+ let allValid = true;
10413
+ for (const prefix of prefixes) {
10414
+ const cell = prefix.weeks[weekKey];
10415
+ if (cell) {
10416
+ requiredTons += cell.planned;
10417
+ calibratedTons += cell.entered ?? 0;
10418
+ if (cell.status === "shortfall") hasShortfall = true;
10419
+ if (cell.status !== "valid" && cell.planned > 0) allValid = false;
10420
+ }
10421
+ }
10422
+ let status2 = "normal";
10423
+ if (hasShortfall) {
10424
+ status2 = "critical";
10425
+ } else if (allValid && requiredTons > 0) {
10426
+ status2 = "complete";
10427
+ }
10428
+ return {
10429
+ columnKey: weekKey,
10430
+ primary: {
10431
+ value: calibratedTons,
10432
+ unit: "t",
10433
+ icon: "factory"
10434
+ },
10435
+ secondary: {
10436
+ value: requiredTons,
10437
+ unit: "t req"
10438
+ },
10439
+ status: status2
10440
+ };
10441
+ });
10442
+ }, [weeks, prefixes]);
8805
10443
  return /* @__PURE__ */ jsxs(
8806
10444
  "div",
8807
10445
  {
@@ -8812,6 +10450,7 @@ function CalibrationTable({
8812
10450
  /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold tracking-tight", children: "Weekly Production Calibration" }),
8813
10451
  /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "Review required weekly production and confirm achievable output at the selected checkpoint." })
8814
10452
  ] }) }),
10453
+ /* @__PURE__ */ jsx(InsightBar, { metrics: insightMetrics }),
8815
10454
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8816
10455
  showToolbar && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
8817
10456
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(
@@ -8844,36 +10483,74 @@ function CalibrationTable({
8844
10483
  style: { maxHeight },
8845
10484
  children: [
8846
10485
  /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse", children: [
8847
- /* @__PURE__ */ jsx("thead", { className: "sticky top-0 z-20", children: /* @__PURE__ */ jsxs("tr", { children: [
8848
- /* @__PURE__ */ jsx("th", { className: cn(
8849
- "h-14 px-3 text-left align-middle font-semibold text-xs text-muted-foreground uppercase tracking-wide",
8850
- "border-r border-b border-border bg-sidebar",
8851
- stickyRowHeader && "sticky left-0 z-30 min-w-[200px]",
8852
- // Right shadow using Quantum token
8853
- stickyRowHeader && "shadow-[var(--j3m-shadow-sticky-edge)]"
8854
- ), children: "Supplier / Scope" }),
8855
- weeks.map((week) => {
8856
- const weekKey = getWeekKey(week.startDate);
8857
- const weekComments = getWeekComments(weekKey);
8858
- return /* @__PURE__ */ jsx(
8859
- "th",
8860
- {
8861
- className: "h-14 px-2 text-left align-middle border-r border-b border-border last:border-r-0 min-w-[220px] bg-sidebar",
8862
- children: /* @__PURE__ */ jsx(
8863
- CalibrationWeekHeader,
8864
- {
8865
- week,
8866
- comments: weekComments,
8867
- showCommentButton: true,
8868
- availablePrefixes,
8869
- onAddComment: (text, prefixId, prefixName) => handleAddWeekComment(weekKey, text, prefixId)
8870
- }
8871
- )
8872
- },
8873
- weekKey
8874
- );
8875
- })
8876
- ] }) }),
10486
+ /* @__PURE__ */ jsxs("thead", { className: "sticky top-0 z-20", children: [
10487
+ /* @__PURE__ */ jsxs("tr", { children: [
10488
+ /* @__PURE__ */ jsx("th", { className: cn(
10489
+ "h-14 px-3 text-left align-middle font-semibold text-xs text-muted-foreground uppercase tracking-wide",
10490
+ "border-r border-b border-border bg-sidebar",
10491
+ stickyRowHeader && "sticky left-0 z-30 min-w-[200px]",
10492
+ // Right shadow using Quantum token
10493
+ stickyRowHeader && "shadow-[var(--j3m-shadow-sticky-edge)]"
10494
+ ), children: "Supplier / Scope" }),
10495
+ weeks.map((week) => {
10496
+ const weekKey = getWeekKey(week.startDate);
10497
+ const weekComments = getWeekComments(weekKey);
10498
+ return /* @__PURE__ */ jsx(
10499
+ "th",
10500
+ {
10501
+ className: "h-14 px-2 text-left align-middle border-r border-b border-border last:border-r-0 min-w-[220px] bg-sidebar",
10502
+ children: /* @__PURE__ */ jsx(
10503
+ CalibrationWeekHeader,
10504
+ {
10505
+ week,
10506
+ comments: weekComments,
10507
+ showCommentButton: true,
10508
+ availablePrefixes,
10509
+ onAddComment: (text, prefixId, prefixName) => handleAddWeekComment(weekKey, text, prefixId)
10510
+ }
10511
+ )
10512
+ },
10513
+ weekKey
10514
+ );
10515
+ })
10516
+ ] }),
10517
+ /* @__PURE__ */ jsxs("tr", { children: [
10518
+ /* @__PURE__ */ jsx("th", { className: cn(
10519
+ "h-auto px-3 py-1.5 text-left align-middle",
10520
+ "border-r border-b border-border bg-muted/30",
10521
+ stickyRowHeader && "sticky left-0 z-30 min-w-[200px]",
10522
+ stickyRowHeader && "shadow-[var(--j3m-shadow-sticky-edge)]"
10523
+ ), children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide", children: "Summary" }) }),
10524
+ columnSummaryData.map((summary) => {
10525
+ const statusBg = summary.status === "complete" ? "bg-green-50/50 dark:bg-green-950/30" : summary.status === "critical" ? "bg-red-50/50 dark:bg-red-950/30" : "bg-muted/30";
10526
+ const statusText = summary.status === "complete" ? "text-green-700 dark:text-green-300" : summary.status === "critical" ? "text-red-700 dark:text-red-300" : "text-muted-foreground";
10527
+ return /* @__PURE__ */ jsx(
10528
+ "th",
10529
+ {
10530
+ className: cn(
10531
+ "h-auto px-2 py-1.5 text-left align-middle",
10532
+ "border-r border-b border-border last:border-r-0 min-w-[220px]",
10533
+ statusBg
10534
+ ),
10535
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
10536
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
10537
+ /* @__PURE__ */ jsx(Factory, { className: cn("h-3 w-3", statusText) }),
10538
+ /* @__PURE__ */ jsxs("span", { className: cn("text-xs font-medium tabular-nums", statusText), children: [
10539
+ summary.primary?.value.toLocaleString(void 0, { maximumFractionDigits: 1 }),
10540
+ " t"
10541
+ ] })
10542
+ ] }),
10543
+ /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground tabular-nums", children: [
10544
+ summary.secondary?.value.toLocaleString(void 0, { maximumFractionDigits: 1 }),
10545
+ " t req"
10546
+ ] })
10547
+ ] })
10548
+ },
10549
+ summary.columnKey
10550
+ );
10551
+ })
10552
+ ] })
10553
+ ] }),
8877
10554
  /* @__PURE__ */ jsx("tbody", { className: "bg-background", children: paginatedPrefixes.length > 0 ? paginatedPrefixes.map((prefix) => {
8878
10555
  const sortedWeekKeys = weeks.map((w) => getWeekKey(w.startDate));
8879
10556
  let hasDeficit = false;
@@ -9372,40 +11049,40 @@ function groupDeliveriesByPrefixAndDay(deliveries) {
9372
11049
  }
9373
11050
  return grouped;
9374
11051
  }
9375
- function getLeftStrokeStyles(state, hasRisk, isHovered) {
11052
+ function getCardStyles(state, hasRisk) {
9376
11053
  if (hasRisk) {
9377
11054
  return {
9378
- stroke: "border-l-[3px] border-l-red-500",
9379
- content: "text-foreground",
9380
- progressBg: "bg-red-500",
9381
- iconColor: "text-red-600 dark:text-red-400",
9382
- cardBg: "bg-background"
11055
+ fill: statusCellFillClasses.risk.combined,
11056
+ titleColor: statusCellTextClasses.risk.title,
11057
+ subtitleColor: statusCellTextClasses.risk.subtitle,
11058
+ iconColor: statusCellTextClasses.risk.icon,
11059
+ opacity: ""
9383
11060
  };
9384
11061
  }
9385
11062
  switch (state) {
9386
11063
  case "sent":
9387
11064
  return {
9388
- stroke: "border-l-[3px] border-l-green-500/40",
9389
- content: "text-muted-foreground/50",
9390
- progressBg: "bg-green-500/50",
9391
- iconColor: "text-green-600/50 dark:text-green-400/50",
9392
- cardBg: "bg-muted/30"
11065
+ fill: statusCellFillClasses.shipped.combined,
11066
+ titleColor: statusCellTextClasses.shipped.title,
11067
+ subtitleColor: statusCellTextClasses.shipped.subtitle,
11068
+ iconColor: statusCellTextClasses.shipped.icon,
11069
+ opacity: "opacity-75"
9393
11070
  };
9394
11071
  case "ready":
9395
11072
  return {
9396
- stroke: "border-l-[3px] border-l-green-500",
9397
- content: "text-foreground",
9398
- progressBg: "bg-green-500",
9399
- iconColor: "text-green-600 dark:text-green-400",
9400
- cardBg: "bg-background"
11073
+ fill: statusCellFillClasses.ready.combined,
11074
+ titleColor: statusCellTextClasses.ready.title,
11075
+ subtitleColor: statusCellTextClasses.ready.subtitle,
11076
+ iconColor: statusCellTextClasses.ready.icon,
11077
+ opacity: ""
9401
11078
  };
9402
11079
  default:
9403
11080
  return {
9404
- stroke: isHovered ? "border-l-[3px] border-l-primary/50" : "border-l-[3px] border-l-border",
9405
- content: "text-foreground",
9406
- progressBg: "bg-primary",
9407
- iconColor: "text-muted-foreground",
9408
- cardBg: "bg-background"
11081
+ fill: statusCellFillClasses.normal.combined,
11082
+ titleColor: statusCellTextClasses.normal.title,
11083
+ subtitleColor: statusCellTextClasses.normal.subtitle,
11084
+ iconColor: statusCellTextClasses.normal.icon,
11085
+ opacity: ""
9409
11086
  };
9410
11087
  }
9411
11088
  }
@@ -9415,55 +11092,10 @@ function DeliveryBadge({
9415
11092
  onCommentClick,
9416
11093
  className
9417
11094
  }) {
9418
- const [isHovered, setIsHovered] = React27.useState(false);
9419
11095
  const hasComments = delivery.comments.length > 0;
9420
11096
  const visualState = getDeliveryVisualState(delivery);
9421
- const styles = getLeftStrokeStyles(visualState, delivery.hasProductionRisk ?? false, isHovered);
9422
- const prefixTitle = React27.useMemo(() => {
9423
- const prefixSet = /* @__PURE__ */ new Set();
9424
- if (delivery.elements && delivery.elements.length > 0) {
9425
- for (const element of delivery.elements) {
9426
- if (element.prefix) {
9427
- prefixSet.add(element.prefix);
9428
- }
9429
- }
9430
- }
9431
- if (prefixSet.size === 0 && delivery.prefixScope) {
9432
- prefixSet.add(delivery.prefixScope);
9433
- }
9434
- const prefixes = Array.from(prefixSet);
9435
- if (prefixes.length === 0) {
9436
- return delivery.label;
9437
- }
9438
- if (prefixes.length > 3) {
9439
- return `${prefixes.slice(0, 3).join(" \xB7 ")} \xB7 +${prefixes.length - 3}`;
9440
- }
9441
- return prefixes.join(" \xB7 ");
9442
- }, [delivery]);
9443
- const productionProgress = React27.useMemo(() => {
9444
- if (delivery.producedTons !== void 0 && delivery.totalTons !== void 0 && delivery.totalTons > 0) {
9445
- return Math.min(delivery.producedTons / delivery.totalTons * 100, 100);
9446
- }
9447
- if (delivery.producedCount !== void 0 && delivery.totalCount !== void 0 && delivery.totalCount > 0) {
9448
- return Math.min(delivery.producedCount / delivery.totalCount * 100, 100);
9449
- }
9450
- if (delivery.loadedCount !== void 0 && delivery.totalCount !== void 0 && delivery.totalCount > 0) {
9451
- return Math.min(delivery.loadedCount / delivery.totalCount * 100, 100);
9452
- }
9453
- return 0;
9454
- }, [delivery]);
9455
- const productionDisplay = React27.useMemo(() => {
9456
- if (delivery.producedTons !== void 0 && delivery.totalTons !== void 0) {
9457
- return `${delivery.producedTons}/${delivery.totalTons}t`;
9458
- }
9459
- if (delivery.producedCount !== void 0 && delivery.totalCount !== void 0) {
9460
- return `${delivery.producedCount}/${delivery.totalCount}`;
9461
- }
9462
- if (delivery.loadedCount !== void 0 && delivery.totalCount !== void 0) {
9463
- return `${delivery.loadedCount}/${delivery.totalCount}`;
9464
- }
9465
- return null;
9466
- }, [delivery]);
11097
+ const styles = getCardStyles(visualState, delivery.hasProductionRisk ?? false);
11098
+ const projectName = delivery.destination || delivery.label;
9467
11099
  const handleClick = (e) => {
9468
11100
  e.stopPropagation();
9469
11101
  onClick?.();
@@ -9479,38 +11111,22 @@ function DeliveryBadge({
9479
11111
  e.stopPropagation();
9480
11112
  onCommentClick?.();
9481
11113
  };
9482
- const amountColorClass = React27.useMemo(() => {
9483
- if (visualState === "sent") {
9484
- return "text-muted-foreground/40";
9485
- }
9486
- if (delivery.isReadyToUnload) {
9487
- return "text-green-600 dark:text-green-400";
9488
- }
9489
- if (delivery.hasProductionRisk) {
9490
- return "text-red-600 dark:text-red-400";
9491
- }
9492
- return "text-muted-foreground";
9493
- }, [visualState, delivery.isReadyToUnload, delivery.hasProductionRisk]);
9494
11114
  return /* @__PURE__ */ jsxs(
9495
11115
  "div",
9496
11116
  {
9497
11117
  className: cn(
9498
11118
  // Position relative for comment button
9499
11119
  "relative",
9500
- // Full-width in cell, 90° corners
9501
- "w-full rounded-none",
9502
- // Sizing using Quantum tokens:
9503
- // - min-h-[100px] card min-height
9504
- // - pt-4 pb-3 = vertical padding (j3m.spacing.m / j3m.spacing.s)
9505
- // - pl-4 = left padding (j3m.spacing.m)
9506
- // - pr-2 = minimal right padding (progress bar extends further)
9507
- "min-h-[100px] pt-4 pb-3 pl-4 pr-2",
9508
- // Card base: dynamic background based on state, complete border
9509
- styles.cardBg,
9510
- "border border-border",
9511
- // Left stroke for status
9512
- styles.stroke,
9513
- // Interactive states (reduced for sent state)
11120
+ // Full-width in cell, small radius (matching planning cards)
11121
+ "w-full rounded-lg",
11122
+ // Compact sizing - min-h-[72px], p-4 (j3m.spacing.m)
11123
+ "min-h-[72px] p-4",
11124
+ // FULL-CARD STATUS FILL - uses shared calibration/planning tokens
11125
+ // This is the key change: status fill on outermost container
11126
+ styles.fill,
11127
+ // Opacity for shipped state
11128
+ styles.opacity,
11129
+ // Interactive states (disabled hover lift for shipped)
9514
11130
  "transition-all duration-200 ease-out",
9515
11131
  visualState !== "sent" && "hover:-translate-y-0.5 hover:shadow-[var(--j3m-shadow-md)]",
9516
11132
  className
@@ -9523,10 +11139,12 @@ function DeliveryBadge({
9523
11139
  variant: "ghost",
9524
11140
  size: "icon",
9525
11141
  className: cn(
9526
- "absolute top-2 right-2",
11142
+ "absolute top-1.5 right-1.5",
9527
11143
  // 44px touch target for accessibility
9528
11144
  "h-11 w-11",
9529
11145
  "rounded-full",
11146
+ // Subtle background for visibility on colored fills
11147
+ "bg-background/50 hover:bg-background/80",
9530
11148
  hasComments && "text-primary"
9531
11149
  ),
9532
11150
  onClick: handleCommentClick,
@@ -9549,13 +11167,11 @@ function DeliveryBadge({
9549
11167
  type: "button",
9550
11168
  onClick: handleClick,
9551
11169
  onKeyDown: handleKeyDown,
9552
- onMouseEnter: () => setIsHovered(true),
9553
- onMouseLeave: () => setIsHovered(false),
9554
11170
  className: cn(
9555
11171
  // Full width, no background (inherits from parent)
9556
11172
  "w-full bg-transparent text-left",
9557
11173
  // Layout - vertical stack
9558
- "flex flex-col gap-2",
11174
+ "flex flex-col justify-between h-full min-h-[40px]",
9559
11175
  // Interactive states
9560
11176
  "cursor-pointer",
9561
11177
  "active:translate-y-0 active:shadow-sm",
@@ -9563,33 +11179,20 @@ function DeliveryBadge({
9563
11179
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1"
9564
11180
  ),
9565
11181
  children: [
9566
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 overflow-hidden pr-12", children: [
9567
- /* @__PURE__ */ jsx("span", { className: cn("text-sm font-semibold truncate", styles.content), children: prefixTitle }),
9568
- delivery.hasProductionRisk && /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4 text-red-500 shrink-0" }),
9569
- delivery.supplierName && /* @__PURE__ */ jsx("span", { className: cn(
9570
- "text-xs truncate ml-auto",
9571
- visualState === "sent" ? "text-muted-foreground/40" : "text-muted-foreground"
9572
- ), children: delivery.supplierName })
11182
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 pr-12", children: [
11183
+ /* @__PURE__ */ jsx("span", { className: cn(
11184
+ "text-sm font-semibold leading-tight line-clamp-2",
11185
+ styles.titleColor
11186
+ ), children: projectName }),
11187
+ delivery.hasProductionRisk && /* @__PURE__ */ jsx(AlertTriangle, { className: cn("h-4 w-4 shrink-0 mt-0.5", styles.iconColor) })
9573
11188
  ] }),
9574
- /* @__PURE__ */ jsx("div", { className: "pr-14", children: /* @__PURE__ */ jsx("div", { className: "h-2 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
9575
- "div",
9576
- {
9577
- className: cn("h-full rounded-full transition-all", styles.progressBg),
9578
- style: { width: `${productionProgress}%` }
9579
- }
9580
- ) }) }),
9581
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
9582
- productionDisplay && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
9583
- /* @__PURE__ */ jsx(Factory, { className: cn("h-3 w-3 shrink-0", styles.iconColor) }),
9584
- /* @__PURE__ */ jsx("span", { className: cn(
9585
- "text-[11px] tabular-nums font-medium",
9586
- amountColorClass
9587
- ), children: productionDisplay })
11189
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mt-2", children: [
11190
+ visualState === "sent" && /* @__PURE__ */ jsxs(Fragment, { children: [
11191
+ /* @__PURE__ */ jsx(Check, { className: cn("h-3.5 w-3.5 shrink-0", styles.iconColor) }),
11192
+ /* @__PURE__ */ jsx("span", { className: cn("text-[10px] font-medium uppercase tracking-wide", styles.subtitleColor), children: "Shipped" })
9588
11193
  ] }),
9589
- visualState === "sent" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 ml-auto", children: [
9590
- /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 text-green-600/60 dark:text-green-400/60 shrink-0" }),
9591
- /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-muted-foreground/50 uppercase tracking-wide", children: "Sent" })
9592
- ] })
11194
+ visualState === "ready" && /* @__PURE__ */ jsx("span", { className: cn("text-[10px] font-semibold uppercase tracking-wide", styles.subtitleColor), children: "Ready" }),
11195
+ delivery.hasProductionRisk && visualState !== "sent" && /* @__PURE__ */ jsx("span", { className: cn("text-[10px] font-semibold uppercase tracking-wide", styles.subtitleColor), children: "At Risk" })
9593
11196
  ] })
9594
11197
  ]
9595
11198
  }
@@ -9598,6 +11201,62 @@ function DeliveryBadge({
9598
11201
  }
9599
11202
  );
9600
11203
  }
11204
+ function isShippedDelivery(delivery) {
11205
+ return delivery.status === "shipped" || delivery.status === "delivered";
11206
+ }
11207
+ function ShippedDeliveriesToggle({
11208
+ shippedDeliveries,
11209
+ isOpen,
11210
+ onToggle,
11211
+ onDeliveryClick,
11212
+ onDeliveryCommentClick
11213
+ }) {
11214
+ if (shippedDeliveries.length === 0) return null;
11215
+ return /* @__PURE__ */ jsxs(Collapsible, { open: isOpen, onOpenChange: onToggle, children: [
11216
+ /* @__PURE__ */ jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs(
11217
+ "button",
11218
+ {
11219
+ type: "button",
11220
+ className: cn(
11221
+ "w-full flex items-center justify-between gap-2",
11222
+ "min-h-[44px] px-3 py-2",
11223
+ "rounded-md",
11224
+ "text-xs text-muted-foreground",
11225
+ "hover:bg-muted/50 transition-colors",
11226
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"
11227
+ ),
11228
+ children: [
11229
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11230
+ /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 text-green-600 dark:text-green-400" }),
11231
+ /* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
11232
+ "Shipped (",
11233
+ shippedDeliveries.length,
11234
+ ")"
11235
+ ] })
11236
+ ] }),
11237
+ /* @__PURE__ */ jsx(
11238
+ ChevronDown,
11239
+ {
11240
+ className: cn(
11241
+ "h-4 w-4 transition-transform duration-200",
11242
+ isOpen && "rotate-180"
11243
+ )
11244
+ }
11245
+ )
11246
+ ]
11247
+ }
11248
+ ) }),
11249
+ /* @__PURE__ */ jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 pt-2", children: shippedDeliveries.map((delivery) => /* @__PURE__ */ jsx(
11250
+ DeliveryBadge,
11251
+ {
11252
+ delivery,
11253
+ onClick: () => onDeliveryClick?.(delivery),
11254
+ onCommentClick: () => onDeliveryCommentClick?.(delivery)
11255
+ },
11256
+ delivery.id
11257
+ )) }) })
11258
+ ] });
11259
+ }
9601
11260
  function WeeklyLoadingView({
9602
11261
  week,
9603
11262
  deliveries,
@@ -9607,6 +11266,24 @@ function WeeklyLoadingView({
9607
11266
  showNavigation = true,
9608
11267
  className
9609
11268
  }) {
11269
+ const [shippedOpenState, setShippedOpenState] = React27.useState({
11270
+ 1: false,
11271
+ // Monday
11272
+ 2: false,
11273
+ // Tuesday
11274
+ 3: false,
11275
+ // Wednesday
11276
+ 4: false,
11277
+ // Thursday
11278
+ 5: false
11279
+ // Friday
11280
+ });
11281
+ const toggleShippedForDay = (dayOfWeek) => {
11282
+ setShippedOpenState((prev) => ({
11283
+ ...prev,
11284
+ [dayOfWeek]: !prev[dayOfWeek]
11285
+ }));
11286
+ };
9610
11287
  const weekDays = React27.useMemo(() => {
9611
11288
  const days = [];
9612
11289
  for (let i = 0; i < 5; i++) {
@@ -9622,19 +11299,36 @@ function WeeklyLoadingView({
9622
11299
  const deliveriesByDay = React27.useMemo(() => {
9623
11300
  const grouped = /* @__PURE__ */ new Map();
9624
11301
  for (let i = 1; i <= 5; i++) {
9625
- grouped.set(i, []);
11302
+ grouped.set(i, { pending: [], shipped: [] });
9626
11303
  }
9627
11304
  for (const delivery of deliveries) {
9628
11305
  const dayOfWeek = delivery.date.getDay();
9629
11306
  if (dayOfWeek >= 1 && dayOfWeek <= 5) {
9630
- const dayDeliveries = grouped.get(dayOfWeek) ?? [];
9631
- dayDeliveries.push(delivery);
9632
- grouped.set(dayOfWeek, dayDeliveries);
11307
+ const dayData = grouped.get(dayOfWeek);
11308
+ if (isShippedDelivery(delivery)) {
11309
+ dayData.shipped.push(delivery);
11310
+ } else {
11311
+ dayData.pending.push(delivery);
11312
+ }
9633
11313
  }
9634
11314
  }
9635
11315
  return grouped;
9636
11316
  }, [deliveries]);
9637
- const totalDeliveries = deliveries.length;
11317
+ const totalPendingDeliveries = deliveries.filter((d) => !isShippedDelivery(d)).length;
11318
+ const totalShippedDeliveries = deliveries.filter((d) => isShippedDelivery(d)).length;
11319
+ const daySummaryData = React27.useMemo(() => {
11320
+ const summaries = /* @__PURE__ */ new Map();
11321
+ for (let i = 1; i <= 5; i++) {
11322
+ const dayData = deliveriesByDay.get(i) ?? { pending: [], shipped: [] };
11323
+ const allDayDeliveries = [...dayData.pending, ...dayData.shipped];
11324
+ summaries.set(i, {
11325
+ deliveries: allDayDeliveries.length,
11326
+ tonsRequired: allDayDeliveries.reduce((sum, d) => sum + (d.totalTons ?? 0), 0),
11327
+ tonsProduced: allDayDeliveries.reduce((sum, d) => sum + (d.producedTons ?? 0), 0)
11328
+ });
11329
+ }
11330
+ return summaries;
11331
+ }, [deliveriesByDay]);
9638
11332
  return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col", className), children: [
9639
11333
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 border-b border-border p-4 lg:flex-row lg:items-center lg:justify-between", children: [
9640
11334
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
@@ -9651,9 +11345,9 @@ function WeeklyLoadingView({
9651
11345
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
9652
11346
  /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: week.dateRange }),
9653
11347
  /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
9654
- totalDeliveries,
9655
- " ",
9656
- totalDeliveries === 1 ? "delivery" : "deliveries"
11348
+ totalPendingDeliveries,
11349
+ " pending",
11350
+ totalShippedDeliveries > 0 && `, ${totalShippedDeliveries} shipped`
9657
11351
  ] })
9658
11352
  ] })
9659
11353
  ] }),
@@ -9719,9 +11413,48 @@ function WeeklyLoadingView({
9719
11413
  },
9720
11414
  dayOfWeek
9721
11415
  )) }),
11416
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-5 border-b border-border", children: weekDays.map(({ dayOfWeek, isToday: dayIsToday }) => {
11417
+ const summary = daySummaryData.get(dayOfWeek) ?? { deliveries: 0, tonsRequired: 0, tonsProduced: 0 };
11418
+ const productionComplete = summary.tonsRequired > 0 && summary.tonsProduced >= summary.tonsRequired;
11419
+ return /* @__PURE__ */ jsxs(
11420
+ "div",
11421
+ {
11422
+ className: cn(
11423
+ "flex flex-col gap-0.5 py-1.5 px-2",
11424
+ productionComplete ? "bg-green-50/50 dark:bg-green-950/30" : "bg-muted/20",
11425
+ dayIsToday && "bg-primary/5"
11426
+ ),
11427
+ children: [
11428
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
11429
+ /* @__PURE__ */ jsx(Truck, { className: "h-3 w-3 text-muted-foreground" }),
11430
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium tabular-nums text-muted-foreground", children: summary.deliveries })
11431
+ ] }),
11432
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
11433
+ /* @__PURE__ */ jsx(Factory, { className: cn(
11434
+ "h-3 w-3",
11435
+ productionComplete ? "text-green-600 dark:text-green-400" : "text-muted-foreground"
11436
+ ) }),
11437
+ /* @__PURE__ */ jsxs("span", { className: cn(
11438
+ "text-[10px] tabular-nums",
11439
+ productionComplete ? "text-green-700 dark:text-green-300" : "text-muted-foreground"
11440
+ ), children: [
11441
+ summary.tonsProduced.toLocaleString(void 0, { maximumFractionDigits: 1 }),
11442
+ "/",
11443
+ summary.tonsRequired.toLocaleString(void 0, { maximumFractionDigits: 1 }),
11444
+ " t"
11445
+ ] })
11446
+ ] })
11447
+ ]
11448
+ },
11449
+ dayOfWeek
11450
+ );
11451
+ }) }),
9722
11452
  /* @__PURE__ */ jsx("div", { className: "grid grid-cols-5", children: weekDays.map(({ dayOfWeek, isToday: dayIsToday }) => {
9723
- const dayDeliveries = deliveriesByDay.get(dayOfWeek) ?? [];
9724
- return /* @__PURE__ */ jsx(
11453
+ const dayData = deliveriesByDay.get(dayOfWeek) ?? { pending: [], shipped: [] };
11454
+ const hasPending = dayData.pending.length > 0;
11455
+ const hasShipped = dayData.shipped.length > 0;
11456
+ const isEmpty = !hasPending && !hasShipped;
11457
+ return /* @__PURE__ */ jsxs(
9725
11458
  "div",
9726
11459
  {
9727
11460
  className: cn(
@@ -9729,22 +11462,39 @@ function WeeklyLoadingView({
9729
11462
  "flex flex-col p-3",
9730
11463
  dayIsToday && "bg-primary/5"
9731
11464
  ),
9732
- children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: dayDeliveries.length > 0 ? dayDeliveries.map((delivery) => /* @__PURE__ */ jsx(
9733
- DeliveryBadge,
9734
- {
9735
- delivery,
9736
- onClick: () => onDeliveryClick?.(delivery),
9737
- onCommentClick: () => onDeliveryCommentClick?.(delivery)
9738
- },
9739
- delivery.id
9740
- )) : /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-6 text-sm text-muted-foreground/40", children: "\u2014" }) })
11465
+ children: [
11466
+ hasPending && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: dayData.pending.map((delivery) => /* @__PURE__ */ jsx(
11467
+ DeliveryBadge,
11468
+ {
11469
+ delivery,
11470
+ onClick: () => onDeliveryClick?.(delivery),
11471
+ onCommentClick: () => onDeliveryCommentClick?.(delivery)
11472
+ },
11473
+ delivery.id
11474
+ )) }),
11475
+ hasShipped && /* @__PURE__ */ jsx("div", { className: cn(hasPending && "mt-3"), children: /* @__PURE__ */ jsx(
11476
+ ShippedDeliveriesToggle,
11477
+ {
11478
+ shippedDeliveries: dayData.shipped,
11479
+ isOpen: shippedOpenState[dayOfWeek] ?? false,
11480
+ onToggle: () => toggleShippedForDay(dayOfWeek),
11481
+ onDeliveryClick,
11482
+ onDeliveryCommentClick
11483
+ }
11484
+ ) }),
11485
+ isEmpty && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-6 text-sm text-muted-foreground/40", children: "\u2014" })
11486
+ ]
9741
11487
  },
9742
11488
  dayOfWeek
9743
11489
  );
9744
11490
  }) })
9745
11491
  ] }),
9746
11492
  /* @__PURE__ */ jsx("div", { className: "sm:hidden divide-y divide-border", children: weekDays.map(({ date, dayOfWeek, isToday: dayIsToday }) => {
9747
- const dayDeliveries = deliveriesByDay.get(dayOfWeek) ?? [];
11493
+ const dayData = deliveriesByDay.get(dayOfWeek) ?? { pending: [], shipped: [] };
11494
+ const hasPending = dayData.pending.length > 0;
11495
+ const hasShipped = dayData.shipped.length > 0;
11496
+ const isEmpty = !hasPending && !hasShipped;
11497
+ dayData.pending.length + dayData.shipped.length;
9748
11498
  return /* @__PURE__ */ jsxs(
9749
11499
  "div",
9750
11500
  {
@@ -9767,20 +11517,33 @@ function WeeklyLoadingView({
9767
11517
  dayIsToday && /* @__PURE__ */ jsx("span", { className: "text-xs text-primary font-medium bg-primary/10 px-2 py-0.5 rounded", children: "Today" })
9768
11518
  ] }),
9769
11519
  /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
9770
- dayDeliveries.length,
9771
- " ",
9772
- dayDeliveries.length === 1 ? "delivery" : "deliveries"
11520
+ dayData.pending.length,
11521
+ " pending",
11522
+ hasShipped && `, ${dayData.shipped.length} shipped`
9773
11523
  ] })
9774
11524
  ] }),
9775
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 p-3 pt-0", children: dayDeliveries.length > 0 ? dayDeliveries.map((delivery) => /* @__PURE__ */ jsx(
9776
- DeliveryBadge,
9777
- {
9778
- delivery,
9779
- onClick: () => onDeliveryClick?.(delivery),
9780
- onCommentClick: () => onDeliveryCommentClick?.(delivery)
9781
- },
9782
- delivery.id
9783
- )) : /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground/40 py-4 text-center", children: "\u2014" }) })
11525
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 p-3 pt-0", children: [
11526
+ hasPending && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: dayData.pending.map((delivery) => /* @__PURE__ */ jsx(
11527
+ DeliveryBadge,
11528
+ {
11529
+ delivery,
11530
+ onClick: () => onDeliveryClick?.(delivery),
11531
+ onCommentClick: () => onDeliveryCommentClick?.(delivery)
11532
+ },
11533
+ delivery.id
11534
+ )) }),
11535
+ hasShipped && /* @__PURE__ */ jsx(
11536
+ ShippedDeliveriesToggle,
11537
+ {
11538
+ shippedDeliveries: dayData.shipped,
11539
+ isOpen: shippedOpenState[dayOfWeek] ?? false,
11540
+ onToggle: () => toggleShippedForDay(dayOfWeek),
11541
+ onDeliveryClick,
11542
+ onDeliveryCommentClick
11543
+ }
11544
+ ),
11545
+ isEmpty && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground/40 py-4 text-center", children: "\u2014" })
11546
+ ] })
9784
11547
  ]
9785
11548
  },
9786
11549
  dayOfWeek
@@ -9789,36 +11552,63 @@ function WeeklyLoadingView({
9789
11552
  ] })
9790
11553
  ] });
9791
11554
  }
9792
- function getStatusBadgeVariant2(status) {
9793
- switch (status) {
9794
- case "shipped":
9795
- case "delivered":
9796
- return "default";
9797
- case "loaded":
9798
- case "in_progress":
9799
- return "secondary";
9800
- case "cancelled":
9801
- return "destructive";
9802
- case "planned":
9803
- default:
9804
- return "outline";
11555
+ function getTimelineState(delivery) {
11556
+ const isShipped = delivery.status === "shipped" || delivery.status === "delivered";
11557
+ const isReady = delivery.isReadyToUnload ?? false;
11558
+ const hasProductionData = delivery.producedCount !== void 0 || delivery.producedTons !== void 0;
11559
+ if (isShipped) {
11560
+ return {
11561
+ currentStep: "delivery",
11562
+ documentState: "completed",
11563
+ productionState: "completed",
11564
+ deliveryState: "completed",
11565
+ isReady: true,
11566
+ currentStepLabel: "Delivery",
11567
+ reason: "Delivery completed"
11568
+ };
9805
11569
  }
9806
- }
9807
- function getStatusBadgeClasses2(status) {
9808
- switch (status) {
9809
- case "shipped":
9810
- case "delivered":
9811
- return "border-green-500 text-green-600 bg-green-50 dark:bg-green-950/50";
9812
- case "loaded":
9813
- return "border-blue-500 text-blue-600 bg-blue-50 dark:bg-blue-950/50";
9814
- case "in_progress":
9815
- return "border-amber-500 text-amber-600 bg-amber-50 dark:bg-amber-950/50";
9816
- case "cancelled":
9817
- return "";
9818
- case "planned":
9819
- default:
9820
- return "border-muted-foreground/50 text-muted-foreground";
11570
+ if (isReady) {
11571
+ return {
11572
+ currentStep: "delivery",
11573
+ documentState: "completed",
11574
+ productionState: "completed",
11575
+ deliveryState: "current",
11576
+ isReady: true,
11577
+ currentStepLabel: "Delivery",
11578
+ reason: "All prerequisites complete"
11579
+ };
11580
+ }
11581
+ if (hasProductionData) {
11582
+ return {
11583
+ currentStep: "production",
11584
+ documentState: "completed",
11585
+ productionState: "current",
11586
+ deliveryState: "upcoming",
11587
+ isReady: false,
11588
+ currentStepLabel: "Production",
11589
+ reason: delivery.hasProductionRisk ? delivery.riskReason || "Production delay risk" : "Not all items have been produced"
11590
+ };
11591
+ }
11592
+ if (delivery.status === "planned") {
11593
+ return {
11594
+ currentStep: "document",
11595
+ documentState: "current",
11596
+ productionState: "upcoming",
11597
+ deliveryState: "upcoming",
11598
+ isReady: false,
11599
+ currentStepLabel: "Document",
11600
+ reason: "Waiting for document approval"
11601
+ };
9821
11602
  }
11603
+ return {
11604
+ currentStep: "production",
11605
+ documentState: "completed",
11606
+ productionState: "current",
11607
+ deliveryState: "upcoming",
11608
+ isReady: false,
11609
+ currentStepLabel: "Production",
11610
+ reason: "Production status pending"
11611
+ };
9822
11612
  }
9823
11613
  function getElementStatusBadgeClasses(status) {
9824
11614
  switch (status) {
@@ -9834,6 +11624,166 @@ function getElementStatusBadgeClasses(status) {
9834
11624
  return "border-muted-foreground/50 text-muted-foreground";
9835
11625
  }
9836
11626
  }
11627
+ var TIMELINE_STEPS = [
11628
+ { id: "document", label: "Document", icon: /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" }) },
11629
+ { id: "production", label: "Production", icon: /* @__PURE__ */ jsx(Factory, { className: "h-4 w-4" }) },
11630
+ { id: "delivery", label: "Delivery", icon: /* @__PURE__ */ jsx(Truck, { className: "h-4 w-4" }) }
11631
+ ];
11632
+ function getStepStyles(state) {
11633
+ switch (state) {
11634
+ case "completed":
11635
+ return {
11636
+ dot: "bg-green-500/20 border-green-500",
11637
+ icon: "text-green-600 dark:text-green-400",
11638
+ label: "text-muted-foreground",
11639
+ line: "bg-green-500"
11640
+ };
11641
+ case "current":
11642
+ return {
11643
+ dot: "bg-primary/20 border-primary",
11644
+ icon: "text-primary",
11645
+ label: "text-foreground font-semibold",
11646
+ line: "bg-border"
11647
+ };
11648
+ case "upcoming":
11649
+ default:
11650
+ return {
11651
+ dot: "bg-muted border-border",
11652
+ icon: "text-muted-foreground/50",
11653
+ label: "text-muted-foreground/50",
11654
+ line: "bg-border"
11655
+ };
11656
+ }
11657
+ }
11658
+ function DeliveryTimeline({ timelineState }) {
11659
+ const getStateForStep = (stepId) => {
11660
+ switch (stepId) {
11661
+ case "document":
11662
+ return timelineState.documentState;
11663
+ case "production":
11664
+ return timelineState.productionState;
11665
+ case "delivery":
11666
+ return timelineState.deliveryState;
11667
+ }
11668
+ };
11669
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between w-full", children: TIMELINE_STEPS.map((step, index) => {
11670
+ const state = getStateForStep(step.id);
11671
+ const styles = getStepStyles(state);
11672
+ const isLast = index === TIMELINE_STEPS.length - 1;
11673
+ return /* @__PURE__ */ jsxs(React27.Fragment, { children: [
11674
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
11675
+ /* @__PURE__ */ jsx(
11676
+ "div",
11677
+ {
11678
+ className: cn(
11679
+ "flex items-center justify-center",
11680
+ "h-10 w-10 rounded-full border-2",
11681
+ "transition-colors duration-200",
11682
+ styles.dot
11683
+ ),
11684
+ children: state === "completed" ? /* @__PURE__ */ jsx(Check, { className: cn("h-4 w-4", styles.icon) }) : /* @__PURE__ */ jsx("span", { className: styles.icon, children: step.icon })
11685
+ }
11686
+ ),
11687
+ /* @__PURE__ */ jsx("span", { className: cn("text-xs", styles.label), children: step.label })
11688
+ ] }),
11689
+ !isLast && /* @__PURE__ */ jsx("div", { className: "flex-1 mx-2 mb-6", children: /* @__PURE__ */ jsx(
11690
+ "div",
11691
+ {
11692
+ className: cn(
11693
+ "h-0.5 w-full rounded-full",
11694
+ styles.line
11695
+ )
11696
+ }
11697
+ ) })
11698
+ ] }, step.id);
11699
+ }) });
11700
+ }
11701
+ function PackingStatusBadge({
11702
+ timelineState,
11703
+ hasRisk
11704
+ }) {
11705
+ const getPackingStatus = () => {
11706
+ if (timelineState.isReady) {
11707
+ return {
11708
+ label: "Ready",
11709
+ className: "bg-green-100 dark:bg-green-900/50 text-green-700 dark:text-green-300 border-green-200 dark:border-green-800"
11710
+ };
11711
+ }
11712
+ if (hasRisk) {
11713
+ return {
11714
+ label: "At risk",
11715
+ className: "bg-red-100 dark:bg-red-900/50 text-red-700 dark:text-red-300 border-red-200 dark:border-red-800"
11716
+ };
11717
+ }
11718
+ switch (timelineState.currentStep) {
11719
+ case "document":
11720
+ return {
11721
+ label: "Pending approval",
11722
+ className: "bg-muted text-muted-foreground border-border"
11723
+ };
11724
+ case "production":
11725
+ return {
11726
+ label: "In production",
11727
+ className: "bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-300 border-amber-200 dark:border-amber-800"
11728
+ };
11729
+ default:
11730
+ return {
11731
+ label: "Not ready",
11732
+ className: "bg-muted text-muted-foreground border-border"
11733
+ };
11734
+ }
11735
+ };
11736
+ const status = getPackingStatus();
11737
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11738
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Packing status:" }),
11739
+ /* @__PURE__ */ jsx("span", { className: cn(
11740
+ "inline-flex items-center px-2 py-0.5 rounded text-xs font-medium border",
11741
+ status.className
11742
+ ), children: status.label })
11743
+ ] });
11744
+ }
11745
+ function ReadinessMessage({
11746
+ timelineState,
11747
+ hasRisk
11748
+ }) {
11749
+ if (timelineState.isReady && timelineState.deliveryState === "completed") {
11750
+ return /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-green-50/50 dark:bg-green-950/20 border border-green-200 dark:border-green-800/50 p-3", children: [
11751
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11752
+ /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-green-600 dark:text-green-400 shrink-0" }),
11753
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-green-700 dark:text-green-300", children: "Shipped" })
11754
+ ] }),
11755
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-green-600/80 dark:text-green-400/80 mt-1 ml-6", children: "Delivery has been completed." })
11756
+ ] });
11757
+ }
11758
+ if (timelineState.isReady) {
11759
+ return /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-green-50/50 dark:bg-green-950/20 border border-green-200 dark:border-green-800/50 p-3", children: [
11760
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11761
+ /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-green-600 dark:text-green-400 shrink-0" }),
11762
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-green-700 dark:text-green-300", children: "Ready" })
11763
+ ] }),
11764
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-green-600/80 dark:text-green-400/80 mt-1 ml-6", children: "All prerequisites are complete." })
11765
+ ] });
11766
+ }
11767
+ return /* @__PURE__ */ jsx("div", { className: cn(
11768
+ "rounded-lg p-3 border",
11769
+ hasRisk ? "bg-red-50/50 dark:bg-red-950/20 border-red-200 dark:border-red-800/50" : "bg-muted/50 border-border"
11770
+ ), children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
11771
+ hasRisk ? /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4 text-red-500 shrink-0 mt-0.5" }) : /* @__PURE__ */ jsx("div", { className: "h-4 w-4 rounded-full bg-primary/20 border border-primary shrink-0 mt-0.5" }),
11772
+ /* @__PURE__ */ jsxs("div", { children: [
11773
+ /* @__PURE__ */ jsxs("span", { className: cn(
11774
+ "text-sm font-medium",
11775
+ hasRisk ? "text-red-700 dark:text-red-300" : "text-foreground"
11776
+ ), children: [
11777
+ "Currently in: ",
11778
+ timelineState.currentStepLabel
11779
+ ] }),
11780
+ /* @__PURE__ */ jsx("p", { className: cn(
11781
+ "text-xs mt-0.5",
11782
+ hasRisk ? "text-red-600/80 dark:text-red-400/80" : "text-muted-foreground"
11783
+ ), children: timelineState.reason })
11784
+ ] })
11785
+ ] }) });
11786
+ }
9837
11787
  function getElementRowBg(status) {
9838
11788
  switch (status) {
9839
11789
  case "loaded":
@@ -10007,31 +11957,6 @@ function CommentsSection({
10007
11957
  )
10008
11958
  ] });
10009
11959
  }
10010
- function getDeliveryHeaderStyles(state, hasRisk) {
10011
- if (hasRisk) {
10012
- return {
10013
- iconBg: "bg-red-100 dark:bg-red-950/50",
10014
- iconColor: "text-red-600 dark:text-red-400"
10015
- };
10016
- }
10017
- switch (state) {
10018
- case "sent":
10019
- return {
10020
- iconBg: "bg-green-100 dark:bg-green-950/50",
10021
- iconColor: "text-green-600 dark:text-green-400"
10022
- };
10023
- case "ready":
10024
- return {
10025
- iconBg: "bg-green-100 dark:bg-green-950/50",
10026
- iconColor: "text-green-600 dark:text-green-400"
10027
- };
10028
- default:
10029
- return {
10030
- iconBg: "bg-muted",
10031
- iconColor: "text-muted-foreground"
10032
- };
10033
- }
10034
- }
10035
11960
  function DeliveryDetailPage({
10036
11961
  delivery,
10037
11962
  week,
@@ -10042,13 +11967,7 @@ function DeliveryDetailPage({
10042
11967
  onAddComment,
10043
11968
  onConfirmLoad
10044
11969
  }) {
10045
- const visualState = getDeliveryVisualState(delivery);
10046
- const headerStyles = getDeliveryHeaderStyles(visualState, delivery.hasProductionRisk ?? false);
10047
- const loadedCount = delivery.loadedCount ?? delivery.elements.filter((e) => e.status === "loaded").length;
10048
- const totalCount = delivery.totalCount ?? delivery.elements.length;
10049
- const loadedPercent = totalCount > 0 ? Math.round(loadedCount / totalCount * 100) : 0;
10050
- const producedCount = delivery.producedCount ?? loadedCount;
10051
- const producedPercent = totalCount > 0 ? Math.round(producedCount / totalCount * 100) : 0;
11970
+ const timelineState = getTimelineState(delivery);
10052
11971
  const elementsByStatus = React27.useMemo(() => {
10053
11972
  const loaded = delivery.elements.filter((e) => e.status === "loaded");
10054
11973
  const missing = delivery.elements.filter((e) => e.status === "missing");
@@ -10057,6 +11976,7 @@ function DeliveryDetailPage({
10057
11976
  return { loaded, missing, moved, addons };
10058
11977
  }, [delivery.elements]);
10059
11978
  const preLoadingComments = delivery.comments.filter((c) => c.context === "pre_unloading");
11979
+ const projectName = delivery.destination || delivery.label;
10060
11980
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
10061
11981
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 px-4 py-3 border-b bg-background sticky top-0 z-10", children: /* @__PURE__ */ jsxs(
10062
11982
  Button,
@@ -10072,129 +11992,39 @@ function DeliveryDetailPage({
10072
11992
  }
10073
11993
  ) }),
10074
11994
  /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsxs("div", { className: "px-4 pb-6 space-y-6", children: [
10075
- /* @__PURE__ */ jsxs("section", { className: "pt-4 space-y-4", children: [
11995
+ /* @__PURE__ */ jsxs("section", { className: "pt-4 space-y-3", children: [
10076
11996
  /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
10077
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
10078
- /* @__PURE__ */ jsx("div", { className: cn(
10079
- "flex items-center justify-center h-12 w-12 rounded-xl shrink-0",
10080
- headerStyles.iconBg
10081
- ), children: /* @__PURE__ */ jsx(Truck, { className: cn("h-6 w-6", headerStyles.iconColor) }) }),
10082
- /* @__PURE__ */ jsxs("div", { children: [
10083
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
10084
- /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold", children: delivery.label }),
10085
- visualState === "sent" && /* @__PURE__ */ jsx(Check, { className: "h-5 w-5 text-green-600 dark:text-green-400" }),
10086
- delivery.hasProductionRisk && /* @__PURE__ */ jsx(AlertTriangle, { className: "h-5 w-5 text-red-500" })
10087
- ] }),
10088
- /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
10089
- delivery.supplierName,
10090
- delivery.prefixScope && ` \u2022 ${delivery.prefixScope}`
10091
- ] })
10092
- ] })
10093
- ] }),
10094
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end gap-1.5", children: [
10095
- /* @__PURE__ */ jsx(
10096
- Badge,
10097
- {
10098
- variant: getStatusBadgeVariant2(delivery.status),
10099
- className: cn("shrink-0", getStatusBadgeClasses2(delivery.status)),
10100
- children: getLoadingDeliveryStatusLabel(delivery.status)
10101
- }
10102
- ),
10103
- delivery.isReadyToUnload && /* @__PURE__ */ jsx(
10104
- Badge,
10105
- {
10106
- variant: "outline",
10107
- className: "bg-green-100 dark:bg-green-900/50 border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",
10108
- children: "Ready to load"
10109
- }
10110
- )
10111
- ] })
11997
+ /* @__PURE__ */ jsx("h1", { className: "text-xl font-bold leading-tight line-clamp-2", children: projectName }),
11998
+ delivery.hasProductionRisk && /* @__PURE__ */ jsx(AlertTriangle, { className: "h-5 w-5 text-red-500 shrink-0 mt-0.5" })
10112
11999
  ] }),
10113
- delivery.hasProductionRisk && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border-l-2 border-l-red-500 bg-red-50/50 dark:bg-red-950/30 p-3", children: [
10114
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
10115
- /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4 text-red-600 dark:text-red-400 shrink-0" }),
10116
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-red-700 dark:text-red-400", children: "Production delay risk" })
12000
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-muted-foreground", children: [
12001
+ delivery.location && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
12002
+ /* @__PURE__ */ jsx(MapPin, { className: "h-3.5 w-3.5 shrink-0" }),
12003
+ /* @__PURE__ */ jsx("span", { children: delivery.location })
10117
12004
  ] }),
10118
- delivery.riskReason && /* @__PURE__ */ jsx("p", { className: "text-sm text-red-600 dark:text-red-400 mt-1 ml-6", children: delivery.riskReason })
10119
- ] }),
10120
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-4 text-sm text-muted-foreground", children: [
10121
12005
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
10122
- /* @__PURE__ */ jsx(Calendar$1, { className: "h-4 w-4" }),
10123
- /* @__PURE__ */ jsx("span", { children: delivery.date.toLocaleDateString("en-US", {
10124
- weekday: "short",
10125
- month: "short",
10126
- day: "numeric"
10127
- }) })
10128
- ] }),
10129
- delivery.destination && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
10130
- /* @__PURE__ */ jsx(MapPin, { className: "h-4 w-4" }),
10131
- /* @__PURE__ */ jsx("span", { children: delivery.destination })
10132
- ] })
10133
- ] }),
10134
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-muted/50 p-4 space-y-3", children: [
10135
- (delivery.producedCount !== void 0 || delivery.producedTons !== void 0) && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
10136
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
10137
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Production" }),
10138
- /* @__PURE__ */ jsxs("span", { className: cn(
10139
- "text-sm font-semibold tabular-nums",
10140
- delivery.isReadyToUnload ? "text-green-600 dark:text-green-400" : delivery.hasProductionRisk ? "text-red-600 dark:text-red-400" : ""
10141
- ), children: [
10142
- delivery.producedTons !== void 0 && delivery.totalTons !== void 0 ? `${delivery.producedTons} / ${delivery.totalTons} tons` : `Produced ${producedCount} / ${totalCount}`,
10143
- delivery.isReadyToUnload && " \u2713"
10144
- ] })
10145
- ] }),
10146
- /* @__PURE__ */ jsx("div", { className: "h-2 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
10147
- "div",
10148
- {
10149
- className: cn(
10150
- "h-full rounded-full transition-all",
10151
- delivery.isReadyToUnload ? "bg-green-500" : delivery.hasProductionRisk ? "bg-red-500" : "bg-amber-500"
10152
- ),
10153
- style: { width: `${producedPercent}%` }
10154
- }
10155
- ) })
10156
- ] }),
10157
- /* @__PURE__ */ jsx(Separator, { className: "my-2" }),
10158
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
10159
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
10160
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Loading Progress" }),
10161
- /* @__PURE__ */ jsxs("span", { className: "text-sm font-semibold tabular-nums", children: [
10162
- "Loaded ",
10163
- loadedCount,
10164
- " / ",
10165
- totalCount
10166
- ] })
10167
- ] }),
10168
- /* @__PURE__ */ jsx("div", { className: "h-2 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
10169
- "div",
10170
- {
10171
- className: cn(
10172
- "h-full rounded-full transition-all",
10173
- loadedPercent === 100 ? "bg-green-500" : "bg-primary"
10174
- ),
10175
- style: { width: `${loadedPercent}%` }
10176
- }
10177
- ) }),
10178
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 flex-wrap text-xs", children: [
10179
- elementsByStatus.loaded.length > 0 && /* @__PURE__ */ jsxs("span", { className: "text-green-600 dark:text-green-400", children: [
10180
- elementsByStatus.loaded.length,
10181
- " Loaded"
10182
- ] }),
10183
- elementsByStatus.missing.length > 0 && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
10184
- elementsByStatus.missing.length,
10185
- " Missing"
10186
- ] }),
10187
- elementsByStatus.moved.length > 0 && /* @__PURE__ */ jsxs("span", { className: "text-blue-600 dark:text-blue-400", children: [
10188
- elementsByStatus.moved.length,
10189
- " Moved"
10190
- ] }),
10191
- elementsByStatus.addons.length > 0 && /* @__PURE__ */ jsxs("span", { className: "text-purple-600 dark:text-purple-400", children: [
10192
- elementsByStatus.addons.length,
10193
- " Add-on"
10194
- ] })
12006
+ /* @__PURE__ */ jsx(Calendar$1, { className: "h-3.5 w-3.5 shrink-0" }),
12007
+ /* @__PURE__ */ jsxs("span", { children: [
12008
+ "Expected on site: ",
12009
+ delivery.date.toLocaleDateString("en-US", {
12010
+ day: "numeric",
12011
+ month: "short",
12012
+ year: "numeric"
12013
+ })
10195
12014
  ] })
10196
12015
  ] })
10197
- ] })
12016
+ ] }),
12017
+ /* @__PURE__ */ jsx(PackingStatusBadge, { timelineState, hasRisk: delivery.hasProductionRisk ?? false })
12018
+ ] }),
12019
+ /* @__PURE__ */ jsxs("section", { className: "space-y-4", children: [
12020
+ /* @__PURE__ */ jsx("div", { className: "py-2", children: /* @__PURE__ */ jsx(DeliveryTimeline, { timelineState }) }),
12021
+ /* @__PURE__ */ jsx(
12022
+ ReadinessMessage,
12023
+ {
12024
+ timelineState,
12025
+ hasRisk: delivery.hasProductionRisk ?? false
12026
+ }
12027
+ )
10198
12028
  ] }),
10199
12029
  (elementsByStatus.loaded.length > 0 || elementsByStatus.missing.length > 0 || elementsByStatus.moved.length > 0) && /* @__PURE__ */ jsxs("section", { className: "space-y-3", children: [
10200
12030
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -10372,31 +12202,74 @@ function SupplierWeeklyLoading({
10372
12202
  handleCommentSubmit();
10373
12203
  }
10374
12204
  };
12205
+ const insightMetrics = React27.useMemo(() => {
12206
+ const totalDeliveries = deliveries.length;
12207
+ const readyDeliveries = deliveries.filter((d) => d.isReadyToUnload).length;
12208
+ deliveries.filter(
12209
+ (d) => d.status === "shipped" || d.status === "delivered"
12210
+ ).length;
12211
+ const totalTonsRequired = deliveries.reduce((sum, d) => sum + (d.totalTons ?? 0), 0);
12212
+ const producedTons = deliveries.reduce((sum, d) => sum + (d.producedTons ?? 0), 0);
12213
+ return [
12214
+ {
12215
+ key: "deliveries",
12216
+ label: "deliveries",
12217
+ value: totalDeliveries,
12218
+ icon: "truck",
12219
+ status: "normal"
12220
+ },
12221
+ {
12222
+ key: "ready",
12223
+ label: "ready",
12224
+ value: readyDeliveries,
12225
+ icon: "check",
12226
+ status: readyDeliveries > 0 ? "success" : "normal"
12227
+ },
12228
+ {
12229
+ key: "required",
12230
+ label: "tons required",
12231
+ value: totalTonsRequired,
12232
+ unit: "t",
12233
+ icon: "factory",
12234
+ status: "normal"
12235
+ },
12236
+ {
12237
+ key: "produced",
12238
+ label: "tons produced",
12239
+ value: producedTons,
12240
+ unit: "t",
12241
+ icon: "factory",
12242
+ status: producedTons >= totalTonsRequired ? "success" : producedTons >= totalTonsRequired * 0.5 ? "normal" : "warning"
12243
+ }
12244
+ ];
12245
+ }, [deliveries]);
10375
12246
  const Wrapper = bordered ? Card : "div";
10376
12247
  const Content14 = bordered ? CardContent : "div";
10377
12248
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10378
- /* @__PURE__ */ jsx(
10379
- Wrapper,
10380
- {
10381
- className: cn(
10382
- "flex flex-col overflow-hidden",
10383
- // Removed fixed min-height - content-driven sizing
10384
- !bordered && "border border-border bg-card rounded-lg",
10385
- className
10386
- ),
10387
- children: /* @__PURE__ */ jsx(Content14, { className: cn("flex-1 overflow-hidden p-0", !bordered && ""), children: /* @__PURE__ */ jsx(
10388
- WeeklyLoadingView,
10389
- {
10390
- week,
10391
- deliveries,
10392
- onDeliveryClick: handleDeliveryClick,
10393
- onDeliveryCommentClick: handleDeliveryCommentClick,
10394
- onWeekChange,
10395
- showNavigation
10396
- }
10397
- ) })
10398
- }
10399
- ),
12249
+ /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-0", className), children: [
12250
+ /* @__PURE__ */ jsx(InsightBar, { metrics: insightMetrics, className: "rounded-t-lg border border-b-0" }),
12251
+ /* @__PURE__ */ jsx(
12252
+ Wrapper,
12253
+ {
12254
+ className: cn(
12255
+ "flex flex-col overflow-hidden rounded-t-none",
12256
+ // Removed fixed min-height - content-driven sizing
12257
+ !bordered && "border border-border bg-card rounded-lg rounded-t-none"
12258
+ ),
12259
+ children: /* @__PURE__ */ jsx(Content14, { className: cn("flex-1 overflow-hidden p-0", !bordered && ""), children: /* @__PURE__ */ jsx(
12260
+ WeeklyLoadingView,
12261
+ {
12262
+ week,
12263
+ deliveries,
12264
+ onDeliveryClick: handleDeliveryClick,
12265
+ onDeliveryCommentClick: handleDeliveryCommentClick,
12266
+ onWeekChange,
12267
+ showNavigation
12268
+ }
12269
+ ) })
12270
+ }
12271
+ )
12272
+ ] }),
10400
12273
  /* @__PURE__ */ jsx(Sheet, { open: sheetOpen, onOpenChange: (open) => !open && handleSheetClose(), children: /* @__PURE__ */ jsxs(
10401
12274
  SheetContent,
10402
12275
  {
@@ -10473,59 +12346,40 @@ function SupplierWeeklyLoading({
10473
12346
  ] }) })
10474
12347
  ] });
10475
12348
  }
10476
- function getStatusBadgeVariant3(status) {
10477
- switch (status) {
10478
- case "shipped":
10479
- case "delivered":
10480
- return "default";
10481
- case "loaded":
10482
- case "in_progress":
10483
- return "secondary";
10484
- case "cancelled":
10485
- return "destructive";
10486
- case "planned":
10487
- default:
10488
- return "outline";
10489
- }
10490
- }
10491
- function getStatusBadgeClasses3(status) {
10492
- switch (status) {
10493
- case "shipped":
10494
- case "delivered":
10495
- return "border-green-500 text-green-600 bg-green-50 dark:bg-green-950/50";
10496
- case "loaded":
10497
- return "border-blue-500 text-blue-600 bg-blue-50 dark:bg-blue-950/50";
10498
- case "in_progress":
10499
- return "border-amber-500 text-amber-600 bg-amber-50 dark:bg-amber-950/50";
10500
- case "cancelled":
10501
- return "";
10502
- case "planned":
10503
- default:
10504
- return "border-muted-foreground/50 text-muted-foreground";
10505
- }
10506
- }
10507
- function getLeftStrokeStyles2(state, hasRisk, isHovered) {
12349
+ function getCardStyles2(state, hasRisk) {
10508
12350
  if (hasRisk) {
10509
12351
  return {
10510
- stroke: "border-l-2 border-l-red-500",
10511
- iconColor: "text-muted-foreground"
12352
+ fill: statusCellFillClasses.risk.combined,
12353
+ titleColor: statusCellTextClasses.risk.title,
12354
+ subtitleColor: statusCellTextClasses.risk.subtitle,
12355
+ iconColor: statusCellTextClasses.risk.icon,
12356
+ opacity: ""
10512
12357
  };
10513
12358
  }
10514
12359
  switch (state) {
10515
12360
  case "sent":
10516
12361
  return {
10517
- stroke: "border-l-2 border-l-green-500/50",
10518
- iconColor: "text-muted-foreground/40"
12362
+ fill: statusCellFillClasses.shipped.combined,
12363
+ titleColor: statusCellTextClasses.shipped.title,
12364
+ subtitleColor: statusCellTextClasses.shipped.subtitle,
12365
+ iconColor: statusCellTextClasses.shipped.icon,
12366
+ opacity: "opacity-75"
10519
12367
  };
10520
12368
  case "ready":
10521
12369
  return {
10522
- stroke: "border-l-2 border-l-green-500",
10523
- iconColor: "text-muted-foreground"
12370
+ fill: statusCellFillClasses.ready.combined,
12371
+ titleColor: statusCellTextClasses.ready.title,
12372
+ subtitleColor: statusCellTextClasses.ready.subtitle,
12373
+ iconColor: statusCellTextClasses.ready.icon,
12374
+ opacity: ""
10524
12375
  };
10525
12376
  default:
10526
12377
  return {
10527
- stroke: isHovered ? "border-l-2 border-l-border" : "border-l-2 border-l-transparent",
10528
- iconColor: "text-muted-foreground"
12378
+ fill: statusCellFillClasses.normal.combined,
12379
+ titleColor: statusCellTextClasses.normal.title,
12380
+ subtitleColor: statusCellTextClasses.normal.subtitle,
12381
+ iconColor: statusCellTextClasses.normal.icon,
12382
+ opacity: ""
10529
12383
  };
10530
12384
  }
10531
12385
  }
@@ -10534,22 +12388,10 @@ function DeliveryCard({
10534
12388
  onTap,
10535
12389
  className
10536
12390
  }) {
10537
- const [isHovered, setIsHovered] = React27.useState(false);
10538
12391
  const hasComments = delivery.comments.length > 0;
10539
12392
  const visualState = getDeliveryVisualState(delivery);
10540
- const styles = getLeftStrokeStyles2(visualState, delivery.hasProductionRisk ?? false, isHovered);
10541
- const productionDisplay = React27.useMemo(() => {
10542
- if (delivery.producedTons !== void 0 && delivery.totalTons !== void 0) {
10543
- return `${delivery.producedTons} / ${delivery.totalTons}t produced`;
10544
- }
10545
- if (delivery.producedCount !== void 0 && delivery.totalCount !== void 0) {
10546
- return `${delivery.producedCount} / ${delivery.totalCount} produced`;
10547
- }
10548
- if (delivery.loadedCount !== void 0 && delivery.totalCount !== void 0) {
10549
- return `Loaded ${delivery.loadedCount} / ${delivery.totalCount}`;
10550
- }
10551
- return null;
10552
- }, [delivery]);
12393
+ const styles = getCardStyles2(visualState, delivery.hasProductionRisk ?? false);
12394
+ const projectName = delivery.destination || delivery.label;
10553
12395
  const handleClick = () => {
10554
12396
  onTap?.();
10555
12397
  };
@@ -10566,76 +12408,47 @@ function DeliveryCard({
10566
12408
  tabIndex: 0,
10567
12409
  onClick: handleClick,
10568
12410
  onKeyDown: handleKeyDown,
10569
- onMouseEnter: () => setIsHovered(true),
10570
- onMouseLeave: () => setIsHovered(false),
10571
12411
  className: cn(
10572
- // Full-width, 90° corners (j3m.radius.none)
10573
- "w-full rounded-none",
12412
+ // Full-width, small radius (matching planning table cards)
12413
+ "w-full rounded-lg",
10574
12414
  // Touch-friendly sizing - 56px min-height for iPad
10575
12415
  "min-h-[56px] p-4",
10576
- // Card styling: white background, standard border
10577
- "bg-background border border-border",
10578
- // Left stroke for status (j3m.stroke.m = 2px)
10579
- styles.stroke,
10580
- // Hover/tap state - lift effect like Calibration
12416
+ // FULL-CARD STATUS FILL - uses shared calibration/planning tokens
12417
+ // This is the key change: status fill on outermost container
12418
+ styles.fill,
12419
+ // Opacity for shipped state
12420
+ styles.opacity,
12421
+ // Hover/tap state - lift effect (disabled for shipped)
10581
12422
  "cursor-pointer transition-all duration-200 ease-out",
10582
- "hover:-translate-y-0.5 hover:shadow-[var(--j3m-shadow-md)]",
12423
+ visualState !== "sent" && "hover:-translate-y-0.5 hover:shadow-[var(--j3m-shadow-md)]",
10583
12424
  "active:translate-y-0 active:shadow-sm",
10584
12425
  // Focus state
10585
12426
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",
10586
- // Greyed out for sent state
10587
- visualState === "sent" && "opacity-60",
10588
12427
  className
10589
12428
  ),
10590
- children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
10591
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 min-w-0 flex-1", children: [
10592
- /* @__PURE__ */ jsx("div", { className: cn(
10593
- "flex items-center justify-center h-10 w-10 rounded-md shrink-0 bg-muted/50"
10594
- ), children: /* @__PURE__ */ jsx(Truck, { className: cn("h-5 w-5", styles.iconColor) }) }),
10595
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 min-w-0", children: [
10596
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
10597
- /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold truncate", children: delivery.label }),
10598
- visualState === "sent" && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-green-600 dark:text-green-400 shrink-0" }),
10599
- visualState === "ready" && /* @__PURE__ */ jsx(
10600
- Badge,
10601
- {
10602
- variant: "outline",
10603
- className: "text-[9px] px-1.5 py-0 h-4 bg-green-100 dark:bg-green-900/50 border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",
10604
- children: "Ready"
10605
- }
10606
- ),
10607
- delivery.hasProductionRisk && /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4 text-red-500 shrink-0" }),
10608
- hasComments && /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
10609
- /* @__PURE__ */ jsx(MessageSquare, { className: "h-3.5 w-3.5 text-muted-foreground" }),
10610
- /* @__PURE__ */ jsx("span", { className: "absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-primary" })
10611
- ] })
10612
- ] }),
10613
- /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground truncate", children: [
10614
- delivery.supplierName,
10615
- delivery.prefixScope && ` \u2022 ${delivery.prefixScope}`
10616
- ] }),
10617
- productionDisplay && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs", children: [
10618
- /* @__PURE__ */ jsx(Package, { className: "h-3 w-3 text-muted-foreground" }),
10619
- /* @__PURE__ */ jsxs("span", { className: cn(
10620
- delivery.isReadyToUnload ? "text-green-600 dark:text-green-400 font-medium" : delivery.hasProductionRisk ? "text-red-600 dark:text-red-400" : "text-muted-foreground"
10621
- ), children: [
10622
- delivery.isReadyToUnload ? "\u2713 " : "",
10623
- productionDisplay
10624
- ] })
12429
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
12430
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 min-w-0 flex-1", children: [
12431
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
12432
+ /* @__PURE__ */ jsx("span", { className: cn(
12433
+ "text-sm font-semibold truncate",
12434
+ styles.titleColor
12435
+ ), children: projectName }),
12436
+ delivery.hasProductionRisk && /* @__PURE__ */ jsx(AlertTriangle, { className: cn("h-4 w-4 shrink-0", styles.iconColor) }),
12437
+ hasComments && /* @__PURE__ */ jsxs("div", { className: "relative shrink-0 p-0.5 rounded bg-background/50", children: [
12438
+ /* @__PURE__ */ jsx(MessageSquare, { className: "h-3.5 w-3.5 text-muted-foreground" }),
12439
+ /* @__PURE__ */ jsx("span", { className: "absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-primary" })
10625
12440
  ] })
12441
+ ] }),
12442
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
12443
+ visualState === "sent" && /* @__PURE__ */ jsxs(Fragment, { children: [
12444
+ /* @__PURE__ */ jsx(Check, { className: cn("h-3.5 w-3.5 shrink-0", styles.iconColor) }),
12445
+ /* @__PURE__ */ jsx("span", { className: cn("text-[10px] font-medium uppercase tracking-wide", styles.subtitleColor), children: "Shipped" })
12446
+ ] }),
12447
+ visualState === "ready" && /* @__PURE__ */ jsx("span", { className: cn("text-[10px] font-semibold uppercase tracking-wide", styles.subtitleColor), children: "Ready" }),
12448
+ delivery.hasProductionRisk && visualState !== "sent" && /* @__PURE__ */ jsx("span", { className: cn("text-[10px] font-semibold uppercase tracking-wide", styles.subtitleColor), children: "At Risk" })
10626
12449
  ] })
10627
12450
  ] }),
10628
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
10629
- /* @__PURE__ */ jsx(
10630
- Badge,
10631
- {
10632
- variant: getStatusBadgeVariant3(delivery.status),
10633
- className: cn("text-[10px] h-5", getStatusBadgeClasses3(delivery.status)),
10634
- children: getLoadingDeliveryStatusLabel(delivery.status)
10635
- }
10636
- ),
10637
- /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 text-muted-foreground" })
10638
- ] })
12451
+ /* @__PURE__ */ jsx(ChevronRight, { className: cn("h-4 w-4 shrink-0", styles.iconColor) })
10639
12452
  ] })
10640
12453
  }
10641
12454
  );
@@ -13860,7 +15673,7 @@ var GanttContentHeader = ({
13860
15673
  return /* @__PURE__ */ jsxs(
13861
15674
  "div",
13862
15675
  {
13863
- className: "sticky top-0 z-20 grid w-full shrink-0 bg-background/95 backdrop-blur-sm",
15676
+ className: "sticky top-0 z-20 grid w-full shrink-0 bg-muted/80 backdrop-blur-sm",
13864
15677
  style: { height: "var(--gantt-header-height)" },
13865
15678
  children: [
13866
15679
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
@@ -14057,7 +15870,7 @@ var GanttSidebarHeader = ({
14057
15870
  }) => /* @__PURE__ */ jsxs(
14058
15871
  "div",
14059
15872
  {
14060
- className: "sticky top-0 z-10 flex shrink-0 items-end justify-between gap-2.5 border-border/50 border-b bg-background/95 px-2.5 py-2 font-medium text-muted-foreground text-xs backdrop-blur-sm",
15873
+ className: "sticky top-0 z-40 flex shrink-0 items-end justify-between gap-2.5 border-border/50 border-b bg-muted/80 px-2.5 py-2 font-medium text-muted-foreground text-xs backdrop-blur-sm",
14061
15874
  style: { height: "var(--gantt-header-height)" },
14062
15875
  children: [
14063
15876
  /* @__PURE__ */ jsx("p", { className: "flex-1 truncate text-left", children: title }),
@@ -14121,11 +15934,12 @@ var GanttGroupSummaryBar = memo(({
14121
15934
  children: /* @__PURE__ */ jsx(
14122
15935
  "div",
14123
15936
  {
14124
- className: "h-full w-full rounded-sm border border-border/60 bg-muted/40 shadow-sm",
15937
+ className: "relative h-full w-full rounded-sm border border-border/60 bg-muted/40 shadow-sm overflow-hidden",
14125
15938
  style: {
14126
15939
  // Subtle gradient for depth
14127
15940
  background: "linear-gradient(180deg, hsl(var(--muted) / 0.5) 0%, hsl(var(--muted) / 0.3) 100%)"
14128
- }
15941
+ },
15942
+ children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center px-2", children: /* @__PURE__ */ jsx("span", { className: "truncate text-[10px] font-medium text-muted-foreground", children: group.title }) })
14129
15943
  }
14130
15944
  )
14131
15945
  }
@@ -14157,7 +15971,7 @@ var GanttCollapsibleSidebarGroup = ({
14157
15971
  /* @__PURE__ */ jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs(
14158
15972
  "button",
14159
15973
  {
14160
- className: "flex w-full items-center gap-2 px-2.5 py-2 text-left font-medium text-xs hover:bg-muted/30 border-b border-border/50 bg-background",
15974
+ className: "flex w-full items-center gap-2 px-2.5 py-2 text-left font-medium text-xs hover:bg-muted/70 border-b border-border/50 bg-muted/40",
14161
15975
  style: { height: "var(--gantt-row-height)" },
14162
15976
  type: "button",
14163
15977
  children: [
@@ -14199,7 +16013,7 @@ var GanttCollapsibleTimelineGroup = ({
14199
16013
  /* @__PURE__ */ jsx(
14200
16014
  "div",
14201
16015
  {
14202
- className: "relative w-full border-b border-border/50",
16016
+ className: "relative w-full border-b border-border/50 bg-muted/20",
14203
16017
  style: { height: "var(--gantt-row-height)" },
14204
16018
  children: /* @__PURE__ */ jsx(GanttGroupSummaryBar, { group })
14205
16019
  }
@@ -14217,7 +16031,7 @@ var GanttSidebarGroup = ({
14217
16031
  /* @__PURE__ */ jsx(
14218
16032
  "p",
14219
16033
  {
14220
- className: "w-full truncate px-2.5 py-2 text-left font-medium text-muted-foreground text-xs border-b border-border/50 bg-background",
16034
+ className: "w-full truncate px-2.5 py-2 text-left font-medium text-muted-foreground text-xs border-b border-border/50 bg-muted/40",
14221
16035
  style: { height: "var(--gantt-row-height)" },
14222
16036
  children: name
14223
16037
  }
@@ -14231,7 +16045,7 @@ var GanttSidebar = ({
14231
16045
  "div",
14232
16046
  {
14233
16047
  className: cn(
14234
- "sticky left-0 z-30 h-max min-h-full border-border/50 border-r bg-background",
16048
+ "sticky left-0 z-30 h-max min-h-full border-border/50 border-r bg-muted/50",
14235
16049
  className
14236
16050
  ),
14237
16051
  style: { width: "var(--gantt-sidebar-width)" },
@@ -15270,6 +17084,6 @@ var KanbanProvider = ({
15270
17084
  ) });
15271
17085
  };
15272
17086
 
15273
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AgendaView, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, BADGE_VARIANT_LABELS, Badge, BigCalendar, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarContext, CalendarDayButton, CalendarHeader, CalendarHeaderCompact, CalendarSettingsButton, CalendarSettingsContent, CalendarSettingsDialog, CalibrationTable, CalibrationWeekCell, CalibrationWeekHeader, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChangeBadgeVariantInput, ChangeVisibleHoursInput, ChangeWorkingHoursInput, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, CircularProgress, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CommentButton, CommentDialog, CommentPopover, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DEFAULT_VISIBLE_HOURS, DEFAULT_WORKING_HOURS, DataTableColumnHeader, DataTablePagination, DataTableViewOptions, DateBadge, DayView, DeliveryBadge, DeliveryCard, DeliveryDetailPage, DeliveryIndicator, DeliveryIndicators, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DragContext, DragProvider, DraggableEvent, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DroppableZone, EVENT_COLORS, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventBadge, EventCalendarProvider, EventDialog, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GanttAddFeatureHelper, GanttCollapsibleSidebarGroup, GanttCollapsibleTimelineGroup, GanttColumn, GanttColumns, GanttContentHeader, GanttCreateMarkerTrigger, GanttFeatureDragHelper, GanttFeatureItem, GanttFeatureItemCard, GanttFeatureList, GanttFeatureListGroup, GanttFeatureRow, GanttGridLines, GanttGroupSummaryBar, GanttHeader, GanttMarker, GanttProvider, GanttSidebar, GanttSidebarGroup, GanttSidebarHeader, GanttSidebarItem, GanttTimeline, GanttToday, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Item6 as Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, KanbanBoard, KanbanCard, KanbanCards, KanbanHeader, KanbanProvider, Kbd, KbdGroup, Label2 as Label, Map2 as Map, MapMarker, MapPopup, MapTileLayer, MapTooltip, MapZoomControl, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MonthView, MoreEvents, NativeSelect, NativeSelectOptGroup, NativeSelectOption, NavMain, NavProjects, NavSecondary, NavUser, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NetBadge, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PlanningTable, PlanningTableToolbar, PlanningWeekCommentPopover, PlayerCanvas, PlayerCanvasActionButton, PlayerCanvasControls, PlayerCanvasDivider, PlayerCanvasInfo, PlayerCanvasLabel, PlayerCanvasPlayButton, PlayerCanvasProgress, PlayerCanvasSkipButton, PlayerCanvasTitle, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, QuickAddEvent, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, RowHeaderCell, ScrollArea, ScrollBar, SearchForm, SearchTrigger, Section, SectionContent, SectionDescription, SectionFooter, SectionHeader, SectionTitle, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiteHeader, Skeleton, Slider, Spinner, SubmitCalibrationBar, SupplierCell, SupplierWeeklyLoading, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeSwitch, TimeIndicator, Toaster, Toggle, ToggleGroup, ToggleGroupItem, ToolBarCanvas, ToolBarCanvasButton, ToolBarCanvasDivider, ToolBarCanvasGroup, Tooltip2 as Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserAvatarsDropdown, VIEW_LABELS, WeekCell, WeekDetailDialog, WeekHeader, WeekView, WeeklyLoadingView, YearView, badgeVariants, buttonGroupVariants, buttonVariants, calculateCalibrationCells, calculateDropDates, calculateMonthEventPositions, canSubmitCalibration, cardVariants, createDefaultEvent, deliveryIndicatorVariants, extractPrefixes, formatCalibrationUnit, formatDateRange2 as formatDateRange, formatProductionUnit, formatTime, generateColumns, generateEventId, generateLoadingWeek, generateLocationOptions, generateWeekColumns, generateWeeks, getCalendarCells, getCommentLocationLabel, getCurrentEvents, getDayHours, getDayLabel, getDeliveryVisualState, getElementShipmentStatus, getEventBlockStyle, getEventDuration, getEventDurationMinutes, getEventsCount, getEventsForDate, getEventsInRange, getHeaderLabel, getISOWeek, getLoadingDeliveryStatusLabel, getLoadingElementStatusLabel, getLoadingISOWeek, getLoadingWeekKey, getMonthCellEvents, getMonthDays, getShipmentStatusLabel, getShortDayLabel, getSupplierColumn, getTimeHeight, getTimePosition, getViewDateRange, getVisibleHours, getWeekDayNames, getWeekDays, getWeekKey, getYearMonths, groupDeliveriesByDay, groupDeliveriesByPrefixAndDay, groupEvents, isMultiDayEvent, isWorkingHour, navigateDate, navigationMenuTriggerStyle, playerCanvasPlayButtonVariants, playerCanvasSkipButtonVariants, rangeText, sectionVariants, snapToInterval, sortEvents, splitEventsByDuration, toggleVariants, toolBarCanvasButtonVariants, useDrag, useDraggable, useDroppable, useEventCalendar, useEventsInRange, useFilteredEvents, useFormField, useGanttDragging, useGanttScrollX, useIsMobile, useSearchShortcut, useSidebar };
17087
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AgendaView, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, BADGE_VARIANT_LABELS, Badge, BigCalendar, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarContext, CalendarDayButton, CalendarHeader, CalendarHeaderCompact, CalendarSettingsButton, CalendarSettingsContent, CalendarSettingsDialog, CalibrationTable, CalibrationWeekCell, CalibrationWeekHeader, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChangeBadgeVariantInput, ChangeVisibleHoursInput, ChangeWorkingHoursInput, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, CircularProgress, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColumnSummaryCell, ColumnSummaryStrip, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CommentButton, CommentDialog, CommentPopover, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DEFAULT_VISIBLE_HOURS, DEFAULT_WORKING_HOURS, DataTableColumnHeader, DataTablePagination, DataTableViewOptions, DateBadge, DayView, DeliveryBadge, DeliveryCard, DeliveryDetailPage, DeliveryIndicator, DeliveryIndicators, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DragContext, DragProvider, DraggableEvent, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DroppableZone, EVENT_COLORS, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventBadge, EventCalendarProvider, EventDialog, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GanttAddFeatureHelper, GanttCollapsibleSidebarGroup, GanttCollapsibleTimelineGroup, GanttColumn, GanttColumns, GanttContentHeader, GanttCreateMarkerTrigger, GanttFeatureDragHelper, GanttFeatureItem, GanttFeatureItemCard, GanttFeatureList, GanttFeatureListGroup, GanttFeatureRow, GanttGridLines, GanttGroupSummaryBar, GanttHeader, GanttMarker, GanttProvider, GanttSidebar, GanttSidebarGroup, GanttSidebarHeader, GanttSidebarItem, GanttTimeline, GanttToday, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InsightBar, Item6 as Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, KanbanBoard, KanbanCard, KanbanCards, KanbanHeader, KanbanProvider, Kbd, KbdGroup, Label2 as Label, Map2 as Map, MapMarker, MapPopup, MapTileLayer, MapTooltip, MapZoomControl, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MonthView, MoreEvents, NativeSelect, NativeSelectOptGroup, NativeSelectOption, NavMain, NavProjects, NavSecondary, NavUser, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NetBadge, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PlanningTable, PlanningTableToolbar, PlanningWeekCommentPopover, PlayerCanvas, PlayerCanvasActionButton, PlayerCanvasControls, PlayerCanvasDivider, PlayerCanvasInfo, PlayerCanvasLabel, PlayerCanvasPlayButton, PlayerCanvasProgress, PlayerCanvasSkipButton, PlayerCanvasTitle, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, QuickAddEvent, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, RowHeaderCell, ScrollArea, ScrollBar, SearchForm, SearchTrigger, Section, SectionContent, SectionDescription, SectionFooter, SectionHeader, SectionTitle, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiteHeader, Skeleton, Slider, Spinner, StatusProgress, SubmitCalibrationBar, SupplierCell, SupplierWeeklyLoading, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeSwitch, TimeIndicator, Toaster, Toggle, ToggleGroup, ToggleGroupItem, ToolBarCanvas, ToolBarCanvasButton, ToolBarCanvasDivider, ToolBarCanvasGroup, Tooltip2 as Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserAvatarsDropdown, VIEW_LABELS, WeekCell, WeekDetailDialog, WeekDetailSheet, WeekHeader, WeekView, WeeklyLoadingView, YearView, badgeVariants, buttonGroupVariants, buttonVariants, calculateCalibrationCells, calculateDropDates, calculateMonthEventPositions, canSubmitCalibration, cardVariants, createDefaultEvent, deliveryIndicatorVariants, extractPrefixes, formatCalibrationUnit, formatDateRange2 as formatDateRange, formatProductionUnit, formatTime, generateColumns, generateEventId, generateLoadingWeek, generateLocationOptions, generateWeekColumns, generateWeeks, getCalendarCells, getCommentLocationLabel, getCurrentEvents, getDayHours, getDayLabel, getDeliveryVisualState, getElementShipmentStatus, getEventBlockStyle, getEventDuration, getEventDurationMinutes, getEventsCount, getEventsForDate, getEventsInRange, getHeaderLabel, getISOWeek, getLoadingDeliveryStatusLabel, getLoadingElementStatusLabel, getLoadingISOWeek, getLoadingWeekKey, getMonthCellEvents, getMonthDays, getShipmentStatusLabel, getShortDayLabel, getSupplierColumn, getTimeHeight, getTimePosition, getViewDateRange, getVisibleHours, getWeekDayNames, getWeekDays, getWeekKey, getYearMonths, groupDeliveriesByDay, groupDeliveriesByPrefixAndDay, groupEvents, isMultiDayEvent, isWorkingHour, navigateDate, navigationMenuTriggerStyle, playerCanvasPlayButtonVariants, playerCanvasSkipButtonVariants, rangeText, sectionVariants, snapToInterval, sortEvents, splitEventsByDuration, toggleVariants, toolBarCanvasButtonVariants, useDrag, useDraggable, useDroppable, useEventCalendar, useEventsInRange, useFilteredEvents, useFormField, useGanttDragging, useGanttScrollX, useIsMobile, useSearchShortcut, useSidebar };
15274
17088
  //# sourceMappingURL=index.js.map
15275
17089
  //# sourceMappingURL=index.js.map