@optifye/dashboard-core 6.0.6 → 6.0.8
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.css +89 -13
- package/dist/index.d.mts +42 -19
- package/dist/index.d.ts +42 -19
- package/dist/index.js +284 -288
- package/dist/index.mjs +285 -289
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -378,24 +378,6 @@ function createMemoizedFunction(fn, getCacheKey) {
|
|
|
378
378
|
return result;
|
|
379
379
|
};
|
|
380
380
|
}
|
|
381
|
-
var memoizedEfficiencyFilter = createMemoizedFunction(
|
|
382
|
-
(data, minEfficiency, maxEfficiency) => {
|
|
383
|
-
return data.filter((item) => {
|
|
384
|
-
const eff = item.efficiency ?? 0;
|
|
385
|
-
return eff >= minEfficiency && (maxEfficiency === void 0 || eff < maxEfficiency);
|
|
386
|
-
});
|
|
387
|
-
},
|
|
388
|
-
(data, min, max = void 0) => `${data.length}-${min}-${max}`
|
|
389
|
-
);
|
|
390
|
-
var memoizedAverageEfficiency = createMemoizedFunction(
|
|
391
|
-
(data, minThreshold = 10) => {
|
|
392
|
-
const validItems = data.filter((item) => (item.efficiency ?? 0) >= minThreshold);
|
|
393
|
-
if (validItems.length === 0) return 0;
|
|
394
|
-
const sum = validItems.reduce((acc, item) => acc + (item.efficiency ?? 0), 0);
|
|
395
|
-
return sum / validItems.length;
|
|
396
|
-
},
|
|
397
|
-
(data, threshold) => `${data.length}-${threshold}`
|
|
398
|
-
);
|
|
399
381
|
var memoizedOutputArrayAggregation = createMemoizedFunction(
|
|
400
382
|
(arrays) => {
|
|
401
383
|
if (arrays.length === 0) return [];
|
|
@@ -606,7 +588,7 @@ var dashboardService = {
|
|
|
606
588
|
const lineMetricsTable = getTable2(dbConfig, "lineMetrics");
|
|
607
589
|
const companyId = entityConfig.companyId;
|
|
608
590
|
const metricsTablePrefixStr = getMetricsTablePrefix();
|
|
609
|
-
|
|
591
|
+
`${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
|
|
610
592
|
const configuredLineIds = getConfiguredLineIds(entityConfig);
|
|
611
593
|
const defaultLineId = configuredLineIds[0];
|
|
612
594
|
const factoryViewId = entityConfig.factoryViewId ?? "factory";
|
|
@@ -617,7 +599,7 @@ var dashboardService = {
|
|
|
617
599
|
if (!isValidFactoryViewConfiguration(entityConfig) || !companyId) {
|
|
618
600
|
throw new Error("Factory View requires at least one configured line and companyId to be configured.");
|
|
619
601
|
}
|
|
620
|
-
const [lineResult, metricsResult
|
|
602
|
+
const [lineResult, metricsResult] = await Promise.all([
|
|
621
603
|
// Get Line 1's info for general factory details
|
|
622
604
|
supabase.from(linesTable).select(`
|
|
623
605
|
id,
|
|
@@ -628,28 +610,29 @@ var dashboardService = {
|
|
|
628
610
|
companies!lines_company_id_fkey(company_name:name)
|
|
629
611
|
`).eq("id", defaultLineId).maybeSingle(),
|
|
630
612
|
// Get metrics from line_metrics table for all configured lines
|
|
631
|
-
supabase.from(lineMetricsTable).select("*").in("line_id", configuredLineIds).eq("shift_id", shiftId).eq("date", date)
|
|
632
|
-
// Get performance data from the dynamic metrics table for all configured lines
|
|
633
|
-
supabase.from(metricsTable).select("efficiency").in("line_id", configuredLineIds).eq("shift_id", shiftId).eq("date", date)
|
|
613
|
+
supabase.from(lineMetricsTable).select("*").in("line_id", configuredLineIds).eq("shift_id", shiftId).eq("date", date)
|
|
634
614
|
]);
|
|
635
615
|
if (lineResult.error) throw lineResult.error;
|
|
636
616
|
if (!lineResult.data) throw new Error(`Configured default line (${defaultLineId}) not found`);
|
|
637
617
|
if (metricsResult.error) throw metricsResult.error;
|
|
638
|
-
if (performanceResult.error) throw performanceResult.error;
|
|
639
618
|
const lineData2 = lineResult.data;
|
|
640
619
|
const metricsData = metricsResult.data;
|
|
641
|
-
const performanceData2 = performanceResult.data;
|
|
642
|
-
const underperformingWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10, 70);
|
|
643
|
-
const validWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10);
|
|
644
|
-
const underperformingCount2 = underperformingWorkspaces2.length;
|
|
645
|
-
validWorkspaces2.length;
|
|
646
620
|
const combinedMetrics = (metricsData || []).reduce((acc, m) => {
|
|
647
|
-
acc.avg_efficiency += m.efficiency ?? 0;
|
|
648
621
|
acc.current_output += m.current_output ?? 0;
|
|
649
622
|
acc.ideal_output += m.ideal_output ?? m.line_threshold ?? 0;
|
|
623
|
+
acc.total_workspaces += m.total_workspaces ?? 0;
|
|
624
|
+
acc.underperforming_workspaces += m.underperforming_workspaces ?? 0;
|
|
625
|
+
acc.weightedEfficiencySum += (m.avg_efficiency ?? 0) * (m.total_workspaces ?? 0);
|
|
650
626
|
return acc;
|
|
651
|
-
}, {
|
|
627
|
+
}, {
|
|
628
|
+
current_output: 0,
|
|
629
|
+
ideal_output: 0,
|
|
630
|
+
total_workspaces: 0,
|
|
631
|
+
underperforming_workspaces: 0,
|
|
632
|
+
weightedEfficiencySum: 0
|
|
633
|
+
});
|
|
652
634
|
metricsData?.length || 1;
|
|
635
|
+
const avgEfficiency = combinedMetrics.total_workspaces > 0 ? combinedMetrics.weightedEfficiencySum / combinedMetrics.total_workspaces : 0;
|
|
653
636
|
return {
|
|
654
637
|
line_id: factoryViewId,
|
|
655
638
|
// Use configured factory view ID
|
|
@@ -662,15 +645,13 @@ var dashboardService = {
|
|
|
662
645
|
shift_id: shiftId,
|
|
663
646
|
date,
|
|
664
647
|
metrics: {
|
|
665
|
-
avg_efficiency:
|
|
666
|
-
// Use memoized calculation for efficiency
|
|
648
|
+
avg_efficiency: avgEfficiency,
|
|
667
649
|
avg_cycle_time: 0,
|
|
668
650
|
// Needs calculation logic if required for factory view
|
|
669
651
|
current_output: combinedMetrics.current_output,
|
|
670
652
|
ideal_output: combinedMetrics.ideal_output,
|
|
671
|
-
total_workspaces: 0,
|
|
672
|
-
|
|
673
|
-
underperforming_workspaces: underperformingCount2,
|
|
653
|
+
total_workspaces: combinedMetrics.total_workspaces || 0,
|
|
654
|
+
underperforming_workspaces: combinedMetrics.underperforming_workspaces,
|
|
674
655
|
underperforming_workspace_names: [],
|
|
675
656
|
// Populate if needed
|
|
676
657
|
underperforming_workspace_uuids: [],
|
|
@@ -704,13 +685,6 @@ var dashboardService = {
|
|
|
704
685
|
} catch (err) {
|
|
705
686
|
console.error(`Error fetching line metrics for ${lineId}:`, err);
|
|
706
687
|
}
|
|
707
|
-
const { data: performanceData, error: performanceError } = await supabase.from(metricsTable).select("efficiency").eq("line_id", lineId).eq("shift_id", shiftId).eq("date", date);
|
|
708
|
-
if (performanceError) throw performanceError;
|
|
709
|
-
const underperformingWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10, 70);
|
|
710
|
-
const validWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10);
|
|
711
|
-
const underperformingCount = underperformingWorkspaces.length;
|
|
712
|
-
validWorkspaces.length;
|
|
713
|
-
const avgEfficiencyFromPerf = memoizedAverageEfficiency(performanceData || [], 10);
|
|
714
688
|
const useFallbackMetrics = !metricsFromDb;
|
|
715
689
|
let metricsForReturn;
|
|
716
690
|
if (useFallbackMetrics) {
|
|
@@ -720,7 +694,7 @@ var dashboardService = {
|
|
|
720
694
|
current_output: 0,
|
|
721
695
|
ideal_output: 0,
|
|
722
696
|
total_workspaces: 42,
|
|
723
|
-
underperforming_workspaces:
|
|
697
|
+
underperforming_workspaces: 0,
|
|
724
698
|
underperforming_workspace_names: [],
|
|
725
699
|
underperforming_workspace_uuids: [],
|
|
726
700
|
output_array: [],
|
|
@@ -733,12 +707,12 @@ var dashboardService = {
|
|
|
733
707
|
};
|
|
734
708
|
} else {
|
|
735
709
|
metricsForReturn = {
|
|
736
|
-
avg_efficiency: metricsFromDb.
|
|
710
|
+
avg_efficiency: metricsFromDb.avg_efficiency ?? 0,
|
|
737
711
|
avg_cycle_time: metricsFromDb.avg_cycle_time || 0,
|
|
738
712
|
current_output: metricsFromDb.current_output || 0,
|
|
739
713
|
ideal_output: metricsFromDb.ideal_output || metricsFromDb.line_threshold || 0,
|
|
740
714
|
total_workspaces: metricsFromDb.total_workspaces ?? workspaceConfig.totalWorkspaces ?? 42,
|
|
741
|
-
underperforming_workspaces:
|
|
715
|
+
underperforming_workspaces: metricsFromDb.underperforming_workspaces ?? 0,
|
|
742
716
|
underperforming_workspace_names: metricsFromDb.underperforming_workspace_names || [],
|
|
743
717
|
underperforming_workspace_uuids: metricsFromDb.underperforming_workspace_uuids || [],
|
|
744
718
|
output_array: metricsFromDb.output_array || [],
|
|
@@ -749,9 +723,6 @@ var dashboardService = {
|
|
|
749
723
|
last_updated: metricsFromDb.last_updated || (/* @__PURE__ */ new Date()).toISOString(),
|
|
750
724
|
poorest_performing_workspaces: metricsFromDb.poorest_performing_workspaces || []
|
|
751
725
|
};
|
|
752
|
-
if (metricsFromDb.efficiency === null || metricsFromDb.efficiency === void 0) {
|
|
753
|
-
metricsForReturn.avg_efficiency = avgEfficiencyFromPerf;
|
|
754
|
-
}
|
|
755
726
|
}
|
|
756
727
|
return {
|
|
757
728
|
line_id: lineData.id,
|
|
@@ -1014,7 +985,7 @@ var dashboardService = {
|
|
|
1014
985
|
const lineMetricsTable = getTable2(dbConfig, "lineMetrics");
|
|
1015
986
|
const companyId = entityConfig.companyId;
|
|
1016
987
|
const metricsTablePrefixStr = getMetricsTablePrefix();
|
|
1017
|
-
|
|
988
|
+
`${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
|
|
1018
989
|
const configuredLineIds = getConfiguredLineIds(entityConfig);
|
|
1019
990
|
const defaultLineId = configuredLineIds[0];
|
|
1020
991
|
const factoryViewId = entityConfig.factoryViewId ?? "factory";
|
|
@@ -1029,25 +1000,17 @@ var dashboardService = {
|
|
|
1029
1000
|
throw new Error("Factory View requires at least one configured line and companyId to be configured.");
|
|
1030
1001
|
}
|
|
1031
1002
|
const lineIdsToQuery = configuredLineIds;
|
|
1032
|
-
const [line1Result, metricsResult2
|
|
1003
|
+
const [line1Result, metricsResult2] = await Promise.all([
|
|
1033
1004
|
supabase.from(linesTable).select("id, line_name, factory_id, factories!lines_factory_id_fkey(factory_name), company_id, companies!lines_company_id_fkey(company_name:name)").eq("id", defaultLineId).single(),
|
|
1034
|
-
supabase.from(lineMetricsTable).select("*").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
|
|
1035
|
-
supabase.from(metricsTable).select("efficiency").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
|
|
1005
|
+
supabase.from(lineMetricsTable).select("*").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
|
|
1036
1006
|
]);
|
|
1037
1007
|
if (line1Result.error) throw line1Result.error;
|
|
1038
1008
|
if (!line1Result.data) {
|
|
1039
1009
|
throw new Error(`Default line ${defaultLineId} for Factory View not found.`);
|
|
1040
1010
|
}
|
|
1041
1011
|
if (metricsResult2.error) throw metricsResult2.error;
|
|
1042
|
-
if (performanceResult2.error) throw performanceResult2.error;
|
|
1043
1012
|
const line1Data = line1Result.data;
|
|
1044
1013
|
const metricsData = metricsResult2.data;
|
|
1045
|
-
const performanceData2 = performanceResult2.data;
|
|
1046
|
-
const underperformingWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10, 70);
|
|
1047
|
-
const validWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10);
|
|
1048
|
-
const underperformingCount2 = underperformingWorkspaces2.length;
|
|
1049
|
-
const totalValidWorkspaces2 = validWorkspaces2.length;
|
|
1050
|
-
const avgEfficiencyFromPerf2 = memoizedAverageEfficiency(performanceData2 || [], 10);
|
|
1051
1014
|
const initialAccumulator = {
|
|
1052
1015
|
avg_cycle_time: 0,
|
|
1053
1016
|
current_output: 0,
|
|
@@ -1055,6 +1018,10 @@ var dashboardService = {
|
|
|
1055
1018
|
line_threshold: 0,
|
|
1056
1019
|
threshold_pph: 0,
|
|
1057
1020
|
total_workspaces: 0,
|
|
1021
|
+
underperforming_workspaces: 0,
|
|
1022
|
+
weightedEfficiencySum: 0,
|
|
1023
|
+
underperforming_workspace_names: [],
|
|
1024
|
+
underperforming_workspace_uuids: [],
|
|
1058
1025
|
output_array: [],
|
|
1059
1026
|
outputArrays: []
|
|
1060
1027
|
};
|
|
@@ -1065,13 +1032,21 @@ var dashboardService = {
|
|
|
1065
1032
|
acc.line_threshold += m.line_threshold ?? 0;
|
|
1066
1033
|
acc.threshold_pph += m.threshold_pph ?? 0;
|
|
1067
1034
|
acc.total_workspaces += m.total_workspaces ?? 0;
|
|
1035
|
+
acc.underperforming_workspaces += m.underperforming_workspaces ?? 0;
|
|
1036
|
+
acc.weightedEfficiencySum += (m.avg_efficiency ?? 0) * (m.total_workspaces ?? 0);
|
|
1037
|
+
if (m.underperforming_workspace_names) {
|
|
1038
|
+
acc.underperforming_workspace_names.push(...m.underperforming_workspace_names);
|
|
1039
|
+
}
|
|
1040
|
+
if (m.underperforming_workspace_uuids) {
|
|
1041
|
+
acc.underperforming_workspace_uuids.push(...m.underperforming_workspace_uuids);
|
|
1042
|
+
}
|
|
1068
1043
|
if (m.output_array && m.output_array.length > 0) {
|
|
1069
1044
|
acc.outputArrays.push(m.output_array);
|
|
1070
1045
|
}
|
|
1071
1046
|
return acc;
|
|
1072
1047
|
}, initialAccumulator);
|
|
1073
1048
|
const numLines = Math.max(metricsData?.length || 0, 1);
|
|
1074
|
-
const
|
|
1049
|
+
const avgEfficiency = combinedMetricsData.total_workspaces > 0 ? combinedMetricsData.weightedEfficiencySum / combinedMetricsData.total_workspaces : 0;
|
|
1075
1050
|
return {
|
|
1076
1051
|
line_id: factoryViewId,
|
|
1077
1052
|
line_name: "Factory View",
|
|
@@ -1082,22 +1057,20 @@ var dashboardService = {
|
|
|
1082
1057
|
date: queryDate,
|
|
1083
1058
|
shift_id: queryShiftId,
|
|
1084
1059
|
metrics: {
|
|
1085
|
-
avg_efficiency:
|
|
1086
|
-
// Use performance data first, fallback to line metrics
|
|
1060
|
+
avg_efficiency: avgEfficiency,
|
|
1087
1061
|
avg_cycle_time: combinedMetricsData.avg_cycle_time / numLines,
|
|
1088
1062
|
current_output: combinedMetricsData.current_output,
|
|
1089
1063
|
ideal_output: combinedMetricsData.ideal_output,
|
|
1090
1064
|
total_workspaces: combinedMetricsData.total_workspaces || 0,
|
|
1091
|
-
|
|
1092
|
-
underperforming_workspaces: underperformingCount2,
|
|
1065
|
+
underperforming_workspaces: combinedMetricsData.underperforming_workspaces,
|
|
1093
1066
|
line_threshold: combinedMetricsData.line_threshold,
|
|
1094
1067
|
threshold_pph: combinedMetricsData.threshold_pph / numLines,
|
|
1095
1068
|
shift_start: metricsData?.[0]?.shift_start || shiftConfig.dayShift?.startTime || "06:00",
|
|
1096
1069
|
shift_end: metricsData?.[0]?.shift_end || shiftConfig.dayShift?.endTime || "18:00",
|
|
1097
1070
|
last_updated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1098
1071
|
output_array: combinedMetricsData.outputArrays.length > 0 ? memoizedOutputArrayAggregation(combinedMetricsData.outputArrays) : [],
|
|
1099
|
-
underperforming_workspace_names:
|
|
1100
|
-
underperforming_workspace_uuids:
|
|
1072
|
+
underperforming_workspace_names: combinedMetricsData.underperforming_workspace_names,
|
|
1073
|
+
underperforming_workspace_uuids: combinedMetricsData.underperforming_workspace_uuids,
|
|
1101
1074
|
poorest_performing_workspaces: []
|
|
1102
1075
|
}
|
|
1103
1076
|
};
|
|
@@ -1105,25 +1078,17 @@ var dashboardService = {
|
|
|
1105
1078
|
if (!companyId) {
|
|
1106
1079
|
throw new Error("Company ID must be configured for detailed line requests.");
|
|
1107
1080
|
}
|
|
1108
|
-
const [lineResult, metricsResult
|
|
1081
|
+
const [lineResult, metricsResult] = await Promise.all([
|
|
1109
1082
|
supabase.from(linesTable).select("id, line_name, factory_id, factories!lines_factory_id_fkey(factory_name), company_id, companies!lines_company_id_fkey(company_name:name)").eq("id", lineIdToQuery).single(),
|
|
1110
|
-
supabase.from(lineMetricsTable).select("*").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate).maybeSingle()
|
|
1111
|
-
supabase.from(metricsTable).select("efficiency").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
|
|
1083
|
+
supabase.from(lineMetricsTable).select("*").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate).maybeSingle()
|
|
1112
1084
|
]);
|
|
1113
1085
|
if (lineResult.error) throw lineResult.error;
|
|
1114
1086
|
if (!lineResult.data) {
|
|
1115
1087
|
throw new Error(`Line ${lineIdToQuery} not found.`);
|
|
1116
1088
|
}
|
|
1117
1089
|
if (metricsResult.error) throw metricsResult.error;
|
|
1118
|
-
if (performanceResult.error) throw performanceResult.error;
|
|
1119
1090
|
const lineData = lineResult.data;
|
|
1120
1091
|
const metrics2 = metricsResult.data;
|
|
1121
|
-
const performanceData = performanceResult.data;
|
|
1122
|
-
const underperformingWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10, 70);
|
|
1123
|
-
const validWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10);
|
|
1124
|
-
const underperformingCount = underperformingWorkspaces.length;
|
|
1125
|
-
const totalValidWorkspaces = validWorkspaces.length;
|
|
1126
|
-
const avgEfficiencyFromPerf = memoizedAverageEfficiency(performanceData || [], 10);
|
|
1127
1092
|
return {
|
|
1128
1093
|
line_id: lineData.id,
|
|
1129
1094
|
line_name: lineData.line_name,
|
|
@@ -1134,13 +1099,12 @@ var dashboardService = {
|
|
|
1134
1099
|
date: queryDate,
|
|
1135
1100
|
shift_id: queryShiftId,
|
|
1136
1101
|
metrics: {
|
|
1137
|
-
avg_efficiency:
|
|
1138
|
-
// Use performance data first, fallback to line metrics
|
|
1102
|
+
avg_efficiency: metrics2?.avg_efficiency ?? 0,
|
|
1139
1103
|
avg_cycle_time: metrics2?.avg_cycle_time || 0,
|
|
1140
1104
|
current_output: metrics2?.current_output || 0,
|
|
1141
1105
|
ideal_output: metrics2?.ideal_output || metrics2?.line_threshold || 0,
|
|
1142
1106
|
total_workspaces: metrics2?.total_workspaces ?? workspaceConfig.totalWorkspaces ?? 42,
|
|
1143
|
-
underperforming_workspaces:
|
|
1107
|
+
underperforming_workspaces: metrics2?.underperforming_workspaces ?? 0,
|
|
1144
1108
|
line_threshold: metrics2?.line_threshold || 0,
|
|
1145
1109
|
threshold_pph: metrics2?.threshold_pph || 0,
|
|
1146
1110
|
shift_start: metrics2?.shift_start || shiftConfig.dayShift?.startTime || "06:00",
|
|
@@ -2025,14 +1989,17 @@ var authOTPService = {
|
|
|
2025
1989
|
const { error } = await supabase.auth.signInWithOtp({
|
|
2026
1990
|
email,
|
|
2027
1991
|
options: {
|
|
2028
|
-
shouldCreateUser:
|
|
2029
|
-
//
|
|
1992
|
+
shouldCreateUser: false,
|
|
1993
|
+
// Only allow existing users to log in
|
|
2030
1994
|
emailRedirectTo: void 0
|
|
2031
1995
|
// Disable magic link redirect
|
|
2032
1996
|
}
|
|
2033
1997
|
});
|
|
2034
1998
|
if (error) {
|
|
2035
1999
|
console.error("Error sending OTP:", error);
|
|
2000
|
+
if (error.message.toLowerCase().includes("signups not allowed") || error.message.toLowerCase().includes("signup") || error.message.toLowerCase().includes("not allowed")) {
|
|
2001
|
+
error.message = "You don't have an account with us. Please contact the Optifye team for more details.";
|
|
2002
|
+
}
|
|
2036
2003
|
}
|
|
2037
2004
|
return { error };
|
|
2038
2005
|
},
|
|
@@ -4646,20 +4613,13 @@ var useRealtimeLineMetrics = ({
|
|
|
4646
4613
|
workspaceData: workspaceData?.length
|
|
4647
4614
|
});
|
|
4648
4615
|
}
|
|
4649
|
-
|
|
4650
|
-
if (workspaceData && workspaceData.length > 0) {
|
|
4651
|
-
const activeWorkspaces = workspaceData.filter((w) => w.efficiency >= 10);
|
|
4652
|
-
if (activeWorkspaces.length > 0) {
|
|
4653
|
-
const totalEfficiency = activeWorkspaces.reduce((sum, workspace) => sum + (workspace.efficiency || 0), 0);
|
|
4654
|
-
avgEfficiency = totalEfficiency / activeWorkspaces.length;
|
|
4655
|
-
}
|
|
4656
|
-
}
|
|
4616
|
+
const avgEfficiency = metricsData.reduce((sum, m) => sum + (m.avg_efficiency || 0), 0) / metricsData.length;
|
|
4657
4617
|
const combinedMetrics = {
|
|
4658
4618
|
line_id: factoryViewId,
|
|
4659
4619
|
shift_id: shiftId,
|
|
4660
4620
|
date,
|
|
4661
4621
|
factory_id: firstLine.factory_id,
|
|
4662
|
-
avg_efficiency: avgEfficiency
|
|
4622
|
+
avg_efficiency: avgEfficiency,
|
|
4663
4623
|
avg_cycle_time: metricsData.reduce((sum, m) => sum + (m.avg_cycle_time || 0), 0) / metricsData.length,
|
|
4664
4624
|
current_output: metricsData.reduce((sum, m) => sum + (m.current_output || 0), 0),
|
|
4665
4625
|
ideal_output: metricsData.reduce((sum, m) => sum + (m.ideal_output || 0), 0),
|
|
@@ -4711,22 +4671,14 @@ var useRealtimeLineMetrics = ({
|
|
|
4711
4671
|
workspaceData: workspaceData?.length
|
|
4712
4672
|
});
|
|
4713
4673
|
}
|
|
4714
|
-
let avgEfficiency = 0;
|
|
4715
|
-
if (workspaceData && workspaceData.length > 0) {
|
|
4716
|
-
const activeWorkspaces = workspaceData.filter((w) => w.efficiency >= 10);
|
|
4717
|
-
if (activeWorkspaces.length > 0) {
|
|
4718
|
-
const totalEfficiency = activeWorkspaces.reduce((sum, workspace) => sum + (workspace.efficiency || 0), 0);
|
|
4719
|
-
avgEfficiency = totalEfficiency / activeWorkspaces.length;
|
|
4720
|
-
}
|
|
4721
|
-
}
|
|
4722
4674
|
if (!metricsData) {
|
|
4723
4675
|
setMetrics({
|
|
4724
4676
|
line_id: lineIdRef.current,
|
|
4725
4677
|
shift_id: shiftId,
|
|
4726
4678
|
date,
|
|
4727
4679
|
factory_id: "",
|
|
4728
|
-
avg_efficiency:
|
|
4729
|
-
//
|
|
4680
|
+
avg_efficiency: 0,
|
|
4681
|
+
// Default to 0 when no data
|
|
4730
4682
|
avg_cycle_time: 0,
|
|
4731
4683
|
current_output: 0,
|
|
4732
4684
|
ideal_output: 0,
|
|
@@ -4745,7 +4697,6 @@ var useRealtimeLineMetrics = ({
|
|
|
4745
4697
|
} else {
|
|
4746
4698
|
setMetrics({
|
|
4747
4699
|
...metricsData,
|
|
4748
|
-
avg_efficiency: avgEfficiency > 0 ? avgEfficiency : metricsData.avg_efficiency,
|
|
4749
4700
|
poorest_performing_workspaces: poorestPerformingWorkspaces
|
|
4750
4701
|
});
|
|
4751
4702
|
}
|
|
@@ -5594,6 +5545,7 @@ console.log("\u{1F504} workspaceDisplayNames.ts module loaded");
|
|
|
5594
5545
|
var runtimeWorkspaceDisplayNames = {};
|
|
5595
5546
|
var isInitialized = false;
|
|
5596
5547
|
var isInitializing = false;
|
|
5548
|
+
var initializedWithLineIds = [];
|
|
5597
5549
|
function getCurrentLineIds() {
|
|
5598
5550
|
try {
|
|
5599
5551
|
const config = _getDashboardConfigInstance();
|
|
@@ -5625,28 +5577,29 @@ async function initializeWorkspaceDisplayNames(explicitLineId) {
|
|
|
5625
5577
|
targetLineIds = getCurrentLineIds();
|
|
5626
5578
|
}
|
|
5627
5579
|
console.log("\u{1F504} Target line IDs for workspace filtering:", targetLineIds);
|
|
5628
|
-
|
|
5580
|
+
runtimeWorkspaceDisplayNames = {};
|
|
5629
5581
|
if (targetLineIds.length > 0) {
|
|
5630
5582
|
for (const lineId of targetLineIds) {
|
|
5631
5583
|
console.log(`\u{1F504} Fetching workspaces for line: ${lineId}`);
|
|
5632
5584
|
const lineDisplayNamesMap = await workspaceService.getWorkspaceDisplayNames(void 0, lineId);
|
|
5585
|
+
runtimeWorkspaceDisplayNames[lineId] = {};
|
|
5633
5586
|
lineDisplayNamesMap.forEach((displayName, workspaceId) => {
|
|
5634
|
-
|
|
5587
|
+
runtimeWorkspaceDisplayNames[lineId][workspaceId] = displayName;
|
|
5635
5588
|
});
|
|
5589
|
+
console.log(`\u2705 Stored ${lineDisplayNamesMap.size} workspaces for line ${lineId}`);
|
|
5636
5590
|
}
|
|
5637
5591
|
} else {
|
|
5638
5592
|
console.warn("\u26A0\uFE0F No line IDs found, fetching all workspaces (less efficient)");
|
|
5639
5593
|
const allWorkspacesMap = await workspaceService.getWorkspaceDisplayNames();
|
|
5594
|
+
runtimeWorkspaceDisplayNames["global"] = {};
|
|
5640
5595
|
allWorkspacesMap.forEach((displayName, workspaceId) => {
|
|
5641
|
-
|
|
5596
|
+
runtimeWorkspaceDisplayNames["global"][workspaceId] = displayName;
|
|
5642
5597
|
});
|
|
5643
5598
|
}
|
|
5644
|
-
runtimeWorkspaceDisplayNames = {};
|
|
5645
|
-
allDisplayNamesMap.forEach((displayName, workspaceId) => {
|
|
5646
|
-
runtimeWorkspaceDisplayNames[workspaceId] = displayName;
|
|
5647
|
-
});
|
|
5648
5599
|
isInitialized = true;
|
|
5600
|
+
initializedWithLineIds = targetLineIds;
|
|
5649
5601
|
console.log("\u2705 Workspace display names initialized from Supabase:", runtimeWorkspaceDisplayNames);
|
|
5602
|
+
console.log("\u2705 Initialized with line IDs:", initializedWithLineIds);
|
|
5650
5603
|
} catch (error) {
|
|
5651
5604
|
console.error("\u274C Failed to initialize workspace display names from Supabase:", error);
|
|
5652
5605
|
} finally {
|
|
@@ -5656,7 +5609,20 @@ async function initializeWorkspaceDisplayNames(explicitLineId) {
|
|
|
5656
5609
|
var preInitializeWorkspaceDisplayNames = async (lineId) => {
|
|
5657
5610
|
console.log("\u{1F504} preInitializeWorkspaceDisplayNames called for lineId:", lineId);
|
|
5658
5611
|
if (isInitialized || isInitializing) {
|
|
5659
|
-
console.log("\u{1F504} Already initialized or initializing
|
|
5612
|
+
console.log("\u{1F504} Already initialized or initializing");
|
|
5613
|
+
if (lineId && !runtimeWorkspaceDisplayNames[lineId]) {
|
|
5614
|
+
console.log(`\u{1F504} Line ${lineId} not in cache, fetching...`);
|
|
5615
|
+
try {
|
|
5616
|
+
const lineDisplayNamesMap = await workspaceService.getWorkspaceDisplayNames(void 0, lineId);
|
|
5617
|
+
runtimeWorkspaceDisplayNames[lineId] = {};
|
|
5618
|
+
lineDisplayNamesMap.forEach((displayName, workspaceId) => {
|
|
5619
|
+
runtimeWorkspaceDisplayNames[lineId][workspaceId] = displayName;
|
|
5620
|
+
});
|
|
5621
|
+
console.log(`\u2705 Added ${lineDisplayNamesMap.size} workspaces for line ${lineId}`);
|
|
5622
|
+
} catch (error) {
|
|
5623
|
+
console.error(`\u274C Failed to fetch workspaces for line ${lineId}:`, error);
|
|
5624
|
+
}
|
|
5625
|
+
}
|
|
5660
5626
|
return;
|
|
5661
5627
|
}
|
|
5662
5628
|
await initializeWorkspaceDisplayNames(lineId);
|
|
@@ -5669,45 +5635,91 @@ var forceRefreshWorkspaceDisplayNames = async (lineId) => {
|
|
|
5669
5635
|
console.log("\u{1F504} Module loaded, will initialize lazily when first function is called");
|
|
5670
5636
|
var getWorkspaceDisplayName = (workspaceId, lineId) => {
|
|
5671
5637
|
if (!isInitialized && !isInitializing) {
|
|
5672
|
-
console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName(${workspaceId}) - Not initialized, triggering lazy init...`);
|
|
5638
|
+
console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) - Not initialized, triggering lazy init...`);
|
|
5673
5639
|
} else if (isInitializing) {
|
|
5674
|
-
console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName(${workspaceId}) - Currently initializing...`);
|
|
5640
|
+
console.log(`\u{1F504} [DEBUG] getWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) - Currently initializing...`);
|
|
5675
5641
|
}
|
|
5676
5642
|
if (!isInitialized && !isInitializing) {
|
|
5677
|
-
console.log("\u{1F504} Lazy initialization triggered by getWorkspaceDisplayName");
|
|
5643
|
+
console.log("\u{1F504} Lazy initialization triggered by getWorkspaceDisplayName with lineId:", lineId);
|
|
5678
5644
|
initializeWorkspaceDisplayNames(lineId).catch((error) => {
|
|
5679
5645
|
console.error("\u274C Lazy initialization failed:", error);
|
|
5680
5646
|
});
|
|
5681
5647
|
}
|
|
5682
|
-
|
|
5648
|
+
if (isInitialized && lineId && !runtimeWorkspaceDisplayNames[lineId]) {
|
|
5649
|
+
console.log(`\u{1F504} Line ${lineId} not in cache, fetching its workspaces...`);
|
|
5650
|
+
workspaceService.getWorkspaceDisplayNames(void 0, lineId).then((lineDisplayNamesMap) => {
|
|
5651
|
+
runtimeWorkspaceDisplayNames[lineId] = {};
|
|
5652
|
+
lineDisplayNamesMap.forEach((displayName2, workspaceId2) => {
|
|
5653
|
+
runtimeWorkspaceDisplayNames[lineId][workspaceId2] = displayName2;
|
|
5654
|
+
});
|
|
5655
|
+
console.log(`\u2705 Added ${lineDisplayNamesMap.size} workspaces for line ${lineId} to cache`);
|
|
5656
|
+
}).catch((error) => {
|
|
5657
|
+
console.error(`\u274C Failed to fetch workspaces for line ${lineId}:`, error);
|
|
5658
|
+
});
|
|
5659
|
+
}
|
|
5660
|
+
let displayName;
|
|
5661
|
+
if (lineId && runtimeWorkspaceDisplayNames[lineId]) {
|
|
5662
|
+
displayName = runtimeWorkspaceDisplayNames[lineId][workspaceId];
|
|
5663
|
+
} else if (!lineId) {
|
|
5664
|
+
for (const cachedLineId of Object.keys(runtimeWorkspaceDisplayNames)) {
|
|
5665
|
+
if (runtimeWorkspaceDisplayNames[cachedLineId][workspaceId]) {
|
|
5666
|
+
displayName = runtimeWorkspaceDisplayNames[cachedLineId][workspaceId];
|
|
5667
|
+
console.warn(`\u26A0\uFE0F No lineId provided for ${workspaceId}, found in line ${cachedLineId}`);
|
|
5668
|
+
break;
|
|
5669
|
+
}
|
|
5670
|
+
}
|
|
5671
|
+
}
|
|
5683
5672
|
if (displayName) {
|
|
5684
|
-
console.log(`getWorkspaceDisplayName(${workspaceId}) -> ${displayName} (from Supabase)`);
|
|
5673
|
+
console.log(`getWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${displayName} (from Supabase)`);
|
|
5685
5674
|
return displayName;
|
|
5686
5675
|
} else {
|
|
5687
5676
|
if (isInitialized) {
|
|
5688
|
-
console.log(`getWorkspaceDisplayName(${workspaceId}) -> ${workspaceId} (not found in Supabase data)`);
|
|
5677
|
+
console.log(`getWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${workspaceId} (not found in Supabase data)`);
|
|
5689
5678
|
} else {
|
|
5690
|
-
console.log(`getWorkspaceDisplayName(${workspaceId}) -> ${workspaceId} (Supabase not initialized yet)`);
|
|
5679
|
+
console.log(`getWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${workspaceId} (Supabase not initialized yet)`);
|
|
5691
5680
|
}
|
|
5692
5681
|
return workspaceId;
|
|
5693
5682
|
}
|
|
5694
5683
|
};
|
|
5695
5684
|
var getShortWorkspaceDisplayName = (workspaceId, lineId) => {
|
|
5696
5685
|
if (!isInitialized && !isInitializing) {
|
|
5697
|
-
console.log("\u{1F504} Lazy initialization triggered by getShortWorkspaceDisplayName");
|
|
5686
|
+
console.log("\u{1F504} Lazy initialization triggered by getShortWorkspaceDisplayName with lineId:", lineId);
|
|
5698
5687
|
initializeWorkspaceDisplayNames(lineId).catch((error) => {
|
|
5699
5688
|
console.error("\u274C Lazy initialization failed:", error);
|
|
5700
5689
|
});
|
|
5701
5690
|
}
|
|
5702
|
-
|
|
5691
|
+
if (isInitialized && lineId && !runtimeWorkspaceDisplayNames[lineId]) {
|
|
5692
|
+
console.log(`\u{1F504} Line ${lineId} not in cache, fetching its workspaces...`);
|
|
5693
|
+
workspaceService.getWorkspaceDisplayNames(void 0, lineId).then((lineDisplayNamesMap) => {
|
|
5694
|
+
runtimeWorkspaceDisplayNames[lineId] = {};
|
|
5695
|
+
lineDisplayNamesMap.forEach((displayName2, workspaceId2) => {
|
|
5696
|
+
runtimeWorkspaceDisplayNames[lineId][workspaceId2] = displayName2;
|
|
5697
|
+
});
|
|
5698
|
+
console.log(`\u2705 Added ${lineDisplayNamesMap.size} workspaces for line ${lineId} to cache`);
|
|
5699
|
+
}).catch((error) => {
|
|
5700
|
+
console.error(`\u274C Failed to fetch workspaces for line ${lineId}:`, error);
|
|
5701
|
+
});
|
|
5702
|
+
}
|
|
5703
|
+
let displayName;
|
|
5704
|
+
if (lineId && runtimeWorkspaceDisplayNames[lineId]) {
|
|
5705
|
+
displayName = runtimeWorkspaceDisplayNames[lineId][workspaceId];
|
|
5706
|
+
} else if (!lineId) {
|
|
5707
|
+
for (const cachedLineId of Object.keys(runtimeWorkspaceDisplayNames)) {
|
|
5708
|
+
if (runtimeWorkspaceDisplayNames[cachedLineId][workspaceId]) {
|
|
5709
|
+
displayName = runtimeWorkspaceDisplayNames[cachedLineId][workspaceId];
|
|
5710
|
+
console.warn(`\u26A0\uFE0F No lineId provided for ${workspaceId}, found in line ${cachedLineId}`);
|
|
5711
|
+
break;
|
|
5712
|
+
}
|
|
5713
|
+
}
|
|
5714
|
+
}
|
|
5703
5715
|
if (displayName) {
|
|
5704
|
-
console.log(`getShortWorkspaceDisplayName(${workspaceId}) -> ${displayName} (from Supabase)`);
|
|
5716
|
+
console.log(`getShortWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${displayName} (from Supabase)`);
|
|
5705
5717
|
return displayName;
|
|
5706
5718
|
} else {
|
|
5707
5719
|
if (isInitialized) {
|
|
5708
|
-
console.log(`getShortWorkspaceDisplayName(${workspaceId}) -> ${workspaceId} (not found in Supabase data)`);
|
|
5720
|
+
console.log(`getShortWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${workspaceId} (not found in Supabase data)`);
|
|
5709
5721
|
} else {
|
|
5710
|
-
console.log(`getShortWorkspaceDisplayName(${workspaceId}) -> ${workspaceId} (Supabase not initialized yet)`);
|
|
5722
|
+
console.log(`getShortWorkspaceDisplayName(${workspaceId}, lineId: ${lineId}) -> ${workspaceId} (Supabase not initialized yet)`);
|
|
5711
5723
|
}
|
|
5712
5724
|
return workspaceId;
|
|
5713
5725
|
}
|
|
@@ -5728,7 +5740,14 @@ var getAllWorkspaceDisplayNamesAsync = async (companyId, lineId) => {
|
|
|
5728
5740
|
while (isInitializing) {
|
|
5729
5741
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
5730
5742
|
}
|
|
5731
|
-
|
|
5743
|
+
if (lineId && runtimeWorkspaceDisplayNames[lineId]) {
|
|
5744
|
+
return { ...runtimeWorkspaceDisplayNames[lineId] };
|
|
5745
|
+
}
|
|
5746
|
+
const allNames = {};
|
|
5747
|
+
Object.values(runtimeWorkspaceDisplayNames).forEach((lineNames) => {
|
|
5748
|
+
Object.assign(allNames, lineNames);
|
|
5749
|
+
});
|
|
5750
|
+
return allNames;
|
|
5732
5751
|
};
|
|
5733
5752
|
var getWorkspaceDisplayNamesMap = async (workspaceIds, companyId, lineId) => {
|
|
5734
5753
|
const allNames = await getAllWorkspaceDisplayNamesAsync(companyId, lineId);
|
|
@@ -5757,10 +5776,11 @@ var clearWorkspaceDisplayNamesCache = () => {
|
|
|
5757
5776
|
runtimeWorkspaceDisplayNames = {};
|
|
5758
5777
|
isInitialized = false;
|
|
5759
5778
|
isInitializing = false;
|
|
5779
|
+
initializedWithLineIds = [];
|
|
5760
5780
|
};
|
|
5761
5781
|
|
|
5762
5782
|
// src/lib/hooks/useWorkspaceDisplayNames.ts
|
|
5763
|
-
var useWorkspaceDisplayNames = (
|
|
5783
|
+
var useWorkspaceDisplayNames = (lineId, companyId) => {
|
|
5764
5784
|
const [displayNames, setDisplayNames] = React19.useState({});
|
|
5765
5785
|
const [loading, setLoading] = React19.useState(true);
|
|
5766
5786
|
const [error, setError] = React19.useState(null);
|
|
@@ -5786,7 +5806,7 @@ var useWorkspaceDisplayNames = (companyId, lineId) => {
|
|
|
5786
5806
|
refetch: fetchDisplayNames
|
|
5787
5807
|
};
|
|
5788
5808
|
};
|
|
5789
|
-
var useWorkspaceDisplayName = (workspaceId,
|
|
5809
|
+
var useWorkspaceDisplayName = (workspaceId, lineId, companyId) => {
|
|
5790
5810
|
const [displayName, setDisplayName] = React19.useState(workspaceId);
|
|
5791
5811
|
const [loading, setLoading] = React19.useState(true);
|
|
5792
5812
|
const [error, setError] = React19.useState(null);
|
|
@@ -5813,7 +5833,7 @@ var useWorkspaceDisplayName = (workspaceId, companyId, lineId) => {
|
|
|
5813
5833
|
refetch: fetchDisplayName
|
|
5814
5834
|
};
|
|
5815
5835
|
};
|
|
5816
|
-
var useWorkspaceDisplayNamesMap = (workspaceIds,
|
|
5836
|
+
var useWorkspaceDisplayNamesMap = (workspaceIds, lineId, companyId) => {
|
|
5817
5837
|
const [displayNames, setDisplayNames] = React19.useState({});
|
|
5818
5838
|
const [loading, setLoading] = React19.useState(true);
|
|
5819
5839
|
const [error, setError] = React19.useState(null);
|
|
@@ -16771,25 +16791,40 @@ var createMotionComponent = /* @__PURE__ */ createMotionComponentFactory({
|
|
|
16771
16791
|
|
|
16772
16792
|
// ../../node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs
|
|
16773
16793
|
var motion = /* @__PURE__ */ createDOMMotionComponentProxy(createMotionComponent);
|
|
16774
|
-
var
|
|
16794
|
+
var OptifyeLogoLoader = ({
|
|
16775
16795
|
size = "md",
|
|
16776
16796
|
message,
|
|
16777
16797
|
className
|
|
16778
16798
|
}) => {
|
|
16779
16799
|
const sizeClasses = {
|
|
16780
|
-
sm: "w-
|
|
16781
|
-
|
|
16782
|
-
|
|
16800
|
+
sm: "w-10",
|
|
16801
|
+
// 40px
|
|
16802
|
+
md: "w-16",
|
|
16803
|
+
// 64px
|
|
16804
|
+
lg: "w-24"
|
|
16805
|
+
// 96px
|
|
16783
16806
|
};
|
|
16784
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16785
|
-
|
|
16786
|
-
|
|
16787
|
-
|
|
16788
|
-
|
|
16789
|
-
|
|
16790
|
-
|
|
16807
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16808
|
+
"div",
|
|
16809
|
+
{
|
|
16810
|
+
role: "status",
|
|
16811
|
+
"aria-label": "Loading",
|
|
16812
|
+
className: `flex flex-col items-center justify-center p-4 ${className || ""}`.trim(),
|
|
16813
|
+
children: [
|
|
16814
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16815
|
+
"img",
|
|
16816
|
+
{
|
|
16817
|
+
src: "/optifye-logo.png",
|
|
16818
|
+
alt: "Optifye Logo",
|
|
16819
|
+
className: `${sizeClasses[size]} h-auto animate-pulse select-none pointer-events-none`
|
|
16820
|
+
}
|
|
16821
|
+
),
|
|
16822
|
+
message && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 text-gray-600 text-sm font-medium text-center", children: message })
|
|
16823
|
+
]
|
|
16824
|
+
}
|
|
16825
|
+
);
|
|
16791
16826
|
};
|
|
16792
|
-
var
|
|
16827
|
+
var OptifyeLogoLoader_default = OptifyeLogoLoader;
|
|
16793
16828
|
var LoadingPage = ({
|
|
16794
16829
|
message = "Loading Dashboard...",
|
|
16795
16830
|
subMessage = "Please wait while we prepare your data",
|
|
@@ -16803,29 +16838,17 @@ var LoadingPage = ({
|
|
|
16803
16838
|
return () => clearTimeout(timeout);
|
|
16804
16839
|
}, [message]);
|
|
16805
16840
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex h-full w-full items-center justify-center bg-slate-50 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center space-y-6 text-center", children: [
|
|
16806
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16807
|
-
/* @__PURE__ */ jsxRuntime.
|
|
16808
|
-
|
|
16809
|
-
|
|
16810
|
-
|
|
16811
|
-
|
|
16812
|
-
|
|
16813
|
-
|
|
16814
|
-
|
|
16815
|
-
|
|
16816
|
-
|
|
16817
|
-
),
|
|
16818
|
-
subMessage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
16819
|
-
motion.p,
|
|
16820
|
-
{
|
|
16821
|
-
className: "mt-2 text-base text-gray-600",
|
|
16822
|
-
initial: { opacity: 0 },
|
|
16823
|
-
animate: { opacity: 1 },
|
|
16824
|
-
transition: { delay: 0.2, duration: 0.3 },
|
|
16825
|
-
children: subMessage
|
|
16826
|
-
}
|
|
16827
|
-
)
|
|
16828
|
-
] })
|
|
16841
|
+
/* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "lg", message }),
|
|
16842
|
+
subMessage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
16843
|
+
motion.p,
|
|
16844
|
+
{
|
|
16845
|
+
className: "mt-2 text-base text-gray-600",
|
|
16846
|
+
initial: { opacity: 0 },
|
|
16847
|
+
animate: { opacity: 1 },
|
|
16848
|
+
transition: { delay: 0.2, duration: 0.3 },
|
|
16849
|
+
children: subMessage
|
|
16850
|
+
}
|
|
16851
|
+
)
|
|
16829
16852
|
] }) });
|
|
16830
16853
|
};
|
|
16831
16854
|
var LoadingPage_default = LoadingPage;
|
|
@@ -18521,7 +18544,7 @@ var VideoCard = React19__namespace.default.memo(({
|
|
|
18521
18544
|
onFatalError: onFatalError ?? (() => throttledReloadDashboard())
|
|
18522
18545
|
});
|
|
18523
18546
|
}
|
|
18524
|
-
const displayName = getWorkspaceDisplayName(workspace.workspace_name);
|
|
18547
|
+
const displayName = getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
|
|
18525
18548
|
const getEfficiencyOverlayColor = (efficiency) => {
|
|
18526
18549
|
if (efficiency >= 80) {
|
|
18527
18550
|
return "bg-[#00D654]/25";
|
|
@@ -18670,7 +18693,7 @@ var VideoGridView = React19__namespace.default.memo(({
|
|
|
18670
18693
|
}, [cropping]);
|
|
18671
18694
|
const veryLowEfficiencyWorkspaces = React19.useMemo(() => {
|
|
18672
18695
|
return new Set(
|
|
18673
|
-
workspaces.filter((w) => w.efficiency < 50 && w.efficiency >= 10).map((w) => w.workspace_name)
|
|
18696
|
+
workspaces.filter((w) => w.efficiency < 50 && w.efficiency >= 10).map((w) => `${w.line_id}_${w.workspace_name}`)
|
|
18674
18697
|
);
|
|
18675
18698
|
}, [workspaces]);
|
|
18676
18699
|
const filteredWorkspaces = React19.useMemo(() => {
|
|
@@ -18778,7 +18801,7 @@ var VideoGridView = React19__namespace.default.memo(({
|
|
|
18778
18801
|
efficiency: workspace.efficiency,
|
|
18779
18802
|
action_count: workspace.action_count
|
|
18780
18803
|
});
|
|
18781
|
-
const displayName = getWorkspaceDisplayName(workspace.workspace_name);
|
|
18804
|
+
const displayName = getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
|
|
18782
18805
|
const navParams = getWorkspaceNavigationParams(workspaceId, displayName);
|
|
18783
18806
|
router$1.push(`/workspace/${workspaceId}${navParams}`);
|
|
18784
18807
|
}, [router$1]);
|
|
@@ -18806,7 +18829,7 @@ var VideoGridView = React19__namespace.default.memo(({
|
|
|
18806
18829
|
}).map((workspace) => {
|
|
18807
18830
|
const workspaceId = workspace.workspace_uuid || workspace.workspace_name;
|
|
18808
18831
|
const isVisible = visibleWorkspaces.has(workspaceId);
|
|
18809
|
-
const isVeryLowEfficiency = veryLowEfficiencyWorkspaces.has(workspace.workspace_name);
|
|
18832
|
+
const isVeryLowEfficiency = veryLowEfficiencyWorkspaces.has(`${workspace.line_id}_${workspace.workspace_name}`);
|
|
18810
18833
|
const workspaceCropping = getWorkspaceCropping(workspace.workspace_name);
|
|
18811
18834
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18812
18835
|
"div",
|
|
@@ -19976,20 +19999,23 @@ var LineHistoryCalendar = ({
|
|
|
19976
19999
|
} else {
|
|
19977
20000
|
calendar.push({
|
|
19978
20001
|
date: currentDate,
|
|
19979
|
-
dayShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0 },
|
|
19980
|
-
nightShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0 }
|
|
20002
|
+
dayShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0, hasData: false },
|
|
20003
|
+
nightShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0, hasData: false }
|
|
19981
20004
|
});
|
|
19982
20005
|
}
|
|
19983
20006
|
}
|
|
19984
20007
|
return calendar;
|
|
19985
20008
|
}, [data, month, year, configuredTimezone]);
|
|
19986
|
-
const
|
|
20009
|
+
const hasRealData = (shift) => {
|
|
20010
|
+
if (shift.hasData !== void 0) return shift.hasData;
|
|
20011
|
+
return shift.total_workspaces > 0 || shift.avg_efficiency > 0 || shift.underperforming_workspaces > 0;
|
|
20012
|
+
};
|
|
20013
|
+
const getPerformanceColor = (efficiency, date, hasData) => {
|
|
19987
20014
|
const istNow = todayInZone;
|
|
19988
20015
|
const nowString = `${istNow.getFullYear()}-${String(istNow.getMonth() + 1).padStart(2, "0")}-${String(istNow.getDate()).padStart(2, "0")}`;
|
|
19989
20016
|
const dateString = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
19990
|
-
if (date.getDay() === 0) return "bg-gray-300 dark:bg-gray-600";
|
|
19991
20017
|
if (dateString > nowString) return "bg-gray-200 dark:bg-gray-700";
|
|
19992
|
-
if (
|
|
20018
|
+
if (!hasData) return "bg-gray-300 dark:bg-gray-600";
|
|
19993
20019
|
return efficiency >= 75 ? "bg-green-500 dark:bg-green-600" : "bg-red-500 dark:bg-red-600";
|
|
19994
20020
|
};
|
|
19995
20021
|
const isCurrentDate = (date) => {
|
|
@@ -20008,7 +20034,7 @@ var LineHistoryCalendar = ({
|
|
|
20008
20034
|
const istNow = todayInZone;
|
|
20009
20035
|
const nowString = `${istNow.getFullYear()}-${String(istNow.getMonth() + 1).padStart(2, "0")}-${String(istNow.getDate()).padStart(2, "0")}`;
|
|
20010
20036
|
const dateString = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
20011
|
-
if (dateString > nowString
|
|
20037
|
+
if (dateString > nowString) return null;
|
|
20012
20038
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-black/80 rounded-lg p-2 text-white opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs space-y-1", children: [
|
|
20013
20039
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
20014
20040
|
"Efficiency: ",
|
|
@@ -20029,14 +20055,14 @@ var LineHistoryCalendar = ({
|
|
|
20029
20055
|
if (!shiftData) return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full border border-gray-100 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800" });
|
|
20030
20056
|
const isToday = isCurrentDate(day.date instanceof Date ? day.date : new Date(day.date));
|
|
20031
20057
|
const isFuture = isFutureDate(day.date instanceof Date ? day.date : new Date(day.date));
|
|
20032
|
-
const
|
|
20058
|
+
const hasData = hasRealData(shiftData);
|
|
20033
20059
|
const dateObj = day.date instanceof Date ? day.date : new Date(day.date);
|
|
20034
20060
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20035
20061
|
"div",
|
|
20036
20062
|
{
|
|
20037
|
-
className: `group h-full ${isFuture ||
|
|
20063
|
+
className: `group h-full ${isFuture || !hasData ? "cursor-not-allowed" : "cursor-pointer hover:opacity-90"}`,
|
|
20038
20064
|
onClick: () => {
|
|
20039
|
-
if (!isFuture &&
|
|
20065
|
+
if (!isFuture && hasData) {
|
|
20040
20066
|
const dateObj2 = day.date instanceof Date ? day.date : new Date(day.date);
|
|
20041
20067
|
const year2 = dateObj2.getFullYear();
|
|
20042
20068
|
const month2 = String(dateObj2.getMonth() + 1).padStart(2, "0");
|
|
@@ -20061,15 +20087,15 @@ var LineHistoryCalendar = ({
|
|
|
20061
20087
|
}
|
|
20062
20088
|
},
|
|
20063
20089
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `
|
|
20064
|
-
${getPerformanceColor(shiftData.avg_efficiency || 0, dateObj)}
|
|
20090
|
+
${getPerformanceColor(shiftData.avg_efficiency || 0, dateObj, hasData)}
|
|
20065
20091
|
rounded-lg h-full p-2 relative
|
|
20066
20092
|
${isToday ? "ring-2 ring-blue-500 dark:ring-blue-400 ring-offset-2 dark:ring-offset-gray-800 shadow-md" : ""}
|
|
20067
20093
|
`, children: [
|
|
20068
20094
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `
|
|
20069
|
-
text-base font-medium text-white flex items-center
|
|
20095
|
+
text-base font-medium ${hasData ? "text-white" : "text-gray-500"} flex items-center
|
|
20070
20096
|
${isToday ? "bg-blue-500 dark:bg-blue-600 rounded-full w-7 h-7 justify-center" : ""}
|
|
20071
20097
|
`, children: dateObj.getDate() }),
|
|
20072
|
-
!isFuture &&
|
|
20098
|
+
!isFuture && hasData && renderStats(shiftData, dateObj)
|
|
20073
20099
|
] })
|
|
20074
20100
|
}
|
|
20075
20101
|
);
|
|
@@ -20250,7 +20276,7 @@ var LineMonthlyHistory = ({
|
|
|
20250
20276
|
className: "block hover:bg-gray-50 transition-colors rounded-lg w-full text-left",
|
|
20251
20277
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between py-3 px-2 border-b border-gray-100 last:border-b-0", children: [
|
|
20252
20278
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "font-medium text-gray-900", children: [
|
|
20253
|
-
getWorkspaceDisplayName(workspace.workspace_name),
|
|
20279
|
+
getWorkspaceDisplayName(workspace.workspace_name, lineId),
|
|
20254
20280
|
workspace.avg_efficiency !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-sm text-gray-500", children: [
|
|
20255
20281
|
"(",
|
|
20256
20282
|
workspace.avg_efficiency.toFixed(1),
|
|
@@ -20834,7 +20860,7 @@ var LinePdfGenerator = ({
|
|
|
20834
20860
|
doc.setFillColor(252, 252, 252);
|
|
20835
20861
|
doc.roundedRect(20, yPos - 5, 170, 8, 1, 1, "F");
|
|
20836
20862
|
}
|
|
20837
|
-
const workspaceName = getWorkspaceDisplayName(ws.workspace_name);
|
|
20863
|
+
const workspaceName = getWorkspaceDisplayName(ws.workspace_name, lineInfo.line_id);
|
|
20838
20864
|
const maxWidth = 55;
|
|
20839
20865
|
const truncatedName = workspaceName.length > 25 ? workspaceName.substring(0, 22) + "..." : workspaceName;
|
|
20840
20866
|
doc.text(truncatedName, 25, yPos);
|
|
@@ -21167,6 +21193,10 @@ var WorkspaceHistoryCalendar = ({
|
|
|
21167
21193
|
const { dateTimeConfig } = useDashboardConfig();
|
|
21168
21194
|
const configuredTimezone = dateTimeConfig?.defaultTimezone || "Asia/Kolkata";
|
|
21169
21195
|
const [animationComplete, setAnimationComplete] = React19.useState(false);
|
|
21196
|
+
const hasRealData = (shift) => {
|
|
21197
|
+
if (shift.hasData !== void 0) return shift.hasData;
|
|
21198
|
+
return shift.efficiency > 0 || shift.output > 0 || shift.cycleTime > 0 || shift.pph > 0 || shift.idealOutput > 0 || shift.idleTime > 0;
|
|
21199
|
+
};
|
|
21170
21200
|
React19.useEffect(() => {
|
|
21171
21201
|
setAnimationComplete(false);
|
|
21172
21202
|
const timer = setTimeout(() => {
|
|
@@ -21219,10 +21249,14 @@ var WorkspaceHistoryCalendar = ({
|
|
|
21219
21249
|
istNow.setHours(0, 0, 0, 0);
|
|
21220
21250
|
const compareDate = new Date(date);
|
|
21221
21251
|
compareDate.setHours(0, 0, 0, 0);
|
|
21222
|
-
if (
|
|
21252
|
+
if (compareDate > istNow) {
|
|
21223
21253
|
return [];
|
|
21224
21254
|
}
|
|
21225
|
-
|
|
21255
|
+
const shiftData = selectedShift === "day" ? day.dayShift : day.nightShift;
|
|
21256
|
+
if (hasRealData(shiftData)) {
|
|
21257
|
+
return [shiftData];
|
|
21258
|
+
}
|
|
21259
|
+
return [];
|
|
21226
21260
|
});
|
|
21227
21261
|
if (validShifts.length === 0) return null;
|
|
21228
21262
|
const badShiftsCount = validShifts.filter((shift) => shift.efficiency < 75).length;
|
|
@@ -21235,7 +21269,7 @@ var WorkspaceHistoryCalendar = ({
|
|
|
21235
21269
|
badDaysCount: badShiftsCount,
|
|
21236
21270
|
totalDays: validShifts.length
|
|
21237
21271
|
};
|
|
21238
|
-
}, [data, month, year, configuredTimezone]);
|
|
21272
|
+
}, [data, month, year, configuredTimezone, selectedShift]);
|
|
21239
21273
|
const handleDayClick = React19.useCallback((day, shift) => {
|
|
21240
21274
|
if (!day || isFutureDate(day.date)) return;
|
|
21241
21275
|
const year2 = day.date.getFullYear();
|
|
@@ -21274,13 +21308,13 @@ var WorkspaceHistoryCalendar = ({
|
|
|
21274
21308
|
compareDate.setHours(0, 0, 0, 0);
|
|
21275
21309
|
return compareDate > istNow;
|
|
21276
21310
|
}, [configuredTimezone]);
|
|
21277
|
-
const getPerformanceColor = React19.useCallback((efficiency, date) => {
|
|
21311
|
+
const getPerformanceColor = React19.useCallback((efficiency, date, hasData) => {
|
|
21278
21312
|
const istNow = getTimeInZoneAsDate(configuredTimezone);
|
|
21279
21313
|
istNow.setHours(0, 0, 0, 0);
|
|
21280
21314
|
const compareDate = dateFnsTz.toZonedTime(date, configuredTimezone);
|
|
21281
21315
|
compareDate.setHours(0, 0, 0, 0);
|
|
21282
|
-
if (compareDate.getDay() === 0) return "bg-gray-300";
|
|
21283
21316
|
if (compareDate > istNow) return "bg-gray-200";
|
|
21317
|
+
if (!hasData) return "bg-gray-300";
|
|
21284
21318
|
if (efficiency >= 80) return "bg-[#00AB45]/90";
|
|
21285
21319
|
if (efficiency >= 70) return "bg-[#FFB020]/90";
|
|
21286
21320
|
return "bg-[#E34329]/90";
|
|
@@ -21289,7 +21323,7 @@ var WorkspaceHistoryCalendar = ({
|
|
|
21289
21323
|
const istNow = getTimeInZoneAsDate(configuredTimezone);
|
|
21290
21324
|
const compareDate = dateFnsTz.toZonedTime(date, configuredTimezone);
|
|
21291
21325
|
compareDate.setHours(0, 0, 0, 0);
|
|
21292
|
-
if (compareDate > istNow ||
|
|
21326
|
+
if (compareDate > istNow || !hasRealData(shift)) return null;
|
|
21293
21327
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-black/80 rounded-lg p-2 text-white opacity-0 group-hover:opacity-100 transition-all duration-200 ease-in-out", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs space-y-1", children: [
|
|
21294
21328
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
21295
21329
|
"Efficiency: ",
|
|
@@ -21341,25 +21375,26 @@ var WorkspaceHistoryCalendar = ({
|
|
|
21341
21375
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `h-full border border-gray-200 rounded-lg ${bgColor} ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} cursor-not-allowed opacity-60`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `text-base font-medium ${textColor} ${isToday ? "text-blue-500" : ""}`, children: dayNumber }) }) });
|
|
21342
21376
|
}
|
|
21343
21377
|
const shiftData = selectedShift === "day" ? day.dayShift : day.nightShift;
|
|
21378
|
+
const hasData = hasRealData(shiftData);
|
|
21344
21379
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21345
21380
|
"div",
|
|
21346
21381
|
{
|
|
21347
|
-
className: `group h-full ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} ${!isFuture && animationComplete ? "cursor-pointer hover:opacity-90 hover:scale-105" : "cursor-not-allowed"}`,
|
|
21348
|
-
onClick: () => !isFuture && handleDayClick(day, selectedShift),
|
|
21382
|
+
className: `group h-full ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} ${!isFuture && hasData && animationComplete ? "cursor-pointer hover:opacity-90 hover:scale-105" : "cursor-not-allowed"}`,
|
|
21383
|
+
onClick: () => !isFuture && hasData && handleDayClick(day, selectedShift),
|
|
21349
21384
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `
|
|
21350
|
-
${getPerformanceColor(shiftData.efficiency, day.date)}
|
|
21385
|
+
${getPerformanceColor(shiftData.efficiency, day.date, hasData)}
|
|
21351
21386
|
rounded-lg h-full p-2 relative ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} shadow-sm
|
|
21352
21387
|
${isToday ? "ring-2 ring-blue-500 ring-offset-2 shadow-md" : ""}
|
|
21353
21388
|
`, children: [
|
|
21354
21389
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `
|
|
21355
|
-
text-base font-medium text-white flex items-center ${animationComplete ? "transition-all duration-300 ease-in-out" : ""}
|
|
21390
|
+
text-base font-medium ${hasData ? "text-white" : "text-gray-500"} flex items-center ${animationComplete ? "transition-all duration-300 ease-in-out" : ""}
|
|
21356
21391
|
${isToday ? "bg-blue-500 rounded-full w-7 h-7 justify-center" : ""}
|
|
21357
21392
|
`, children: day.date.getDate() }),
|
|
21358
|
-
!isFuture && animationComplete && renderStats(shiftData, day.date)
|
|
21393
|
+
!isFuture && hasData && animationComplete && renderStats(shiftData, day.date)
|
|
21359
21394
|
] })
|
|
21360
21395
|
}
|
|
21361
21396
|
);
|
|
21362
|
-
}, [selectedShift, isCurrentDate, isFutureDate, getPerformanceColor, handleDayClick, year, month, configuredTimezone, animationComplete]);
|
|
21397
|
+
}, [selectedShift, isCurrentDate, isFutureDate, getPerformanceColor, handleDayClick, year, month, configuredTimezone, animationComplete, hasRealData]);
|
|
21363
21398
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `calendar-wrapper space-y-6 ${className || ""} ${animationComplete ? "animation-complete" : ""}`, children: [
|
|
21364
21399
|
/* @__PURE__ */ jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: styles } }),
|
|
21365
21400
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 border border-gray-200 rounded-lg p-1 bg-gray-50", children: [
|
|
@@ -21397,7 +21432,10 @@ var WorkspaceHistoryCalendar = ({
|
|
|
21397
21432
|
] }),
|
|
21398
21433
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "calendar-container bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
|
|
21399
21434
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
|
|
21400
|
-
/* @__PURE__ */ jsxRuntime.
|
|
21435
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h3", { className: "font-semibold text-gray-900 text-lg", children: [
|
|
21436
|
+
"Monthly Summary - ",
|
|
21437
|
+
selectedShift === "day" ? "Day Shift" : "Night Shift"
|
|
21438
|
+
] }),
|
|
21401
21439
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 mt-1", children: "Overview of monthly performance metrics" })
|
|
21402
21440
|
] }),
|
|
21403
21441
|
monthlyMetrics ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
|
|
@@ -21503,7 +21541,7 @@ var WorkspacePdfGenerator = ({ workspace, className }) => {
|
|
|
21503
21541
|
doc.setFontSize(22);
|
|
21504
21542
|
doc.setFont("helvetica", "normal");
|
|
21505
21543
|
doc.setTextColor(40, 40, 40);
|
|
21506
|
-
doc.text(getWorkspaceDisplayName(workspace.workspace_name), 20, 52);
|
|
21544
|
+
doc.text(getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id), 20, 52);
|
|
21507
21545
|
doc.setFontSize(13);
|
|
21508
21546
|
doc.setFont("helvetica", "normal");
|
|
21509
21547
|
doc.setTextColor(60, 60, 60);
|
|
@@ -22133,10 +22171,7 @@ var LoadingOverlay = ({
|
|
|
22133
22171
|
className: `fixed inset-0 z-[100] flex items-center justify-center bg-black/30 backdrop-blur-sm ${className || ""}`,
|
|
22134
22172
|
"aria-modal": "true",
|
|
22135
22173
|
role: "dialog",
|
|
22136
|
-
children: /* @__PURE__ */ jsxRuntime.
|
|
22137
|
-
/* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size: "md" }),
|
|
22138
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base font-medium text-gray-700", children: message })
|
|
22139
|
-
] })
|
|
22174
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center space-y-3 rounded-lg bg-white p-8 shadow-xl", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message }) })
|
|
22140
22175
|
}
|
|
22141
22176
|
);
|
|
22142
22177
|
};
|
|
@@ -22961,20 +22996,6 @@ var S3ClipsService = class {
|
|
|
22961
22996
|
return videos;
|
|
22962
22997
|
}
|
|
22963
22998
|
};
|
|
22964
|
-
var LoadingSpinner2 = ({
|
|
22965
|
-
size = "md",
|
|
22966
|
-
message = "Loading..."
|
|
22967
|
-
}) => {
|
|
22968
|
-
const sizeClasses = {
|
|
22969
|
-
sm: "w-4 h-4",
|
|
22970
|
-
md: "w-6 h-6",
|
|
22971
|
-
lg: "w-8 h-8"
|
|
22972
|
-
};
|
|
22973
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
22974
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${sizeClasses[size]} border-2 border-t-blue-500 border-r-blue-500 border-b-gray-200 border-l-gray-200 rounded-full animate-spin mb-2` }),
|
|
22975
|
-
message && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-600 text-sm", children: message })
|
|
22976
|
-
] });
|
|
22977
|
-
};
|
|
22978
22999
|
var BottlenecksContent = ({
|
|
22979
23000
|
workspaceId,
|
|
22980
23001
|
workspaceName,
|
|
@@ -23493,7 +23514,7 @@ var BottlenecksContent = ({
|
|
|
23493
23514
|
] });
|
|
23494
23515
|
}
|
|
23495
23516
|
if (isLoading && allVideos.length === 0) {
|
|
23496
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow p-4 flex items-center justify-center h-[calc(100vh-12rem)]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23517
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow p-4 flex items-center justify-center h-[calc(100vh-12rem)]", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "lg", message: "Loading clips..." }) });
|
|
23497
23518
|
}
|
|
23498
23519
|
if (error) {
|
|
23499
23520
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-grow p-4 flex flex-col items-center justify-center h-[calc(100vh-12rem)] text-center", children: [
|
|
@@ -23671,7 +23692,7 @@ var BottlenecksContent = ({
|
|
|
23671
23692
|
}
|
|
23672
23693
|
)
|
|
23673
23694
|
] }),
|
|
23674
|
-
isLoading && allVideos.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23695
|
+
isLoading && allVideos.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading clips..." }) }) : allVideos.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center p-8", children: [
|
|
23675
23696
|
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-16 h-16 text-gray-300 mx-auto mb-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) }),
|
|
23676
23697
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-medium text-gray-700 mb-2", children: "No Clips Found" }),
|
|
23677
23698
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-500", children: "There were no video clips found for this workspace today." })
|
|
@@ -23989,7 +24010,7 @@ var WorkspaceGridItem = React19__namespace.default.memo(({
|
|
|
23989
24010
|
const handleClick = React19.useCallback((e) => {
|
|
23990
24011
|
e.preventDefault();
|
|
23991
24012
|
if (isInactive) return;
|
|
23992
|
-
const displayName = getWorkspaceDisplayName(data.workspace_name);
|
|
24013
|
+
const displayName = getWorkspaceDisplayName(data.workspace_name, data.line_id);
|
|
23993
24014
|
const navParams = getWorkspaceNavigationParams(data.workspace_id, displayName);
|
|
23994
24015
|
navigate(`/workspace/${data.workspace_id}${navParams}`, {
|
|
23995
24016
|
trackingEvent: {
|
|
@@ -24037,7 +24058,7 @@ var WorkspaceGridItem = React19__namespace.default.memo(({
|
|
|
24037
24058
|
onClick: handleClick,
|
|
24038
24059
|
className: `${styles2} ${colorClass} ${isBottleneck ? "ring-2 ring-red-500/70" : ""} ${isVeryLowEfficiency ? "ring-2 ring-red-500/50" : ""} ${isInactive ? "bg-gray-200" : ""} shadow-lg`,
|
|
24039
24060
|
"aria-label": isInactive ? `Inactive workspace ${workspaceNumber}` : `View details for workspace ${workspaceNumber}`,
|
|
24040
|
-
title: isInactive ? `Inactive: ${getWorkspaceDisplayName(data.workspace_name)}` : getWorkspaceDisplayName(data.workspace_name),
|
|
24061
|
+
title: isInactive ? `Inactive: ${getWorkspaceDisplayName(data.workspace_name, data.line_id)}` : getWorkspaceDisplayName(data.workspace_name, data.line_id),
|
|
24041
24062
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `font-semibold tracking-wide text-[min(4vw,2rem)] uppercase ${isInactive ? "text-gray-400" : "text-white"} drop-shadow-sm`, children: workspaceNumber })
|
|
24042
24063
|
}
|
|
24043
24064
|
),
|
|
@@ -25361,11 +25382,8 @@ var LoadingState = ({
|
|
|
25361
25382
|
className = ""
|
|
25362
25383
|
}) => {
|
|
25363
25384
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex h-full w-full items-center justify-center bg-gray-50/50 ${className}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center space-y-4 text-center", children: [
|
|
25364
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25365
|
-
/* @__PURE__ */ jsxRuntime.
|
|
25366
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-medium text-gray-900", children: message }),
|
|
25367
|
-
subMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-gray-600", children: subMessage })
|
|
25368
|
-
] })
|
|
25385
|
+
/* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size, message }),
|
|
25386
|
+
subMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-gray-600", children: subMessage })
|
|
25369
25387
|
] }) });
|
|
25370
25388
|
};
|
|
25371
25389
|
var LoadingSkeleton = ({
|
|
@@ -25392,10 +25410,7 @@ var LoadingSkeleton = ({
|
|
|
25392
25410
|
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-6 w-1/3" }),
|
|
25393
25411
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
25394
25412
|
/* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-64 w-full" }),
|
|
25395
|
-
showLoadingIndicator && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white/80 rounded-lg p-3 shadow-sm", children: /* @__PURE__ */ jsxRuntime.
|
|
25396
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
25397
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
25398
|
-
] }) }) })
|
|
25413
|
+
showLoadingIndicator && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white/80 rounded-lg p-3 shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm" }) }) })
|
|
25399
25414
|
] })
|
|
25400
25415
|
] });
|
|
25401
25416
|
case "table":
|
|
@@ -25446,10 +25461,7 @@ var LoadingInline = ({
|
|
|
25446
25461
|
size = "sm",
|
|
25447
25462
|
className = ""
|
|
25448
25463
|
}) => {
|
|
25449
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
25450
|
-
/* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size }),
|
|
25451
|
-
message && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-600", children: message })
|
|
25452
|
-
] });
|
|
25464
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `inline-flex items-center space-x-2 ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size, message }) });
|
|
25453
25465
|
};
|
|
25454
25466
|
var DEFAULT_HLS_CONFIG = {
|
|
25455
25467
|
maxBufferLength: 15,
|
|
@@ -25678,7 +25690,7 @@ var ThreadSidebar = ({
|
|
|
25678
25690
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Chat History" }),
|
|
25679
25691
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 mt-1", children: "Your previous conversations" })
|
|
25680
25692
|
] }),
|
|
25681
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto min-h-0", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center p-8", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
25693
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto min-h-0", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center p-8", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm" }) }) : threads.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-gray-500 text-sm", children: "No conversations yet" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2", children: threads.map((thread) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25682
25694
|
"div",
|
|
25683
25695
|
{
|
|
25684
25696
|
onClick: () => onSelectThread(thread.id),
|
|
@@ -25689,7 +25701,7 @@ var ThreadSidebar = ({
|
|
|
25689
25701
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: `text-sm font-medium truncate ${activeThreadId === thread.id ? "text-blue-900" : "text-gray-900"}`, children: thread.title || "Untitled Chat" }),
|
|
25690
25702
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-xs mt-0.5 ${activeThreadId === thread.id ? "text-blue-700" : "text-gray-500"}`, children: formatDate(thread.created_at) })
|
|
25691
25703
|
] }),
|
|
25692
|
-
deletingId === thread.id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
25704
|
+
deletingId === thread.id ? /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm", className: "flex-shrink-0" }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
25693
25705
|
"button",
|
|
25694
25706
|
{
|
|
25695
25707
|
onClick: (e) => handleDelete(e, thread.id),
|
|
@@ -27450,7 +27462,13 @@ var AIAgentView = () => {
|
|
|
27450
27462
|
{
|
|
27451
27463
|
className: `relative px-5 py-4 rounded-2xl shadow-sm ${message.role === "user" ? "bg-blue-600 text-white max-w-[85%] ml-auto" : "bg-white border border-gray-200/80 max-w-full"}`,
|
|
27452
27464
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${message.role === "user" ? "text-white" : "text-gray-800"}`, children: [
|
|
27453
|
-
message.role === "assistant" ?
|
|
27465
|
+
message.role === "assistant" ? message.id === -1 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
27466
|
+
"div",
|
|
27467
|
+
{
|
|
27468
|
+
className: "formatted-content",
|
|
27469
|
+
dangerouslySetInnerHTML: { __html: formatMessage(message.content) }
|
|
27470
|
+
}
|
|
27471
|
+
) : renderAssistantContent(message.content) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap leading-relaxed", children: message.content }),
|
|
27454
27472
|
message.id === -1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-0.5 h-4 bg-gray-400 animate-pulse ml-0.5" })
|
|
27455
27473
|
] })
|
|
27456
27474
|
}
|
|
@@ -27480,7 +27498,13 @@ var AIAgentView = () => {
|
|
|
27480
27498
|
className: `relative px-5 py-4 rounded-2xl shadow-sm ${message.role === "user" ? "bg-blue-600 text-white max-w-[85%] ml-auto" : "bg-white border border-gray-200/80 max-w-full"}`,
|
|
27481
27499
|
children: [
|
|
27482
27500
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${message.role === "user" ? "text-white" : "text-gray-800"}`, children: [
|
|
27483
|
-
message.role === "assistant" ?
|
|
27501
|
+
message.role === "assistant" ? message.id === -1 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
27502
|
+
"div",
|
|
27503
|
+
{
|
|
27504
|
+
className: "formatted-content",
|
|
27505
|
+
dangerouslySetInnerHTML: { __html: formatMessage(message.content) }
|
|
27506
|
+
}
|
|
27507
|
+
) : renderAssistantContent(message.content) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap leading-relaxed", children: message.content }),
|
|
27484
27508
|
message.id === -1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-0.5 h-4 bg-gray-400 animate-pulse ml-0.5" })
|
|
27485
27509
|
] }),
|
|
27486
27510
|
message.role === "assistant" && message.id !== -1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -28502,7 +28526,7 @@ var HelpView = ({
|
|
|
28502
28526
|
disabled: isSubmitting,
|
|
28503
28527
|
className: "px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 shadow-sm text-sm",
|
|
28504
28528
|
children: isSubmitting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
28505
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
28529
|
+
/* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm" }),
|
|
28506
28530
|
"Submitting..."
|
|
28507
28531
|
] }) : "Submit Ticket"
|
|
28508
28532
|
}
|
|
@@ -28687,7 +28711,7 @@ function HomeView({
|
|
|
28687
28711
|
) }) }),
|
|
28688
28712
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto sm:overflow-hidden relative", children: [
|
|
28689
28713
|
lineSelectorComponent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-3 top-2 sm:right-6 sm:top-3 z-30", children: lineSelectorComponent }),
|
|
28690
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full sm:h-full min-h-[calc(100vh-80px)] sm:min-h-0", children: isDataLoading
|
|
28714
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full sm:h-full min-h-[calc(100vh-80px)] sm:min-h-0", children: isDataLoading || !hasInitialDataLoaded ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 sm:px-6 lg:px-8 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSkeleton, { type: "workspace-card", count: 8, className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4" }) }) : memoizedWorkspaceMetrics.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
28691
28715
|
motion.div,
|
|
28692
28716
|
{
|
|
28693
28717
|
initial: { opacity: 0, scale: 0.98 },
|
|
@@ -28849,6 +28873,7 @@ var MetricCards = React19.memo(({ lineInfo }) => {
|
|
|
28849
28873
|
MetricCards.displayName = "MetricCards";
|
|
28850
28874
|
var BottomSection = React19.memo(({
|
|
28851
28875
|
lineInfo,
|
|
28876
|
+
lineId,
|
|
28852
28877
|
workspaceData,
|
|
28853
28878
|
sortedByEfficiency,
|
|
28854
28879
|
hourlyOutputData,
|
|
@@ -28906,7 +28931,7 @@ var BottomSection = React19.memo(({
|
|
|
28906
28931
|
return null;
|
|
28907
28932
|
}
|
|
28908
28933
|
const clickHandler = () => handleWorkspaceClick(ws, index);
|
|
28909
|
-
const displayName = getWorkspaceDisplayName(ws.workspace_name);
|
|
28934
|
+
const displayName = getWorkspaceDisplayName(ws.workspace_name, lineId);
|
|
28910
28935
|
const navParams = wsUuid ? getWorkspaceNavigationParams2(wsUuid, displayName) : "";
|
|
28911
28936
|
const dateShiftParams = urlDate ? `&date=${urlDate}&shift=${urlShift || "0"}` : "";
|
|
28912
28937
|
const returnToParam = `&returnTo=${encodeURIComponent(`/kpis/${lineInfo?.line_id}`)}`;
|
|
@@ -28940,7 +28965,7 @@ var BottomSection = React19.memo(({
|
|
|
28940
28965
|
// Fallback to sorted workspaces if no poorest performing workspaces provided
|
|
28941
28966
|
sortedByEfficiency.map((ws, index) => {
|
|
28942
28967
|
const clickHandler = () => handleWorkspaceClick(ws, index);
|
|
28943
|
-
const displayName = getWorkspaceDisplayName(ws.workspace_name);
|
|
28968
|
+
const displayName = getWorkspaceDisplayName(ws.workspace_name, lineId);
|
|
28944
28969
|
const navParams = ws.workspace_uuid ? getWorkspaceNavigationParams2(ws.workspace_uuid, displayName) : "";
|
|
28945
28970
|
const dateShiftParams = urlDate ? `&date=${urlDate}&shift=${urlShift || "0"}` : "";
|
|
28946
28971
|
const returnToParam = `&returnTo=${encodeURIComponent(`/kpis/${lineInfo?.line_id}`)}`;
|
|
@@ -29437,6 +29462,7 @@ var KPIDetailView = ({
|
|
|
29437
29462
|
BottomSection,
|
|
29438
29463
|
{
|
|
29439
29464
|
lineInfo,
|
|
29465
|
+
lineId,
|
|
29440
29466
|
workspaceData: workspaces || [],
|
|
29441
29467
|
sortedByEfficiency,
|
|
29442
29468
|
hourlyOutputData,
|
|
@@ -29539,6 +29565,7 @@ var KPIDetailView = ({
|
|
|
29539
29565
|
BottomSection,
|
|
29540
29566
|
{
|
|
29541
29567
|
lineInfo,
|
|
29568
|
+
lineId,
|
|
29542
29569
|
workspaceData: workspaces || [],
|
|
29543
29570
|
sortedByEfficiency,
|
|
29544
29571
|
hourlyOutputData,
|
|
@@ -29557,34 +29584,10 @@ var KPIDetailView = ({
|
|
|
29557
29584
|
var KPIDetailView_default = KPIDetailView;
|
|
29558
29585
|
var LineCard = ({ line, onClick }) => {
|
|
29559
29586
|
const { kpis, isLoading, error } = useLineKPIs({ lineId: line.id });
|
|
29560
|
-
const shiftConfig = useShiftConfig();
|
|
29561
|
-
const dateTimeConfig = useDateTimeConfig();
|
|
29562
29587
|
const isOnTrack = React19__namespace.default.useMemo(() => {
|
|
29563
29588
|
if (!kpis) return null;
|
|
29564
|
-
|
|
29565
|
-
|
|
29566
|
-
const currentShiftDetails = getCurrentShift(timezone, shiftConfig);
|
|
29567
|
-
const shiftStartTime = currentShiftDetails.shiftId === 0 ? shiftConfig.dayShift?.startTime || "06:00" : shiftConfig.nightShift?.startTime || "18:00";
|
|
29568
|
-
const shiftEndTime = currentShiftDetails.shiftId === 0 ? shiftConfig.dayShift?.endTime || "14:00" : shiftConfig.nightShift?.endTime || "02:00";
|
|
29569
|
-
const [startHour, startMin] = shiftStartTime.split(":").map(Number);
|
|
29570
|
-
const [endHour, endMin] = shiftEndTime.split(":").map(Number);
|
|
29571
|
-
const shiftStart = /* @__PURE__ */ new Date();
|
|
29572
|
-
shiftStart.setHours(startHour, startMin, 0, 0);
|
|
29573
|
-
const shiftEnd = /* @__PURE__ */ new Date();
|
|
29574
|
-
shiftEnd.setHours(endHour, endMin, 0, 0);
|
|
29575
|
-
if (endHour < startHour) {
|
|
29576
|
-
if (currentTime.getHours() < endHour) {
|
|
29577
|
-
shiftStart.setDate(shiftStart.getDate() - 1);
|
|
29578
|
-
} else {
|
|
29579
|
-
shiftEnd.setDate(shiftEnd.getDate() + 1);
|
|
29580
|
-
}
|
|
29581
|
-
}
|
|
29582
|
-
const totalShiftMinutes = (shiftEnd.getTime() - shiftStart.getTime()) / (1e3 * 60);
|
|
29583
|
-
const elapsedMinutes = (currentTime.getTime() - shiftStart.getTime()) / (1e3 * 60);
|
|
29584
|
-
const shiftProgress = Math.max(0, Math.min(1, elapsedMinutes / totalShiftMinutes));
|
|
29585
|
-
const outputProgress = kpis.outputProgress.current / kpis.outputProgress.target;
|
|
29586
|
-
return outputProgress >= shiftProgress - 0.05;
|
|
29587
|
-
}, [kpis, shiftConfig, dateTimeConfig]);
|
|
29589
|
+
return kpis.efficiency.value > 90;
|
|
29590
|
+
}, [kpis]);
|
|
29588
29591
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29589
29592
|
motion.div,
|
|
29590
29593
|
{
|
|
@@ -29900,7 +29903,7 @@ var MobileWorkspaceCard = React19.memo(({
|
|
|
29900
29903
|
getMedalIcon(rank)
|
|
29901
29904
|
] }),
|
|
29902
29905
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
29903
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-semibold text-gray-900", children: getWorkspaceDisplayName(workspace.workspace_name) }),
|
|
29906
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-semibold text-gray-900", children: getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id) }),
|
|
29904
29907
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-500", children: getLineName(workspace.line_id) })
|
|
29905
29908
|
] })
|
|
29906
29909
|
] }),
|
|
@@ -29950,7 +29953,7 @@ var DesktopWorkspaceRow = React19.memo(({
|
|
|
29950
29953
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: index + 1 }),
|
|
29951
29954
|
getMedalIcon(index + 1)
|
|
29952
29955
|
] }) }),
|
|
29953
|
-
/* @__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: getWorkspaceDisplayName(workspace.workspace_name) }) }),
|
|
29956
|
+
/* @__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: getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id) }) }),
|
|
29954
29957
|
/* @__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: getLineName(workspace.line_id) }) }),
|
|
29955
29958
|
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-3 py-2.5 sm:p-4 text-sm sm:text-base font-medium whitespace-nowrap", children: [
|
|
29956
29959
|
(workspace.efficiency || 0).toFixed(1),
|
|
@@ -30067,7 +30070,7 @@ var LeaderboardDetailView = React19.memo(({
|
|
|
30067
30070
|
action_count: workspace.action_count,
|
|
30068
30071
|
action_threshold: workspace.action_threshold
|
|
30069
30072
|
});
|
|
30070
|
-
const displayName = getWorkspaceDisplayName(workspace.workspace_name);
|
|
30073
|
+
const displayName = getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
|
|
30071
30074
|
const navParams = workspace.workspace_uuid ? getWorkspaceNavigationParams(workspace.workspace_uuid, displayName) : "";
|
|
30072
30075
|
const returnToParam = `&returnTo=${encodeURIComponent(`/leaderboard`)}`;
|
|
30073
30076
|
if (onWorkspaceClick) {
|
|
@@ -30314,7 +30317,7 @@ var ProfileView = () => {
|
|
|
30314
30317
|
}
|
|
30315
30318
|
};
|
|
30316
30319
|
if (authLoading || loading) {
|
|
30317
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
30320
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "lg" }) });
|
|
30318
30321
|
}
|
|
30319
30322
|
if (!user) {
|
|
30320
30323
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
@@ -30471,7 +30474,7 @@ var ProfileView = () => {
|
|
|
30471
30474
|
] })
|
|
30472
30475
|
] }),
|
|
30473
30476
|
isEditing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6 flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "outline", onClick: handleSaveProfile, disabled: loading, children: loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
30474
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
30477
|
+
/* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm", className: "mr-2" }),
|
|
30475
30478
|
"Saving..."
|
|
30476
30479
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
30477
30480
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "h-4 w-4 mr-2" }),
|
|
@@ -30535,7 +30538,7 @@ var ProfileView = () => {
|
|
|
30535
30538
|
disabled: loading,
|
|
30536
30539
|
className: "flex items-center gap-2 text-red-600 hover:text-red-700 border-red-200 hover:border-red-300",
|
|
30537
30540
|
children: loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
30538
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
30541
|
+
/* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm", className: "mr-2" }),
|
|
30539
30542
|
"Signing out..."
|
|
30540
30543
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
30541
30544
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "h-4 w-4" }),
|
|
@@ -31295,8 +31298,8 @@ var calculateDayOutput = (pph, shiftHours, breaks = []) => {
|
|
|
31295
31298
|
const realWorkHours = shiftHours - totalBreakHours;
|
|
31296
31299
|
return Math.round(pph * realWorkHours);
|
|
31297
31300
|
};
|
|
31298
|
-
var formatWorkspaceName = (name) => {
|
|
31299
|
-
return getWorkspaceDisplayName(name);
|
|
31301
|
+
var formatWorkspaceName = (name, lineId) => {
|
|
31302
|
+
return getWorkspaceDisplayName(name, lineId);
|
|
31300
31303
|
};
|
|
31301
31304
|
var getStoredLineState2 = (lineId) => {
|
|
31302
31305
|
try {
|
|
@@ -31324,6 +31327,7 @@ var BulkConfigureModal = ({
|
|
|
31324
31327
|
isOpen,
|
|
31325
31328
|
onClose,
|
|
31326
31329
|
lineWorkspaces,
|
|
31330
|
+
lineNames,
|
|
31327
31331
|
onSave,
|
|
31328
31332
|
selectedShift
|
|
31329
31333
|
}) => {
|
|
@@ -31474,10 +31478,7 @@ var BulkConfigureModal = ({
|
|
|
31474
31478
|
className: "block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm\n shadow-sm focus:border-blue-500 focus:ring-blue-500 \n transition-all duration-200 hover:border-blue-400\n appearance-none bg-no-repeat bg-right pr-10\n hover:bg-blue-50/50",
|
|
31475
31479
|
children: [
|
|
31476
31480
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "Select a line" }),
|
|
31477
|
-
Object.entries(lineWorkspaces).map(([lineId, line]) => /* @__PURE__ */ jsxRuntime.
|
|
31478
|
-
lineId,
|
|
31479
|
-
" "
|
|
31480
|
-
] }, lineId))
|
|
31481
|
+
Object.entries(lineWorkspaces).map(([lineId, line]) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: lineId, className: "py-2", children: lineNames[lineId] || lineId }, lineId))
|
|
31481
31482
|
]
|
|
31482
31483
|
}
|
|
31483
31484
|
)
|
|
@@ -31535,7 +31536,7 @@ var BulkConfigureModal = ({
|
|
|
31535
31536
|
className: "rounded border-gray-300 text-blue-600 focus:ring-blue-500"
|
|
31536
31537
|
}
|
|
31537
31538
|
),
|
|
31538
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `text-sm ${selectedWorkspaces.includes(workspace.id) ? "text-blue-900 font-medium" : "text-gray-900"}`, children: formatWorkspaceName(workspace.name) })
|
|
31539
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `text-sm ${selectedWorkspaces.includes(workspace.id) ? "text-blue-900 font-medium" : "text-gray-900"}`, children: formatWorkspaceName(workspace.name, selectedLine) })
|
|
31539
31540
|
]
|
|
31540
31541
|
},
|
|
31541
31542
|
workspace.id
|
|
@@ -31982,7 +31983,7 @@ var SKUList = ({
|
|
|
31982
31983
|
}) => {
|
|
31983
31984
|
if (isLoading) {
|
|
31984
31985
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white rounded-xl shadow-sm border border-gray-200 p-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-center items-center", children: [
|
|
31985
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31986
|
+
/* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md" }),
|
|
31986
31987
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-3 text-gray-600", children: "Loading SKUs..." })
|
|
31987
31988
|
] }) });
|
|
31988
31989
|
}
|
|
@@ -32068,7 +32069,7 @@ var TargetsViewUI = ({
|
|
|
32068
32069
|
skuRequired = false
|
|
32069
32070
|
}) => {
|
|
32070
32071
|
if (isLoading) {
|
|
32071
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-screen bg-gray-50", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
32072
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-screen bg-gray-50", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "lg", message: "Loading targets..." }) }) });
|
|
32072
32073
|
}
|
|
32073
32074
|
return /* @__PURE__ */ jsxRuntime.jsxs("main", { className: "min-h-screen flex-1 bg-gray-50", children: [
|
|
32074
32075
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white px-8 py-6 shadow-sm border-b border-gray-200/80", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between relative", children: [
|
|
@@ -32170,7 +32171,7 @@ var TargetsViewUI = ({
|
|
|
32170
32171
|
className: `ml-6 inline-flex items-center px-4 py-2 text-sm font-medium rounded-lg transition-all duration-200
|
|
32171
32172
|
${savingLines[lineId] ? "bg-gray-100 text-gray-400 cursor-not-allowed" : "bg-blue-600 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"}`,
|
|
32172
32173
|
children: savingLines[lineId] ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
32173
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
32174
|
+
/* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm", className: "mr-2" }),
|
|
32174
32175
|
"Saving..."
|
|
32175
32176
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
32176
32177
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "w-4 h-4 mr-2" }),
|
|
@@ -32222,7 +32223,7 @@ var TargetsViewUI = ({
|
|
|
32222
32223
|
{
|
|
32223
32224
|
className: "px-6 py-4 hover:bg-gray-50 transition-all duration-200",
|
|
32224
32225
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-6 items-center", children: [
|
|
32225
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-900", children: formatWorkspaceName(workspace.name) }) }),
|
|
32226
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-gray-900", children: formatWorkspaceName(workspace.name, lineId) }) }),
|
|
32226
32227
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
32227
32228
|
"select",
|
|
32228
32229
|
{
|
|
@@ -32232,7 +32233,7 @@ var TargetsViewUI = ({
|
|
|
32232
32233
|
onActionTypeChange(lineId, workspace.id, newActionType);
|
|
32233
32234
|
},
|
|
32234
32235
|
className: "w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",
|
|
32235
|
-
"aria-label": `Action type for ${formatWorkspaceName(workspace.name)}`,
|
|
32236
|
+
"aria-label": `Action type for ${formatWorkspaceName(workspace.name, lineId)}`,
|
|
32236
32237
|
children: [
|
|
32237
32238
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "assembly", className: "py-2", children: "Assembly" }),
|
|
32238
32239
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "packaging", className: "py-2", children: "Packaging" })
|
|
@@ -32291,6 +32292,7 @@ var TargetsViewUI = ({
|
|
|
32291
32292
|
isOpen: isBulkConfigureOpen,
|
|
32292
32293
|
onClose: onToggleBulkConfigure,
|
|
32293
32294
|
lineWorkspaces,
|
|
32295
|
+
lineNames,
|
|
32294
32296
|
onSave: onBulkConfigure,
|
|
32295
32297
|
selectedShift
|
|
32296
32298
|
}
|
|
@@ -33308,13 +33310,7 @@ var WorkspaceDetailView = ({
|
|
|
33308
33310
|
] }) }, i)) }),
|
|
33309
33311
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white rounded-lg p-6 shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "animate-pulse", children: [
|
|
33310
33312
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 w-40 bg-gray-200 rounded mb-4" }),
|
|
33311
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-64 bg-gray-100 rounded relative overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.
|
|
33312
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "animate-spin h-8 w-8 text-blue-500", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
33313
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
33314
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
33315
|
-
] }),
|
|
33316
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-600 mt-2", children: "Loading chart data..." })
|
|
33317
|
-
] }) }) })
|
|
33313
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-64 bg-gray-100 rounded relative overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white/80 rounded-lg p-4 shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading chart data..." }) }) }) })
|
|
33318
33314
|
] }) })
|
|
33319
33315
|
] })
|
|
33320
33316
|
] })
|
|
@@ -34208,7 +34204,6 @@ exports.LoadingInline = LoadingInline;
|
|
|
34208
34204
|
exports.LoadingOverlay = LoadingOverlay_default;
|
|
34209
34205
|
exports.LoadingPage = LoadingPage_default;
|
|
34210
34206
|
exports.LoadingSkeleton = LoadingSkeleton;
|
|
34211
|
-
exports.LoadingSpinner = LoadingSpinner_default;
|
|
34212
34207
|
exports.LoadingState = LoadingState;
|
|
34213
34208
|
exports.LoginPage = LoginPage;
|
|
34214
34209
|
exports.LoginView = LoginView_default;
|
|
@@ -34216,6 +34211,7 @@ exports.MainLayout = MainLayout;
|
|
|
34216
34211
|
exports.MetricCard = MetricCard_default;
|
|
34217
34212
|
exports.NoWorkspaceData = NoWorkspaceData;
|
|
34218
34213
|
exports.OptifyeAgentClient = OptifyeAgentClient;
|
|
34214
|
+
exports.OptifyeLogoLoader = OptifyeLogoLoader_default;
|
|
34219
34215
|
exports.OutputProgressChart = OutputProgressChart;
|
|
34220
34216
|
exports.PageHeader = PageHeader;
|
|
34221
34217
|
exports.PieChart = PieChart4;
|