@optifye/dashboard-core 6.12.7 → 6.12.9

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
@@ -4551,11 +4551,12 @@ var fetchLineDummySkuId = async (supabase, lineId, skuTable = "skus") => {
4551
4551
  var fetchLineSkuCatalog = async (supabase, lineId, skuTable = "skus") => {
4552
4552
  if (!supabase || !lineId) return [];
4553
4553
  try {
4554
- const { data } = await supabase.from(skuTable).select("id, sku_id, sku_definition").eq("line_id", lineId).eq("is_active", true);
4554
+ const { data } = await supabase.from(skuTable).select("id, sku_id, display_name, sku_definition").eq("line_id", lineId).eq("is_active", true);
4555
4555
  if (Array.isArray(data)) {
4556
4556
  return data.filter((item) => item && typeof item.id === "string").map((item) => ({
4557
4557
  id: item.id,
4558
4558
  sku_id: typeof item.sku_id === "string" ? item.sku_id : null,
4559
+ display_name: typeof item.display_name === "string" ? item.display_name : null,
4559
4560
  sku_definition: typeof item.sku_definition === "string" ? item.sku_definition : null
4560
4561
  }));
4561
4562
  }
@@ -4576,10 +4577,12 @@ var buildLineSkuBreakdown = (rows, skuCatalog) => {
4576
4577
  if (!skuUuid) return null;
4577
4578
  const meta = catalogById.get(skuUuid);
4578
4579
  const skuCode = meta?.sku_id || skuUuid;
4580
+ const skuDisplayName = meta?.display_name?.trim() || skuCode;
4579
4581
  const isDummy = meta?.sku_definition === "dummy_definition";
4580
4582
  return {
4581
4583
  sku_id: skuUuid,
4582
4584
  sku_code: skuCode,
4585
+ sku_display_name: skuDisplayName,
4583
4586
  is_dummy: isDummy,
4584
4587
  current_output: safeInt(row.current_output),
4585
4588
  ideal_output: safeInt(row.ideal_output),
@@ -13163,6 +13166,7 @@ var normalizeSkuBreakdown = (raw) => {
13163
13166
  return {
13164
13167
  sku_id: typeof item.sku_id === "string" ? item.sku_id : String(item.sku_id ?? ""),
13165
13168
  sku_code: typeof item.sku_code === "string" ? item.sku_code : String(item.sku_code ?? ""),
13169
+ sku_display_name: typeof item.sku_display_name === "string" ? item.sku_display_name : coerceOptionalString(item.sku_display_name),
13166
13170
  sku_definition: typeof item.sku_definition === "string" ? item.sku_definition : String(item.sku_definition ?? ""),
13167
13171
  is_dummy: Boolean(item.is_dummy),
13168
13172
  total_output: coerceNumber(item.total_output, 0),
@@ -13181,6 +13185,7 @@ var normalizeSkuSegment = (raw) => {
13181
13185
  return {
13182
13186
  sku_id: typeof item.sku_id === "string" ? item.sku_id : String(item.sku_id ?? ""),
13183
13187
  sku_code: typeof item.sku_code === "string" ? item.sku_code : String(item.sku_code ?? ""),
13188
+ sku_display_name: typeof item.sku_display_name === "string" ? item.sku_display_name : coerceOptionalString(item.sku_display_name),
13184
13189
  start_time: typeof item.start_time === "string" ? item.start_time : String(item.start_time ?? ""),
13185
13190
  end_time: coerceOptionalString(item.end_time),
13186
13191
  pph_threshold: coerceNumber(item.pph_threshold, 0)
@@ -34456,6 +34461,13 @@ var LineChart = React144__namespace.default.memo(LineChartComponent, (prevProps,
34456
34461
  return true;
34457
34462
  });
34458
34463
  LineChart.displayName = "LineChart";
34464
+
34465
+ // src/lib/utils/skuDisplay.ts
34466
+ var clean = (value) => typeof value === "string" ? value.trim() : "";
34467
+ var getSkuDisplayName = (sku) => {
34468
+ if (!sku) return "SKU";
34469
+ return clean(sku.sku_display_name) || clean(sku.display_name) || clean(sku.sku_code) || clean(sku.sku_id) || clean(sku.id) || "SKU";
34470
+ };
34459
34471
  var formatPercentage = (current, target) => {
34460
34472
  if (!target || target <= 0) return "0.0";
34461
34473
  return (current / target * 100).toFixed(1);
@@ -34532,12 +34544,13 @@ var SkuRow = ({ sku, isSelected, isLive, onSelect }) => {
34532
34544
  const ratio = target > 0 ? Math.min(current / target, 1) : 0;
34533
34545
  const fillColor = "#3b82f6";
34534
34546
  const percentage = formatPercentage(current, target);
34547
+ const skuLabel = getSkuDisplayName(sku);
34535
34548
  return /* @__PURE__ */ jsxRuntime.jsxs(
34536
34549
  "div",
34537
34550
  {
34538
34551
  className: `space-y-1.5 p-2 rounded-lg cursor-pointer transition-all ${isSelected ? "ring-2 ring-blue-500 ring-dashed bg-blue-50/30" : "hover:bg-gray-50"}`,
34539
34552
  onClick: () => onSelect?.(isSelected ? null : sku.sku_id),
34540
- "data-testid": `sku-progress-row-${sku.sku_code}`,
34553
+ "data-testid": `sku-progress-row-${sku.sku_id}`,
34541
34554
  children: [
34542
34555
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [
34543
34556
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
@@ -34545,8 +34558,8 @@ var SkuRow = ({ sku, isSelected, isLive, onSelect }) => {
34545
34558
  "span",
34546
34559
  {
34547
34560
  className: "text-sm font-semibold text-gray-800 truncate",
34548
- title: sku.sku_code,
34549
- children: sku.sku_code
34561
+ title: skuLabel,
34562
+ children: skuLabel
34550
34563
  }
34551
34564
  ),
34552
34565
  isLive && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-2 h-2 rounded-full bg-green-500 shrink-0 shadow-[0_0_4px_rgba(34,197,94,0.6)]", title: "Currently running" })
@@ -34565,7 +34578,7 @@ var SkuRow = ({ sku, isSelected, isLive, onSelect }) => {
34565
34578
  "aria-valuenow": Math.round(current),
34566
34579
  "aria-valuemin": 0,
34567
34580
  "aria-valuemax": Math.round(target),
34568
- "aria-label": `${sku.sku_code} output progress`,
34581
+ "aria-label": `${skuLabel} output progress`,
34569
34582
  children: /* @__PURE__ */ jsxRuntime.jsx(
34570
34583
  "div",
34571
34584
  {
@@ -36536,7 +36549,7 @@ var HourlyOutputChartComponent = ({
36536
36549
  const end = Math.max(start, Math.min(nextOffset, timelineEndOffset));
36537
36550
  return {
36538
36551
  skuId: entry.segment.sku_id,
36539
- label: entry.segment.sku_code,
36552
+ label: getSkuDisplayName(entry.segment),
36540
36553
  start,
36541
36554
  end,
36542
36555
  pphThreshold: entry.segment.pph_threshold ?? pphThreshold
@@ -37412,7 +37425,7 @@ var HourlyOutputChart = React144__namespace.default.memo(
37412
37425
  for (let i = 0; i < prevSegments.length; i += 1) {
37413
37426
  const prevSeg = prevSegments[i];
37414
37427
  const nextSeg = nextSegments[i];
37415
- if (prevSeg.sku_id !== nextSeg.sku_id || prevSeg.sku_code !== nextSeg.sku_code || prevSeg.start_time !== nextSeg.start_time || prevSeg.end_time !== nextSeg.end_time) {
37428
+ if (prevSeg.sku_id !== nextSeg.sku_id || prevSeg.sku_code !== nextSeg.sku_code || prevSeg.sku_display_name !== nextSeg.sku_display_name || prevSeg.start_time !== nextSeg.start_time || prevSeg.end_time !== nextSeg.end_time) {
37416
37429
  return false;
37417
37430
  }
37418
37431
  }
@@ -38401,6 +38414,7 @@ var WorkspaceMetricCardsImpl = ({
38401
38414
  const pphThreshold = activeSku ? activeSku.pph_threshold : workspace.pph_threshold;
38402
38415
  const cycleValue = activeSku ? activeSku.avg_cycle_time : workspace.avg_cycle_time;
38403
38416
  const cycleStandard = activeSku ? activeSku.ideal_cycle_time : workspace.ideal_cycle_time;
38417
+ const displaySkuLabel = displaySku ? getSkuDisplayName(displaySku) : "";
38404
38418
  const efficiencyValue = workspace.avg_efficiency || 0;
38405
38419
  const efficiencyTarget = effectiveLegend.green_min;
38406
38420
  const efficiencyColor = getEfficiencyHexColor(efficiencyValue, effectiveLegend);
@@ -38431,7 +38445,7 @@ var WorkspaceMetricCardsImpl = ({
38431
38445
  /* @__PURE__ */ jsxRuntime.jsxs(Card2, { className: "flex flex-col bg-white shadow-sm h-full min-h-[150px] sm:min-h-0", children: [
38432
38446
  /* @__PURE__ */ jsxRuntime.jsxs(CardHeader2, { className: "pb-2 flex-none text-center", children: [
38433
38447
  /* @__PURE__ */ jsxRuntime.jsx(CardTitle2, { className: "text-lg", children: "PPH" }),
38434
- displaySku && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySku.sku_code, children: displaySku.sku_code })
38448
+ displaySku && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySkuLabel, children: displaySkuLabel })
38435
38449
  ] }),
38436
38450
  /* @__PURE__ */ jsxRuntime.jsx(CardContent2, { className: "flex-1 flex items-center justify-center py-6 sm:py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
38437
38451
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-5xl font-bold ${pphValue >= pphThreshold ? "text-green-500" : "text-red-500"}`, children: pphValue.toFixed(1) }),
@@ -38444,7 +38458,7 @@ var WorkspaceMetricCardsImpl = ({
38444
38458
  /* @__PURE__ */ jsxRuntime.jsxs(Card2, { className: "flex flex-col bg-white shadow-sm h-full min-h-[150px] sm:min-h-0", children: [
38445
38459
  /* @__PURE__ */ jsxRuntime.jsxs(CardHeader2, { className: "pb-2 flex-none text-center", children: [
38446
38460
  /* @__PURE__ */ jsxRuntime.jsx(CardTitle2, { className: "text-lg", children: "Avg. Cycle Time" }),
38447
- displaySku && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySku.sku_code, children: displaySku.sku_code })
38461
+ displaySku && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySkuLabel, children: displaySkuLabel })
38448
38462
  ] }),
38449
38463
  /* @__PURE__ */ jsxRuntime.jsx(CardContent2, { className: "flex-1 flex items-center justify-center py-6 sm:py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
38450
38464
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-5xl font-bold ${cycleValue > (cycleStandard || 0) ? "text-red-500" : "text-green-500"}`, children: cycleValue.toFixed(1) }),
@@ -51766,7 +51780,7 @@ var LinePdfGenerator = ({
51766
51780
  if (intervalIndex >= 0) {
51767
51781
  if (segmentIndex > 0 || segmentMinutes > hourlyTimeRanges[0]?.start) {
51768
51782
  if (!skuRemarksByIndex[intervalIndex]) skuRemarksByIndex[intervalIndex] = [];
51769
- skuRemarksByIndex[intervalIndex].push(segment.sku_code);
51783
+ skuRemarksByIndex[intervalIndex].push(getSkuDisplayName(segment));
51770
51784
  }
51771
51785
  }
51772
51786
  }
@@ -53780,7 +53794,7 @@ var WorkspacePdfGenerator = ({
53780
53794
  if (intervalIndex >= 0) {
53781
53795
  if (segmentIndex > 0 || segmentMinutes > hourlyIntervals[0]?.start) {
53782
53796
  if (!skuRemarksByIndex[intervalIndex]) skuRemarksByIndex[intervalIndex] = [];
53783
- skuRemarksByIndex[intervalIndex].push(segment.sku_code);
53797
+ skuRemarksByIndex[intervalIndex].push(getSkuDisplayName(segment));
53784
53798
  }
53785
53799
  }
53786
53800
  }
@@ -54445,6 +54459,7 @@ var WorkspaceCycleTimeMetricCards = ({
54445
54459
  }, [activeSku, skuAware, activeSkuId, liveSkuId, skuBreakdown]);
54446
54460
  const cycleValue = activeSku ? activeSku.avg_cycle_time : workspace.avg_cycle_time;
54447
54461
  const cycleStandard = activeSku ? activeSku.ideal_cycle_time : workspace.ideal_cycle_time;
54462
+ const displaySkuLabel = displaySku ? getSkuDisplayName(displaySku) : "";
54448
54463
  const efficiencyValue = workspace.avg_efficiency || 0;
54449
54464
  const efficiencyTarget = effectiveLegend.green_min;
54450
54465
  const efficiencyColor = getEfficiencyHexColor(efficiencyValue, effectiveLegend);
@@ -54472,7 +54487,7 @@ var WorkspaceCycleTimeMetricCards = ({
54472
54487
  /* @__PURE__ */ jsxRuntime.jsxs(Card2, { className: "flex flex-col bg-white shadow-sm border border-gray-200 h-full min-h-[150px] sm:min-h-0 rounded-xl", children: [
54473
54488
  /* @__PURE__ */ jsxRuntime.jsxs(CardHeader2, { className: "pb-1 pt-5 flex-none text-center", children: [
54474
54489
  /* @__PURE__ */ jsxRuntime.jsx(CardTitle2, { className: "text-[15px] font-bold text-gray-900 tracking-wide", children: "Cycle Time (s)" }),
54475
- displaySku && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySku.sku_code, children: displaySku.sku_code })
54490
+ displaySku && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySkuLabel, children: displaySkuLabel })
54476
54491
  ] }),
54477
54492
  /* @__PURE__ */ jsxRuntime.jsxs(CardContent2, { className: "flex-1 flex flex-col items-center justify-center pb-6", children: [
54478
54493
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-5xl font-bold tracking-tight ${cycleValue > (cycleStandard || 0) ? "text-red-500" : "text-[#34C759]"}`, children: cycleValue.toFixed(1) }),
@@ -66531,6 +66546,7 @@ var MetricCards = React144.memo(({
66531
66546
  (prevProps.skuBreakdown || []).map((sku) => ({
66532
66547
  sku_id: sku.sku_id,
66533
66548
  sku_code: sku.sku_code,
66549
+ sku_display_name: sku.sku_display_name,
66534
66550
  total_output: sku.total_output,
66535
66551
  target_output: sku.target_output,
66536
66552
  avg_pph: sku.avg_pph,
@@ -66546,6 +66562,7 @@ var MetricCards = React144.memo(({
66546
66562
  (nextProps.skuBreakdown || []).map((sku) => ({
66547
66563
  sku_id: sku.sku_id,
66548
66564
  sku_code: sku.sku_code,
66565
+ sku_display_name: sku.sku_display_name,
66549
66566
  total_output: sku.total_output,
66550
66567
  target_output: sku.target_output,
66551
66568
  avg_pph: sku.avg_pph,
@@ -66855,6 +66872,7 @@ var BottomSection = React144.memo(({
66855
66872
  (prevProps.skuSegments || []).map((segment) => ({
66856
66873
  sku_id: segment.sku_id,
66857
66874
  sku_code: segment.sku_code,
66875
+ sku_display_name: segment.sku_display_name,
66858
66876
  start_time: segment.start_time,
66859
66877
  end_time: segment.end_time,
66860
66878
  pph_threshold: segment.pph_threshold
@@ -66864,6 +66882,7 @@ var BottomSection = React144.memo(({
66864
66882
  (nextProps.skuSegments || []).map((segment) => ({
66865
66883
  sku_id: segment.sku_id,
66866
66884
  sku_code: segment.sku_code,
66885
+ sku_display_name: segment.sku_display_name,
66867
66886
  start_time: segment.start_time,
66868
66887
  end_time: segment.end_time,
66869
66888
  pph_threshold: segment.pph_threshold
@@ -67544,6 +67563,7 @@ var KPIDetailView = ({
67544
67563
  }).map((item) => ({
67545
67564
  sku_id: item.sku_id,
67546
67565
  sku_code: item.sku_code,
67566
+ sku_display_name: item.sku_display_name,
67547
67567
  sku_definition: "",
67548
67568
  is_dummy: false,
67549
67569
  total_output: item.current_output ?? 0,
@@ -67608,11 +67628,13 @@ var KPIDetailView = ({
67608
67628
  }, [resolvedLineInfo, selectedSkuRow]);
67609
67629
  const handleSkuChange = React144.useCallback((nextSkuId) => {
67610
67630
  if (nextSkuId === selectedSkuId) return;
67631
+ const selectedSkuOption = nextSkuId === "all" ? null : realSkuOptions.find((item) => item.sku_id === nextSkuId) ?? null;
67611
67632
  setSelectedSkuId(nextSkuId);
67612
67633
  trackCoreEvent("Line Detail SKU Filter Changed", {
67613
67634
  line_id: lineId,
67614
67635
  sku_id: nextSkuId === "all" ? null : nextSkuId,
67615
- sku_code: nextSkuId === "all" ? null : realSkuOptions.find((item) => item.sku_id === nextSkuId)?.sku_code ?? null
67636
+ sku_code: selectedSkuOption?.sku_code ?? null,
67637
+ sku_display_name: selectedSkuOption ? getSkuDisplayName(selectedSkuOption) : null
67616
67638
  });
67617
67639
  }, [lineId, realSkuOptions, selectedSkuId]);
67618
67640
  const handleChartSkuSelect = React144.useCallback(
@@ -70470,20 +70492,14 @@ var AnimatedEfficiency = React144.memo(({ value }) => {
70470
70492
  });
70471
70493
  AnimatedEfficiency.displayName = "AnimatedEfficiency";
70472
70494
  var getWorkspaceLeaderboardMetricValue = (workspace) => {
70473
- if (workspace.monitoring_mode === "output") {
70474
- return toFiniteNumber(workspace.efficiency);
70475
- }
70476
70495
  if (workspace.leaderboard_metric_kind === "recent_flow_shift_average") {
70477
- return toFiniteNumber(workspace.leaderboard_value);
70496
+ return toFiniteNumber(workspace.leaderboard_value) ?? toFiniteNumber(workspace.avg_recent_flow);
70478
70497
  }
70479
70498
  return toFiniteNumber(workspace.leaderboard_value) ?? toFiniteNumber(workspace.efficiency);
70480
70499
  };
70481
70500
  var getWorkspaceDisplayedMetricValue = (workspace) => getWorkspaceLeaderboardMetricValue(workspace);
70482
- var getWorkspaceLeaderboardMetricLabel = (workspace, defaultLabel) => workspace.monitoring_mode !== "output" && workspace.leaderboard_metric_kind === "recent_flow_shift_average" ? "Avg Flow" : defaultLabel;
70483
- var renderWorkspaceLeaderboardMetric = (workspace, isAssemblyMode) => {
70484
- if (isAssemblyMode) {
70485
- return /* @__PURE__ */ jsxRuntime.jsx(CycleTimeComparison, { workspace });
70486
- }
70501
+ var getWorkspaceLeaderboardMetricLabel = (workspace, defaultLabel) => workspace.leaderboard_metric_kind === "recent_flow_shift_average" ? "Avg Flow" : defaultLabel;
70502
+ var renderWorkspaceLeaderboardMetric = (workspace) => {
70487
70503
  const displayedMetricValue = getWorkspaceDisplayedMetricValue(workspace);
70488
70504
  if (displayedMetricValue === null) {
70489
70505
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tabular-nums", children: "--" });
@@ -70540,8 +70556,7 @@ var MobileWorkspaceCard = React144.memo(({
70540
70556
  isClickable,
70541
70557
  onWorkspaceClick,
70542
70558
  getMedalIcon,
70543
- metricLabel,
70544
- isAssemblyMode
70559
+ metricLabel
70545
70560
  }) => /* @__PURE__ */ jsxRuntime.jsx(
70546
70561
  motion.div,
70547
70562
  {
@@ -70568,13 +70583,13 @@ var MobileWorkspaceCard = React144.memo(({
70568
70583
  ] })
70569
70584
  ] }),
70570
70585
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-right", children: [
70571
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-bold text-gray-900 text-lg flex justify-end", children: renderWorkspaceLeaderboardMetric(workspace, isAssemblyMode) }),
70586
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-bold text-gray-900 text-lg flex justify-end", children: renderWorkspaceLeaderboardMetric(workspace) }),
70572
70587
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-500", children: getWorkspaceLeaderboardMetricLabel(workspace, metricLabel) })
70573
70588
  ] })
70574
70589
  ] })
70575
70590
  }
70576
70591
  ), (prevProps, nextProps) => {
70577
- return prevProps.metricLabel === nextProps.metricLabel && prevProps.isAssemblyMode === nextProps.isAssemblyMode && prevProps.rank === nextProps.rank && prevProps.cardClass === nextProps.cardClass && prevProps.isClickable === nextProps.isClickable && prevProps.workspace.workspace_uuid === nextProps.workspace.workspace_uuid && prevProps.workspace.leaderboard_value === nextProps.workspace.leaderboard_value && prevProps.workspace.leaderboard_metric_kind === nextProps.workspace.leaderboard_metric_kind && prevProps.workspace.efficiency === nextProps.workspace.efficiency && prevProps.workspace.ideal_cycle_time === nextProps.workspace.ideal_cycle_time && prevProps.workspace.action_count === nextProps.workspace.action_count && prevProps.workspace.action_threshold === nextProps.workspace.action_threshold && prevProps.workspace.avg_cycle_time === nextProps.workspace.avg_cycle_time && prevProps.workspace.displayName === nextProps.workspace.displayName && prevProps.workspace.lineName === nextProps.workspace.lineName;
70592
+ return prevProps.metricLabel === nextProps.metricLabel && prevProps.rank === nextProps.rank && prevProps.cardClass === nextProps.cardClass && prevProps.isClickable === nextProps.isClickable && prevProps.workspace.workspace_uuid === nextProps.workspace.workspace_uuid && prevProps.workspace.leaderboard_value === nextProps.workspace.leaderboard_value && prevProps.workspace.avg_recent_flow === nextProps.workspace.avg_recent_flow && prevProps.workspace.leaderboard_metric_kind === nextProps.workspace.leaderboard_metric_kind && prevProps.workspace.efficiency === nextProps.workspace.efficiency && prevProps.workspace.ideal_cycle_time === nextProps.workspace.ideal_cycle_time && prevProps.workspace.action_count === nextProps.workspace.action_count && prevProps.workspace.action_threshold === nextProps.workspace.action_threshold && prevProps.workspace.avg_cycle_time === nextProps.workspace.avg_cycle_time && prevProps.workspace.displayName === nextProps.workspace.displayName && prevProps.workspace.lineName === nextProps.workspace.lineName;
70578
70593
  });
70579
70594
  MobileWorkspaceCard.displayName = "MobileWorkspaceCard";
70580
70595
  var DesktopWorkspaceRow = React144.memo(({
@@ -70583,8 +70598,7 @@ var DesktopWorkspaceRow = React144.memo(({
70583
70598
  rowClass,
70584
70599
  isClickable,
70585
70600
  onWorkspaceClick,
70586
- getMedalIcon,
70587
- isAssemblyMode
70601
+ getMedalIcon
70588
70602
  }) => /* @__PURE__ */ jsxRuntime.jsxs(
70589
70603
  motion.tr,
70590
70604
  {
@@ -70601,11 +70615,11 @@ var DesktopWorkspaceRow = React144.memo(({
70601
70615
  ] }) }),
70602
70616
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: workspace.displayName }) }),
70603
70617
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: workspace.lineName }) }),
70604
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: `px-3 py-2.5 sm:p-4 text-sm sm:text-base font-medium ${isAssemblyMode ? "" : "whitespace-nowrap"}`, children: isAssemblyMode ? renderWorkspaceLeaderboardMetric(workspace, true) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col", children: renderWorkspaceLeaderboardMetric(workspace, false) }) })
70618
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base font-medium whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col", children: renderWorkspaceLeaderboardMetric(workspace) }) })
70605
70619
  ]
70606
70620
  }
70607
70621
  ), (prevProps, nextProps) => {
70608
- return prevProps.index === nextProps.index && prevProps.rowClass === nextProps.rowClass && prevProps.isClickable === nextProps.isClickable && prevProps.isAssemblyMode === nextProps.isAssemblyMode && prevProps.workspace.workspace_uuid === nextProps.workspace.workspace_uuid && prevProps.workspace.leaderboard_value === nextProps.workspace.leaderboard_value && prevProps.workspace.leaderboard_metric_kind === nextProps.workspace.leaderboard_metric_kind && prevProps.workspace.efficiency === nextProps.workspace.efficiency && prevProps.workspace.ideal_cycle_time === nextProps.workspace.ideal_cycle_time && prevProps.workspace.avg_cycle_time === nextProps.workspace.avg_cycle_time && prevProps.workspace.displayName === nextProps.workspace.displayName && prevProps.workspace.lineName === nextProps.workspace.lineName;
70622
+ return prevProps.index === nextProps.index && prevProps.rowClass === nextProps.rowClass && prevProps.isClickable === nextProps.isClickable && prevProps.workspace.workspace_uuid === nextProps.workspace.workspace_uuid && prevProps.workspace.leaderboard_value === nextProps.workspace.leaderboard_value && prevProps.workspace.avg_recent_flow === nextProps.workspace.avg_recent_flow && prevProps.workspace.leaderboard_metric_kind === nextProps.workspace.leaderboard_metric_kind && prevProps.workspace.efficiency === nextProps.workspace.efficiency && prevProps.workspace.ideal_cycle_time === nextProps.workspace.ideal_cycle_time && prevProps.workspace.avg_cycle_time === nextProps.workspace.avg_cycle_time && prevProps.workspace.displayName === nextProps.workspace.displayName && prevProps.workspace.lineName === nextProps.workspace.lineName;
70609
70623
  });
70610
70624
  DesktopWorkspaceRow.displayName = "DesktopWorkspaceRow";
70611
70625
  var LeaderboardDetailView = React144.memo(({
@@ -71381,14 +71395,6 @@ var LeaderboardDetailView = React144.memo(({
71381
71395
  filtered = filtered.filter((ws) => ws.shift_id?.toString() === selectedShiftFilter);
71382
71396
  }
71383
71397
  return filtered.sort((a, b) => {
71384
- if (isAssemblyMode) {
71385
- const ratioA = getCycleRatio(a);
71386
- const ratioB = getCycleRatio(b);
71387
- if (ratioA === null && ratioB === null) return 0;
71388
- if (ratioA === null) return 1;
71389
- if (ratioB === null) return -1;
71390
- return sortAscending ? ratioA - ratioB : ratioB - ratioA;
71391
- }
71392
71398
  const metricA = getWorkspaceLeaderboardMetricValue(a);
71393
71399
  const metricB = getWorkspaceLeaderboardMetricValue(b);
71394
71400
  if (metricA === null && metricB === null) return 0;
@@ -71458,7 +71464,13 @@ var LeaderboardDetailView = React144.memo(({
71458
71464
  error.message
71459
71465
  ] }) });
71460
71466
  }
71461
- const metricLabel = viewType === "machine" ? "Utilization" : isAssemblyMode ? "Cycle Time" : "Efficiency";
71467
+ const hasRecentFlowLeaderboardRows = sortedWorkspaces.some(
71468
+ (workspace) => workspace.leaderboard_metric_kind === "recent_flow_shift_average"
71469
+ );
71470
+ const hasEfficiencyLeaderboardRows = sortedWorkspaces.some(
71471
+ (workspace) => workspace.leaderboard_metric_kind !== "recent_flow_shift_average"
71472
+ );
71473
+ const metricLabel = viewType === "machine" ? "Utilization" : hasRecentFlowLeaderboardRows && !hasEfficiencyLeaderboardRows ? "Avg Flow" : hasRecentFlowLeaderboardRows && hasEfficiencyLeaderboardRows ? "Performance" : "Efficiency";
71462
71474
  const descendingSortLabel = "Highest to Lowest";
71463
71475
  const ascendingSortLabel = "Lowest to Highest";
71464
71476
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `min-h-screen bg-slate-50 flex flex-col ${className}`, style: { willChange: "contents" }, children: [
@@ -71722,8 +71734,7 @@ var LeaderboardDetailView = React144.memo(({
71722
71734
  isClickable: canOpenWorkspace(ws.line_id),
71723
71735
  onWorkspaceClick: stableHandleWorkspaceClick,
71724
71736
  getMedalIcon: stableGetMedalIcon,
71725
- metricLabel,
71726
- isAssemblyMode
71737
+ metricLabel
71727
71738
  },
71728
71739
  ws.workspace_uuid
71729
71740
  );
@@ -71747,8 +71758,7 @@ var LeaderboardDetailView = React144.memo(({
71747
71758
  rowClass,
71748
71759
  isClickable: canOpenWorkspace(ws.line_id),
71749
71760
  onWorkspaceClick: stableHandleWorkspaceClick,
71750
- getMedalIcon: stableGetMedalIcon,
71751
- isAssemblyMode
71761
+ getMedalIcon: stableGetMedalIcon
71752
71762
  },
71753
71763
  ws.workspace_uuid
71754
71764
  );
@@ -73578,6 +73588,7 @@ var SKUSelector = ({
73578
73588
  if (lineId && (sku.line_id ?? "") !== lineId) return false;
73579
73589
  const term = searchTerm.toLowerCase();
73580
73590
  if (term.length === 0) return true;
73591
+ if (getSkuDisplayName(sku).toLowerCase().includes(term)) return true;
73581
73592
  if ((sku.sku_id || "").toLowerCase().includes(term)) return true;
73582
73593
  if ((sku.sku_definition || "").toLowerCase().includes(term)) return true;
73583
73594
  return JSON.stringify(sku.attributes ?? {}).toLowerCase().includes(term);
@@ -73602,7 +73613,7 @@ var SKUSelector = ({
73602
73613
  disabled,
73603
73614
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
73604
73615
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: selectedSKU ? "text-gray-900" : "text-gray-500", children: selectedSKU ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
73605
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: selectedSKU.sku_id }),
73616
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: getSkuDisplayName(selectedSKU) }),
73606
73617
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-gray-500 ml-2", children: [
73607
73618
  "(Target: ",
73608
73619
  selectedSKU.production_target,
@@ -73646,7 +73657,7 @@ var SKUSelector = ({
73646
73657
  ${selectedSKU?.id === sku.id ? "bg-blue-50" : ""}
73647
73658
  `,
73648
73659
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
73649
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: sku.sku_id }),
73660
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: getSkuDisplayName(sku) }),
73650
73661
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-gray-500", children: [
73651
73662
  "Target: ",
73652
73663
  sku.production_target,
@@ -73702,44 +73713,50 @@ var SKUList = ({
73702
73713
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
73703
73714
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden lg:block bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [
73704
73715
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
73705
- /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "SKU Code" }),
73716
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "SKU" }),
73706
73717
  /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "Definition" }),
73707
73718
  /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "Line" }),
73708
73719
  /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "Production Target" }),
73709
73720
  /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "Status" }),
73710
73721
  /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "Created" })
73711
73722
  ] }) }),
73712
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: skus.map((sku) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "hover:bg-gray-50 transition-colors duration-150", children: [
73713
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-gray-900", children: sku.sku_id }) }),
73714
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700 max-w-md truncate", title: sku.sku_definition || "", children: sku.sku_definition || /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400", children: "\u2014" }) }) }),
73715
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700", children: formatLine(sku, lineNames) }) }),
73716
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-gray-700", children: formatTarget(sku.production_target) }) }),
73717
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex px-2 py-1 text-xs font-semibold rounded-full ${sku.is_active ? "bg-green-100 text-green-800" : "bg-gray-100 text-gray-800"}`, children: sku.is_active ? "Active" : "Inactive" }) }),
73718
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: formatCreatedAt(sku.created_at) })
73719
- ] }, sku.id)) })
73723
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: skus.map((sku) => {
73724
+ const displayName = getSkuDisplayName(sku);
73725
+ return /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "hover:bg-gray-50 transition-colors duration-150", children: [
73726
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-gray-900", children: displayName }) }),
73727
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700 max-w-md truncate", title: sku.sku_definition || "", children: sku.sku_definition || /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400", children: "\u2014" }) }) }),
73728
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700", children: formatLine(sku, lineNames) }) }),
73729
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-gray-700", children: formatTarget(sku.production_target) }) }),
73730
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex px-2 py-1 text-xs font-semibold rounded-full ${sku.is_active ? "bg-green-100 text-green-800" : "bg-gray-100 text-gray-800"}`, children: sku.is_active ? "Active" : "Inactive" }) }),
73731
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: formatCreatedAt(sku.created_at) })
73732
+ ] }, sku.id);
73733
+ }) })
73720
73734
  ] }) }) }),
73721
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:hidden space-y-3 sm:space-y-4", children: skus.map((sku) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-xl shadow-sm border border-gray-200 p-4 hover:shadow-md transition-all duration-200", children: [
73722
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between mb-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
73723
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base sm:text-lg font-semibold text-gray-900 truncate", children: sku.sku_id }),
73724
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex px-2 py-1 text-xs font-semibold rounded-full ${sku.is_active ? "bg-green-100 text-green-800" : "bg-gray-100 text-gray-800"}`, children: sku.is_active ? "Active" : "Inactive" }) })
73725
- ] }) }),
73726
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73727
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Definition" }),
73728
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700 break-words", children: sku.sku_definition || /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "\u2014" }) })
73729
- ] }),
73730
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73731
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Line" }),
73732
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700", children: formatLine(sku, lineNames) })
73733
- ] }),
73734
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73735
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Production Target" }),
73736
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm sm:text-base font-medium text-gray-700", children: formatTarget(sku.production_target) })
73737
- ] }),
73738
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-gray-500", children: [
73739
- "Created: ",
73740
- formatCreatedAt(sku.created_at)
73741
- ] })
73742
- ] }, sku.id)) })
73735
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:hidden space-y-3 sm:space-y-4", children: skus.map((sku) => {
73736
+ const displayName = getSkuDisplayName(sku);
73737
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-xl shadow-sm border border-gray-200 p-4 hover:shadow-md transition-all duration-200", children: [
73738
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between mb-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
73739
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base sm:text-lg font-semibold text-gray-900 truncate", children: displayName }),
73740
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex px-2 py-1 text-xs font-semibold rounded-full ${sku.is_active ? "bg-green-100 text-green-800" : "bg-gray-100 text-gray-800"}`, children: sku.is_active ? "Active" : "Inactive" }) })
73741
+ ] }) }),
73742
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73743
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Definition" }),
73744
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700 break-words", children: sku.sku_definition || /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 italic", children: "\u2014" }) })
73745
+ ] }),
73746
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73747
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Line" }),
73748
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700", children: formatLine(sku, lineNames) })
73749
+ ] }),
73750
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73751
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Production Target" }),
73752
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm sm:text-base font-medium text-gray-700", children: formatTarget(sku.production_target) })
73753
+ ] }),
73754
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-gray-500", children: [
73755
+ "Created: ",
73756
+ formatCreatedAt(sku.created_at)
73757
+ ] })
73758
+ ] }, sku.id);
73759
+ }) })
73743
73760
  ] });
73744
73761
  };
73745
73762
  var TargetsViewUI = ({
@@ -73970,7 +73987,7 @@ var TargetsViewUI = ({
73970
73987
  className: "w-full sm:w-auto rounded-lg border border-gray-300 bg-white px-3 py-1.5 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 transition-all duration-200 hover:border-gray-400",
73971
73988
  "aria-label": `SKU for ${formattedName}`,
73972
73989
  children: realSkuOptions.map((row) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: row.sku_uuid, children: [
73973
- row.sku_code,
73990
+ getSkuDisplayName(row),
73974
73991
  workspace.currentSku && !workspace.currentSku.is_dummy && workspace.currentSku.sku_uuid === row.sku_uuid ? " (active)" : ""
73975
73992
  ] }, row.sku_uuid))
73976
73993
  }
@@ -74237,8 +74254,14 @@ var TargetsView = ({
74237
74254
  const skuMetaByUuid = React144.useMemo(() => {
74238
74255
  const map = /* @__PURE__ */ new Map();
74239
74256
  skuCatalog.forEach((sku) => {
74257
+ const skuCode = sku.sku_id || sku.id;
74240
74258
  map.set(sku.id, {
74241
- sku_code: sku.sku_id || sku.id,
74259
+ sku_code: skuCode,
74260
+ sku_display_name: getSkuDisplayName({
74261
+ display_name: sku.display_name,
74262
+ sku_code: skuCode,
74263
+ id: sku.id
74264
+ }),
74242
74265
  is_dummy: sku.sku_definition === "dummy_definition",
74243
74266
  line_id: sku.line_id
74244
74267
  });
@@ -74250,11 +74273,20 @@ var TargetsView = ({
74250
74273
  skuCatalog.forEach((sku) => {
74251
74274
  if (sku.sku_definition === "dummy_definition") return;
74252
74275
  const list = map.get(sku.line_id) || [];
74253
- list.push({ sku_uuid: sku.id, sku_code: sku.sku_id || sku.id });
74276
+ const skuCode = sku.sku_id || sku.id;
74277
+ list.push({
74278
+ sku_uuid: sku.id,
74279
+ sku_code: skuCode,
74280
+ sku_display_name: getSkuDisplayName({
74281
+ display_name: sku.display_name,
74282
+ sku_code: skuCode,
74283
+ id: sku.id
74284
+ })
74285
+ });
74254
74286
  map.set(sku.line_id, list);
74255
74287
  });
74256
74288
  map.forEach((list) => list.sort(
74257
- (a, b) => a.sku_code.localeCompare(b.sku_code, void 0, { numeric: true })
74289
+ (a, b) => a.sku_display_name.localeCompare(b.sku_display_name, void 0, { numeric: true })
74258
74290
  ));
74259
74291
  return map;
74260
74292
  }, [skuCatalog]);
@@ -74402,8 +74434,9 @@ var TargetsView = ({
74402
74434
  const meta = skuMetaByUuid.get(skuUuid);
74403
74435
  skuRowsMap.set(skuUuid, {
74404
74436
  sku_uuid: skuUuid,
74405
- sku_code: meta?.sku_code || skuUuid,
74406
- is_dummy: meta?.is_dummy ?? false,
74437
+ sku_code: payload?.sku_code || meta?.sku_code || skuUuid,
74438
+ sku_display_name: payload?.sku_display_name || meta?.sku_display_name || payload?.sku_code || meta?.sku_code || skuUuid,
74439
+ is_dummy: payload?.is_dummy ?? meta?.is_dummy ?? false,
74407
74440
  pph_threshold: payload?.pph_threshold ? Math.round(payload.pph_threshold) : "",
74408
74441
  ideal_cycle_time: payload?.ideal_cycle_time ?? "",
74409
74442
  total_day_output: payload?.total_day_output ?? "",
@@ -74456,10 +74489,11 @@ var TargetsView = ({
74456
74489
  const lineDummySkuUuidFallback = dummySkuByLine.get(lineId) || null;
74457
74490
  const buildEmptySkuRows = () => {
74458
74491
  const rows = [];
74459
- lineNonDummySkusFallback.forEach(({ sku_uuid, sku_code }) => {
74492
+ lineNonDummySkusFallback.forEach(({ sku_uuid, sku_code, sku_display_name }) => {
74460
74493
  rows.push({
74461
74494
  sku_uuid,
74462
74495
  sku_code,
74496
+ sku_display_name,
74463
74497
  is_dummy: false,
74464
74498
  pph_threshold: "",
74465
74499
  ideal_cycle_time: "",
@@ -74472,6 +74506,7 @@ var TargetsView = ({
74472
74506
  rows.push({
74473
74507
  sku_uuid: lineDummySkuUuidFallback,
74474
74508
  sku_code: meta?.sku_code || lineDummySkuUuidFallback,
74509
+ sku_display_name: meta?.sku_display_name || meta?.sku_code || lineDummySkuUuidFallback,
74475
74510
  is_dummy: true,
74476
74511
  pph_threshold: "",
74477
74512
  ideal_cycle_time: "",
@@ -74798,6 +74833,7 @@ var TargetsView = ({
74798
74833
  rowsToSave = fallback ? [{
74799
74834
  sku_uuid: fallback.sku_uuid,
74800
74835
  sku_code: "",
74836
+ sku_display_name: "",
74801
74837
  is_dummy: true,
74802
74838
  pph_threshold: fallback.pph_threshold,
74803
74839
  ideal_cycle_time: fallback.ideal_cycle_time,
@@ -76865,7 +76901,7 @@ var SKUManagementView = () => {
76865
76901
  if (activeFilter === "inactive" && sku.is_active) return false;
76866
76902
  if (lineFilter !== "all" && sku.line_id !== lineFilter) return false;
76867
76903
  if (term.length === 0) return true;
76868
- return (sku.sku_id || "").toLowerCase().includes(term);
76904
+ return getSkuDisplayName(sku).toLowerCase().includes(term) || (sku.sku_id || "").toLowerCase().includes(term);
76869
76905
  });
76870
76906
  }, [skus, searchTerm, lineFilter, activeFilter]);
76871
76907
  const handleBack = () => {
@@ -76905,9 +76941,9 @@ var SKUManagementView = () => {
76905
76941
  type: "search",
76906
76942
  value: searchTerm,
76907
76943
  onChange: (event) => setSearchTerm(event.target.value),
76908
- placeholder: "Search by SKU code",
76944
+ placeholder: "Search by SKU",
76909
76945
  className: "w-full pl-9 pr-3 py-2 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
76910
- "aria-label": "Search SKUs by code"
76946
+ "aria-label": "Search SKUs"
76911
76947
  }
76912
76948
  )
76913
76949
  ] }),