@optifye/dashboard-core 6.10.18 → 6.10.19
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 +32 -5
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +128 -55
- package/dist/index.mjs +128 -55
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -1035,6 +1035,9 @@ body {
|
|
|
1035
1035
|
.h-\[60px\] {
|
|
1036
1036
|
height: 60px;
|
|
1037
1037
|
}
|
|
1038
|
+
.h-\[72px\] {
|
|
1039
|
+
height: 72px;
|
|
1040
|
+
}
|
|
1038
1041
|
.h-\[80px\] {
|
|
1039
1042
|
height: 80px;
|
|
1040
1043
|
}
|
|
@@ -1146,9 +1149,6 @@ body {
|
|
|
1146
1149
|
.min-h-\[150px\] {
|
|
1147
1150
|
min-height: 150px;
|
|
1148
1151
|
}
|
|
1149
|
-
.min-h-\[20px\] {
|
|
1150
|
-
min-height: 20px;
|
|
1151
|
-
}
|
|
1152
1152
|
.min-h-\[280px\] {
|
|
1153
1153
|
min-height: 280px;
|
|
1154
1154
|
}
|
|
@@ -1513,6 +1513,10 @@ body {
|
|
|
1513
1513
|
--tw-translate-y: -50%;
|
|
1514
1514
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1515
1515
|
}
|
|
1516
|
+
.-translate-y-4 {
|
|
1517
|
+
--tw-translate-y: -1rem;
|
|
1518
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1519
|
+
}
|
|
1516
1520
|
.translate-x-0 {
|
|
1517
1521
|
--tw-translate-x: 0px;
|
|
1518
1522
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -1529,6 +1533,14 @@ body {
|
|
|
1529
1533
|
--tw-translate-x: 100%;
|
|
1530
1534
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1531
1535
|
}
|
|
1536
|
+
.translate-y-0 {
|
|
1537
|
+
--tw-translate-y: 0px;
|
|
1538
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1539
|
+
}
|
|
1540
|
+
.translate-y-4 {
|
|
1541
|
+
--tw-translate-y: 1rem;
|
|
1542
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1543
|
+
}
|
|
1532
1544
|
.rotate-12 {
|
|
1533
1545
|
--tw-rotate: 12deg;
|
|
1534
1546
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -2145,6 +2157,10 @@ body {
|
|
|
2145
2157
|
.border-gray-700\/60 {
|
|
2146
2158
|
border-color: rgb(55 65 81 / 0.6);
|
|
2147
2159
|
}
|
|
2160
|
+
.border-green-100 {
|
|
2161
|
+
--tw-border-opacity: 1;
|
|
2162
|
+
border-color: rgb(220 252 231 / var(--tw-border-opacity, 1));
|
|
2163
|
+
}
|
|
2148
2164
|
.border-green-200 {
|
|
2149
2165
|
--tw-border-opacity: 1;
|
|
2150
2166
|
border-color: rgb(187 247 208 / var(--tw-border-opacity, 1));
|
|
@@ -5005,13 +5021,20 @@ input[type=range]:active::-moz-range-thumb {
|
|
|
5005
5021
|
.disabled\:cursor-not-allowed:disabled {
|
|
5006
5022
|
cursor: not-allowed;
|
|
5007
5023
|
}
|
|
5008
|
-
.disabled\:bg-
|
|
5024
|
+
.disabled\:bg-blue-400:disabled {
|
|
5009
5025
|
--tw-bg-opacity: 1;
|
|
5010
|
-
background-color: rgb(
|
|
5026
|
+
background-color: rgb(96 165 250 / var(--tw-bg-opacity, 1));
|
|
5011
5027
|
}
|
|
5012
5028
|
.disabled\:opacity-50:disabled {
|
|
5013
5029
|
opacity: 0.5;
|
|
5014
5030
|
}
|
|
5031
|
+
.disabled\:hover\:bg-transparent:hover:disabled {
|
|
5032
|
+
background-color: transparent;
|
|
5033
|
+
}
|
|
5034
|
+
.disabled\:hover\:text-gray-400:hover:disabled {
|
|
5035
|
+
--tw-text-opacity: 1;
|
|
5036
|
+
color: rgb(156 163 175 / var(--tw-text-opacity, 1));
|
|
5037
|
+
}
|
|
5015
5038
|
.group:last-child .group-last\:border-b-0 {
|
|
5016
5039
|
border-bottom-width: 0px;
|
|
5017
5040
|
}
|
|
@@ -6202,6 +6225,10 @@ input[type=range]:active::-moz-range-thumb {
|
|
|
6202
6225
|
.dark\:bg-white\/10 {
|
|
6203
6226
|
background-color: rgb(255 255 255 / 0.1);
|
|
6204
6227
|
}
|
|
6228
|
+
.dark\:bg-yellow-600 {
|
|
6229
|
+
--tw-bg-opacity: 1;
|
|
6230
|
+
background-color: rgb(202 138 4 / var(--tw-bg-opacity, 1));
|
|
6231
|
+
}
|
|
6205
6232
|
.dark\:bg-yellow-900\/20 {
|
|
6206
6233
|
background-color: rgb(113 63 18 / 0.2);
|
|
6207
6234
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -7109,6 +7109,7 @@ interface WorkspaceHistoryCalendarProps {
|
|
|
7109
7109
|
month: number;
|
|
7110
7110
|
year: number;
|
|
7111
7111
|
workspaceId: string;
|
|
7112
|
+
legend?: EfficiencyLegendUpdate;
|
|
7112
7113
|
/** Numeric shift ID (0, 1, 2, ...) - supports multi-shift */
|
|
7113
7114
|
selectedShiftId?: number;
|
|
7114
7115
|
onMonthNavigate?: (newMonth: number, newYear: number) => void;
|
|
@@ -7132,6 +7133,7 @@ interface WorkspaceMonthlyHistoryProps {
|
|
|
7132
7133
|
rangeStart: string;
|
|
7133
7134
|
rangeEnd: string;
|
|
7134
7135
|
timezone: string;
|
|
7136
|
+
legend?: EfficiencyLegendUpdate;
|
|
7135
7137
|
/** Numeric shift ID (0, 1, 2, ...) - supports multi-shift */
|
|
7136
7138
|
selectedShiftId?: number;
|
|
7137
7139
|
/** Callback when date is selected - passes numeric shift ID */
|
|
@@ -7164,6 +7166,7 @@ interface WorkspacePdfGeneratorProps {
|
|
|
7164
7166
|
workspace: WorkspaceDetailedMetrics;
|
|
7165
7167
|
className?: string;
|
|
7166
7168
|
idleTimeReasons?: IdleTimeReasonData[];
|
|
7169
|
+
efficiencyLegend?: EfficiencyLegendUpdate;
|
|
7167
7170
|
}
|
|
7168
7171
|
declare const WorkspacePdfGenerator: React__default.FC<WorkspacePdfGeneratorProps>;
|
|
7169
7172
|
|
|
@@ -7183,6 +7186,7 @@ interface WorkspaceMonthlyPdfGeneratorProps {
|
|
|
7183
7186
|
id: number;
|
|
7184
7187
|
name: string;
|
|
7185
7188
|
}>;
|
|
7189
|
+
efficiencyLegend?: EfficiencyLegendUpdate;
|
|
7186
7190
|
className?: string;
|
|
7187
7191
|
}
|
|
7188
7192
|
declare const WorkspaceMonthlyPdfGenerator: React__default.FC<WorkspaceMonthlyPdfGeneratorProps>;
|
|
@@ -7190,6 +7194,7 @@ declare const WorkspaceMonthlyPdfGenerator: React__default.FC<WorkspaceMonthlyPd
|
|
|
7190
7194
|
interface WorkspaceMetricCardsProps {
|
|
7191
7195
|
workspace: WorkspaceDetailedMetrics;
|
|
7192
7196
|
className?: string;
|
|
7197
|
+
legend?: EfficiencyLegendUpdate;
|
|
7193
7198
|
}
|
|
7194
7199
|
declare const WorkspaceMetricCardsImpl: React__default.FC<WorkspaceMetricCardsProps>;
|
|
7195
7200
|
declare const WorkspaceMetricCards: React__default.FC<WorkspaceMetricCardsProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -7109,6 +7109,7 @@ interface WorkspaceHistoryCalendarProps {
|
|
|
7109
7109
|
month: number;
|
|
7110
7110
|
year: number;
|
|
7111
7111
|
workspaceId: string;
|
|
7112
|
+
legend?: EfficiencyLegendUpdate;
|
|
7112
7113
|
/** Numeric shift ID (0, 1, 2, ...) - supports multi-shift */
|
|
7113
7114
|
selectedShiftId?: number;
|
|
7114
7115
|
onMonthNavigate?: (newMonth: number, newYear: number) => void;
|
|
@@ -7132,6 +7133,7 @@ interface WorkspaceMonthlyHistoryProps {
|
|
|
7132
7133
|
rangeStart: string;
|
|
7133
7134
|
rangeEnd: string;
|
|
7134
7135
|
timezone: string;
|
|
7136
|
+
legend?: EfficiencyLegendUpdate;
|
|
7135
7137
|
/** Numeric shift ID (0, 1, 2, ...) - supports multi-shift */
|
|
7136
7138
|
selectedShiftId?: number;
|
|
7137
7139
|
/** Callback when date is selected - passes numeric shift ID */
|
|
@@ -7164,6 +7166,7 @@ interface WorkspacePdfGeneratorProps {
|
|
|
7164
7166
|
workspace: WorkspaceDetailedMetrics;
|
|
7165
7167
|
className?: string;
|
|
7166
7168
|
idleTimeReasons?: IdleTimeReasonData[];
|
|
7169
|
+
efficiencyLegend?: EfficiencyLegendUpdate;
|
|
7167
7170
|
}
|
|
7168
7171
|
declare const WorkspacePdfGenerator: React__default.FC<WorkspacePdfGeneratorProps>;
|
|
7169
7172
|
|
|
@@ -7183,6 +7186,7 @@ interface WorkspaceMonthlyPdfGeneratorProps {
|
|
|
7183
7186
|
id: number;
|
|
7184
7187
|
name: string;
|
|
7185
7188
|
}>;
|
|
7189
|
+
efficiencyLegend?: EfficiencyLegendUpdate;
|
|
7186
7190
|
className?: string;
|
|
7187
7191
|
}
|
|
7188
7192
|
declare const WorkspaceMonthlyPdfGenerator: React__default.FC<WorkspaceMonthlyPdfGeneratorProps>;
|
|
@@ -7190,6 +7194,7 @@ declare const WorkspaceMonthlyPdfGenerator: React__default.FC<WorkspaceMonthlyPd
|
|
|
7190
7194
|
interface WorkspaceMetricCardsProps {
|
|
7191
7195
|
workspace: WorkspaceDetailedMetrics;
|
|
7192
7196
|
className?: string;
|
|
7197
|
+
legend?: EfficiencyLegendUpdate;
|
|
7193
7198
|
}
|
|
7194
7199
|
declare const WorkspaceMetricCardsImpl: React__default.FC<WorkspaceMetricCardsProps>;
|
|
7195
7200
|
declare const WorkspaceMetricCards: React__default.FC<WorkspaceMetricCardsProps>;
|
package/dist/index.js
CHANGED
|
@@ -9450,6 +9450,19 @@ function getEfficiencyColorClasses(efficiency, legend = DEFAULT_EFFICIENCY_LEGEN
|
|
|
9450
9450
|
return "bg-gray-300/90";
|
|
9451
9451
|
}
|
|
9452
9452
|
}
|
|
9453
|
+
function getEfficiencyHexColor(efficiency, legend = DEFAULT_EFFICIENCY_LEGEND) {
|
|
9454
|
+
const color2 = getEfficiencyColor(efficiency, legend);
|
|
9455
|
+
switch (color2) {
|
|
9456
|
+
case "green":
|
|
9457
|
+
return "#00AB45";
|
|
9458
|
+
case "yellow":
|
|
9459
|
+
return "#FFB020";
|
|
9460
|
+
case "red":
|
|
9461
|
+
return "#E34329";
|
|
9462
|
+
default:
|
|
9463
|
+
return "#D1D5DB";
|
|
9464
|
+
}
|
|
9465
|
+
}
|
|
9453
9466
|
|
|
9454
9467
|
// src/lib/hooks/useDashboardMetrics.ts
|
|
9455
9468
|
var parseEfficiencyLegend = (legend) => {
|
|
@@ -28037,8 +28050,13 @@ var CardFooter2 = (props) => {
|
|
|
28037
28050
|
};
|
|
28038
28051
|
var WorkspaceMetricCardsImpl = ({
|
|
28039
28052
|
workspace,
|
|
28040
|
-
className
|
|
28053
|
+
className,
|
|
28054
|
+
legend
|
|
28041
28055
|
}) => {
|
|
28056
|
+
const effectiveLegend = legend || DEFAULT_EFFICIENCY_LEGEND;
|
|
28057
|
+
const efficiencyValue = workspace.avg_efficiency || 0;
|
|
28058
|
+
const efficiencyTarget = effectiveLegend.green_min;
|
|
28059
|
+
const efficiencyColor = getEfficiencyHexColor(efficiencyValue, effectiveLegend);
|
|
28042
28060
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `grid grid-cols-1 gap-4 sm:gap-3 sm:grid-cols-2 lg:grid-cols-5 w-full h-full ${className || ""}`, children: [
|
|
28043
28061
|
/* @__PURE__ */ jsxRuntime.jsxs(Card2, { className: "flex flex-col bg-white shadow-sm h-full min-h-[150px] sm:min-h-0", children: [
|
|
28044
28062
|
/* @__PURE__ */ jsxRuntime.jsx(CardHeader2, { className: "pb-2 flex-none", children: /* @__PURE__ */ jsxRuntime.jsx(CardTitle2, { className: "text-lg text-center", children: "Pieces Lost" }) }),
|
|
@@ -28050,11 +28068,15 @@ var WorkspaceMetricCardsImpl = ({
|
|
|
28050
28068
|
/* @__PURE__ */ jsxRuntime.jsxs(Card2, { className: "flex flex-col bg-white shadow-sm h-full min-h-[150px] sm:min-h-0", children: [
|
|
28051
28069
|
/* @__PURE__ */ jsxRuntime.jsx(CardHeader2, { className: "pb-2 flex-none", children: /* @__PURE__ */ jsxRuntime.jsx(CardTitle2, { className: "text-lg text-center", children: "Efficiency" }) }),
|
|
28052
28070
|
/* @__PURE__ */ jsxRuntime.jsx(CardContent2, { className: "flex-1 flex items-center justify-center py-6 sm:py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
28053
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className:
|
|
28054
|
-
|
|
28071
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-5xl font-bold", style: { color: efficiencyColor }, children: [
|
|
28072
|
+
efficiencyValue.toFixed(1),
|
|
28055
28073
|
"%"
|
|
28056
28074
|
] }),
|
|
28057
|
-
/* @__PURE__ */ jsxRuntime.
|
|
28075
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-gray-500 mt-2", children: [
|
|
28076
|
+
"Target: ",
|
|
28077
|
+
Math.round(efficiencyTarget),
|
|
28078
|
+
"%"
|
|
28079
|
+
] })
|
|
28058
28080
|
] }) })
|
|
28059
28081
|
] }),
|
|
28060
28082
|
/* @__PURE__ */ jsxRuntime.jsxs(Card2, { className: "flex flex-col bg-white shadow-sm h-full min-h-[150px] sm:min-h-0", children: [
|
|
@@ -38995,6 +39017,7 @@ var WorkspaceHistoryCalendar = ({
|
|
|
38995
39017
|
month,
|
|
38996
39018
|
year,
|
|
38997
39019
|
workspaceId,
|
|
39020
|
+
legend,
|
|
38998
39021
|
selectedShiftId = 0,
|
|
38999
39022
|
onMonthNavigate,
|
|
39000
39023
|
onShiftChange,
|
|
@@ -39004,6 +39027,7 @@ var WorkspaceHistoryCalendar = ({
|
|
|
39004
39027
|
const { dateTimeConfig } = useDashboardConfig();
|
|
39005
39028
|
const configuredTimezone = dateTimeConfig?.defaultTimezone || "Asia/Kolkata";
|
|
39006
39029
|
const [animationComplete, setAnimationComplete] = React24.useState(false);
|
|
39030
|
+
const effectiveLegend = legend || DEFAULT_EFFICIENCY_LEGEND;
|
|
39007
39031
|
const hasRealData = (shift) => {
|
|
39008
39032
|
if (shift.hasData !== void 0) return shift.hasData;
|
|
39009
39033
|
return shift.efficiency > 0 || shift.output > 0 || shift.cycleTime > 0 || shift.pph > 0 || shift.idealOutput > 0 || shift.idleTime > 0;
|
|
@@ -39070,7 +39094,7 @@ var WorkspaceHistoryCalendar = ({
|
|
|
39070
39094
|
return [];
|
|
39071
39095
|
});
|
|
39072
39096
|
if (validShifts.length === 0) return null;
|
|
39073
|
-
const badShiftsCount = validShifts.filter((shift) => shift.efficiency <
|
|
39097
|
+
const badShiftsCount = validShifts.filter((shift) => shift.efficiency < effectiveLegend.green_min).length;
|
|
39074
39098
|
const totalIdleTime = validShifts.reduce((sum, shift) => sum + shift.idleTime, 0);
|
|
39075
39099
|
const avgIdleTime = Math.round(totalIdleTime / validShifts.length);
|
|
39076
39100
|
return {
|
|
@@ -39080,7 +39104,7 @@ var WorkspaceHistoryCalendar = ({
|
|
|
39080
39104
|
badDaysCount: badShiftsCount,
|
|
39081
39105
|
totalDays: validShifts.length
|
|
39082
39106
|
};
|
|
39083
|
-
}, [data, month, year, configuredTimezone, selectedShiftId]);
|
|
39107
|
+
}, [data, month, year, configuredTimezone, selectedShiftId, effectiveLegend]);
|
|
39084
39108
|
const handleDayClick = React24.useCallback((day, shiftId) => {
|
|
39085
39109
|
if (!day || isFutureDate(day.date)) return;
|
|
39086
39110
|
const year2 = day.date.getFullYear();
|
|
@@ -39127,10 +39151,11 @@ var WorkspaceHistoryCalendar = ({
|
|
|
39127
39151
|
compareDate.setHours(0, 0, 0, 0);
|
|
39128
39152
|
if (compareDate > istNow) return "bg-gray-200";
|
|
39129
39153
|
if (!hasData) return "bg-gray-300";
|
|
39130
|
-
|
|
39131
|
-
if (
|
|
39154
|
+
const efficiencyColor = getEfficiencyColor(efficiency, effectiveLegend);
|
|
39155
|
+
if (efficiencyColor === "green") return "bg-[#00AB45]/90";
|
|
39156
|
+
if (efficiencyColor === "yellow") return "bg-[#FFB020]/90";
|
|
39132
39157
|
return "bg-[#E34329]/90";
|
|
39133
|
-
}, [configuredTimezone]);
|
|
39158
|
+
}, [configuredTimezone, effectiveLegend]);
|
|
39134
39159
|
const renderStats = (shift, date) => {
|
|
39135
39160
|
const istNow = getTimeInZoneAsDate(configuredTimezone);
|
|
39136
39161
|
const compareDate = dateFnsTz.toZonedTime(date, configuredTimezone);
|
|
@@ -39318,6 +39343,7 @@ var WorkspaceMonthlyHistory = ({
|
|
|
39318
39343
|
rangeStart,
|
|
39319
39344
|
rangeEnd,
|
|
39320
39345
|
timezone,
|
|
39346
|
+
legend,
|
|
39321
39347
|
selectedShiftId = 0,
|
|
39322
39348
|
onDateSelect,
|
|
39323
39349
|
onMonthNavigate,
|
|
@@ -39327,6 +39353,7 @@ var WorkspaceMonthlyHistory = ({
|
|
|
39327
39353
|
monthlyDataLoading = false,
|
|
39328
39354
|
className = ""
|
|
39329
39355
|
}) => {
|
|
39356
|
+
const effectiveLegend = legend || DEFAULT_EFFICIENCY_LEGEND;
|
|
39330
39357
|
const monthBounds = React24.useMemo(() => getMonthKeyBounds(year, month), [year, month]);
|
|
39331
39358
|
const normalizedRange = React24.useMemo(() => {
|
|
39332
39359
|
const startKey = rangeStart || monthBounds.startKey;
|
|
@@ -39579,7 +39606,10 @@ var WorkspaceMonthlyHistory = ({
|
|
|
39579
39606
|
if (isFuture) return "bg-gray-200 dark:bg-gray-700";
|
|
39580
39607
|
if (!hasData || !shiftData) return "bg-gray-300 dark:bg-gray-600";
|
|
39581
39608
|
if (showRange && !inRange) return "bg-gray-200 dark:bg-gray-700";
|
|
39582
|
-
|
|
39609
|
+
const efficiencyColor = getEfficiencyColor(shiftData.efficiency, effectiveLegend);
|
|
39610
|
+
if (efficiencyColor === "green") return "bg-green-500 dark:bg-green-600";
|
|
39611
|
+
if (efficiencyColor === "yellow") return "bg-yellow-500 dark:bg-yellow-600";
|
|
39612
|
+
return "bg-red-500 dark:bg-red-600";
|
|
39583
39613
|
};
|
|
39584
39614
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-square relative", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
39585
39615
|
"div",
|
|
@@ -39624,7 +39654,7 @@ var WorkspaceMonthlyHistory = ({
|
|
|
39624
39654
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-100 p-4", children: [
|
|
39625
39655
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-600 text-center mb-1", children: "Avg Efficiency" }),
|
|
39626
39656
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-2xl font-bold text-center", style: {
|
|
39627
|
-
color: metrics2
|
|
39657
|
+
color: getEfficiencyHexColor(metrics2?.avgEfficiency ?? 0, effectiveLegend)
|
|
39628
39658
|
}, children: [
|
|
39629
39659
|
metrics2?.avgEfficiency ?? 0,
|
|
39630
39660
|
"%"
|
|
@@ -39877,9 +39907,10 @@ var WorkspaceWhatsAppShareButton = ({
|
|
|
39877
39907
|
}
|
|
39878
39908
|
);
|
|
39879
39909
|
};
|
|
39880
|
-
var WorkspacePdfGenerator = ({ workspace, className, idleTimeReasons }) => {
|
|
39910
|
+
var WorkspacePdfGenerator = ({ workspace, className, idleTimeReasons, efficiencyLegend }) => {
|
|
39881
39911
|
const [isGenerating, setIsGenerating] = React24.useState(false);
|
|
39882
39912
|
const entityConfig = useEntityConfig();
|
|
39913
|
+
const effectiveLegend = efficiencyLegend || DEFAULT_EFFICIENCY_LEGEND;
|
|
39883
39914
|
const generatePDF = async () => {
|
|
39884
39915
|
setIsGenerating(true);
|
|
39885
39916
|
try {
|
|
@@ -39973,7 +40004,7 @@ var WorkspacePdfGenerator = ({ workspace, className, idleTimeReasons }) => {
|
|
|
39973
40004
|
doc.setFont("helvetica", "normal");
|
|
39974
40005
|
doc.text("Efficiency:", 25, kpiStartY + kpiSpacing);
|
|
39975
40006
|
doc.setFont("helvetica", "bold");
|
|
39976
|
-
doc.text(`${(workspace.avg_efficiency || 0).toFixed(1)}% (Target:
|
|
40007
|
+
doc.text(`${(workspace.avg_efficiency || 0).toFixed(1)}% (Target: ${Math.round(effectiveLegend.green_min)}%)`, 120, kpiStartY + kpiSpacing);
|
|
39977
40008
|
createKPIBox(kpiStartY + kpiSpacing * 2);
|
|
39978
40009
|
doc.setFont("helvetica", "normal");
|
|
39979
40010
|
doc.text("PPH (Pieces Per Hour):", 25, kpiStartY + kpiSpacing * 2);
|
|
@@ -40150,9 +40181,11 @@ var WorkspaceMonthlyPdfGenerator = ({
|
|
|
40150
40181
|
rangeEnd,
|
|
40151
40182
|
selectedShiftId,
|
|
40152
40183
|
availableShifts,
|
|
40184
|
+
efficiencyLegend,
|
|
40153
40185
|
className
|
|
40154
40186
|
}) => {
|
|
40155
40187
|
const [isGenerating, setIsGenerating] = React24.useState(false);
|
|
40188
|
+
const effectiveLegend = efficiencyLegend || DEFAULT_EFFICIENCY_LEGEND;
|
|
40156
40189
|
const generatePDF = async () => {
|
|
40157
40190
|
setIsGenerating(true);
|
|
40158
40191
|
try {
|
|
@@ -40248,7 +40281,7 @@ var WorkspaceMonthlyPdfGenerator = ({
|
|
|
40248
40281
|
avgCycleTime: validShifts.reduce((sum, shift) => sum + shift.cycleTime, 0) / validShifts.length,
|
|
40249
40282
|
avgPph: validShifts.reduce((sum, shift) => sum + shift.pph, 0) / validShifts.length,
|
|
40250
40283
|
totalDays: validShifts.length,
|
|
40251
|
-
underperformingDays: validShifts.filter((shift) => shift.efficiency <
|
|
40284
|
+
underperformingDays: validShifts.filter((shift) => shift.efficiency < effectiveLegend.green_min).length
|
|
40252
40285
|
} : null;
|
|
40253
40286
|
const createKPIBox = (y) => {
|
|
40254
40287
|
doc.setFillColor(255, 255, 255);
|
|
@@ -40272,7 +40305,7 @@ var WorkspaceMonthlyPdfGenerator = ({
|
|
|
40272
40305
|
doc.setFont("helvetica", "normal");
|
|
40273
40306
|
doc.text("Average Efficiency:", 25, kpiStartY);
|
|
40274
40307
|
doc.setFont("helvetica", "bold");
|
|
40275
|
-
doc.text(`${monthlyMetrics.avgEfficiency.toFixed(1)}% (Target:
|
|
40308
|
+
doc.text(`${monthlyMetrics.avgEfficiency.toFixed(1)}% (Target: ${Math.round(effectiveLegend.green_min)}%)`, 120, kpiStartY);
|
|
40276
40309
|
createKPIBox(kpiStartY + kpiSpacing);
|
|
40277
40310
|
doc.setFont("helvetica", "normal");
|
|
40278
40311
|
doc.text("Average Output:", 25, kpiStartY + kpiSpacing);
|
|
@@ -40343,7 +40376,7 @@ var WorkspaceMonthlyPdfGenerator = ({
|
|
|
40343
40376
|
doc.text(`${shift.output}`, 60, yPos);
|
|
40344
40377
|
doc.text(`${shift.idealOutput}`, 95, yPos);
|
|
40345
40378
|
doc.text(`${shift.efficiency.toFixed(1)}%`, 135, yPos);
|
|
40346
|
-
if (shift.efficiency >=
|
|
40379
|
+
if (shift.efficiency >= effectiveLegend.green_min) {
|
|
40347
40380
|
doc.setTextColor(0, 171, 69);
|
|
40348
40381
|
doc.text("\u2713", 170, yPos);
|
|
40349
40382
|
} else {
|
|
@@ -40488,6 +40521,9 @@ var getWorkspaceStyles = (position, isPlaceholder = false) => {
|
|
|
40488
40521
|
};
|
|
40489
40522
|
var formatPercentRange = (min, max) => {
|
|
40490
40523
|
const format7 = (value) => Number.isInteger(value) ? `${value}` : value.toFixed(1);
|
|
40524
|
+
if (min >= 100 || max >= 100) {
|
|
40525
|
+
return `${format7(min)}+%`;
|
|
40526
|
+
}
|
|
40491
40527
|
return `${format7(min)}-${format7(max)}%`;
|
|
40492
40528
|
};
|
|
40493
40529
|
var Legend6 = ({ useBottleneckLabel = false, legend }) => {
|
|
@@ -51856,7 +51892,9 @@ var ConfigureLegendModal = ({
|
|
|
51856
51892
|
});
|
|
51857
51893
|
if (result.success) {
|
|
51858
51894
|
setSaveSuccess(true);
|
|
51859
|
-
setTimeout(() =>
|
|
51895
|
+
setTimeout(() => {
|
|
51896
|
+
onClose();
|
|
51897
|
+
}, 1500);
|
|
51860
51898
|
} else {
|
|
51861
51899
|
sonner.toast.error(result.error || "Failed to update legend");
|
|
51862
51900
|
}
|
|
@@ -51873,7 +51911,7 @@ var ConfigureLegendModal = ({
|
|
|
51873
51911
|
{
|
|
51874
51912
|
className: "fixed inset-0 bg-gray-900/40 backdrop-blur-sm z-50 flex items-center justify-center transition-opacity duration-300",
|
|
51875
51913
|
onClick: (e) => {
|
|
51876
|
-
if (e.target === e.currentTarget) {
|
|
51914
|
+
if (e.target === e.currentTarget && !isSaving && !saveSuccess) {
|
|
51877
51915
|
onClose();
|
|
51878
51916
|
}
|
|
51879
51917
|
},
|
|
@@ -51887,7 +51925,8 @@ var ConfigureLegendModal = ({
|
|
|
51887
51925
|
"button",
|
|
51888
51926
|
{
|
|
51889
51927
|
onClick: onClose,
|
|
51890
|
-
|
|
51928
|
+
disabled: isSaving || saveSuccess,
|
|
51929
|
+
className: "text-gray-400 hover:text-gray-600 transition-colors p-1.5 hover:bg-gray-50 rounded-md disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-gray-400",
|
|
51891
51930
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-4 h-4" })
|
|
51892
51931
|
}
|
|
51893
51932
|
)
|
|
@@ -52028,30 +52067,49 @@ var ConfigureLegendModal = ({
|
|
|
52028
52067
|
] })
|
|
52029
52068
|
] })
|
|
52030
52069
|
] }),
|
|
52031
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-6 py-4 bg-gray-50 border-t border-gray-100
|
|
52032
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
52033
|
-
|
|
52034
|
-
|
|
52035
|
-
|
|
52036
|
-
|
|
52037
|
-
|
|
52038
|
-
|
|
52039
|
-
|
|
52040
|
-
|
|
52041
|
-
|
|
52042
|
-
|
|
52043
|
-
|
|
52044
|
-
|
|
52045
|
-
|
|
52046
|
-
|
|
52047
|
-
|
|
52048
|
-
|
|
52049
|
-
|
|
52050
|
-
|
|
52051
|
-
|
|
52052
|
-
|
|
52053
|
-
|
|
52054
|
-
|
|
52070
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-6 py-4 bg-gray-50 border-t border-gray-100 h-[72px] rounded-b-lg relative overflow-hidden", children: [
|
|
52071
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
52072
|
+
"div",
|
|
52073
|
+
{
|
|
52074
|
+
className: `absolute inset-0 flex items-center justify-center transition-all duration-500 ease-out ${saveSuccess ? "opacity-100 translate-y-0" : "opacity-0 translate-y-4 pointer-events-none"}`,
|
|
52075
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-green-600 bg-green-50 px-4 py-2 rounded-full border border-green-100 shadow-sm", children: [
|
|
52076
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "w-5 h-5" }),
|
|
52077
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold", children: "Saved successfully" })
|
|
52078
|
+
] })
|
|
52079
|
+
}
|
|
52080
|
+
),
|
|
52081
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
52082
|
+
"div",
|
|
52083
|
+
{
|
|
52084
|
+
className: `flex items-center justify-end gap-3 h-full transition-all duration-300 ease-in-out ${saveSuccess ? "opacity-0 -translate-y-4 pointer-events-none" : "opacity-100 translate-y-0"}`,
|
|
52085
|
+
children: [
|
|
52086
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
52087
|
+
"button",
|
|
52088
|
+
{
|
|
52089
|
+
onClick: onClose,
|
|
52090
|
+
disabled: isSaving,
|
|
52091
|
+
className: "px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors disabled:opacity-50",
|
|
52092
|
+
children: "Cancel"
|
|
52093
|
+
}
|
|
52094
|
+
),
|
|
52095
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
52096
|
+
"button",
|
|
52097
|
+
{
|
|
52098
|
+
onClick: handleSave,
|
|
52099
|
+
disabled: !canSave || isSaving,
|
|
52100
|
+
className: "px-5 py-2.5 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 shadow-sm transition-all min-w-[140px] flex items-center justify-center gap-2 disabled:bg-blue-400",
|
|
52101
|
+
children: isSaving ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
52102
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-4 h-4 animate-spin" }),
|
|
52103
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Saving..." })
|
|
52104
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
52105
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-4 h-4" }),
|
|
52106
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Save Changes" })
|
|
52107
|
+
] })
|
|
52108
|
+
}
|
|
52109
|
+
)
|
|
52110
|
+
]
|
|
52111
|
+
}
|
|
52112
|
+
)
|
|
52055
52113
|
] })
|
|
52056
52114
|
] })
|
|
52057
52115
|
}
|
|
@@ -53560,6 +53618,7 @@ var WorkspaceDetailView = ({
|
|
|
53560
53618
|
const [usingFallbackData, setUsingFallbackData] = React24.useState(false);
|
|
53561
53619
|
const [showIdleTime, setShowIdleTime] = React24.useState(false);
|
|
53562
53620
|
const dashboardConfig = useDashboardConfig();
|
|
53621
|
+
const { legend: efficiencyLegend } = useEfficiencyLegend();
|
|
53563
53622
|
const isClipsEnabled = dashboardConfig?.clipsConfig?.enabled ?? true;
|
|
53564
53623
|
dashboardConfig?.supervisorConfig?.enabled || false;
|
|
53565
53624
|
const effectiveLineId = lineId || selectedLineId;
|
|
@@ -53647,6 +53706,9 @@ var WorkspaceDetailView = ({
|
|
|
53647
53706
|
const workspace = isHistoricView ? historicMetrics : liveMetrics;
|
|
53648
53707
|
const loading = (isHistoricView ? historicLoading : liveLoading) || isShiftConfigLoading;
|
|
53649
53708
|
const error = isHistoricView ? historicError : liveError;
|
|
53709
|
+
const efficiencyValue = workspace?.avg_efficiency ?? 0;
|
|
53710
|
+
const efficiencyTarget = efficiencyLegend.green_min;
|
|
53711
|
+
const efficiencyColor = getEfficiencyHexColor(efficiencyValue, efficiencyLegend);
|
|
53650
53712
|
const { supervisorName } = useLineSupervisor(workspace?.line_id || lineId);
|
|
53651
53713
|
React24.useEffect(() => {
|
|
53652
53714
|
if (onTabChange) {
|
|
@@ -54093,7 +54155,8 @@ var WorkspaceDetailView = ({
|
|
|
54093
54155
|
WorkspacePdfGenerator,
|
|
54094
54156
|
{
|
|
54095
54157
|
workspace,
|
|
54096
|
-
idleTimeReasons: idleTimeChartData
|
|
54158
|
+
idleTimeReasons: idleTimeChartData,
|
|
54159
|
+
efficiencyLegend
|
|
54097
54160
|
}
|
|
54098
54161
|
) }),
|
|
54099
54162
|
activeTab === "monthly_history" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1.5 lg:gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -54107,7 +54170,8 @@ var WorkspaceDetailView = ({
|
|
|
54107
54170
|
selectedYear,
|
|
54108
54171
|
rangeStart,
|
|
54109
54172
|
rangeEnd,
|
|
54110
|
-
selectedShiftId: selectedShift
|
|
54173
|
+
selectedShiftId: selectedShift,
|
|
54174
|
+
efficiencyLegend
|
|
54111
54175
|
}
|
|
54112
54176
|
) })
|
|
54113
54177
|
] })
|
|
@@ -54124,7 +54188,7 @@ var WorkspaceDetailView = ({
|
|
|
54124
54188
|
initial: "initial",
|
|
54125
54189
|
animate: "animate",
|
|
54126
54190
|
children: [
|
|
54127
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's
|
|
54191
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
|
|
54128
54192
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
54129
54193
|
OutputProgressChart,
|
|
54130
54194
|
{
|
|
@@ -54216,11 +54280,15 @@ var WorkspaceDetailView = ({
|
|
|
54216
54280
|
/* @__PURE__ */ jsxRuntime.jsxs(Card2, { children: [
|
|
54217
54281
|
/* @__PURE__ */ jsxRuntime.jsx(CardHeader2, { className: "pb-2 flex-none", children: /* @__PURE__ */ jsxRuntime.jsx(CardTitle2, { className: "text-lg text-center", children: "Efficiency" }) }),
|
|
54218
54282
|
/* @__PURE__ */ jsxRuntime.jsx(CardContent2, { className: "flex-1 flex items-center justify-center py-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
54219
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className:
|
|
54220
|
-
|
|
54283
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-5xl font-bold", style: { color: efficiencyColor }, children: [
|
|
54284
|
+
efficiencyValue.toFixed(1),
|
|
54221
54285
|
"%"
|
|
54222
54286
|
] }),
|
|
54223
|
-
/* @__PURE__ */ jsxRuntime.
|
|
54287
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-gray-500 mt-2", children: [
|
|
54288
|
+
"Target: ",
|
|
54289
|
+
Math.round(efficiencyTarget),
|
|
54290
|
+
"%"
|
|
54291
|
+
] })
|
|
54224
54292
|
] }) })
|
|
54225
54293
|
] }),
|
|
54226
54294
|
/* @__PURE__ */ jsxRuntime.jsxs(Card2, { children: [
|
|
@@ -54244,7 +54312,7 @@ var WorkspaceDetailView = ({
|
|
|
54244
54312
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 mt-2", children: "Total idle time" })
|
|
54245
54313
|
] }) })
|
|
54246
54314
|
] })
|
|
54247
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(WorkspaceMetricCards, { workspace, className: "flex-1" }) })
|
|
54315
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(WorkspaceMetricCards, { workspace, legend: efficiencyLegend, className: "flex-1" }) })
|
|
54248
54316
|
] }),
|
|
54249
54317
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "hidden lg:flex lg:flex-col lg:h-full", children: [
|
|
54250
54318
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-[50%] grid grid-cols-1 lg:grid-cols-10 gap-3 mb-3", children: [
|
|
@@ -54256,7 +54324,7 @@ var WorkspaceDetailView = ({
|
|
|
54256
54324
|
initial: "initial",
|
|
54257
54325
|
animate: "animate",
|
|
54258
54326
|
children: [
|
|
54259
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's
|
|
54327
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
|
|
54260
54328
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
54261
54329
|
OutputProgressChart,
|
|
54262
54330
|
{
|
|
@@ -54347,11 +54415,15 @@ var WorkspaceDetailView = ({
|
|
|
54347
54415
|
/* @__PURE__ */ jsxRuntime.jsxs(Card2, { children: [
|
|
54348
54416
|
/* @__PURE__ */ jsxRuntime.jsx(CardHeader2, { className: "pb-2 flex-none", children: /* @__PURE__ */ jsxRuntime.jsx(CardTitle2, { className: "text-lg text-center", children: "Efficiency" }) }),
|
|
54349
54417
|
/* @__PURE__ */ jsxRuntime.jsx(CardContent2, { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
54350
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className:
|
|
54351
|
-
|
|
54418
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-5xl font-bold", style: { color: efficiencyColor }, children: [
|
|
54419
|
+
efficiencyValue.toFixed(1),
|
|
54352
54420
|
"%"
|
|
54353
54421
|
] }),
|
|
54354
|
-
/* @__PURE__ */ jsxRuntime.
|
|
54422
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-gray-500 mt-2", children: [
|
|
54423
|
+
"Target: ",
|
|
54424
|
+
Math.round(efficiencyTarget),
|
|
54425
|
+
"%"
|
|
54426
|
+
] })
|
|
54355
54427
|
] }) })
|
|
54356
54428
|
] }),
|
|
54357
54429
|
/* @__PURE__ */ jsxRuntime.jsxs(Card2, { children: [
|
|
@@ -54375,7 +54447,7 @@ var WorkspaceDetailView = ({
|
|
|
54375
54447
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 mt-2", children: "Total idle time" })
|
|
54376
54448
|
] }) })
|
|
54377
54449
|
] })
|
|
54378
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[50%] flex", children: /* @__PURE__ */ jsxRuntime.jsx(WorkspaceMetricCards, { workspace, className: "flex-1" }) })
|
|
54450
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[50%] flex", children: /* @__PURE__ */ jsxRuntime.jsx(WorkspaceMetricCards, { workspace, legend: efficiencyLegend, className: "flex-1" }) })
|
|
54379
54451
|
] })
|
|
54380
54452
|
] }),
|
|
54381
54453
|
activeTab === "monthly_history" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-[calc(100vh-10rem)] overflow-y-auto px-2 sm:px-4 lg:px-0", children: [
|
|
@@ -54397,6 +54469,7 @@ var WorkspaceDetailView = ({
|
|
|
54397
54469
|
timezone,
|
|
54398
54470
|
monthlyDataLoading,
|
|
54399
54471
|
availableShifts: shiftConfig?.shifts?.map((s) => ({ id: s.shiftId, name: s.shiftName })),
|
|
54472
|
+
legend: efficiencyLegend,
|
|
54400
54473
|
onDateSelect: (selectedDate, shiftId) => {
|
|
54401
54474
|
if (onDateSelect) {
|
|
54402
54475
|
onDateSelect(selectedDate, shiftId);
|
package/dist/index.mjs
CHANGED
|
@@ -9421,6 +9421,19 @@ function getEfficiencyColorClasses(efficiency, legend = DEFAULT_EFFICIENCY_LEGEN
|
|
|
9421
9421
|
return "bg-gray-300/90";
|
|
9422
9422
|
}
|
|
9423
9423
|
}
|
|
9424
|
+
function getEfficiencyHexColor(efficiency, legend = DEFAULT_EFFICIENCY_LEGEND) {
|
|
9425
|
+
const color2 = getEfficiencyColor(efficiency, legend);
|
|
9426
|
+
switch (color2) {
|
|
9427
|
+
case "green":
|
|
9428
|
+
return "#00AB45";
|
|
9429
|
+
case "yellow":
|
|
9430
|
+
return "#FFB020";
|
|
9431
|
+
case "red":
|
|
9432
|
+
return "#E34329";
|
|
9433
|
+
default:
|
|
9434
|
+
return "#D1D5DB";
|
|
9435
|
+
}
|
|
9436
|
+
}
|
|
9424
9437
|
|
|
9425
9438
|
// src/lib/hooks/useDashboardMetrics.ts
|
|
9426
9439
|
var parseEfficiencyLegend = (legend) => {
|
|
@@ -28008,8 +28021,13 @@ var CardFooter2 = (props) => {
|
|
|
28008
28021
|
};
|
|
28009
28022
|
var WorkspaceMetricCardsImpl = ({
|
|
28010
28023
|
workspace,
|
|
28011
|
-
className
|
|
28024
|
+
className,
|
|
28025
|
+
legend
|
|
28012
28026
|
}) => {
|
|
28027
|
+
const effectiveLegend = legend || DEFAULT_EFFICIENCY_LEGEND;
|
|
28028
|
+
const efficiencyValue = workspace.avg_efficiency || 0;
|
|
28029
|
+
const efficiencyTarget = effectiveLegend.green_min;
|
|
28030
|
+
const efficiencyColor = getEfficiencyHexColor(efficiencyValue, effectiveLegend);
|
|
28013
28031
|
return /* @__PURE__ */ jsxs("div", { className: `grid grid-cols-1 gap-4 sm:gap-3 sm:grid-cols-2 lg:grid-cols-5 w-full h-full ${className || ""}`, children: [
|
|
28014
28032
|
/* @__PURE__ */ jsxs(Card2, { className: "flex flex-col bg-white shadow-sm h-full min-h-[150px] sm:min-h-0", children: [
|
|
28015
28033
|
/* @__PURE__ */ jsx(CardHeader2, { className: "pb-2 flex-none", children: /* @__PURE__ */ jsx(CardTitle2, { className: "text-lg text-center", children: "Pieces Lost" }) }),
|
|
@@ -28021,11 +28039,15 @@ var WorkspaceMetricCardsImpl = ({
|
|
|
28021
28039
|
/* @__PURE__ */ jsxs(Card2, { className: "flex flex-col bg-white shadow-sm h-full min-h-[150px] sm:min-h-0", children: [
|
|
28022
28040
|
/* @__PURE__ */ jsx(CardHeader2, { className: "pb-2 flex-none", children: /* @__PURE__ */ jsx(CardTitle2, { className: "text-lg text-center", children: "Efficiency" }) }),
|
|
28023
28041
|
/* @__PURE__ */ jsx(CardContent2, { className: "flex-1 flex items-center justify-center py-6 sm:py-3", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
28024
|
-
/* @__PURE__ */ jsxs("p", { className:
|
|
28025
|
-
|
|
28042
|
+
/* @__PURE__ */ jsxs("p", { className: "text-5xl font-bold", style: { color: efficiencyColor }, children: [
|
|
28043
|
+
efficiencyValue.toFixed(1),
|
|
28026
28044
|
"%"
|
|
28027
28045
|
] }),
|
|
28028
|
-
/* @__PURE__ */
|
|
28046
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 mt-2", children: [
|
|
28047
|
+
"Target: ",
|
|
28048
|
+
Math.round(efficiencyTarget),
|
|
28049
|
+
"%"
|
|
28050
|
+
] })
|
|
28029
28051
|
] }) })
|
|
28030
28052
|
] }),
|
|
28031
28053
|
/* @__PURE__ */ jsxs(Card2, { className: "flex flex-col bg-white shadow-sm h-full min-h-[150px] sm:min-h-0", children: [
|
|
@@ -38966,6 +38988,7 @@ var WorkspaceHistoryCalendar = ({
|
|
|
38966
38988
|
month,
|
|
38967
38989
|
year,
|
|
38968
38990
|
workspaceId,
|
|
38991
|
+
legend,
|
|
38969
38992
|
selectedShiftId = 0,
|
|
38970
38993
|
onMonthNavigate,
|
|
38971
38994
|
onShiftChange,
|
|
@@ -38975,6 +38998,7 @@ var WorkspaceHistoryCalendar = ({
|
|
|
38975
38998
|
const { dateTimeConfig } = useDashboardConfig();
|
|
38976
38999
|
const configuredTimezone = dateTimeConfig?.defaultTimezone || "Asia/Kolkata";
|
|
38977
39000
|
const [animationComplete, setAnimationComplete] = useState(false);
|
|
39001
|
+
const effectiveLegend = legend || DEFAULT_EFFICIENCY_LEGEND;
|
|
38978
39002
|
const hasRealData = (shift) => {
|
|
38979
39003
|
if (shift.hasData !== void 0) return shift.hasData;
|
|
38980
39004
|
return shift.efficiency > 0 || shift.output > 0 || shift.cycleTime > 0 || shift.pph > 0 || shift.idealOutput > 0 || shift.idleTime > 0;
|
|
@@ -39041,7 +39065,7 @@ var WorkspaceHistoryCalendar = ({
|
|
|
39041
39065
|
return [];
|
|
39042
39066
|
});
|
|
39043
39067
|
if (validShifts.length === 0) return null;
|
|
39044
|
-
const badShiftsCount = validShifts.filter((shift) => shift.efficiency <
|
|
39068
|
+
const badShiftsCount = validShifts.filter((shift) => shift.efficiency < effectiveLegend.green_min).length;
|
|
39045
39069
|
const totalIdleTime = validShifts.reduce((sum, shift) => sum + shift.idleTime, 0);
|
|
39046
39070
|
const avgIdleTime = Math.round(totalIdleTime / validShifts.length);
|
|
39047
39071
|
return {
|
|
@@ -39051,7 +39075,7 @@ var WorkspaceHistoryCalendar = ({
|
|
|
39051
39075
|
badDaysCount: badShiftsCount,
|
|
39052
39076
|
totalDays: validShifts.length
|
|
39053
39077
|
};
|
|
39054
|
-
}, [data, month, year, configuredTimezone, selectedShiftId]);
|
|
39078
|
+
}, [data, month, year, configuredTimezone, selectedShiftId, effectiveLegend]);
|
|
39055
39079
|
const handleDayClick = useCallback((day, shiftId) => {
|
|
39056
39080
|
if (!day || isFutureDate(day.date)) return;
|
|
39057
39081
|
const year2 = day.date.getFullYear();
|
|
@@ -39098,10 +39122,11 @@ var WorkspaceHistoryCalendar = ({
|
|
|
39098
39122
|
compareDate.setHours(0, 0, 0, 0);
|
|
39099
39123
|
if (compareDate > istNow) return "bg-gray-200";
|
|
39100
39124
|
if (!hasData) return "bg-gray-300";
|
|
39101
|
-
|
|
39102
|
-
if (
|
|
39125
|
+
const efficiencyColor = getEfficiencyColor(efficiency, effectiveLegend);
|
|
39126
|
+
if (efficiencyColor === "green") return "bg-[#00AB45]/90";
|
|
39127
|
+
if (efficiencyColor === "yellow") return "bg-[#FFB020]/90";
|
|
39103
39128
|
return "bg-[#E34329]/90";
|
|
39104
|
-
}, [configuredTimezone]);
|
|
39129
|
+
}, [configuredTimezone, effectiveLegend]);
|
|
39105
39130
|
const renderStats = (shift, date) => {
|
|
39106
39131
|
const istNow = getTimeInZoneAsDate(configuredTimezone);
|
|
39107
39132
|
const compareDate = toZonedTime(date, configuredTimezone);
|
|
@@ -39289,6 +39314,7 @@ var WorkspaceMonthlyHistory = ({
|
|
|
39289
39314
|
rangeStart,
|
|
39290
39315
|
rangeEnd,
|
|
39291
39316
|
timezone,
|
|
39317
|
+
legend,
|
|
39292
39318
|
selectedShiftId = 0,
|
|
39293
39319
|
onDateSelect,
|
|
39294
39320
|
onMonthNavigate,
|
|
@@ -39298,6 +39324,7 @@ var WorkspaceMonthlyHistory = ({
|
|
|
39298
39324
|
monthlyDataLoading = false,
|
|
39299
39325
|
className = ""
|
|
39300
39326
|
}) => {
|
|
39327
|
+
const effectiveLegend = legend || DEFAULT_EFFICIENCY_LEGEND;
|
|
39301
39328
|
const monthBounds = useMemo(() => getMonthKeyBounds(year, month), [year, month]);
|
|
39302
39329
|
const normalizedRange = useMemo(() => {
|
|
39303
39330
|
const startKey = rangeStart || monthBounds.startKey;
|
|
@@ -39550,7 +39577,10 @@ var WorkspaceMonthlyHistory = ({
|
|
|
39550
39577
|
if (isFuture) return "bg-gray-200 dark:bg-gray-700";
|
|
39551
39578
|
if (!hasData || !shiftData) return "bg-gray-300 dark:bg-gray-600";
|
|
39552
39579
|
if (showRange && !inRange) return "bg-gray-200 dark:bg-gray-700";
|
|
39553
|
-
|
|
39580
|
+
const efficiencyColor = getEfficiencyColor(shiftData.efficiency, effectiveLegend);
|
|
39581
|
+
if (efficiencyColor === "green") return "bg-green-500 dark:bg-green-600";
|
|
39582
|
+
if (efficiencyColor === "yellow") return "bg-yellow-500 dark:bg-yellow-600";
|
|
39583
|
+
return "bg-red-500 dark:bg-red-600";
|
|
39554
39584
|
};
|
|
39555
39585
|
return /* @__PURE__ */ jsx("div", { className: "aspect-square relative", children: /* @__PURE__ */ jsx(
|
|
39556
39586
|
"div",
|
|
@@ -39595,7 +39625,7 @@ var WorkspaceMonthlyHistory = ({
|
|
|
39595
39625
|
/* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-100 p-4", children: [
|
|
39596
39626
|
/* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-gray-600 text-center mb-1", children: "Avg Efficiency" }),
|
|
39597
39627
|
/* @__PURE__ */ jsxs("div", { className: "text-2xl font-bold text-center", style: {
|
|
39598
|
-
color: metrics2
|
|
39628
|
+
color: getEfficiencyHexColor(metrics2?.avgEfficiency ?? 0, effectiveLegend)
|
|
39599
39629
|
}, children: [
|
|
39600
39630
|
metrics2?.avgEfficiency ?? 0,
|
|
39601
39631
|
"%"
|
|
@@ -39848,9 +39878,10 @@ var WorkspaceWhatsAppShareButton = ({
|
|
|
39848
39878
|
}
|
|
39849
39879
|
);
|
|
39850
39880
|
};
|
|
39851
|
-
var WorkspacePdfGenerator = ({ workspace, className, idleTimeReasons }) => {
|
|
39881
|
+
var WorkspacePdfGenerator = ({ workspace, className, idleTimeReasons, efficiencyLegend }) => {
|
|
39852
39882
|
const [isGenerating, setIsGenerating] = useState(false);
|
|
39853
39883
|
const entityConfig = useEntityConfig();
|
|
39884
|
+
const effectiveLegend = efficiencyLegend || DEFAULT_EFFICIENCY_LEGEND;
|
|
39854
39885
|
const generatePDF = async () => {
|
|
39855
39886
|
setIsGenerating(true);
|
|
39856
39887
|
try {
|
|
@@ -39944,7 +39975,7 @@ var WorkspacePdfGenerator = ({ workspace, className, idleTimeReasons }) => {
|
|
|
39944
39975
|
doc.setFont("helvetica", "normal");
|
|
39945
39976
|
doc.text("Efficiency:", 25, kpiStartY + kpiSpacing);
|
|
39946
39977
|
doc.setFont("helvetica", "bold");
|
|
39947
|
-
doc.text(`${(workspace.avg_efficiency || 0).toFixed(1)}% (Target:
|
|
39978
|
+
doc.text(`${(workspace.avg_efficiency || 0).toFixed(1)}% (Target: ${Math.round(effectiveLegend.green_min)}%)`, 120, kpiStartY + kpiSpacing);
|
|
39948
39979
|
createKPIBox(kpiStartY + kpiSpacing * 2);
|
|
39949
39980
|
doc.setFont("helvetica", "normal");
|
|
39950
39981
|
doc.text("PPH (Pieces Per Hour):", 25, kpiStartY + kpiSpacing * 2);
|
|
@@ -40121,9 +40152,11 @@ var WorkspaceMonthlyPdfGenerator = ({
|
|
|
40121
40152
|
rangeEnd,
|
|
40122
40153
|
selectedShiftId,
|
|
40123
40154
|
availableShifts,
|
|
40155
|
+
efficiencyLegend,
|
|
40124
40156
|
className
|
|
40125
40157
|
}) => {
|
|
40126
40158
|
const [isGenerating, setIsGenerating] = useState(false);
|
|
40159
|
+
const effectiveLegend = efficiencyLegend || DEFAULT_EFFICIENCY_LEGEND;
|
|
40127
40160
|
const generatePDF = async () => {
|
|
40128
40161
|
setIsGenerating(true);
|
|
40129
40162
|
try {
|
|
@@ -40219,7 +40252,7 @@ var WorkspaceMonthlyPdfGenerator = ({
|
|
|
40219
40252
|
avgCycleTime: validShifts.reduce((sum, shift) => sum + shift.cycleTime, 0) / validShifts.length,
|
|
40220
40253
|
avgPph: validShifts.reduce((sum, shift) => sum + shift.pph, 0) / validShifts.length,
|
|
40221
40254
|
totalDays: validShifts.length,
|
|
40222
|
-
underperformingDays: validShifts.filter((shift) => shift.efficiency <
|
|
40255
|
+
underperformingDays: validShifts.filter((shift) => shift.efficiency < effectiveLegend.green_min).length
|
|
40223
40256
|
} : null;
|
|
40224
40257
|
const createKPIBox = (y) => {
|
|
40225
40258
|
doc.setFillColor(255, 255, 255);
|
|
@@ -40243,7 +40276,7 @@ var WorkspaceMonthlyPdfGenerator = ({
|
|
|
40243
40276
|
doc.setFont("helvetica", "normal");
|
|
40244
40277
|
doc.text("Average Efficiency:", 25, kpiStartY);
|
|
40245
40278
|
doc.setFont("helvetica", "bold");
|
|
40246
|
-
doc.text(`${monthlyMetrics.avgEfficiency.toFixed(1)}% (Target:
|
|
40279
|
+
doc.text(`${monthlyMetrics.avgEfficiency.toFixed(1)}% (Target: ${Math.round(effectiveLegend.green_min)}%)`, 120, kpiStartY);
|
|
40247
40280
|
createKPIBox(kpiStartY + kpiSpacing);
|
|
40248
40281
|
doc.setFont("helvetica", "normal");
|
|
40249
40282
|
doc.text("Average Output:", 25, kpiStartY + kpiSpacing);
|
|
@@ -40314,7 +40347,7 @@ var WorkspaceMonthlyPdfGenerator = ({
|
|
|
40314
40347
|
doc.text(`${shift.output}`, 60, yPos);
|
|
40315
40348
|
doc.text(`${shift.idealOutput}`, 95, yPos);
|
|
40316
40349
|
doc.text(`${shift.efficiency.toFixed(1)}%`, 135, yPos);
|
|
40317
|
-
if (shift.efficiency >=
|
|
40350
|
+
if (shift.efficiency >= effectiveLegend.green_min) {
|
|
40318
40351
|
doc.setTextColor(0, 171, 69);
|
|
40319
40352
|
doc.text("\u2713", 170, yPos);
|
|
40320
40353
|
} else {
|
|
@@ -40459,6 +40492,9 @@ var getWorkspaceStyles = (position, isPlaceholder = false) => {
|
|
|
40459
40492
|
};
|
|
40460
40493
|
var formatPercentRange = (min, max) => {
|
|
40461
40494
|
const format7 = (value) => Number.isInteger(value) ? `${value}` : value.toFixed(1);
|
|
40495
|
+
if (min >= 100 || max >= 100) {
|
|
40496
|
+
return `${format7(min)}+%`;
|
|
40497
|
+
}
|
|
40462
40498
|
return `${format7(min)}-${format7(max)}%`;
|
|
40463
40499
|
};
|
|
40464
40500
|
var Legend6 = ({ useBottleneckLabel = false, legend }) => {
|
|
@@ -51827,7 +51863,9 @@ var ConfigureLegendModal = ({
|
|
|
51827
51863
|
});
|
|
51828
51864
|
if (result.success) {
|
|
51829
51865
|
setSaveSuccess(true);
|
|
51830
|
-
setTimeout(() =>
|
|
51866
|
+
setTimeout(() => {
|
|
51867
|
+
onClose();
|
|
51868
|
+
}, 1500);
|
|
51831
51869
|
} else {
|
|
51832
51870
|
toast.error(result.error || "Failed to update legend");
|
|
51833
51871
|
}
|
|
@@ -51844,7 +51882,7 @@ var ConfigureLegendModal = ({
|
|
|
51844
51882
|
{
|
|
51845
51883
|
className: "fixed inset-0 bg-gray-900/40 backdrop-blur-sm z-50 flex items-center justify-center transition-opacity duration-300",
|
|
51846
51884
|
onClick: (e) => {
|
|
51847
|
-
if (e.target === e.currentTarget) {
|
|
51885
|
+
if (e.target === e.currentTarget && !isSaving && !saveSuccess) {
|
|
51848
51886
|
onClose();
|
|
51849
51887
|
}
|
|
51850
51888
|
},
|
|
@@ -51858,7 +51896,8 @@ var ConfigureLegendModal = ({
|
|
|
51858
51896
|
"button",
|
|
51859
51897
|
{
|
|
51860
51898
|
onClick: onClose,
|
|
51861
|
-
|
|
51899
|
+
disabled: isSaving || saveSuccess,
|
|
51900
|
+
className: "text-gray-400 hover:text-gray-600 transition-colors p-1.5 hover:bg-gray-50 rounded-md disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-gray-400",
|
|
51862
51901
|
children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" })
|
|
51863
51902
|
}
|
|
51864
51903
|
)
|
|
@@ -51999,30 +52038,49 @@ var ConfigureLegendModal = ({
|
|
|
51999
52038
|
] })
|
|
52000
52039
|
] })
|
|
52001
52040
|
] }),
|
|
52002
|
-
/* @__PURE__ */ jsxs("div", { className: "px-6 py-4 bg-gray-50 border-t border-gray-100
|
|
52003
|
-
/* @__PURE__ */ jsx(
|
|
52004
|
-
|
|
52005
|
-
|
|
52006
|
-
|
|
52007
|
-
|
|
52008
|
-
|
|
52009
|
-
|
|
52010
|
-
|
|
52011
|
-
|
|
52012
|
-
|
|
52013
|
-
|
|
52014
|
-
|
|
52015
|
-
|
|
52016
|
-
|
|
52017
|
-
|
|
52018
|
-
|
|
52019
|
-
|
|
52020
|
-
|
|
52021
|
-
|
|
52022
|
-
|
|
52023
|
-
|
|
52024
|
-
|
|
52025
|
-
|
|
52041
|
+
/* @__PURE__ */ jsxs("div", { className: "px-6 py-4 bg-gray-50 border-t border-gray-100 h-[72px] rounded-b-lg relative overflow-hidden", children: [
|
|
52042
|
+
/* @__PURE__ */ jsx(
|
|
52043
|
+
"div",
|
|
52044
|
+
{
|
|
52045
|
+
className: `absolute inset-0 flex items-center justify-center transition-all duration-500 ease-out ${saveSuccess ? "opacity-100 translate-y-0" : "opacity-0 translate-y-4 pointer-events-none"}`,
|
|
52046
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-green-600 bg-green-50 px-4 py-2 rounded-full border border-green-100 shadow-sm", children: [
|
|
52047
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "w-5 h-5" }),
|
|
52048
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: "Saved successfully" })
|
|
52049
|
+
] })
|
|
52050
|
+
}
|
|
52051
|
+
),
|
|
52052
|
+
/* @__PURE__ */ jsxs(
|
|
52053
|
+
"div",
|
|
52054
|
+
{
|
|
52055
|
+
className: `flex items-center justify-end gap-3 h-full transition-all duration-300 ease-in-out ${saveSuccess ? "opacity-0 -translate-y-4 pointer-events-none" : "opacity-100 translate-y-0"}`,
|
|
52056
|
+
children: [
|
|
52057
|
+
/* @__PURE__ */ jsx(
|
|
52058
|
+
"button",
|
|
52059
|
+
{
|
|
52060
|
+
onClick: onClose,
|
|
52061
|
+
disabled: isSaving,
|
|
52062
|
+
className: "px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors disabled:opacity-50",
|
|
52063
|
+
children: "Cancel"
|
|
52064
|
+
}
|
|
52065
|
+
),
|
|
52066
|
+
/* @__PURE__ */ jsx(
|
|
52067
|
+
"button",
|
|
52068
|
+
{
|
|
52069
|
+
onClick: handleSave,
|
|
52070
|
+
disabled: !canSave || isSaving,
|
|
52071
|
+
className: "px-5 py-2.5 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 shadow-sm transition-all min-w-[140px] flex items-center justify-center gap-2 disabled:bg-blue-400",
|
|
52072
|
+
children: isSaving ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52073
|
+
/* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 animate-spin" }),
|
|
52074
|
+
/* @__PURE__ */ jsx("span", { children: "Saving..." })
|
|
52075
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52076
|
+
/* @__PURE__ */ jsx(Check, { className: "w-4 h-4" }),
|
|
52077
|
+
/* @__PURE__ */ jsx("span", { children: "Save Changes" })
|
|
52078
|
+
] })
|
|
52079
|
+
}
|
|
52080
|
+
)
|
|
52081
|
+
]
|
|
52082
|
+
}
|
|
52083
|
+
)
|
|
52026
52084
|
] })
|
|
52027
52085
|
] })
|
|
52028
52086
|
}
|
|
@@ -53531,6 +53589,7 @@ var WorkspaceDetailView = ({
|
|
|
53531
53589
|
const [usingFallbackData, setUsingFallbackData] = useState(false);
|
|
53532
53590
|
const [showIdleTime, setShowIdleTime] = useState(false);
|
|
53533
53591
|
const dashboardConfig = useDashboardConfig();
|
|
53592
|
+
const { legend: efficiencyLegend } = useEfficiencyLegend();
|
|
53534
53593
|
const isClipsEnabled = dashboardConfig?.clipsConfig?.enabled ?? true;
|
|
53535
53594
|
dashboardConfig?.supervisorConfig?.enabled || false;
|
|
53536
53595
|
const effectiveLineId = lineId || selectedLineId;
|
|
@@ -53618,6 +53677,9 @@ var WorkspaceDetailView = ({
|
|
|
53618
53677
|
const workspace = isHistoricView ? historicMetrics : liveMetrics;
|
|
53619
53678
|
const loading = (isHistoricView ? historicLoading : liveLoading) || isShiftConfigLoading;
|
|
53620
53679
|
const error = isHistoricView ? historicError : liveError;
|
|
53680
|
+
const efficiencyValue = workspace?.avg_efficiency ?? 0;
|
|
53681
|
+
const efficiencyTarget = efficiencyLegend.green_min;
|
|
53682
|
+
const efficiencyColor = getEfficiencyHexColor(efficiencyValue, efficiencyLegend);
|
|
53621
53683
|
const { supervisorName } = useLineSupervisor(workspace?.line_id || lineId);
|
|
53622
53684
|
useEffect(() => {
|
|
53623
53685
|
if (onTabChange) {
|
|
@@ -54064,7 +54126,8 @@ var WorkspaceDetailView = ({
|
|
|
54064
54126
|
WorkspacePdfGenerator,
|
|
54065
54127
|
{
|
|
54066
54128
|
workspace,
|
|
54067
|
-
idleTimeReasons: idleTimeChartData
|
|
54129
|
+
idleTimeReasons: idleTimeChartData,
|
|
54130
|
+
efficiencyLegend
|
|
54068
54131
|
}
|
|
54069
54132
|
) }),
|
|
54070
54133
|
activeTab === "monthly_history" && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 lg:gap-2", children: /* @__PURE__ */ jsx(
|
|
@@ -54078,7 +54141,8 @@ var WorkspaceDetailView = ({
|
|
|
54078
54141
|
selectedYear,
|
|
54079
54142
|
rangeStart,
|
|
54080
54143
|
rangeEnd,
|
|
54081
|
-
selectedShiftId: selectedShift
|
|
54144
|
+
selectedShiftId: selectedShift,
|
|
54145
|
+
efficiencyLegend
|
|
54082
54146
|
}
|
|
54083
54147
|
) })
|
|
54084
54148
|
] })
|
|
@@ -54095,7 +54159,7 @@ var WorkspaceDetailView = ({
|
|
|
54095
54159
|
initial: "initial",
|
|
54096
54160
|
animate: "animate",
|
|
54097
54161
|
children: [
|
|
54098
|
-
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's
|
|
54162
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
|
|
54099
54163
|
/* @__PURE__ */ jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsx(
|
|
54100
54164
|
OutputProgressChart,
|
|
54101
54165
|
{
|
|
@@ -54187,11 +54251,15 @@ var WorkspaceDetailView = ({
|
|
|
54187
54251
|
/* @__PURE__ */ jsxs(Card2, { children: [
|
|
54188
54252
|
/* @__PURE__ */ jsx(CardHeader2, { className: "pb-2 flex-none", children: /* @__PURE__ */ jsx(CardTitle2, { className: "text-lg text-center", children: "Efficiency" }) }),
|
|
54189
54253
|
/* @__PURE__ */ jsx(CardContent2, { className: "flex-1 flex items-center justify-center py-6", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
54190
|
-
/* @__PURE__ */ jsxs("p", { className:
|
|
54191
|
-
|
|
54254
|
+
/* @__PURE__ */ jsxs("p", { className: "text-5xl font-bold", style: { color: efficiencyColor }, children: [
|
|
54255
|
+
efficiencyValue.toFixed(1),
|
|
54192
54256
|
"%"
|
|
54193
54257
|
] }),
|
|
54194
|
-
/* @__PURE__ */
|
|
54258
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 mt-2", children: [
|
|
54259
|
+
"Target: ",
|
|
54260
|
+
Math.round(efficiencyTarget),
|
|
54261
|
+
"%"
|
|
54262
|
+
] })
|
|
54195
54263
|
] }) })
|
|
54196
54264
|
] }),
|
|
54197
54265
|
/* @__PURE__ */ jsxs(Card2, { children: [
|
|
@@ -54215,7 +54283,7 @@ var WorkspaceDetailView = ({
|
|
|
54215
54283
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mt-2", children: "Total idle time" })
|
|
54216
54284
|
] }) })
|
|
54217
54285
|
] })
|
|
54218
|
-
] }) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(WorkspaceMetricCards, { workspace, className: "flex-1" }) })
|
|
54286
|
+
] }) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(WorkspaceMetricCards, { workspace, legend: efficiencyLegend, className: "flex-1" }) })
|
|
54219
54287
|
] }),
|
|
54220
54288
|
/* @__PURE__ */ jsxs("div", { className: "hidden lg:flex lg:flex-col lg:h-full", children: [
|
|
54221
54289
|
/* @__PURE__ */ jsxs("div", { className: "h-[50%] grid grid-cols-1 lg:grid-cols-10 gap-3 mb-3", children: [
|
|
@@ -54227,7 +54295,7 @@ var WorkspaceDetailView = ({
|
|
|
54227
54295
|
initial: "initial",
|
|
54228
54296
|
animate: "animate",
|
|
54229
54297
|
children: [
|
|
54230
|
-
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's
|
|
54298
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4 text-center", children: "Today's Output" }),
|
|
54231
54299
|
/* @__PURE__ */ jsx("div", { className: "h-[calc(100%-3rem)]", children: /* @__PURE__ */ jsx(
|
|
54232
54300
|
OutputProgressChart,
|
|
54233
54301
|
{
|
|
@@ -54318,11 +54386,15 @@ var WorkspaceDetailView = ({
|
|
|
54318
54386
|
/* @__PURE__ */ jsxs(Card2, { children: [
|
|
54319
54387
|
/* @__PURE__ */ jsx(CardHeader2, { className: "pb-2 flex-none", children: /* @__PURE__ */ jsx(CardTitle2, { className: "text-lg text-center", children: "Efficiency" }) }),
|
|
54320
54388
|
/* @__PURE__ */ jsx(CardContent2, { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
54321
|
-
/* @__PURE__ */ jsxs("p", { className:
|
|
54322
|
-
|
|
54389
|
+
/* @__PURE__ */ jsxs("p", { className: "text-5xl font-bold", style: { color: efficiencyColor }, children: [
|
|
54390
|
+
efficiencyValue.toFixed(1),
|
|
54323
54391
|
"%"
|
|
54324
54392
|
] }),
|
|
54325
|
-
/* @__PURE__ */
|
|
54393
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 mt-2", children: [
|
|
54394
|
+
"Target: ",
|
|
54395
|
+
Math.round(efficiencyTarget),
|
|
54396
|
+
"%"
|
|
54397
|
+
] })
|
|
54326
54398
|
] }) })
|
|
54327
54399
|
] }),
|
|
54328
54400
|
/* @__PURE__ */ jsxs(Card2, { children: [
|
|
@@ -54346,7 +54418,7 @@ var WorkspaceDetailView = ({
|
|
|
54346
54418
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mt-2", children: "Total idle time" })
|
|
54347
54419
|
] }) })
|
|
54348
54420
|
] })
|
|
54349
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "h-[50%] flex", children: /* @__PURE__ */ jsx(WorkspaceMetricCards, { workspace, className: "flex-1" }) })
|
|
54421
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "h-[50%] flex", children: /* @__PURE__ */ jsx(WorkspaceMetricCards, { workspace, legend: efficiencyLegend, className: "flex-1" }) })
|
|
54350
54422
|
] })
|
|
54351
54423
|
] }),
|
|
54352
54424
|
activeTab === "monthly_history" && /* @__PURE__ */ jsxs("div", { className: "h-[calc(100vh-10rem)] overflow-y-auto px-2 sm:px-4 lg:px-0", children: [
|
|
@@ -54368,6 +54440,7 @@ var WorkspaceDetailView = ({
|
|
|
54368
54440
|
timezone,
|
|
54369
54441
|
monthlyDataLoading,
|
|
54370
54442
|
availableShifts: shiftConfig?.shifts?.map((s) => ({ id: s.shiftId, name: s.shiftName })),
|
|
54443
|
+
legend: efficiencyLegend,
|
|
54371
54444
|
onDateSelect: (selectedDate, shiftId) => {
|
|
54372
54445
|
if (onDateSelect) {
|
|
54373
54446
|
onDateSelect(selectedDate, shiftId);
|