@optifye/dashboard-core 6.12.8 → 6.12.10

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) }),
@@ -51365,19 +51379,12 @@ var fitTextWithEllipsis = (doc, text, maxWidth) => {
51365
51379
  var LinePdfGenerator = ({
51366
51380
  lineInfo,
51367
51381
  workspaceData,
51368
- issueResolutionSummary,
51369
51382
  shiftName,
51370
51383
  className,
51371
51384
  shiftBreaks = [],
51372
51385
  reportTimezone = "Asia/Kolkata"
51373
51386
  }) => {
51374
51387
  const [isGenerating, setIsGenerating] = React144.useState(false);
51375
- const formatResolutionDuration2 = (seconds) => {
51376
- if (seconds === null || seconds === void 0 || seconds <= 0) {
51377
- return "-";
51378
- }
51379
- return formatIdleTime(Math.max(0, Math.floor(seconds)));
51380
- };
51381
51388
  const generatePDF = async () => {
51382
51389
  setIsGenerating(true);
51383
51390
  try {
@@ -51700,7 +51707,7 @@ var LinePdfGenerator = ({
51700
51707
  doc.line(20, 53, 190, 53);
51701
51708
  const perfOverviewStartY = 58;
51702
51709
  doc.setFillColor(245, 245, 245);
51703
- doc.roundedRect(15, perfOverviewStartY, 180, 50, 3, 3, "F");
51710
+ doc.roundedRect(15, perfOverviewStartY, 180, 40, 3, 3, "F");
51704
51711
  doc.setFontSize(18);
51705
51712
  doc.setFont("helvetica", "bold");
51706
51713
  doc.setTextColor(40, 40, 40);
@@ -51716,20 +51723,13 @@ var LinePdfGenerator = ({
51716
51723
  doc.text(`${lineInfo.metrics.current_output} / ${lineInfo.metrics.line_threshold}`, 120, kpiStartY);
51717
51724
  createKPIBox(kpiStartY + kpiSpacing);
51718
51725
  doc.setFont("helvetica", "normal");
51719
- doc.text("Issue Resolution Time:", 25, kpiStartY + kpiSpacing);
51720
- doc.setFont("helvetica", "bold");
51721
- const resolutionSeconds = issueResolutionSummary ? issueResolutionSummary.mean_resolution_seconds ?? issueResolutionSummary.median_resolution_seconds : null;
51722
- const displayValue = resolutionSeconds !== null ? formatResolutionDuration2(resolutionSeconds) : "-";
51723
- doc.text(displayValue, 120, kpiStartY + kpiSpacing);
51724
- createKPIBox(kpiStartY + kpiSpacing * 2);
51725
- doc.setFont("helvetica", "normal");
51726
- doc.text("Average Efficiency:", 25, kpiStartY + kpiSpacing * 2);
51726
+ doc.text("Average Efficiency:", 25, kpiStartY + kpiSpacing);
51727
51727
  doc.setFont("helvetica", "bold");
51728
- doc.text(`${lineInfo.metrics.avg_efficiency.toFixed(1)}%`, 120, kpiStartY + kpiSpacing * 2);
51728
+ doc.text(`${lineInfo.metrics.avg_efficiency.toFixed(1)}%`, 120, kpiStartY + kpiSpacing);
51729
51729
  doc.setDrawColor(180, 180, 180);
51730
51730
  doc.setLineWidth(0.8);
51731
- doc.line(20, 123, 190, 123);
51732
- const hourlyOverviewStartY = 128;
51731
+ doc.line(20, 113, 190, 113);
51732
+ const hourlyOverviewStartY = 118;
51733
51733
  const formatMinutesLabel = (totalMinutes) => {
51734
51734
  const normalized = (totalMinutes % (24 * 60) + 24 * 60) % (24 * 60);
51735
51735
  const hour = Math.floor(normalized / 60);
@@ -51766,7 +51766,7 @@ var LinePdfGenerator = ({
51766
51766
  if (intervalIndex >= 0) {
51767
51767
  if (segmentIndex > 0 || segmentMinutes > hourlyTimeRanges[0]?.start) {
51768
51768
  if (!skuRemarksByIndex[intervalIndex]) skuRemarksByIndex[intervalIndex] = [];
51769
- skuRemarksByIndex[intervalIndex].push(segment.sku_code);
51769
+ skuRemarksByIndex[intervalIndex].push(getSkuDisplayName(segment));
51770
51770
  }
51771
51771
  }
51772
51772
  }
@@ -51919,8 +51919,8 @@ var LinePdfGenerator = ({
51919
51919
  return Math.round(lineInfo.metrics.current_output / shiftDuration);
51920
51920
  });
51921
51921
  }
51922
- const tableHeaderY = 151;
51923
- const tableStartY = 158;
51922
+ const tableHeaderY = 141;
51923
+ const tableStartY = 148;
51924
51924
  const rowSpacing = 8;
51925
51925
  const bottomPadding = 8;
51926
51926
  const hourlyTableHeight = hourlyTimeRanges.length * rowSpacing;
@@ -51930,10 +51930,10 @@ var LinePdfGenerator = ({
51930
51930
  doc.setFontSize(18);
51931
51931
  doc.setFont("helvetica", "bold");
51932
51932
  doc.setTextColor(40, 40, 40);
51933
- doc.text("Hourly Performance", 20, 138);
51933
+ doc.text("Hourly Performance", 20, 128);
51934
51934
  doc.setTextColor(0, 0, 0);
51935
- const gridTopY = 144;
51936
- const headerBottomY = 153;
51935
+ const gridTopY = 134;
51936
+ const headerBottomY = 143;
51937
51937
  const colBoundaries = [20, 70, 100, 130, 155, 190];
51938
51938
  const totalRows = hourlyTimeRanges.length;
51939
51939
  const gridBottomY = headerBottomY + totalRows * rowSpacing;
@@ -53780,7 +53780,7 @@ var WorkspacePdfGenerator = ({
53780
53780
  if (intervalIndex >= 0) {
53781
53781
  if (segmentIndex > 0 || segmentMinutes > hourlyIntervals[0]?.start) {
53782
53782
  if (!skuRemarksByIndex[intervalIndex]) skuRemarksByIndex[intervalIndex] = [];
53783
- skuRemarksByIndex[intervalIndex].push(segment.sku_code);
53783
+ skuRemarksByIndex[intervalIndex].push(getSkuDisplayName(segment));
53784
53784
  }
53785
53785
  }
53786
53786
  }
@@ -54445,6 +54445,7 @@ var WorkspaceCycleTimeMetricCards = ({
54445
54445
  }, [activeSku, skuAware, activeSkuId, liveSkuId, skuBreakdown]);
54446
54446
  const cycleValue = activeSku ? activeSku.avg_cycle_time : workspace.avg_cycle_time;
54447
54447
  const cycleStandard = activeSku ? activeSku.ideal_cycle_time : workspace.ideal_cycle_time;
54448
+ const displaySkuLabel = displaySku ? getSkuDisplayName(displaySku) : "";
54448
54449
  const efficiencyValue = workspace.avg_efficiency || 0;
54449
54450
  const efficiencyTarget = effectiveLegend.green_min;
54450
54451
  const efficiencyColor = getEfficiencyHexColor(efficiencyValue, effectiveLegend);
@@ -54472,7 +54473,7 @@ var WorkspaceCycleTimeMetricCards = ({
54472
54473
  /* @__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
54474
  /* @__PURE__ */ jsxRuntime.jsxs(CardHeader2, { className: "pb-1 pt-5 flex-none text-center", children: [
54474
54475
  /* @__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 })
54476
+ displaySku && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySkuLabel, children: displaySkuLabel })
54476
54477
  ] }),
54477
54478
  /* @__PURE__ */ jsxRuntime.jsxs(CardContent2, { className: "flex-1 flex flex-col items-center justify-center pb-6", children: [
54478
54479
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-5xl font-bold tracking-tight ${cycleValue > (cycleStandard || 0) ? "text-red-500" : "text-[#34C759]"}`, children: cycleValue.toFixed(1) }),
@@ -66407,25 +66408,8 @@ var formatLocalDate = (date) => {
66407
66408
  };
66408
66409
  return date.toLocaleDateString("en-US", options);
66409
66410
  };
66410
- var formatResolutionDuration = (seconds) => {
66411
- if (seconds === null || seconds === void 0 || seconds <= 0) {
66412
- return "-";
66413
- }
66414
- return formatIdleTime(Math.max(0, Math.floor(seconds)));
66415
- };
66416
- var getIssueResolutionSecondaryText = (summary) => {
66417
- if (!summary) {
66418
- return "No issue data";
66419
- }
66420
- const parts = [`${summary.resolved_issue_count} resolved`];
66421
- if ((summary.open_issue_count || 0) > 0) {
66422
- parts.push(`oldest open ${formatResolutionDuration(summary.oldest_open_issue_age_seconds)}`);
66423
- }
66424
- return parts.join(" \u2022 ");
66425
- };
66426
66411
  var MetricCards = React144.memo(({
66427
66412
  lineInfo,
66428
- issueResolutionSummary,
66429
66413
  idleTimeData,
66430
66414
  showIdleTime,
66431
66415
  efficiencyLegend,
@@ -66437,13 +66421,7 @@ var MetricCards = React144.memo(({
66437
66421
  }) => {
66438
66422
  const efficiency = lineInfo?.metrics.avg_efficiency || 0;
66439
66423
  const efficiencyColorClass = getEfficiencyTextColorClasses(efficiency, efficiencyLegend);
66440
- const showIssueResolutionCard = Boolean(issueResolutionSummary);
66441
- const largeGridColumns = showIdleTime ? showIssueResolutionCard ? "lg:grid-cols-5" : "lg:grid-cols-4" : showIssueResolutionCard ? "lg:grid-cols-4" : "lg:grid-cols-3";
66442
- const shouldMaskIssueResolution = efficiency < 5;
66443
- const issueResolutionValue = shouldMaskIssueResolution ? "-" : formatResolutionDuration(
66444
- issueResolutionSummary?.mean_resolution_seconds ?? issueResolutionSummary?.median_resolution_seconds
66445
- );
66446
- getIssueResolutionSecondaryText(issueResolutionSummary);
66424
+ const largeGridColumns = showIdleTime ? "lg:grid-cols-4" : "lg:grid-cols-3";
66447
66425
  const outputTarget = lineInfo?.metrics.output_target_recalculated ?? lineInfo?.metrics.line_threshold ?? 0;
66448
66426
  return /* @__PURE__ */ jsxRuntime.jsxs(
66449
66427
  motion.div,
@@ -66484,28 +66462,6 @@ var MetricCards = React144.memo(({
66484
66462
  "%"
66485
66463
  ] }) })
66486
66464
  ] }),
66487
- showIssueResolutionCard && /* @__PURE__ */ jsxRuntime.jsxs(
66488
- motion.div,
66489
- {
66490
- variants: itemVariants,
66491
- className: "bg-white rounded-xl shadow-sm p-3 sm:p-4 flex flex-col overflow-hidden h-[240px] sm:h-[260px] md:h-auto",
66492
- children: [
66493
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-10 sm:h-12 flex items-start justify-center gap-1.5 mb-2 mt-1 relative group z-10", children: [
66494
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm sm:text-base font-bold text-gray-700 text-center", children: "Issue Resolution Time" }),
66495
- /* @__PURE__ */ jsxRuntime.jsx(outline.InformationCircleIcon, { className: "w-4 h-4 text-gray-400 cursor-help flex-shrink-0" }),
66496
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute top-full left-1/2 transform -translate-x-1/2 mt-2.5 w-[260px] p-3 bg-white rounded-lg shadow-xl border border-gray-200 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 pointer-events-none z-50", children: [
66497
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-xs text-gray-600 leading-relaxed mb-2.5 px-1", children: "The average time a supervisor takes to resolve a workstation in red." }),
66498
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-gray-50 rounded-md py-1.5 border border-gray-100/80", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-center font-medium text-[11px] text-gray-500", children: [
66499
- ((issueResolutionSummary?.resolved_issue_count || 0) + (issueResolutionSummary?.open_issue_count || 0)).toLocaleString(),
66500
- " recorded issues"
66501
- ] }) }),
66502
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -top-1.5 left-1/2 transform -translate-x-1/2 w-3 h-3 bg-white border-l border-t border-gray-200 rotate-45" })
66503
- ] })
66504
- ] }),
66505
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: `whitespace-nowrap tracking-tight text-3xl sm:text-4xl md:text-4xl lg:text-3xl xl:text-4xl 2xl:text-5xl font-bold ${shouldMaskIssueResolution ? "text-gray-400" : "text-gray-900"}`, children: issueResolutionValue }) })
66506
- ]
66507
- }
66508
- ),
66509
66465
  showIdleTime && /* @__PURE__ */ jsxRuntime.jsxs(motion.div, { variants: itemVariants, className: "bg-white rounded-xl shadow-sm p-3 sm:p-4 flex flex-col overflow-hidden h-[240px] sm:h-[260px] md:h-auto", children: [
66510
66466
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 sm:h-12 flex items-start justify-center mb-2 mt-1", children: /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm sm:text-base font-bold text-gray-700 text-center", children: "Idle Time Breakdown" }) }),
66511
66467
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -66531,6 +66487,7 @@ var MetricCards = React144.memo(({
66531
66487
  (prevProps.skuBreakdown || []).map((sku) => ({
66532
66488
  sku_id: sku.sku_id,
66533
66489
  sku_code: sku.sku_code,
66490
+ sku_display_name: sku.sku_display_name,
66534
66491
  total_output: sku.total_output,
66535
66492
  target_output: sku.target_output,
66536
66493
  avg_pph: sku.avg_pph,
@@ -66546,6 +66503,7 @@ var MetricCards = React144.memo(({
66546
66503
  (nextProps.skuBreakdown || []).map((sku) => ({
66547
66504
  sku_id: sku.sku_id,
66548
66505
  sku_code: sku.sku_code,
66506
+ sku_display_name: sku.sku_display_name,
66549
66507
  total_output: sku.total_output,
66550
66508
  target_output: sku.target_output,
66551
66509
  avg_pph: sku.avg_pph,
@@ -66560,8 +66518,6 @@ var MetricCards = React144.memo(({
66560
66518
  if (prevSkuSignature !== nextSkuSignature) return false;
66561
66519
  const prevMetrics = prevProps.lineInfo.metrics;
66562
66520
  const nextMetrics = nextProps.lineInfo.metrics;
66563
- const prevIssueSummary = prevProps.issueResolutionSummary;
66564
- const nextIssueSummary = nextProps.issueResolutionSummary;
66565
66521
  const prevIdleChartSignature = JSON.stringify(
66566
66522
  (prevProps.idleTimeData?.chartData || []).map((entry) => ({
66567
66523
  name: entry.name,
@@ -66580,9 +66536,6 @@ var MetricCards = React144.memo(({
66580
66536
  );
66581
66537
  const idleTimeChanged = prevProps.idleTimeData?.isLoading !== nextProps.idleTimeData?.isLoading || prevProps.idleTimeData?.error !== nextProps.idleTimeData?.error || prevIdleChartSignature !== nextIdleChartSignature || prevProps.idleTimeData?.data?.total_idle_time_seconds !== nextProps.idleTimeData?.data?.total_idle_time_seconds || prevProps.idleTimeData?.data?.scope_work_seconds !== nextProps.idleTimeData?.data?.scope_work_seconds;
66582
66538
  if (idleTimeChanged) return false;
66583
- if (prevIssueSummary?.mean_resolution_seconds !== nextIssueSummary?.mean_resolution_seconds || prevIssueSummary?.median_resolution_seconds !== nextIssueSummary?.median_resolution_seconds || prevIssueSummary?.resolved_issue_count !== nextIssueSummary?.resolved_issue_count || prevIssueSummary?.open_issue_count !== nextIssueSummary?.open_issue_count || prevIssueSummary?.oldest_open_issue_age_seconds !== nextIssueSummary?.oldest_open_issue_age_seconds || prevIssueSummary?.total_issue_seconds !== nextIssueSummary?.total_issue_seconds) {
66584
- return false;
66585
- }
66586
66539
  return prevMetrics.current_output === nextMetrics.current_output && prevMetrics.line_threshold === nextMetrics.line_threshold && prevMetrics.output_target_recalculated === nextMetrics.output_target_recalculated && prevMetrics.underperforming_workspaces === nextMetrics.underperforming_workspaces && prevMetrics.total_workspaces === nextMetrics.total_workspaces && prevMetrics.avg_efficiency === nextMetrics.avg_efficiency;
66587
66540
  });
66588
66541
  MetricCards.displayName = "MetricCards";
@@ -66855,6 +66808,7 @@ var BottomSection = React144.memo(({
66855
66808
  (prevProps.skuSegments || []).map((segment) => ({
66856
66809
  sku_id: segment.sku_id,
66857
66810
  sku_code: segment.sku_code,
66811
+ sku_display_name: segment.sku_display_name,
66858
66812
  start_time: segment.start_time,
66859
66813
  end_time: segment.end_time,
66860
66814
  pph_threshold: segment.pph_threshold
@@ -66864,6 +66818,7 @@ var BottomSection = React144.memo(({
66864
66818
  (nextProps.skuSegments || []).map((segment) => ({
66865
66819
  sku_id: segment.sku_id,
66866
66820
  sku_code: segment.sku_code,
66821
+ sku_display_name: segment.sku_display_name,
66867
66822
  start_time: segment.start_time,
66868
66823
  end_time: segment.end_time,
66869
66824
  pph_threshold: segment.pph_threshold
@@ -67544,6 +67499,7 @@ var KPIDetailView = ({
67544
67499
  }).map((item) => ({
67545
67500
  sku_id: item.sku_id,
67546
67501
  sku_code: item.sku_code,
67502
+ sku_display_name: item.sku_display_name,
67547
67503
  sku_definition: "",
67548
67504
  is_dummy: false,
67549
67505
  total_output: item.current_output ?? 0,
@@ -67608,11 +67564,13 @@ var KPIDetailView = ({
67608
67564
  }, [resolvedLineInfo, selectedSkuRow]);
67609
67565
  const handleSkuChange = React144.useCallback((nextSkuId) => {
67610
67566
  if (nextSkuId === selectedSkuId) return;
67567
+ const selectedSkuOption = nextSkuId === "all" ? null : realSkuOptions.find((item) => item.sku_id === nextSkuId) ?? null;
67611
67568
  setSelectedSkuId(nextSkuId);
67612
67569
  trackCoreEvent("Line Detail SKU Filter Changed", {
67613
67570
  line_id: lineId,
67614
67571
  sku_id: nextSkuId === "all" ? null : nextSkuId,
67615
- sku_code: nextSkuId === "all" ? null : realSkuOptions.find((item) => item.sku_id === nextSkuId)?.sku_code ?? null
67572
+ sku_code: selectedSkuOption?.sku_code ?? null,
67573
+ sku_display_name: selectedSkuOption ? getSkuDisplayName(selectedSkuOption) : null
67616
67574
  });
67617
67575
  }, [lineId, realSkuOptions, selectedSkuId]);
67618
67576
  const handleChartSkuSelect = React144.useCallback(
@@ -68388,7 +68346,6 @@ var KPIDetailView = ({
68388
68346
  MetricCards,
68389
68347
  {
68390
68348
  lineInfo: displayLineInfo ?? resolvedLineInfo,
68391
- issueResolutionSummary,
68392
68349
  idleTimeData,
68393
68350
  showIdleTime: idleTimeVlmEnabled,
68394
68351
  efficiencyLegend,
@@ -68503,7 +68460,6 @@ var KPIDetailView = ({
68503
68460
  MetricCards,
68504
68461
  {
68505
68462
  lineInfo: displayLineInfo ?? resolvedLineInfo,
68506
- issueResolutionSummary,
68507
68463
  idleTimeData,
68508
68464
  showIdleTime: idleTimeVlmEnabled,
68509
68465
  efficiencyLegend,
@@ -73566,6 +73522,7 @@ var SKUSelector = ({
73566
73522
  if (lineId && (sku.line_id ?? "") !== lineId) return false;
73567
73523
  const term = searchTerm.toLowerCase();
73568
73524
  if (term.length === 0) return true;
73525
+ if (getSkuDisplayName(sku).toLowerCase().includes(term)) return true;
73569
73526
  if ((sku.sku_id || "").toLowerCase().includes(term)) return true;
73570
73527
  if ((sku.sku_definition || "").toLowerCase().includes(term)) return true;
73571
73528
  return JSON.stringify(sku.attributes ?? {}).toLowerCase().includes(term);
@@ -73590,7 +73547,7 @@ var SKUSelector = ({
73590
73547
  disabled,
73591
73548
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
73592
73549
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: selectedSKU ? "text-gray-900" : "text-gray-500", children: selectedSKU ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
73593
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: selectedSKU.sku_id }),
73550
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: getSkuDisplayName(selectedSKU) }),
73594
73551
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-gray-500 ml-2", children: [
73595
73552
  "(Target: ",
73596
73553
  selectedSKU.production_target,
@@ -73634,7 +73591,7 @@ var SKUSelector = ({
73634
73591
  ${selectedSKU?.id === sku.id ? "bg-blue-50" : ""}
73635
73592
  `,
73636
73593
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
73637
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: sku.sku_id }),
73594
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: getSkuDisplayName(sku) }),
73638
73595
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-gray-500", children: [
73639
73596
  "Target: ",
73640
73597
  sku.production_target,
@@ -73690,44 +73647,50 @@ var SKUList = ({
73690
73647
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
73691
73648
  /* @__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: [
73692
73649
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
73693
- /* @__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" }),
73650
+ /* @__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" }),
73694
73651
  /* @__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" }),
73695
73652
  /* @__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" }),
73696
73653
  /* @__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" }),
73697
73654
  /* @__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" }),
73698
73655
  /* @__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" })
73699
73656
  ] }) }),
73700
- /* @__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: [
73701
- /* @__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 }) }),
73702
- /* @__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" }) }) }),
73703
- /* @__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) }) }),
73704
- /* @__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) }) }),
73705
- /* @__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" }) }),
73706
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: formatCreatedAt(sku.created_at) })
73707
- ] }, sku.id)) })
73657
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: skus.map((sku) => {
73658
+ const displayName = getSkuDisplayName(sku);
73659
+ return /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "hover:bg-gray-50 transition-colors duration-150", children: [
73660
+ /* @__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 }) }),
73661
+ /* @__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" }) }) }),
73662
+ /* @__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) }) }),
73663
+ /* @__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) }) }),
73664
+ /* @__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" }) }),
73665
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: formatCreatedAt(sku.created_at) })
73666
+ ] }, sku.id);
73667
+ }) })
73708
73668
  ] }) }) }),
73709
- /* @__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: [
73710
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between mb-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
73711
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base sm:text-lg font-semibold text-gray-900 truncate", children: sku.sku_id }),
73712
- /* @__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" }) })
73713
- ] }) }),
73714
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73715
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Definition" }),
73716
- /* @__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" }) })
73717
- ] }),
73718
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73719
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Line" }),
73720
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700", children: formatLine(sku, lineNames) })
73721
- ] }),
73722
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73723
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Production Target" }),
73724
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm sm:text-base font-medium text-gray-700", children: formatTarget(sku.production_target) })
73725
- ] }),
73726
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-gray-500", children: [
73727
- "Created: ",
73728
- formatCreatedAt(sku.created_at)
73729
- ] })
73730
- ] }, sku.id)) })
73669
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:hidden space-y-3 sm:space-y-4", children: skus.map((sku) => {
73670
+ const displayName = getSkuDisplayName(sku);
73671
+ 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: [
73672
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between mb-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
73673
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base sm:text-lg font-semibold text-gray-900 truncate", children: displayName }),
73674
+ /* @__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" }) })
73675
+ ] }) }),
73676
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73677
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Definition" }),
73678
+ /* @__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" }) })
73679
+ ] }),
73680
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73681
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Line" }),
73682
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-700", children: formatLine(sku, lineNames) })
73683
+ ] }),
73684
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
73685
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Production Target" }),
73686
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm sm:text-base font-medium text-gray-700", children: formatTarget(sku.production_target) })
73687
+ ] }),
73688
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-gray-500", children: [
73689
+ "Created: ",
73690
+ formatCreatedAt(sku.created_at)
73691
+ ] })
73692
+ ] }, sku.id);
73693
+ }) })
73731
73694
  ] });
73732
73695
  };
73733
73696
  var TargetsViewUI = ({
@@ -73958,7 +73921,7 @@ var TargetsViewUI = ({
73958
73921
  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",
73959
73922
  "aria-label": `SKU for ${formattedName}`,
73960
73923
  children: realSkuOptions.map((row) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: row.sku_uuid, children: [
73961
- row.sku_code,
73924
+ getSkuDisplayName(row),
73962
73925
  workspace.currentSku && !workspace.currentSku.is_dummy && workspace.currentSku.sku_uuid === row.sku_uuid ? " (active)" : ""
73963
73926
  ] }, row.sku_uuid))
73964
73927
  }
@@ -74225,8 +74188,14 @@ var TargetsView = ({
74225
74188
  const skuMetaByUuid = React144.useMemo(() => {
74226
74189
  const map = /* @__PURE__ */ new Map();
74227
74190
  skuCatalog.forEach((sku) => {
74191
+ const skuCode = sku.sku_id || sku.id;
74228
74192
  map.set(sku.id, {
74229
- sku_code: sku.sku_id || sku.id,
74193
+ sku_code: skuCode,
74194
+ sku_display_name: getSkuDisplayName({
74195
+ display_name: sku.display_name,
74196
+ sku_code: skuCode,
74197
+ id: sku.id
74198
+ }),
74230
74199
  is_dummy: sku.sku_definition === "dummy_definition",
74231
74200
  line_id: sku.line_id
74232
74201
  });
@@ -74238,11 +74207,20 @@ var TargetsView = ({
74238
74207
  skuCatalog.forEach((sku) => {
74239
74208
  if (sku.sku_definition === "dummy_definition") return;
74240
74209
  const list = map.get(sku.line_id) || [];
74241
- list.push({ sku_uuid: sku.id, sku_code: sku.sku_id || sku.id });
74210
+ const skuCode = sku.sku_id || sku.id;
74211
+ list.push({
74212
+ sku_uuid: sku.id,
74213
+ sku_code: skuCode,
74214
+ sku_display_name: getSkuDisplayName({
74215
+ display_name: sku.display_name,
74216
+ sku_code: skuCode,
74217
+ id: sku.id
74218
+ })
74219
+ });
74242
74220
  map.set(sku.line_id, list);
74243
74221
  });
74244
74222
  map.forEach((list) => list.sort(
74245
- (a, b) => a.sku_code.localeCompare(b.sku_code, void 0, { numeric: true })
74223
+ (a, b) => a.sku_display_name.localeCompare(b.sku_display_name, void 0, { numeric: true })
74246
74224
  ));
74247
74225
  return map;
74248
74226
  }, [skuCatalog]);
@@ -74390,8 +74368,9 @@ var TargetsView = ({
74390
74368
  const meta = skuMetaByUuid.get(skuUuid);
74391
74369
  skuRowsMap.set(skuUuid, {
74392
74370
  sku_uuid: skuUuid,
74393
- sku_code: meta?.sku_code || skuUuid,
74394
- is_dummy: meta?.is_dummy ?? false,
74371
+ sku_code: payload?.sku_code || meta?.sku_code || skuUuid,
74372
+ sku_display_name: payload?.sku_display_name || meta?.sku_display_name || payload?.sku_code || meta?.sku_code || skuUuid,
74373
+ is_dummy: payload?.is_dummy ?? meta?.is_dummy ?? false,
74395
74374
  pph_threshold: payload?.pph_threshold ? Math.round(payload.pph_threshold) : "",
74396
74375
  ideal_cycle_time: payload?.ideal_cycle_time ?? "",
74397
74376
  total_day_output: payload?.total_day_output ?? "",
@@ -74444,10 +74423,11 @@ var TargetsView = ({
74444
74423
  const lineDummySkuUuidFallback = dummySkuByLine.get(lineId) || null;
74445
74424
  const buildEmptySkuRows = () => {
74446
74425
  const rows = [];
74447
- lineNonDummySkusFallback.forEach(({ sku_uuid, sku_code }) => {
74426
+ lineNonDummySkusFallback.forEach(({ sku_uuid, sku_code, sku_display_name }) => {
74448
74427
  rows.push({
74449
74428
  sku_uuid,
74450
74429
  sku_code,
74430
+ sku_display_name,
74451
74431
  is_dummy: false,
74452
74432
  pph_threshold: "",
74453
74433
  ideal_cycle_time: "",
@@ -74460,6 +74440,7 @@ var TargetsView = ({
74460
74440
  rows.push({
74461
74441
  sku_uuid: lineDummySkuUuidFallback,
74462
74442
  sku_code: meta?.sku_code || lineDummySkuUuidFallback,
74443
+ sku_display_name: meta?.sku_display_name || meta?.sku_code || lineDummySkuUuidFallback,
74463
74444
  is_dummy: true,
74464
74445
  pph_threshold: "",
74465
74446
  ideal_cycle_time: "",
@@ -74786,6 +74767,7 @@ var TargetsView = ({
74786
74767
  rowsToSave = fallback ? [{
74787
74768
  sku_uuid: fallback.sku_uuid,
74788
74769
  sku_code: "",
74770
+ sku_display_name: "",
74789
74771
  is_dummy: true,
74790
74772
  pph_threshold: fallback.pph_threshold,
74791
74773
  ideal_cycle_time: fallback.ideal_cycle_time,
@@ -76853,7 +76835,7 @@ var SKUManagementView = () => {
76853
76835
  if (activeFilter === "inactive" && sku.is_active) return false;
76854
76836
  if (lineFilter !== "all" && sku.line_id !== lineFilter) return false;
76855
76837
  if (term.length === 0) return true;
76856
- return (sku.sku_id || "").toLowerCase().includes(term);
76838
+ return getSkuDisplayName(sku).toLowerCase().includes(term) || (sku.sku_id || "").toLowerCase().includes(term);
76857
76839
  });
76858
76840
  }, [skus, searchTerm, lineFilter, activeFilter]);
76859
76841
  const handleBack = () => {
@@ -76893,9 +76875,9 @@ var SKUManagementView = () => {
76893
76875
  type: "search",
76894
76876
  value: searchTerm,
76895
76877
  onChange: (event) => setSearchTerm(event.target.value),
76896
- placeholder: "Search by SKU code",
76878
+ placeholder: "Search by SKU",
76897
76879
  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",
76898
- "aria-label": "Search SKUs by code"
76880
+ "aria-label": "Search SKUs"
76899
76881
  }
76900
76882
  )
76901
76883
  ] }),