@optifye/dashboard-core 6.5.7 → 6.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +119 -46
- package/dist/index.mjs +119 -46
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,7 @@ interface LineInfo {
|
|
|
32
32
|
underperforming_workspace_names: string[];
|
|
33
33
|
underperforming_workspace_uuids: string[];
|
|
34
34
|
output_array: number[];
|
|
35
|
+
output_hourly?: Record<string, number[]>;
|
|
35
36
|
line_threshold: number;
|
|
36
37
|
threshold_pph?: number;
|
|
37
38
|
shift_start?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ interface LineInfo {
|
|
|
32
32
|
underperforming_workspace_names: string[];
|
|
33
33
|
underperforming_workspace_uuids: string[];
|
|
34
34
|
output_array: number[];
|
|
35
|
+
output_hourly?: Record<string, number[]>;
|
|
35
36
|
line_threshold: number;
|
|
36
37
|
threshold_pph?: number;
|
|
37
38
|
shift_start?: string;
|
package/dist/index.js
CHANGED
|
@@ -889,22 +889,21 @@ var dashboardService = {
|
|
|
889
889
|
if (hasOutputHourlyData) {
|
|
890
890
|
console.log("Using new output_hourly column for workspace:", data.workspace_name);
|
|
891
891
|
console.log("Raw output_hourly data:", outputHourly);
|
|
892
|
-
const isNightShift = data.shift_id === 1;
|
|
893
|
-
const shiftStart = data.shift_start || (isNightShift ? "22:00" : "06:00");
|
|
894
|
-
const shiftEnd = data.shift_end || (isNightShift ? "06:00" : "14:00");
|
|
892
|
+
const isNightShift = data.shift_id === (shiftConfig.nightShift?.id ?? 1);
|
|
893
|
+
const shiftStart = data.shift_start || (isNightShift ? shiftConfig.nightShift?.startTime || "22:00" : shiftConfig.dayShift?.startTime || "06:00");
|
|
894
|
+
const shiftEnd = data.shift_end || (isNightShift ? shiftConfig.nightShift?.endTime || "06:00" : shiftConfig.dayShift?.endTime || "14:00");
|
|
895
895
|
const startHour = parseInt(shiftStart.split(":")[0]);
|
|
896
896
|
const startMinute = parseInt(shiftStart.split(":")[1] || "0");
|
|
897
897
|
const endHour = parseInt(shiftEnd.split(":")[0]);
|
|
898
898
|
const endMinute = parseInt(shiftEnd.split(":")[1] || "0");
|
|
899
899
|
let shiftDuration = endHour - startHour;
|
|
900
|
-
if (endMinute > startMinute) {
|
|
901
|
-
shiftDuration += 1;
|
|
902
|
-
}
|
|
903
900
|
if (shiftDuration <= 0) {
|
|
904
901
|
shiftDuration += 24;
|
|
905
902
|
}
|
|
903
|
+
const hasPartialLastHour = endMinute > 0 && endMinute < 60;
|
|
904
|
+
const hourCount = hasPartialLastHour ? Math.ceil(shiftDuration + endMinute / 60) : shiftDuration;
|
|
906
905
|
let expectedHours = [];
|
|
907
|
-
for (let i = 0; i <
|
|
906
|
+
for (let i = 0; i < hourCount; i++) {
|
|
908
907
|
expectedHours.push((startHour + i) % 24);
|
|
909
908
|
}
|
|
910
909
|
console.log("Expected shift hours:", expectedHours);
|
|
@@ -5703,21 +5702,20 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
5703
5702
|
console.log("Using new output_hourly column for workspace (fallback):", recentData.workspace_name);
|
|
5704
5703
|
console.log("Raw output_hourly data (fallback):", outputHourly2);
|
|
5705
5704
|
const isNightShift = recentData.shift_id === 1;
|
|
5706
|
-
const shiftStart = recentData.shift_start || (isNightShift ? "22:00" : "06:00");
|
|
5707
|
-
const shiftEnd = recentData.shift_end || (isNightShift ? "06:00" : "14:00");
|
|
5705
|
+
const shiftStart = recentData.shift_start || (isNightShift ? shiftConfig.nightShift?.startTime || "22:00" : shiftConfig.dayShift?.startTime || "06:00");
|
|
5706
|
+
const shiftEnd = recentData.shift_end || (isNightShift ? shiftConfig.nightShift?.endTime || "06:00" : shiftConfig.dayShift?.endTime || "14:00");
|
|
5708
5707
|
const startHour = parseInt(shiftStart.split(":")[0]);
|
|
5709
5708
|
const startMinute = parseInt(shiftStart.split(":")[1] || "0");
|
|
5710
5709
|
const endHour = parseInt(shiftEnd.split(":")[0]);
|
|
5711
5710
|
const endMinute = parseInt(shiftEnd.split(":")[1] || "0");
|
|
5712
5711
|
let shiftDuration = endHour - startHour;
|
|
5713
|
-
if (endMinute > startMinute) {
|
|
5714
|
-
shiftDuration += 1;
|
|
5715
|
-
}
|
|
5716
5712
|
if (shiftDuration <= 0) {
|
|
5717
5713
|
shiftDuration += 24;
|
|
5718
5714
|
}
|
|
5715
|
+
const hasPartialLastHour = endMinute > 0 && endMinute < 60;
|
|
5716
|
+
const hourCount = hasPartialLastHour ? Math.ceil(shiftDuration + endMinute / 60) : shiftDuration;
|
|
5719
5717
|
let expectedHours = [];
|
|
5720
|
-
for (let i = 0; i <
|
|
5718
|
+
for (let i = 0; i < hourCount; i++) {
|
|
5721
5719
|
expectedHours.push((startHour + i) % 24);
|
|
5722
5720
|
}
|
|
5723
5721
|
console.log("Expected shift hours (fallback):", expectedHours);
|
|
@@ -5762,8 +5760,8 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
5762
5760
|
date: recentData.date,
|
|
5763
5761
|
shift_id: recentData.shift_id,
|
|
5764
5762
|
action_name: recentData.action_name || "",
|
|
5765
|
-
shift_start: recentData.shift_start || "06:00",
|
|
5766
|
-
shift_end: recentData.shift_end || "14:00",
|
|
5763
|
+
shift_start: recentData.shift_start || (recentData.shift_id === 1 ? shiftConfig.nightShift?.startTime || "22:00" : shiftConfig.dayShift?.startTime || "06:00"),
|
|
5764
|
+
shift_end: recentData.shift_end || (recentData.shift_id === 1 ? shiftConfig.nightShift?.endTime || "06:00" : shiftConfig.dayShift?.endTime || "14:00"),
|
|
5767
5765
|
shift_type: recentData.shift_type || (recentData.shift_id === 0 ? "Day" : "Night"),
|
|
5768
5766
|
pph_threshold: recentData.pph_threshold || 0,
|
|
5769
5767
|
target_output: recentData.total_day_output || 0,
|
|
@@ -5819,21 +5817,20 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
5819
5817
|
console.log("\u2705 Using new output_hourly column for workspace:", data.workspace_name);
|
|
5820
5818
|
console.log("Raw output_hourly data:", JSON.stringify(outputHourly));
|
|
5821
5819
|
const isNightShift = data.shift_id === 1;
|
|
5822
|
-
const shiftStart = data.shift_start || (isNightShift ? "22:00" : "06:00");
|
|
5823
|
-
const shiftEnd = data.shift_end || (isNightShift ? "06:00" : "14:00");
|
|
5820
|
+
const shiftStart = data.shift_start || (isNightShift ? shiftConfig.nightShift?.startTime || "22:00" : shiftConfig.dayShift?.startTime || "06:00");
|
|
5821
|
+
const shiftEnd = data.shift_end || (isNightShift ? shiftConfig.nightShift?.endTime || "06:00" : shiftConfig.dayShift?.endTime || "14:00");
|
|
5824
5822
|
const startHour = parseInt(shiftStart.split(":")[0]);
|
|
5825
5823
|
const startMinute = parseInt(shiftStart.split(":")[1] || "0");
|
|
5826
5824
|
const endHour = parseInt(shiftEnd.split(":")[0]);
|
|
5827
5825
|
const endMinute = parseInt(shiftEnd.split(":")[1] || "0");
|
|
5828
5826
|
let shiftDuration = endHour - startHour;
|
|
5829
|
-
if (endMinute > startMinute) {
|
|
5830
|
-
shiftDuration += 1;
|
|
5831
|
-
}
|
|
5832
5827
|
if (shiftDuration <= 0) {
|
|
5833
5828
|
shiftDuration += 24;
|
|
5834
5829
|
}
|
|
5830
|
+
const hasPartialLastHour = endMinute > 0 && endMinute < 60;
|
|
5831
|
+
const hourCount = hasPartialLastHour ? Math.ceil(shiftDuration + endMinute / 60) : shiftDuration;
|
|
5835
5832
|
let expectedHours = [];
|
|
5836
|
-
for (let i = 0; i <
|
|
5833
|
+
for (let i = 0; i < hourCount; i++) {
|
|
5837
5834
|
expectedHours.push((startHour + i) % 24);
|
|
5838
5835
|
}
|
|
5839
5836
|
console.log("Expected shift hours:", expectedHours);
|
|
@@ -5881,8 +5878,8 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
5881
5878
|
date: data.date,
|
|
5882
5879
|
shift_id: data.shift_id,
|
|
5883
5880
|
action_name: data.action_name || "",
|
|
5884
|
-
shift_start: data.shift_start || "06:00",
|
|
5885
|
-
shift_end: data.shift_end || "14:00",
|
|
5881
|
+
shift_start: data.shift_start || (data.shift_id === 1 ? shiftConfig.nightShift?.startTime || "22:00" : shiftConfig.dayShift?.startTime || "06:00"),
|
|
5882
|
+
shift_end: data.shift_end || (data.shift_id === 1 ? shiftConfig.nightShift?.endTime || "06:00" : shiftConfig.dayShift?.endTime || "14:00"),
|
|
5886
5883
|
shift_type: data.shift_type || (data.shift_id === 0 ? "Day" : "Night"),
|
|
5887
5884
|
pph_threshold: data.pph_threshold || 0,
|
|
5888
5885
|
target_output: data.total_day_output || 0,
|
|
@@ -21273,18 +21270,41 @@ var HourlyOutputChartComponent = ({
|
|
|
21273
21270
|
return { hour, minute, decimalHour };
|
|
21274
21271
|
};
|
|
21275
21272
|
const shiftStartTime = getTimeFromTimeString(shiftStart);
|
|
21276
|
-
const
|
|
21273
|
+
const { shiftDuration, shiftEndTime, hasPartialLastHour } = React19__namespace.default.useMemo(() => {
|
|
21274
|
+
console.log("[HourlyOutputChart] Calculating shift duration with:", {
|
|
21275
|
+
shiftStart,
|
|
21276
|
+
shiftEnd,
|
|
21277
|
+
shiftStartTime
|
|
21278
|
+
});
|
|
21277
21279
|
if (!shiftEnd) {
|
|
21278
|
-
|
|
21280
|
+
console.log("[HourlyOutputChart] No shiftEnd provided, using default 11 hours");
|
|
21281
|
+
return {
|
|
21282
|
+
shiftDuration: 11,
|
|
21283
|
+
shiftEndTime: null,
|
|
21284
|
+
hasPartialLastHour: false
|
|
21285
|
+
};
|
|
21279
21286
|
}
|
|
21280
21287
|
const endTime = getTimeFromTimeString(shiftEnd);
|
|
21281
21288
|
let duration = endTime.decimalHour - shiftStartTime.decimalHour;
|
|
21282
21289
|
if (duration <= 0) {
|
|
21283
21290
|
duration += 24;
|
|
21284
21291
|
}
|
|
21285
|
-
|
|
21292
|
+
const hasPartial = endTime.minute > 0 && endTime.minute < 60;
|
|
21293
|
+
const hourCount = hasPartial ? Math.ceil(duration) : Math.round(duration);
|
|
21294
|
+
console.log("[HourlyOutputChart] Shift calculation results:", {
|
|
21295
|
+
endTime,
|
|
21296
|
+
duration,
|
|
21297
|
+
hasPartial,
|
|
21298
|
+
hourCount
|
|
21299
|
+
});
|
|
21300
|
+
return {
|
|
21301
|
+
shiftDuration: hourCount,
|
|
21302
|
+
shiftEndTime: endTime,
|
|
21303
|
+
hasPartialLastHour: hasPartial
|
|
21304
|
+
};
|
|
21286
21305
|
}, [shiftEnd, shiftStartTime.decimalHour]);
|
|
21287
|
-
const SHIFT_DURATION =
|
|
21306
|
+
const SHIFT_DURATION = shiftDuration;
|
|
21307
|
+
shiftEndTime ? shiftEndTime.hour : (shiftStartTime.hour + SHIFT_DURATION) % 24;
|
|
21288
21308
|
const [animatedData, setAnimatedData] = React19__namespace.default.useState(
|
|
21289
21309
|
() => Array(SHIFT_DURATION).fill(0)
|
|
21290
21310
|
);
|
|
@@ -21395,12 +21415,19 @@ var HourlyOutputChartComponent = ({
|
|
|
21395
21415
|
};
|
|
21396
21416
|
}, []);
|
|
21397
21417
|
const formatHour = React19__namespace.default.useCallback((hourIndex) => {
|
|
21418
|
+
const isLastHour = hourIndex === SHIFT_DURATION - 1;
|
|
21398
21419
|
const startDecimalHour = shiftStartTime.decimalHour + hourIndex;
|
|
21399
21420
|
const startHour = Math.floor(startDecimalHour) % 24;
|
|
21400
21421
|
const startMinute = Math.round(startDecimalHour % 1 * 60);
|
|
21401
|
-
|
|
21402
|
-
|
|
21403
|
-
|
|
21422
|
+
let endHour, endMinute;
|
|
21423
|
+
if (isLastHour && shiftEndTime) {
|
|
21424
|
+
endHour = shiftEndTime.hour;
|
|
21425
|
+
endMinute = shiftEndTime.minute;
|
|
21426
|
+
} else {
|
|
21427
|
+
const endDecimalHour = startDecimalHour + 1;
|
|
21428
|
+
endHour = Math.floor(endDecimalHour) % 24;
|
|
21429
|
+
endMinute = Math.round(endDecimalHour % 1 * 60);
|
|
21430
|
+
}
|
|
21404
21431
|
const formatTime3 = (h, m) => {
|
|
21405
21432
|
const period = h >= 12 ? "PM" : "AM";
|
|
21406
21433
|
const hour12 = h === 0 ? 12 : h > 12 ? h - 12 : h;
|
|
@@ -21410,21 +21437,28 @@ var HourlyOutputChartComponent = ({
|
|
|
21410
21437
|
return `${hour12}:${m.toString().padStart(2, "0")}${period}`;
|
|
21411
21438
|
};
|
|
21412
21439
|
return `${formatTime3(startHour, startMinute)}-${formatTime3(endHour, endMinute)}`;
|
|
21413
|
-
}, [shiftStartTime.decimalHour]);
|
|
21440
|
+
}, [shiftStartTime.decimalHour, SHIFT_DURATION, shiftEndTime]);
|
|
21414
21441
|
const formatTimeRange = React19__namespace.default.useCallback((hourIndex) => {
|
|
21442
|
+
const isLastHour = hourIndex === SHIFT_DURATION - 1;
|
|
21415
21443
|
const startDecimalHour = shiftStartTime.decimalHour + hourIndex;
|
|
21416
21444
|
const startHour = Math.floor(startDecimalHour) % 24;
|
|
21417
21445
|
const startMinute = Math.round(startDecimalHour % 1 * 60);
|
|
21418
|
-
|
|
21419
|
-
|
|
21420
|
-
|
|
21446
|
+
let endHour, endMinute;
|
|
21447
|
+
if (isLastHour && shiftEndTime) {
|
|
21448
|
+
endHour = shiftEndTime.hour;
|
|
21449
|
+
endMinute = shiftEndTime.minute;
|
|
21450
|
+
} else {
|
|
21451
|
+
const endDecimalHour = startDecimalHour + 1;
|
|
21452
|
+
endHour = Math.floor(endDecimalHour) % 24;
|
|
21453
|
+
endMinute = Math.round(endDecimalHour % 1 * 60);
|
|
21454
|
+
}
|
|
21421
21455
|
const formatTime3 = (h, m) => {
|
|
21422
21456
|
const period = h >= 12 ? "PM" : "AM";
|
|
21423
21457
|
const hour12 = h === 0 ? 12 : h > 12 ? h - 12 : h;
|
|
21424
21458
|
return `${hour12}:${m.toString().padStart(2, "0")} ${period}`;
|
|
21425
21459
|
};
|
|
21426
21460
|
return `${formatTime3(startHour, startMinute)} - ${formatTime3(endHour, endMinute)}`;
|
|
21427
|
-
}, [shiftStartTime.decimalHour]);
|
|
21461
|
+
}, [shiftStartTime.decimalHour, SHIFT_DURATION, shiftEndTime]);
|
|
21428
21462
|
const chartData = React19__namespace.default.useMemo(() => {
|
|
21429
21463
|
return Array.from({ length: SHIFT_DURATION }, (_, i) => {
|
|
21430
21464
|
const actualHour = (shiftStartTime.hour + i) % 24;
|
|
@@ -24939,11 +24973,25 @@ var LinePdfGenerator = ({
|
|
|
24939
24973
|
doc.setTextColor(70, 70, 70);
|
|
24940
24974
|
doc.text("Hourly Output Overview", 20, 135);
|
|
24941
24975
|
doc.setTextColor(0, 0, 0);
|
|
24942
|
-
const getHourlyTimeRanges = (startTimeStr) => {
|
|
24976
|
+
const getHourlyTimeRanges = (startTimeStr, endTimeStr) => {
|
|
24943
24977
|
const [hours, minutes] = startTimeStr.split(":");
|
|
24944
24978
|
const startHour = parseInt(hours);
|
|
24945
24979
|
const startMinute = parseInt(minutes || "0");
|
|
24946
|
-
|
|
24980
|
+
let SHIFT_DURATION = 11;
|
|
24981
|
+
if (endTimeStr) {
|
|
24982
|
+
const [endHours, endMinutes] = endTimeStr.split(":");
|
|
24983
|
+
const endHour = parseInt(endHours);
|
|
24984
|
+
const endMinute = parseInt(endMinutes || "0");
|
|
24985
|
+
let duration = endHour - startHour;
|
|
24986
|
+
if (duration <= 0) {
|
|
24987
|
+
duration += 24;
|
|
24988
|
+
}
|
|
24989
|
+
const minuteDiff = endMinute - startMinute;
|
|
24990
|
+
if (minuteDiff !== 0) {
|
|
24991
|
+
duration += minuteDiff / 60;
|
|
24992
|
+
}
|
|
24993
|
+
SHIFT_DURATION = Math.round(duration);
|
|
24994
|
+
}
|
|
24947
24995
|
return Array.from({ length: SHIFT_DURATION }, (_, i) => {
|
|
24948
24996
|
const hourStartTime = /* @__PURE__ */ new Date();
|
|
24949
24997
|
hourStartTime.setHours(startHour);
|
|
@@ -24964,12 +25012,35 @@ var LinePdfGenerator = ({
|
|
|
24964
25012
|
return `${formatTime3(hourStartTime)} - ${formatTime3(hourEndTime)}`;
|
|
24965
25013
|
});
|
|
24966
25014
|
};
|
|
24967
|
-
const hourlyTimeRanges = lineInfo.metrics.shift_start ? getHourlyTimeRanges(lineInfo.metrics.shift_start) : [];
|
|
24968
|
-
const
|
|
24969
|
-
const
|
|
24970
|
-
|
|
24971
|
-
|
|
24972
|
-
|
|
25015
|
+
const hourlyTimeRanges = lineInfo.metrics.shift_start ? getHourlyTimeRanges(lineInfo.metrics.shift_start, lineInfo.metrics.shift_end) : [];
|
|
25016
|
+
const shiftDuration = hourlyTimeRanges.length || 11;
|
|
25017
|
+
const targetOutputPerHour = Math.round(lineInfo.metrics.line_threshold / shiftDuration);
|
|
25018
|
+
let hourlyActualOutput = [];
|
|
25019
|
+
if (lineInfo.metrics.output_hourly && Object.keys(lineInfo.metrics.output_hourly).length > 0) {
|
|
25020
|
+
const startHour = parseInt(lineInfo.metrics.shift_start?.split(":")[0] || "6");
|
|
25021
|
+
const expectedHours = [];
|
|
25022
|
+
for (let i = 0; i < shiftDuration; i++) {
|
|
25023
|
+
expectedHours.push((startHour + i) % 24);
|
|
25024
|
+
}
|
|
25025
|
+
hourlyActualOutput = expectedHours.map((hour) => {
|
|
25026
|
+
const hourData = lineInfo.metrics.output_hourly[hour.toString()];
|
|
25027
|
+
if (hourData && Array.isArray(hourData)) {
|
|
25028
|
+
return hourData.reduce((sum, val) => sum + (val || 0), 0);
|
|
25029
|
+
}
|
|
25030
|
+
return 0;
|
|
25031
|
+
});
|
|
25032
|
+
} else if (lineInfo.metrics.output_array && lineInfo.metrics.output_array.length > 0) {
|
|
25033
|
+
hourlyActualOutput = lineInfo.metrics.output_array.reduce((acc, val, i) => {
|
|
25034
|
+
const hourIndex = Math.floor(i / 60);
|
|
25035
|
+
if (!acc[hourIndex]) acc[hourIndex] = 0;
|
|
25036
|
+
acc[hourIndex] += val;
|
|
25037
|
+
return acc;
|
|
25038
|
+
}, []);
|
|
25039
|
+
} else {
|
|
25040
|
+
hourlyActualOutput = Array.from({ length: shiftDuration }, () => {
|
|
25041
|
+
return Math.round(lineInfo.metrics.current_output / shiftDuration);
|
|
25042
|
+
});
|
|
25043
|
+
}
|
|
24973
25044
|
doc.setFontSize(11);
|
|
24974
25045
|
doc.setFont("helvetica", "bold");
|
|
24975
25046
|
doc.setFillColor(245, 245, 245);
|
|
@@ -29357,10 +29428,11 @@ var HealthStatusGrid = ({
|
|
|
29357
29428
|
};
|
|
29358
29429
|
var ISTTimer2 = ISTTimer_default;
|
|
29359
29430
|
var DashboardHeader = React19.memo(({ lineTitle, className = "", headerControls }) => {
|
|
29431
|
+
const dashboardConfig = useDashboardConfig();
|
|
29360
29432
|
const getShiftName = () => {
|
|
29361
|
-
const
|
|
29362
|
-
const
|
|
29363
|
-
return
|
|
29433
|
+
const timezone = dashboardConfig.dateTimeConfig?.defaultTimezone || "Asia/Kolkata";
|
|
29434
|
+
const currentShift = getCurrentShift(timezone, dashboardConfig.shiftConfig);
|
|
29435
|
+
return currentShift.shiftId === 0 ? "Day" : "Night";
|
|
29364
29436
|
};
|
|
29365
29437
|
const getShiftIcon = () => {
|
|
29366
29438
|
const shift = getShiftName();
|
|
@@ -34093,6 +34165,7 @@ var KPIDetailView = ({
|
|
|
34093
34165
|
underperforming_workspace_names: metrics2.underperforming_workspace_names || [],
|
|
34094
34166
|
underperforming_workspace_uuids: metrics2.underperforming_workspace_uuids || [],
|
|
34095
34167
|
output_array: metrics2.output_array || [],
|
|
34168
|
+
output_hourly: metrics2.output_hourly,
|
|
34096
34169
|
line_threshold: metrics2.line_threshold ?? 0,
|
|
34097
34170
|
threshold_pph: metrics2.threshold_pph ?? 0,
|
|
34098
34171
|
shift_start: metrics2.shift_start || "06:00",
|
package/dist/index.mjs
CHANGED
|
@@ -859,22 +859,21 @@ var dashboardService = {
|
|
|
859
859
|
if (hasOutputHourlyData) {
|
|
860
860
|
console.log("Using new output_hourly column for workspace:", data.workspace_name);
|
|
861
861
|
console.log("Raw output_hourly data:", outputHourly);
|
|
862
|
-
const isNightShift = data.shift_id === 1;
|
|
863
|
-
const shiftStart = data.shift_start || (isNightShift ? "22:00" : "06:00");
|
|
864
|
-
const shiftEnd = data.shift_end || (isNightShift ? "06:00" : "14:00");
|
|
862
|
+
const isNightShift = data.shift_id === (shiftConfig.nightShift?.id ?? 1);
|
|
863
|
+
const shiftStart = data.shift_start || (isNightShift ? shiftConfig.nightShift?.startTime || "22:00" : shiftConfig.dayShift?.startTime || "06:00");
|
|
864
|
+
const shiftEnd = data.shift_end || (isNightShift ? shiftConfig.nightShift?.endTime || "06:00" : shiftConfig.dayShift?.endTime || "14:00");
|
|
865
865
|
const startHour = parseInt(shiftStart.split(":")[0]);
|
|
866
866
|
const startMinute = parseInt(shiftStart.split(":")[1] || "0");
|
|
867
867
|
const endHour = parseInt(shiftEnd.split(":")[0]);
|
|
868
868
|
const endMinute = parseInt(shiftEnd.split(":")[1] || "0");
|
|
869
869
|
let shiftDuration = endHour - startHour;
|
|
870
|
-
if (endMinute > startMinute) {
|
|
871
|
-
shiftDuration += 1;
|
|
872
|
-
}
|
|
873
870
|
if (shiftDuration <= 0) {
|
|
874
871
|
shiftDuration += 24;
|
|
875
872
|
}
|
|
873
|
+
const hasPartialLastHour = endMinute > 0 && endMinute < 60;
|
|
874
|
+
const hourCount = hasPartialLastHour ? Math.ceil(shiftDuration + endMinute / 60) : shiftDuration;
|
|
876
875
|
let expectedHours = [];
|
|
877
|
-
for (let i = 0; i <
|
|
876
|
+
for (let i = 0; i < hourCount; i++) {
|
|
878
877
|
expectedHours.push((startHour + i) % 24);
|
|
879
878
|
}
|
|
880
879
|
console.log("Expected shift hours:", expectedHours);
|
|
@@ -5673,21 +5672,20 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
5673
5672
|
console.log("Using new output_hourly column for workspace (fallback):", recentData.workspace_name);
|
|
5674
5673
|
console.log("Raw output_hourly data (fallback):", outputHourly2);
|
|
5675
5674
|
const isNightShift = recentData.shift_id === 1;
|
|
5676
|
-
const shiftStart = recentData.shift_start || (isNightShift ? "22:00" : "06:00");
|
|
5677
|
-
const shiftEnd = recentData.shift_end || (isNightShift ? "06:00" : "14:00");
|
|
5675
|
+
const shiftStart = recentData.shift_start || (isNightShift ? shiftConfig.nightShift?.startTime || "22:00" : shiftConfig.dayShift?.startTime || "06:00");
|
|
5676
|
+
const shiftEnd = recentData.shift_end || (isNightShift ? shiftConfig.nightShift?.endTime || "06:00" : shiftConfig.dayShift?.endTime || "14:00");
|
|
5678
5677
|
const startHour = parseInt(shiftStart.split(":")[0]);
|
|
5679
5678
|
const startMinute = parseInt(shiftStart.split(":")[1] || "0");
|
|
5680
5679
|
const endHour = parseInt(shiftEnd.split(":")[0]);
|
|
5681
5680
|
const endMinute = parseInt(shiftEnd.split(":")[1] || "0");
|
|
5682
5681
|
let shiftDuration = endHour - startHour;
|
|
5683
|
-
if (endMinute > startMinute) {
|
|
5684
|
-
shiftDuration += 1;
|
|
5685
|
-
}
|
|
5686
5682
|
if (shiftDuration <= 0) {
|
|
5687
5683
|
shiftDuration += 24;
|
|
5688
5684
|
}
|
|
5685
|
+
const hasPartialLastHour = endMinute > 0 && endMinute < 60;
|
|
5686
|
+
const hourCount = hasPartialLastHour ? Math.ceil(shiftDuration + endMinute / 60) : shiftDuration;
|
|
5689
5687
|
let expectedHours = [];
|
|
5690
|
-
for (let i = 0; i <
|
|
5688
|
+
for (let i = 0; i < hourCount; i++) {
|
|
5691
5689
|
expectedHours.push((startHour + i) % 24);
|
|
5692
5690
|
}
|
|
5693
5691
|
console.log("Expected shift hours (fallback):", expectedHours);
|
|
@@ -5732,8 +5730,8 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
5732
5730
|
date: recentData.date,
|
|
5733
5731
|
shift_id: recentData.shift_id,
|
|
5734
5732
|
action_name: recentData.action_name || "",
|
|
5735
|
-
shift_start: recentData.shift_start || "06:00",
|
|
5736
|
-
shift_end: recentData.shift_end || "14:00",
|
|
5733
|
+
shift_start: recentData.shift_start || (recentData.shift_id === 1 ? shiftConfig.nightShift?.startTime || "22:00" : shiftConfig.dayShift?.startTime || "06:00"),
|
|
5734
|
+
shift_end: recentData.shift_end || (recentData.shift_id === 1 ? shiftConfig.nightShift?.endTime || "06:00" : shiftConfig.dayShift?.endTime || "14:00"),
|
|
5737
5735
|
shift_type: recentData.shift_type || (recentData.shift_id === 0 ? "Day" : "Night"),
|
|
5738
5736
|
pph_threshold: recentData.pph_threshold || 0,
|
|
5739
5737
|
target_output: recentData.total_day_output || 0,
|
|
@@ -5789,21 +5787,20 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
5789
5787
|
console.log("\u2705 Using new output_hourly column for workspace:", data.workspace_name);
|
|
5790
5788
|
console.log("Raw output_hourly data:", JSON.stringify(outputHourly));
|
|
5791
5789
|
const isNightShift = data.shift_id === 1;
|
|
5792
|
-
const shiftStart = data.shift_start || (isNightShift ? "22:00" : "06:00");
|
|
5793
|
-
const shiftEnd = data.shift_end || (isNightShift ? "06:00" : "14:00");
|
|
5790
|
+
const shiftStart = data.shift_start || (isNightShift ? shiftConfig.nightShift?.startTime || "22:00" : shiftConfig.dayShift?.startTime || "06:00");
|
|
5791
|
+
const shiftEnd = data.shift_end || (isNightShift ? shiftConfig.nightShift?.endTime || "06:00" : shiftConfig.dayShift?.endTime || "14:00");
|
|
5794
5792
|
const startHour = parseInt(shiftStart.split(":")[0]);
|
|
5795
5793
|
const startMinute = parseInt(shiftStart.split(":")[1] || "0");
|
|
5796
5794
|
const endHour = parseInt(shiftEnd.split(":")[0]);
|
|
5797
5795
|
const endMinute = parseInt(shiftEnd.split(":")[1] || "0");
|
|
5798
5796
|
let shiftDuration = endHour - startHour;
|
|
5799
|
-
if (endMinute > startMinute) {
|
|
5800
|
-
shiftDuration += 1;
|
|
5801
|
-
}
|
|
5802
5797
|
if (shiftDuration <= 0) {
|
|
5803
5798
|
shiftDuration += 24;
|
|
5804
5799
|
}
|
|
5800
|
+
const hasPartialLastHour = endMinute > 0 && endMinute < 60;
|
|
5801
|
+
const hourCount = hasPartialLastHour ? Math.ceil(shiftDuration + endMinute / 60) : shiftDuration;
|
|
5805
5802
|
let expectedHours = [];
|
|
5806
|
-
for (let i = 0; i <
|
|
5803
|
+
for (let i = 0; i < hourCount; i++) {
|
|
5807
5804
|
expectedHours.push((startHour + i) % 24);
|
|
5808
5805
|
}
|
|
5809
5806
|
console.log("Expected shift hours:", expectedHours);
|
|
@@ -5851,8 +5848,8 @@ var useWorkspaceDetailedMetrics = (workspaceId, date, shiftId) => {
|
|
|
5851
5848
|
date: data.date,
|
|
5852
5849
|
shift_id: data.shift_id,
|
|
5853
5850
|
action_name: data.action_name || "",
|
|
5854
|
-
shift_start: data.shift_start || "06:00",
|
|
5855
|
-
shift_end: data.shift_end || "14:00",
|
|
5851
|
+
shift_start: data.shift_start || (data.shift_id === 1 ? shiftConfig.nightShift?.startTime || "22:00" : shiftConfig.dayShift?.startTime || "06:00"),
|
|
5852
|
+
shift_end: data.shift_end || (data.shift_id === 1 ? shiftConfig.nightShift?.endTime || "06:00" : shiftConfig.dayShift?.endTime || "14:00"),
|
|
5856
5853
|
shift_type: data.shift_type || (data.shift_id === 0 ? "Day" : "Night"),
|
|
5857
5854
|
pph_threshold: data.pph_threshold || 0,
|
|
5858
5855
|
target_output: data.total_day_output || 0,
|
|
@@ -21243,18 +21240,41 @@ var HourlyOutputChartComponent = ({
|
|
|
21243
21240
|
return { hour, minute, decimalHour };
|
|
21244
21241
|
};
|
|
21245
21242
|
const shiftStartTime = getTimeFromTimeString(shiftStart);
|
|
21246
|
-
const
|
|
21243
|
+
const { shiftDuration, shiftEndTime, hasPartialLastHour } = React19__default.useMemo(() => {
|
|
21244
|
+
console.log("[HourlyOutputChart] Calculating shift duration with:", {
|
|
21245
|
+
shiftStart,
|
|
21246
|
+
shiftEnd,
|
|
21247
|
+
shiftStartTime
|
|
21248
|
+
});
|
|
21247
21249
|
if (!shiftEnd) {
|
|
21248
|
-
|
|
21250
|
+
console.log("[HourlyOutputChart] No shiftEnd provided, using default 11 hours");
|
|
21251
|
+
return {
|
|
21252
|
+
shiftDuration: 11,
|
|
21253
|
+
shiftEndTime: null,
|
|
21254
|
+
hasPartialLastHour: false
|
|
21255
|
+
};
|
|
21249
21256
|
}
|
|
21250
21257
|
const endTime = getTimeFromTimeString(shiftEnd);
|
|
21251
21258
|
let duration = endTime.decimalHour - shiftStartTime.decimalHour;
|
|
21252
21259
|
if (duration <= 0) {
|
|
21253
21260
|
duration += 24;
|
|
21254
21261
|
}
|
|
21255
|
-
|
|
21262
|
+
const hasPartial = endTime.minute > 0 && endTime.minute < 60;
|
|
21263
|
+
const hourCount = hasPartial ? Math.ceil(duration) : Math.round(duration);
|
|
21264
|
+
console.log("[HourlyOutputChart] Shift calculation results:", {
|
|
21265
|
+
endTime,
|
|
21266
|
+
duration,
|
|
21267
|
+
hasPartial,
|
|
21268
|
+
hourCount
|
|
21269
|
+
});
|
|
21270
|
+
return {
|
|
21271
|
+
shiftDuration: hourCount,
|
|
21272
|
+
shiftEndTime: endTime,
|
|
21273
|
+
hasPartialLastHour: hasPartial
|
|
21274
|
+
};
|
|
21256
21275
|
}, [shiftEnd, shiftStartTime.decimalHour]);
|
|
21257
|
-
const SHIFT_DURATION =
|
|
21276
|
+
const SHIFT_DURATION = shiftDuration;
|
|
21277
|
+
shiftEndTime ? shiftEndTime.hour : (shiftStartTime.hour + SHIFT_DURATION) % 24;
|
|
21258
21278
|
const [animatedData, setAnimatedData] = React19__default.useState(
|
|
21259
21279
|
() => Array(SHIFT_DURATION).fill(0)
|
|
21260
21280
|
);
|
|
@@ -21365,12 +21385,19 @@ var HourlyOutputChartComponent = ({
|
|
|
21365
21385
|
};
|
|
21366
21386
|
}, []);
|
|
21367
21387
|
const formatHour = React19__default.useCallback((hourIndex) => {
|
|
21388
|
+
const isLastHour = hourIndex === SHIFT_DURATION - 1;
|
|
21368
21389
|
const startDecimalHour = shiftStartTime.decimalHour + hourIndex;
|
|
21369
21390
|
const startHour = Math.floor(startDecimalHour) % 24;
|
|
21370
21391
|
const startMinute = Math.round(startDecimalHour % 1 * 60);
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
|
|
21392
|
+
let endHour, endMinute;
|
|
21393
|
+
if (isLastHour && shiftEndTime) {
|
|
21394
|
+
endHour = shiftEndTime.hour;
|
|
21395
|
+
endMinute = shiftEndTime.minute;
|
|
21396
|
+
} else {
|
|
21397
|
+
const endDecimalHour = startDecimalHour + 1;
|
|
21398
|
+
endHour = Math.floor(endDecimalHour) % 24;
|
|
21399
|
+
endMinute = Math.round(endDecimalHour % 1 * 60);
|
|
21400
|
+
}
|
|
21374
21401
|
const formatTime3 = (h, m) => {
|
|
21375
21402
|
const period = h >= 12 ? "PM" : "AM";
|
|
21376
21403
|
const hour12 = h === 0 ? 12 : h > 12 ? h - 12 : h;
|
|
@@ -21380,21 +21407,28 @@ var HourlyOutputChartComponent = ({
|
|
|
21380
21407
|
return `${hour12}:${m.toString().padStart(2, "0")}${period}`;
|
|
21381
21408
|
};
|
|
21382
21409
|
return `${formatTime3(startHour, startMinute)}-${formatTime3(endHour, endMinute)}`;
|
|
21383
|
-
}, [shiftStartTime.decimalHour]);
|
|
21410
|
+
}, [shiftStartTime.decimalHour, SHIFT_DURATION, shiftEndTime]);
|
|
21384
21411
|
const formatTimeRange = React19__default.useCallback((hourIndex) => {
|
|
21412
|
+
const isLastHour = hourIndex === SHIFT_DURATION - 1;
|
|
21385
21413
|
const startDecimalHour = shiftStartTime.decimalHour + hourIndex;
|
|
21386
21414
|
const startHour = Math.floor(startDecimalHour) % 24;
|
|
21387
21415
|
const startMinute = Math.round(startDecimalHour % 1 * 60);
|
|
21388
|
-
|
|
21389
|
-
|
|
21390
|
-
|
|
21416
|
+
let endHour, endMinute;
|
|
21417
|
+
if (isLastHour && shiftEndTime) {
|
|
21418
|
+
endHour = shiftEndTime.hour;
|
|
21419
|
+
endMinute = shiftEndTime.minute;
|
|
21420
|
+
} else {
|
|
21421
|
+
const endDecimalHour = startDecimalHour + 1;
|
|
21422
|
+
endHour = Math.floor(endDecimalHour) % 24;
|
|
21423
|
+
endMinute = Math.round(endDecimalHour % 1 * 60);
|
|
21424
|
+
}
|
|
21391
21425
|
const formatTime3 = (h, m) => {
|
|
21392
21426
|
const period = h >= 12 ? "PM" : "AM";
|
|
21393
21427
|
const hour12 = h === 0 ? 12 : h > 12 ? h - 12 : h;
|
|
21394
21428
|
return `${hour12}:${m.toString().padStart(2, "0")} ${period}`;
|
|
21395
21429
|
};
|
|
21396
21430
|
return `${formatTime3(startHour, startMinute)} - ${formatTime3(endHour, endMinute)}`;
|
|
21397
|
-
}, [shiftStartTime.decimalHour]);
|
|
21431
|
+
}, [shiftStartTime.decimalHour, SHIFT_DURATION, shiftEndTime]);
|
|
21398
21432
|
const chartData = React19__default.useMemo(() => {
|
|
21399
21433
|
return Array.from({ length: SHIFT_DURATION }, (_, i) => {
|
|
21400
21434
|
const actualHour = (shiftStartTime.hour + i) % 24;
|
|
@@ -24909,11 +24943,25 @@ var LinePdfGenerator = ({
|
|
|
24909
24943
|
doc.setTextColor(70, 70, 70);
|
|
24910
24944
|
doc.text("Hourly Output Overview", 20, 135);
|
|
24911
24945
|
doc.setTextColor(0, 0, 0);
|
|
24912
|
-
const getHourlyTimeRanges = (startTimeStr) => {
|
|
24946
|
+
const getHourlyTimeRanges = (startTimeStr, endTimeStr) => {
|
|
24913
24947
|
const [hours, minutes] = startTimeStr.split(":");
|
|
24914
24948
|
const startHour = parseInt(hours);
|
|
24915
24949
|
const startMinute = parseInt(minutes || "0");
|
|
24916
|
-
|
|
24950
|
+
let SHIFT_DURATION = 11;
|
|
24951
|
+
if (endTimeStr) {
|
|
24952
|
+
const [endHours, endMinutes] = endTimeStr.split(":");
|
|
24953
|
+
const endHour = parseInt(endHours);
|
|
24954
|
+
const endMinute = parseInt(endMinutes || "0");
|
|
24955
|
+
let duration = endHour - startHour;
|
|
24956
|
+
if (duration <= 0) {
|
|
24957
|
+
duration += 24;
|
|
24958
|
+
}
|
|
24959
|
+
const minuteDiff = endMinute - startMinute;
|
|
24960
|
+
if (minuteDiff !== 0) {
|
|
24961
|
+
duration += minuteDiff / 60;
|
|
24962
|
+
}
|
|
24963
|
+
SHIFT_DURATION = Math.round(duration);
|
|
24964
|
+
}
|
|
24917
24965
|
return Array.from({ length: SHIFT_DURATION }, (_, i) => {
|
|
24918
24966
|
const hourStartTime = /* @__PURE__ */ new Date();
|
|
24919
24967
|
hourStartTime.setHours(startHour);
|
|
@@ -24934,12 +24982,35 @@ var LinePdfGenerator = ({
|
|
|
24934
24982
|
return `${formatTime3(hourStartTime)} - ${formatTime3(hourEndTime)}`;
|
|
24935
24983
|
});
|
|
24936
24984
|
};
|
|
24937
|
-
const hourlyTimeRanges = lineInfo.metrics.shift_start ? getHourlyTimeRanges(lineInfo.metrics.shift_start) : [];
|
|
24938
|
-
const
|
|
24939
|
-
const
|
|
24940
|
-
|
|
24941
|
-
|
|
24942
|
-
|
|
24985
|
+
const hourlyTimeRanges = lineInfo.metrics.shift_start ? getHourlyTimeRanges(lineInfo.metrics.shift_start, lineInfo.metrics.shift_end) : [];
|
|
24986
|
+
const shiftDuration = hourlyTimeRanges.length || 11;
|
|
24987
|
+
const targetOutputPerHour = Math.round(lineInfo.metrics.line_threshold / shiftDuration);
|
|
24988
|
+
let hourlyActualOutput = [];
|
|
24989
|
+
if (lineInfo.metrics.output_hourly && Object.keys(lineInfo.metrics.output_hourly).length > 0) {
|
|
24990
|
+
const startHour = parseInt(lineInfo.metrics.shift_start?.split(":")[0] || "6");
|
|
24991
|
+
const expectedHours = [];
|
|
24992
|
+
for (let i = 0; i < shiftDuration; i++) {
|
|
24993
|
+
expectedHours.push((startHour + i) % 24);
|
|
24994
|
+
}
|
|
24995
|
+
hourlyActualOutput = expectedHours.map((hour) => {
|
|
24996
|
+
const hourData = lineInfo.metrics.output_hourly[hour.toString()];
|
|
24997
|
+
if (hourData && Array.isArray(hourData)) {
|
|
24998
|
+
return hourData.reduce((sum, val) => sum + (val || 0), 0);
|
|
24999
|
+
}
|
|
25000
|
+
return 0;
|
|
25001
|
+
});
|
|
25002
|
+
} else if (lineInfo.metrics.output_array && lineInfo.metrics.output_array.length > 0) {
|
|
25003
|
+
hourlyActualOutput = lineInfo.metrics.output_array.reduce((acc, val, i) => {
|
|
25004
|
+
const hourIndex = Math.floor(i / 60);
|
|
25005
|
+
if (!acc[hourIndex]) acc[hourIndex] = 0;
|
|
25006
|
+
acc[hourIndex] += val;
|
|
25007
|
+
return acc;
|
|
25008
|
+
}, []);
|
|
25009
|
+
} else {
|
|
25010
|
+
hourlyActualOutput = Array.from({ length: shiftDuration }, () => {
|
|
25011
|
+
return Math.round(lineInfo.metrics.current_output / shiftDuration);
|
|
25012
|
+
});
|
|
25013
|
+
}
|
|
24943
25014
|
doc.setFontSize(11);
|
|
24944
25015
|
doc.setFont("helvetica", "bold");
|
|
24945
25016
|
doc.setFillColor(245, 245, 245);
|
|
@@ -29327,10 +29398,11 @@ var HealthStatusGrid = ({
|
|
|
29327
29398
|
};
|
|
29328
29399
|
var ISTTimer2 = ISTTimer_default;
|
|
29329
29400
|
var DashboardHeader = memo(({ lineTitle, className = "", headerControls }) => {
|
|
29401
|
+
const dashboardConfig = useDashboardConfig();
|
|
29330
29402
|
const getShiftName = () => {
|
|
29331
|
-
const
|
|
29332
|
-
const
|
|
29333
|
-
return
|
|
29403
|
+
const timezone = dashboardConfig.dateTimeConfig?.defaultTimezone || "Asia/Kolkata";
|
|
29404
|
+
const currentShift = getCurrentShift(timezone, dashboardConfig.shiftConfig);
|
|
29405
|
+
return currentShift.shiftId === 0 ? "Day" : "Night";
|
|
29334
29406
|
};
|
|
29335
29407
|
const getShiftIcon = () => {
|
|
29336
29408
|
const shift = getShiftName();
|
|
@@ -34063,6 +34135,7 @@ var KPIDetailView = ({
|
|
|
34063
34135
|
underperforming_workspace_names: metrics2.underperforming_workspace_names || [],
|
|
34064
34136
|
underperforming_workspace_uuids: metrics2.underperforming_workspace_uuids || [],
|
|
34065
34137
|
output_array: metrics2.output_array || [],
|
|
34138
|
+
output_hourly: metrics2.output_hourly,
|
|
34066
34139
|
line_threshold: metrics2.line_threshold ?? 0,
|
|
34067
34140
|
threshold_pph: metrics2.threshold_pph ?? 0,
|
|
34068
34141
|
shift_start: metrics2.shift_start || "06:00",
|