@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.mjs CHANGED
@@ -16,7 +16,7 @@ import { BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, ReferenceLine, Too
16
16
  import { Slot } from '@radix-ui/react-slot';
17
17
  import * as SelectPrimitive from '@radix-ui/react-select';
18
18
  import { DayPicker, useNavigation as useNavigation$1 } from 'react-day-picker';
19
- import { AdjustmentsHorizontalIcon, ClockIcon, UsersIcon, UserCircleIcon, TicketIcon, CurrencyDollarIcon, QuestionMarkCircleIcon, XMarkIcon, InformationCircleIcon, ArrowRightIcon, Bars3Icon, HomeIcon, VideoCameraIcon, TrophyIcon, ChartBarIcon, LightBulbIcon, CubeIcon, HeartIcon, Cog6ToothIcon, ChevronRightIcon, ArrowRightStartOnRectangleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, CalendarIcon, ChevronDownIcon, ChevronLeftIcon, EnvelopeIcon, DocumentTextIcon, ChevronUpIcon, ArrowDownTrayIcon, CheckCircleIcon, ChatBubbleLeftRightIcon, XCircleIcon, FunnelIcon, EyeIcon, ArrowLeftIcon, PlayCircleIcon } from '@heroicons/react/24/outline';
19
+ import { AdjustmentsHorizontalIcon, ClockIcon, UsersIcon, UserCircleIcon, TicketIcon, CurrencyDollarIcon, QuestionMarkCircleIcon, XMarkIcon, ArrowRightIcon, Bars3Icon, HomeIcon, VideoCameraIcon, TrophyIcon, ChartBarIcon, LightBulbIcon, CubeIcon, HeartIcon, Cog6ToothIcon, ChevronRightIcon, ArrowRightStartOnRectangleIcon, ExclamationCircleIcon, ExclamationTriangleIcon, CalendarIcon, ChevronDownIcon, ChevronLeftIcon, EnvelopeIcon, DocumentTextIcon, ChevronUpIcon, ArrowDownTrayIcon, CheckCircleIcon, ChatBubbleLeftRightIcon, XCircleIcon, FunnelIcon, EyeIcon, InformationCircleIcon, ArrowLeftIcon, PlayCircleIcon } from '@heroicons/react/24/outline';
20
20
  import { CheckIcon } from '@heroicons/react/24/solid';
21
21
  import html2canvas from 'html2canvas';
22
22
  import jsPDF, { jsPDF as jsPDF$1 } from 'jspdf';
@@ -4522,11 +4522,12 @@ var fetchLineDummySkuId = async (supabase, lineId, skuTable = "skus") => {
4522
4522
  var fetchLineSkuCatalog = async (supabase, lineId, skuTable = "skus") => {
4523
4523
  if (!supabase || !lineId) return [];
4524
4524
  try {
4525
- const { data } = await supabase.from(skuTable).select("id, sku_id, sku_definition").eq("line_id", lineId).eq("is_active", true);
4525
+ const { data } = await supabase.from(skuTable).select("id, sku_id, display_name, sku_definition").eq("line_id", lineId).eq("is_active", true);
4526
4526
  if (Array.isArray(data)) {
4527
4527
  return data.filter((item) => item && typeof item.id === "string").map((item) => ({
4528
4528
  id: item.id,
4529
4529
  sku_id: typeof item.sku_id === "string" ? item.sku_id : null,
4530
+ display_name: typeof item.display_name === "string" ? item.display_name : null,
4530
4531
  sku_definition: typeof item.sku_definition === "string" ? item.sku_definition : null
4531
4532
  }));
4532
4533
  }
@@ -4547,10 +4548,12 @@ var buildLineSkuBreakdown = (rows, skuCatalog) => {
4547
4548
  if (!skuUuid) return null;
4548
4549
  const meta = catalogById.get(skuUuid);
4549
4550
  const skuCode = meta?.sku_id || skuUuid;
4551
+ const skuDisplayName = meta?.display_name?.trim() || skuCode;
4550
4552
  const isDummy = meta?.sku_definition === "dummy_definition";
4551
4553
  return {
4552
4554
  sku_id: skuUuid,
4553
4555
  sku_code: skuCode,
4556
+ sku_display_name: skuDisplayName,
4554
4557
  is_dummy: isDummy,
4555
4558
  current_output: safeInt(row.current_output),
4556
4559
  ideal_output: safeInt(row.ideal_output),
@@ -13134,6 +13137,7 @@ var normalizeSkuBreakdown = (raw) => {
13134
13137
  return {
13135
13138
  sku_id: typeof item.sku_id === "string" ? item.sku_id : String(item.sku_id ?? ""),
13136
13139
  sku_code: typeof item.sku_code === "string" ? item.sku_code : String(item.sku_code ?? ""),
13140
+ sku_display_name: typeof item.sku_display_name === "string" ? item.sku_display_name : coerceOptionalString(item.sku_display_name),
13137
13141
  sku_definition: typeof item.sku_definition === "string" ? item.sku_definition : String(item.sku_definition ?? ""),
13138
13142
  is_dummy: Boolean(item.is_dummy),
13139
13143
  total_output: coerceNumber(item.total_output, 0),
@@ -13152,6 +13156,7 @@ var normalizeSkuSegment = (raw) => {
13152
13156
  return {
13153
13157
  sku_id: typeof item.sku_id === "string" ? item.sku_id : String(item.sku_id ?? ""),
13154
13158
  sku_code: typeof item.sku_code === "string" ? item.sku_code : String(item.sku_code ?? ""),
13159
+ sku_display_name: typeof item.sku_display_name === "string" ? item.sku_display_name : coerceOptionalString(item.sku_display_name),
13155
13160
  start_time: typeof item.start_time === "string" ? item.start_time : String(item.start_time ?? ""),
13156
13161
  end_time: coerceOptionalString(item.end_time),
13157
13162
  pph_threshold: coerceNumber(item.pph_threshold, 0)
@@ -34427,6 +34432,13 @@ var LineChart = React144__default.memo(LineChartComponent, (prevProps, nextProps
34427
34432
  return true;
34428
34433
  });
34429
34434
  LineChart.displayName = "LineChart";
34435
+
34436
+ // src/lib/utils/skuDisplay.ts
34437
+ var clean = (value) => typeof value === "string" ? value.trim() : "";
34438
+ var getSkuDisplayName = (sku) => {
34439
+ if (!sku) return "SKU";
34440
+ return clean(sku.sku_display_name) || clean(sku.display_name) || clean(sku.sku_code) || clean(sku.sku_id) || clean(sku.id) || "SKU";
34441
+ };
34430
34442
  var formatPercentage = (current, target) => {
34431
34443
  if (!target || target <= 0) return "0.0";
34432
34444
  return (current / target * 100).toFixed(1);
@@ -34503,12 +34515,13 @@ var SkuRow = ({ sku, isSelected, isLive, onSelect }) => {
34503
34515
  const ratio = target > 0 ? Math.min(current / target, 1) : 0;
34504
34516
  const fillColor = "#3b82f6";
34505
34517
  const percentage = formatPercentage(current, target);
34518
+ const skuLabel = getSkuDisplayName(sku);
34506
34519
  return /* @__PURE__ */ jsxs(
34507
34520
  "div",
34508
34521
  {
34509
34522
  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"}`,
34510
34523
  onClick: () => onSelect?.(isSelected ? null : sku.sku_id),
34511
- "data-testid": `sku-progress-row-${sku.sku_code}`,
34524
+ "data-testid": `sku-progress-row-${sku.sku_id}`,
34512
34525
  children: [
34513
34526
  /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [
34514
34527
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 truncate", children: [
@@ -34516,8 +34529,8 @@ var SkuRow = ({ sku, isSelected, isLive, onSelect }) => {
34516
34529
  "span",
34517
34530
  {
34518
34531
  className: "text-sm font-semibold text-gray-800 truncate",
34519
- title: sku.sku_code,
34520
- children: sku.sku_code
34532
+ title: skuLabel,
34533
+ children: skuLabel
34521
34534
  }
34522
34535
  ),
34523
34536
  isLive && /* @__PURE__ */ 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" })
@@ -34536,7 +34549,7 @@ var SkuRow = ({ sku, isSelected, isLive, onSelect }) => {
34536
34549
  "aria-valuenow": Math.round(current),
34537
34550
  "aria-valuemin": 0,
34538
34551
  "aria-valuemax": Math.round(target),
34539
- "aria-label": `${sku.sku_code} output progress`,
34552
+ "aria-label": `${skuLabel} output progress`,
34540
34553
  children: /* @__PURE__ */ jsx(
34541
34554
  "div",
34542
34555
  {
@@ -36507,7 +36520,7 @@ var HourlyOutputChartComponent = ({
36507
36520
  const end = Math.max(start, Math.min(nextOffset, timelineEndOffset));
36508
36521
  return {
36509
36522
  skuId: entry.segment.sku_id,
36510
- label: entry.segment.sku_code,
36523
+ label: getSkuDisplayName(entry.segment),
36511
36524
  start,
36512
36525
  end,
36513
36526
  pphThreshold: entry.segment.pph_threshold ?? pphThreshold
@@ -37383,7 +37396,7 @@ var HourlyOutputChart = React144__default.memo(
37383
37396
  for (let i = 0; i < prevSegments.length; i += 1) {
37384
37397
  const prevSeg = prevSegments[i];
37385
37398
  const nextSeg = nextSegments[i];
37386
- 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) {
37399
+ 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) {
37387
37400
  return false;
37388
37401
  }
37389
37402
  }
@@ -38372,6 +38385,7 @@ var WorkspaceMetricCardsImpl = ({
38372
38385
  const pphThreshold = activeSku ? activeSku.pph_threshold : workspace.pph_threshold;
38373
38386
  const cycleValue = activeSku ? activeSku.avg_cycle_time : workspace.avg_cycle_time;
38374
38387
  const cycleStandard = activeSku ? activeSku.ideal_cycle_time : workspace.ideal_cycle_time;
38388
+ const displaySkuLabel = displaySku ? getSkuDisplayName(displaySku) : "";
38375
38389
  const efficiencyValue = workspace.avg_efficiency || 0;
38376
38390
  const efficiencyTarget = effectiveLegend.green_min;
38377
38391
  const efficiencyColor = getEfficiencyHexColor(efficiencyValue, effectiveLegend);
@@ -38402,7 +38416,7 @@ var WorkspaceMetricCardsImpl = ({
38402
38416
  /* @__PURE__ */ jsxs(Card2, { className: "flex flex-col bg-white shadow-sm h-full min-h-[150px] sm:min-h-0", children: [
38403
38417
  /* @__PURE__ */ jsxs(CardHeader2, { className: "pb-2 flex-none text-center", children: [
38404
38418
  /* @__PURE__ */ jsx(CardTitle2, { className: "text-lg", children: "PPH" }),
38405
- displaySku && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySku.sku_code, children: displaySku.sku_code })
38419
+ displaySku && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySkuLabel, children: displaySkuLabel })
38406
38420
  ] }),
38407
38421
  /* @__PURE__ */ jsx(CardContent2, { className: "flex-1 flex items-center justify-center py-6 sm:py-3", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
38408
38422
  /* @__PURE__ */ jsx("p", { className: `text-5xl font-bold ${pphValue >= pphThreshold ? "text-green-500" : "text-red-500"}`, children: pphValue.toFixed(1) }),
@@ -38415,7 +38429,7 @@ var WorkspaceMetricCardsImpl = ({
38415
38429
  /* @__PURE__ */ jsxs(Card2, { className: "flex flex-col bg-white shadow-sm h-full min-h-[150px] sm:min-h-0", children: [
38416
38430
  /* @__PURE__ */ jsxs(CardHeader2, { className: "pb-2 flex-none text-center", children: [
38417
38431
  /* @__PURE__ */ jsx(CardTitle2, { className: "text-lg", children: "Avg. Cycle Time" }),
38418
- displaySku && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySku.sku_code, children: displaySku.sku_code })
38432
+ displaySku && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySkuLabel, children: displaySkuLabel })
38419
38433
  ] }),
38420
38434
  /* @__PURE__ */ jsx(CardContent2, { className: "flex-1 flex items-center justify-center py-6 sm:py-3", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
38421
38435
  /* @__PURE__ */ jsx("p", { className: `text-5xl font-bold ${cycleValue > (cycleStandard || 0) ? "text-red-500" : "text-green-500"}`, children: cycleValue.toFixed(1) }),
@@ -51336,19 +51350,12 @@ var fitTextWithEllipsis = (doc, text, maxWidth) => {
51336
51350
  var LinePdfGenerator = ({
51337
51351
  lineInfo,
51338
51352
  workspaceData,
51339
- issueResolutionSummary,
51340
51353
  shiftName,
51341
51354
  className,
51342
51355
  shiftBreaks = [],
51343
51356
  reportTimezone = "Asia/Kolkata"
51344
51357
  }) => {
51345
51358
  const [isGenerating, setIsGenerating] = useState(false);
51346
- const formatResolutionDuration2 = (seconds) => {
51347
- if (seconds === null || seconds === void 0 || seconds <= 0) {
51348
- return "-";
51349
- }
51350
- return formatIdleTime(Math.max(0, Math.floor(seconds)));
51351
- };
51352
51359
  const generatePDF = async () => {
51353
51360
  setIsGenerating(true);
51354
51361
  try {
@@ -51671,7 +51678,7 @@ var LinePdfGenerator = ({
51671
51678
  doc.line(20, 53, 190, 53);
51672
51679
  const perfOverviewStartY = 58;
51673
51680
  doc.setFillColor(245, 245, 245);
51674
- doc.roundedRect(15, perfOverviewStartY, 180, 50, 3, 3, "F");
51681
+ doc.roundedRect(15, perfOverviewStartY, 180, 40, 3, 3, "F");
51675
51682
  doc.setFontSize(18);
51676
51683
  doc.setFont("helvetica", "bold");
51677
51684
  doc.setTextColor(40, 40, 40);
@@ -51687,20 +51694,13 @@ var LinePdfGenerator = ({
51687
51694
  doc.text(`${lineInfo.metrics.current_output} / ${lineInfo.metrics.line_threshold}`, 120, kpiStartY);
51688
51695
  createKPIBox(kpiStartY + kpiSpacing);
51689
51696
  doc.setFont("helvetica", "normal");
51690
- doc.text("Issue Resolution Time:", 25, kpiStartY + kpiSpacing);
51691
- doc.setFont("helvetica", "bold");
51692
- const resolutionSeconds = issueResolutionSummary ? issueResolutionSummary.mean_resolution_seconds ?? issueResolutionSummary.median_resolution_seconds : null;
51693
- const displayValue = resolutionSeconds !== null ? formatResolutionDuration2(resolutionSeconds) : "-";
51694
- doc.text(displayValue, 120, kpiStartY + kpiSpacing);
51695
- createKPIBox(kpiStartY + kpiSpacing * 2);
51696
- doc.setFont("helvetica", "normal");
51697
- doc.text("Average Efficiency:", 25, kpiStartY + kpiSpacing * 2);
51697
+ doc.text("Average Efficiency:", 25, kpiStartY + kpiSpacing);
51698
51698
  doc.setFont("helvetica", "bold");
51699
- doc.text(`${lineInfo.metrics.avg_efficiency.toFixed(1)}%`, 120, kpiStartY + kpiSpacing * 2);
51699
+ doc.text(`${lineInfo.metrics.avg_efficiency.toFixed(1)}%`, 120, kpiStartY + kpiSpacing);
51700
51700
  doc.setDrawColor(180, 180, 180);
51701
51701
  doc.setLineWidth(0.8);
51702
- doc.line(20, 123, 190, 123);
51703
- const hourlyOverviewStartY = 128;
51702
+ doc.line(20, 113, 190, 113);
51703
+ const hourlyOverviewStartY = 118;
51704
51704
  const formatMinutesLabel = (totalMinutes) => {
51705
51705
  const normalized = (totalMinutes % (24 * 60) + 24 * 60) % (24 * 60);
51706
51706
  const hour = Math.floor(normalized / 60);
@@ -51737,7 +51737,7 @@ var LinePdfGenerator = ({
51737
51737
  if (intervalIndex >= 0) {
51738
51738
  if (segmentIndex > 0 || segmentMinutes > hourlyTimeRanges[0]?.start) {
51739
51739
  if (!skuRemarksByIndex[intervalIndex]) skuRemarksByIndex[intervalIndex] = [];
51740
- skuRemarksByIndex[intervalIndex].push(segment.sku_code);
51740
+ skuRemarksByIndex[intervalIndex].push(getSkuDisplayName(segment));
51741
51741
  }
51742
51742
  }
51743
51743
  }
@@ -51890,8 +51890,8 @@ var LinePdfGenerator = ({
51890
51890
  return Math.round(lineInfo.metrics.current_output / shiftDuration);
51891
51891
  });
51892
51892
  }
51893
- const tableHeaderY = 151;
51894
- const tableStartY = 158;
51893
+ const tableHeaderY = 141;
51894
+ const tableStartY = 148;
51895
51895
  const rowSpacing = 8;
51896
51896
  const bottomPadding = 8;
51897
51897
  const hourlyTableHeight = hourlyTimeRanges.length * rowSpacing;
@@ -51901,10 +51901,10 @@ var LinePdfGenerator = ({
51901
51901
  doc.setFontSize(18);
51902
51902
  doc.setFont("helvetica", "bold");
51903
51903
  doc.setTextColor(40, 40, 40);
51904
- doc.text("Hourly Performance", 20, 138);
51904
+ doc.text("Hourly Performance", 20, 128);
51905
51905
  doc.setTextColor(0, 0, 0);
51906
- const gridTopY = 144;
51907
- const headerBottomY = 153;
51906
+ const gridTopY = 134;
51907
+ const headerBottomY = 143;
51908
51908
  const colBoundaries = [20, 70, 100, 130, 155, 190];
51909
51909
  const totalRows = hourlyTimeRanges.length;
51910
51910
  const gridBottomY = headerBottomY + totalRows * rowSpacing;
@@ -53751,7 +53751,7 @@ var WorkspacePdfGenerator = ({
53751
53751
  if (intervalIndex >= 0) {
53752
53752
  if (segmentIndex > 0 || segmentMinutes > hourlyIntervals[0]?.start) {
53753
53753
  if (!skuRemarksByIndex[intervalIndex]) skuRemarksByIndex[intervalIndex] = [];
53754
- skuRemarksByIndex[intervalIndex].push(segment.sku_code);
53754
+ skuRemarksByIndex[intervalIndex].push(getSkuDisplayName(segment));
53755
53755
  }
53756
53756
  }
53757
53757
  }
@@ -54416,6 +54416,7 @@ var WorkspaceCycleTimeMetricCards = ({
54416
54416
  }, [activeSku, skuAware, activeSkuId, liveSkuId, skuBreakdown]);
54417
54417
  const cycleValue = activeSku ? activeSku.avg_cycle_time : workspace.avg_cycle_time;
54418
54418
  const cycleStandard = activeSku ? activeSku.ideal_cycle_time : workspace.ideal_cycle_time;
54419
+ const displaySkuLabel = displaySku ? getSkuDisplayName(displaySku) : "";
54419
54420
  const efficiencyValue = workspace.avg_efficiency || 0;
54420
54421
  const efficiencyTarget = effectiveLegend.green_min;
54421
54422
  const efficiencyColor = getEfficiencyHexColor(efficiencyValue, effectiveLegend);
@@ -54443,7 +54444,7 @@ var WorkspaceCycleTimeMetricCards = ({
54443
54444
  /* @__PURE__ */ 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: [
54444
54445
  /* @__PURE__ */ jsxs(CardHeader2, { className: "pb-1 pt-5 flex-none text-center", children: [
54445
54446
  /* @__PURE__ */ jsx(CardTitle2, { className: "text-[15px] font-bold text-gray-900 tracking-wide", children: "Cycle Time (s)" }),
54446
- displaySku && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySku.sku_code, children: displaySku.sku_code })
54447
+ displaySku && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-blue-600 mt-1 truncate px-2", title: displaySkuLabel, children: displaySkuLabel })
54447
54448
  ] }),
54448
54449
  /* @__PURE__ */ jsxs(CardContent2, { className: "flex-1 flex flex-col items-center justify-center pb-6", children: [
54449
54450
  /* @__PURE__ */ jsx("p", { className: `text-5xl font-bold tracking-tight ${cycleValue > (cycleStandard || 0) ? "text-red-500" : "text-[#34C759]"}`, children: cycleValue.toFixed(1) }),
@@ -66378,25 +66379,8 @@ var formatLocalDate = (date) => {
66378
66379
  };
66379
66380
  return date.toLocaleDateString("en-US", options);
66380
66381
  };
66381
- var formatResolutionDuration = (seconds) => {
66382
- if (seconds === null || seconds === void 0 || seconds <= 0) {
66383
- return "-";
66384
- }
66385
- return formatIdleTime(Math.max(0, Math.floor(seconds)));
66386
- };
66387
- var getIssueResolutionSecondaryText = (summary) => {
66388
- if (!summary) {
66389
- return "No issue data";
66390
- }
66391
- const parts = [`${summary.resolved_issue_count} resolved`];
66392
- if ((summary.open_issue_count || 0) > 0) {
66393
- parts.push(`oldest open ${formatResolutionDuration(summary.oldest_open_issue_age_seconds)}`);
66394
- }
66395
- return parts.join(" \u2022 ");
66396
- };
66397
66382
  var MetricCards = memo$1(({
66398
66383
  lineInfo,
66399
- issueResolutionSummary,
66400
66384
  idleTimeData,
66401
66385
  showIdleTime,
66402
66386
  efficiencyLegend,
@@ -66408,13 +66392,7 @@ var MetricCards = memo$1(({
66408
66392
  }) => {
66409
66393
  const efficiency = lineInfo?.metrics.avg_efficiency || 0;
66410
66394
  const efficiencyColorClass = getEfficiencyTextColorClasses(efficiency, efficiencyLegend);
66411
- const showIssueResolutionCard = Boolean(issueResolutionSummary);
66412
- const largeGridColumns = showIdleTime ? showIssueResolutionCard ? "lg:grid-cols-5" : "lg:grid-cols-4" : showIssueResolutionCard ? "lg:grid-cols-4" : "lg:grid-cols-3";
66413
- const shouldMaskIssueResolution = efficiency < 5;
66414
- const issueResolutionValue = shouldMaskIssueResolution ? "-" : formatResolutionDuration(
66415
- issueResolutionSummary?.mean_resolution_seconds ?? issueResolutionSummary?.median_resolution_seconds
66416
- );
66417
- getIssueResolutionSecondaryText(issueResolutionSummary);
66395
+ const largeGridColumns = showIdleTime ? "lg:grid-cols-4" : "lg:grid-cols-3";
66418
66396
  const outputTarget = lineInfo?.metrics.output_target_recalculated ?? lineInfo?.metrics.line_threshold ?? 0;
66419
66397
  return /* @__PURE__ */ jsxs(
66420
66398
  motion.div,
@@ -66455,28 +66433,6 @@ var MetricCards = memo$1(({
66455
66433
  "%"
66456
66434
  ] }) })
66457
66435
  ] }),
66458
- showIssueResolutionCard && /* @__PURE__ */ jsxs(
66459
- motion.div,
66460
- {
66461
- variants: itemVariants,
66462
- 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",
66463
- children: [
66464
- /* @__PURE__ */ 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: [
66465
- /* @__PURE__ */ jsx("h2", { className: "text-sm sm:text-base font-bold text-gray-700 text-center", children: "Issue Resolution Time" }),
66466
- /* @__PURE__ */ jsx(InformationCircleIcon, { className: "w-4 h-4 text-gray-400 cursor-help flex-shrink-0" }),
66467
- /* @__PURE__ */ 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: [
66468
- /* @__PURE__ */ 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." }),
66469
- /* @__PURE__ */ jsx("div", { className: "bg-gray-50 rounded-md py-1.5 border border-gray-100/80", children: /* @__PURE__ */ jsxs("p", { className: "text-center font-medium text-[11px] text-gray-500", children: [
66470
- ((issueResolutionSummary?.resolved_issue_count || 0) + (issueResolutionSummary?.open_issue_count || 0)).toLocaleString(),
66471
- " recorded issues"
66472
- ] }) }),
66473
- /* @__PURE__ */ 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" })
66474
- ] })
66475
- ] }),
66476
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center flex-1 min-h-0", children: /* @__PURE__ */ 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 }) })
66477
- ]
66478
- }
66479
- ),
66480
66436
  showIdleTime && /* @__PURE__ */ 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: [
66481
66437
  /* @__PURE__ */ jsx("div", { className: "h-10 sm:h-12 flex items-start justify-center mb-2 mt-1", children: /* @__PURE__ */ jsx("h2", { className: "text-sm sm:text-base font-bold text-gray-700 text-center", children: "Idle Time Breakdown" }) }),
66482
66438
  /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsx(
@@ -66502,6 +66458,7 @@ var MetricCards = memo$1(({
66502
66458
  (prevProps.skuBreakdown || []).map((sku) => ({
66503
66459
  sku_id: sku.sku_id,
66504
66460
  sku_code: sku.sku_code,
66461
+ sku_display_name: sku.sku_display_name,
66505
66462
  total_output: sku.total_output,
66506
66463
  target_output: sku.target_output,
66507
66464
  avg_pph: sku.avg_pph,
@@ -66517,6 +66474,7 @@ var MetricCards = memo$1(({
66517
66474
  (nextProps.skuBreakdown || []).map((sku) => ({
66518
66475
  sku_id: sku.sku_id,
66519
66476
  sku_code: sku.sku_code,
66477
+ sku_display_name: sku.sku_display_name,
66520
66478
  total_output: sku.total_output,
66521
66479
  target_output: sku.target_output,
66522
66480
  avg_pph: sku.avg_pph,
@@ -66531,8 +66489,6 @@ var MetricCards = memo$1(({
66531
66489
  if (prevSkuSignature !== nextSkuSignature) return false;
66532
66490
  const prevMetrics = prevProps.lineInfo.metrics;
66533
66491
  const nextMetrics = nextProps.lineInfo.metrics;
66534
- const prevIssueSummary = prevProps.issueResolutionSummary;
66535
- const nextIssueSummary = nextProps.issueResolutionSummary;
66536
66492
  const prevIdleChartSignature = JSON.stringify(
66537
66493
  (prevProps.idleTimeData?.chartData || []).map((entry) => ({
66538
66494
  name: entry.name,
@@ -66551,9 +66507,6 @@ var MetricCards = memo$1(({
66551
66507
  );
66552
66508
  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;
66553
66509
  if (idleTimeChanged) return false;
66554
- 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) {
66555
- return false;
66556
- }
66557
66510
  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;
66558
66511
  });
66559
66512
  MetricCards.displayName = "MetricCards";
@@ -66826,6 +66779,7 @@ var BottomSection = memo$1(({
66826
66779
  (prevProps.skuSegments || []).map((segment) => ({
66827
66780
  sku_id: segment.sku_id,
66828
66781
  sku_code: segment.sku_code,
66782
+ sku_display_name: segment.sku_display_name,
66829
66783
  start_time: segment.start_time,
66830
66784
  end_time: segment.end_time,
66831
66785
  pph_threshold: segment.pph_threshold
@@ -66835,6 +66789,7 @@ var BottomSection = memo$1(({
66835
66789
  (nextProps.skuSegments || []).map((segment) => ({
66836
66790
  sku_id: segment.sku_id,
66837
66791
  sku_code: segment.sku_code,
66792
+ sku_display_name: segment.sku_display_name,
66838
66793
  start_time: segment.start_time,
66839
66794
  end_time: segment.end_time,
66840
66795
  pph_threshold: segment.pph_threshold
@@ -67515,6 +67470,7 @@ var KPIDetailView = ({
67515
67470
  }).map((item) => ({
67516
67471
  sku_id: item.sku_id,
67517
67472
  sku_code: item.sku_code,
67473
+ sku_display_name: item.sku_display_name,
67518
67474
  sku_definition: "",
67519
67475
  is_dummy: false,
67520
67476
  total_output: item.current_output ?? 0,
@@ -67579,11 +67535,13 @@ var KPIDetailView = ({
67579
67535
  }, [resolvedLineInfo, selectedSkuRow]);
67580
67536
  const handleSkuChange = useCallback((nextSkuId) => {
67581
67537
  if (nextSkuId === selectedSkuId) return;
67538
+ const selectedSkuOption = nextSkuId === "all" ? null : realSkuOptions.find((item) => item.sku_id === nextSkuId) ?? null;
67582
67539
  setSelectedSkuId(nextSkuId);
67583
67540
  trackCoreEvent("Line Detail SKU Filter Changed", {
67584
67541
  line_id: lineId,
67585
67542
  sku_id: nextSkuId === "all" ? null : nextSkuId,
67586
- sku_code: nextSkuId === "all" ? null : realSkuOptions.find((item) => item.sku_id === nextSkuId)?.sku_code ?? null
67543
+ sku_code: selectedSkuOption?.sku_code ?? null,
67544
+ sku_display_name: selectedSkuOption ? getSkuDisplayName(selectedSkuOption) : null
67587
67545
  });
67588
67546
  }, [lineId, realSkuOptions, selectedSkuId]);
67589
67547
  const handleChartSkuSelect = useCallback(
@@ -68359,7 +68317,6 @@ var KPIDetailView = ({
68359
68317
  MetricCards,
68360
68318
  {
68361
68319
  lineInfo: displayLineInfo ?? resolvedLineInfo,
68362
- issueResolutionSummary,
68363
68320
  idleTimeData,
68364
68321
  showIdleTime: idleTimeVlmEnabled,
68365
68322
  efficiencyLegend,
@@ -68474,7 +68431,6 @@ var KPIDetailView = ({
68474
68431
  MetricCards,
68475
68432
  {
68476
68433
  lineInfo: displayLineInfo ?? resolvedLineInfo,
68477
- issueResolutionSummary,
68478
68434
  idleTimeData,
68479
68435
  showIdleTime: idleTimeVlmEnabled,
68480
68436
  efficiencyLegend,
@@ -73537,6 +73493,7 @@ var SKUSelector = ({
73537
73493
  if (lineId && (sku.line_id ?? "") !== lineId) return false;
73538
73494
  const term = searchTerm.toLowerCase();
73539
73495
  if (term.length === 0) return true;
73496
+ if (getSkuDisplayName(sku).toLowerCase().includes(term)) return true;
73540
73497
  if ((sku.sku_id || "").toLowerCase().includes(term)) return true;
73541
73498
  if ((sku.sku_definition || "").toLowerCase().includes(term)) return true;
73542
73499
  return JSON.stringify(sku.attributes ?? {}).toLowerCase().includes(term);
@@ -73561,7 +73518,7 @@ var SKUSelector = ({
73561
73518
  disabled,
73562
73519
  children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
73563
73520
  /* @__PURE__ */ jsx("span", { className: selectedSKU ? "text-gray-900" : "text-gray-500", children: selectedSKU ? /* @__PURE__ */ jsxs("div", { children: [
73564
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: selectedSKU.sku_id }),
73521
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: getSkuDisplayName(selectedSKU) }),
73565
73522
  /* @__PURE__ */ jsxs("span", { className: "text-sm text-gray-500 ml-2", children: [
73566
73523
  "(Target: ",
73567
73524
  selectedSKU.production_target,
@@ -73605,7 +73562,7 @@ var SKUSelector = ({
73605
73562
  ${selectedSKU?.id === sku.id ? "bg-blue-50" : ""}
73606
73563
  `,
73607
73564
  children: /* @__PURE__ */ jsxs("div", { children: [
73608
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: sku.sku_id }),
73565
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: getSkuDisplayName(sku) }),
73609
73566
  /* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500", children: [
73610
73567
  "Target: ",
73611
73568
  sku.production_target,
@@ -73661,44 +73618,50 @@ var SKUList = ({
73661
73618
  return /* @__PURE__ */ jsxs(Fragment, { children: [
73662
73619
  /* @__PURE__ */ jsx("div", { className: "hidden lg:block bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [
73663
73620
  /* @__PURE__ */ jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsxs("tr", { children: [
73664
- /* @__PURE__ */ jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "SKU Code" }),
73621
+ /* @__PURE__ */ jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "SKU" }),
73665
73622
  /* @__PURE__ */ jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "Definition" }),
73666
73623
  /* @__PURE__ */ jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "Line" }),
73667
73624
  /* @__PURE__ */ jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "Production Target" }),
73668
73625
  /* @__PURE__ */ jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "Status" }),
73669
73626
  /* @__PURE__ */ jsx("th", { scope: "col", className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider", children: "Created" })
73670
73627
  ] }) }),
73671
- /* @__PURE__ */ jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: skus.map((sku) => /* @__PURE__ */ jsxs("tr", { className: "hover:bg-gray-50 transition-colors duration-150", children: [
73672
- /* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-gray-900", children: sku.sku_id }) }),
73673
- /* @__PURE__ */ jsx("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-700 max-w-md truncate", title: sku.sku_definition || "", children: sku.sku_definition || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "\u2014" }) }) }),
73674
- /* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-700", children: formatLine(sku, lineNames) }) }),
73675
- /* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-gray-700", children: formatTarget(sku.production_target) }) }),
73676
- /* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ 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" }) }),
73677
- /* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: formatCreatedAt(sku.created_at) })
73678
- ] }, sku.id)) })
73628
+ /* @__PURE__ */ jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: skus.map((sku) => {
73629
+ const displayName = getSkuDisplayName(sku);
73630
+ return /* @__PURE__ */ jsxs("tr", { className: "hover:bg-gray-50 transition-colors duration-150", children: [
73631
+ /* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-gray-900", children: displayName }) }),
73632
+ /* @__PURE__ */ jsx("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-700 max-w-md truncate", title: sku.sku_definition || "", children: sku.sku_definition || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "\u2014" }) }) }),
73633
+ /* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-700", children: formatLine(sku, lineNames) }) }),
73634
+ /* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-gray-700", children: formatTarget(sku.production_target) }) }),
73635
+ /* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ 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" }) }),
73636
+ /* @__PURE__ */ jsx("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: formatCreatedAt(sku.created_at) })
73637
+ ] }, sku.id);
73638
+ }) })
73679
73639
  ] }) }) }),
73680
- /* @__PURE__ */ jsx("div", { className: "lg:hidden space-y-3 sm:space-y-4", children: skus.map((sku) => /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl shadow-sm border border-gray-200 p-4 hover:shadow-md transition-all duration-200", children: [
73681
- /* @__PURE__ */ jsx("div", { className: "flex items-start justify-between mb-3", children: /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
73682
- /* @__PURE__ */ jsx("h3", { className: "text-base sm:text-lg font-semibold text-gray-900 truncate", children: sku.sku_id }),
73683
- /* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ 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" }) })
73684
- ] }) }),
73685
- /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
73686
- /* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Definition" }),
73687
- /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-700 break-words", children: sku.sku_definition || /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "\u2014" }) })
73688
- ] }),
73689
- /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
73690
- /* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Line" }),
73691
- /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-700", children: formatLine(sku, lineNames) })
73692
- ] }),
73693
- /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
73694
- /* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Production Target" }),
73695
- /* @__PURE__ */ jsx("div", { className: "text-sm sm:text-base font-medium text-gray-700", children: formatTarget(sku.production_target) })
73696
- ] }),
73697
- /* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500", children: [
73698
- "Created: ",
73699
- formatCreatedAt(sku.created_at)
73700
- ] })
73701
- ] }, sku.id)) })
73640
+ /* @__PURE__ */ jsx("div", { className: "lg:hidden space-y-3 sm:space-y-4", children: skus.map((sku) => {
73641
+ const displayName = getSkuDisplayName(sku);
73642
+ return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl shadow-sm border border-gray-200 p-4 hover:shadow-md transition-all duration-200", children: [
73643
+ /* @__PURE__ */ jsx("div", { className: "flex items-start justify-between mb-3", children: /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
73644
+ /* @__PURE__ */ jsx("h3", { className: "text-base sm:text-lg font-semibold text-gray-900 truncate", children: displayName }),
73645
+ /* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ 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" }) })
73646
+ ] }) }),
73647
+ /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
73648
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Definition" }),
73649
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-700 break-words", children: sku.sku_definition || /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "\u2014" }) })
73650
+ ] }),
73651
+ /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
73652
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Line" }),
73653
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-700", children: formatLine(sku, lineNames) })
73654
+ ] }),
73655
+ /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
73656
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-gray-500 uppercase tracking-wider mb-1", children: "Production Target" }),
73657
+ /* @__PURE__ */ jsx("div", { className: "text-sm sm:text-base font-medium text-gray-700", children: formatTarget(sku.production_target) })
73658
+ ] }),
73659
+ /* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500", children: [
73660
+ "Created: ",
73661
+ formatCreatedAt(sku.created_at)
73662
+ ] })
73663
+ ] }, sku.id);
73664
+ }) })
73702
73665
  ] });
73703
73666
  };
73704
73667
  var TargetsViewUI = ({
@@ -73929,7 +73892,7 @@ var TargetsViewUI = ({
73929
73892
  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",
73930
73893
  "aria-label": `SKU for ${formattedName}`,
73931
73894
  children: realSkuOptions.map((row) => /* @__PURE__ */ jsxs("option", { value: row.sku_uuid, children: [
73932
- row.sku_code,
73895
+ getSkuDisplayName(row),
73933
73896
  workspace.currentSku && !workspace.currentSku.is_dummy && workspace.currentSku.sku_uuid === row.sku_uuid ? " (active)" : ""
73934
73897
  ] }, row.sku_uuid))
73935
73898
  }
@@ -74196,8 +74159,14 @@ var TargetsView = ({
74196
74159
  const skuMetaByUuid = useMemo(() => {
74197
74160
  const map = /* @__PURE__ */ new Map();
74198
74161
  skuCatalog.forEach((sku) => {
74162
+ const skuCode = sku.sku_id || sku.id;
74199
74163
  map.set(sku.id, {
74200
- sku_code: sku.sku_id || sku.id,
74164
+ sku_code: skuCode,
74165
+ sku_display_name: getSkuDisplayName({
74166
+ display_name: sku.display_name,
74167
+ sku_code: skuCode,
74168
+ id: sku.id
74169
+ }),
74201
74170
  is_dummy: sku.sku_definition === "dummy_definition",
74202
74171
  line_id: sku.line_id
74203
74172
  });
@@ -74209,11 +74178,20 @@ var TargetsView = ({
74209
74178
  skuCatalog.forEach((sku) => {
74210
74179
  if (sku.sku_definition === "dummy_definition") return;
74211
74180
  const list = map.get(sku.line_id) || [];
74212
- list.push({ sku_uuid: sku.id, sku_code: sku.sku_id || sku.id });
74181
+ const skuCode = sku.sku_id || sku.id;
74182
+ list.push({
74183
+ sku_uuid: sku.id,
74184
+ sku_code: skuCode,
74185
+ sku_display_name: getSkuDisplayName({
74186
+ display_name: sku.display_name,
74187
+ sku_code: skuCode,
74188
+ id: sku.id
74189
+ })
74190
+ });
74213
74191
  map.set(sku.line_id, list);
74214
74192
  });
74215
74193
  map.forEach((list) => list.sort(
74216
- (a, b) => a.sku_code.localeCompare(b.sku_code, void 0, { numeric: true })
74194
+ (a, b) => a.sku_display_name.localeCompare(b.sku_display_name, void 0, { numeric: true })
74217
74195
  ));
74218
74196
  return map;
74219
74197
  }, [skuCatalog]);
@@ -74361,8 +74339,9 @@ var TargetsView = ({
74361
74339
  const meta = skuMetaByUuid.get(skuUuid);
74362
74340
  skuRowsMap.set(skuUuid, {
74363
74341
  sku_uuid: skuUuid,
74364
- sku_code: meta?.sku_code || skuUuid,
74365
- is_dummy: meta?.is_dummy ?? false,
74342
+ sku_code: payload?.sku_code || meta?.sku_code || skuUuid,
74343
+ sku_display_name: payload?.sku_display_name || meta?.sku_display_name || payload?.sku_code || meta?.sku_code || skuUuid,
74344
+ is_dummy: payload?.is_dummy ?? meta?.is_dummy ?? false,
74366
74345
  pph_threshold: payload?.pph_threshold ? Math.round(payload.pph_threshold) : "",
74367
74346
  ideal_cycle_time: payload?.ideal_cycle_time ?? "",
74368
74347
  total_day_output: payload?.total_day_output ?? "",
@@ -74415,10 +74394,11 @@ var TargetsView = ({
74415
74394
  const lineDummySkuUuidFallback = dummySkuByLine.get(lineId) || null;
74416
74395
  const buildEmptySkuRows = () => {
74417
74396
  const rows = [];
74418
- lineNonDummySkusFallback.forEach(({ sku_uuid, sku_code }) => {
74397
+ lineNonDummySkusFallback.forEach(({ sku_uuid, sku_code, sku_display_name }) => {
74419
74398
  rows.push({
74420
74399
  sku_uuid,
74421
74400
  sku_code,
74401
+ sku_display_name,
74422
74402
  is_dummy: false,
74423
74403
  pph_threshold: "",
74424
74404
  ideal_cycle_time: "",
@@ -74431,6 +74411,7 @@ var TargetsView = ({
74431
74411
  rows.push({
74432
74412
  sku_uuid: lineDummySkuUuidFallback,
74433
74413
  sku_code: meta?.sku_code || lineDummySkuUuidFallback,
74414
+ sku_display_name: meta?.sku_display_name || meta?.sku_code || lineDummySkuUuidFallback,
74434
74415
  is_dummy: true,
74435
74416
  pph_threshold: "",
74436
74417
  ideal_cycle_time: "",
@@ -74757,6 +74738,7 @@ var TargetsView = ({
74757
74738
  rowsToSave = fallback ? [{
74758
74739
  sku_uuid: fallback.sku_uuid,
74759
74740
  sku_code: "",
74741
+ sku_display_name: "",
74760
74742
  is_dummy: true,
74761
74743
  pph_threshold: fallback.pph_threshold,
74762
74744
  ideal_cycle_time: fallback.ideal_cycle_time,
@@ -76824,7 +76806,7 @@ var SKUManagementView = () => {
76824
76806
  if (activeFilter === "inactive" && sku.is_active) return false;
76825
76807
  if (lineFilter !== "all" && sku.line_id !== lineFilter) return false;
76826
76808
  if (term.length === 0) return true;
76827
- return (sku.sku_id || "").toLowerCase().includes(term);
76809
+ return getSkuDisplayName(sku).toLowerCase().includes(term) || (sku.sku_id || "").toLowerCase().includes(term);
76828
76810
  });
76829
76811
  }, [skus, searchTerm, lineFilter, activeFilter]);
76830
76812
  const handleBack = () => {
@@ -76864,9 +76846,9 @@ var SKUManagementView = () => {
76864
76846
  type: "search",
76865
76847
  value: searchTerm,
76866
76848
  onChange: (event) => setSearchTerm(event.target.value),
76867
- placeholder: "Search by SKU code",
76849
+ placeholder: "Search by SKU",
76868
76850
  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",
76869
- "aria-label": "Search SKUs by code"
76851
+ "aria-label": "Search SKUs"
76870
76852
  }
76871
76853
  )
76872
76854
  ] }),