@optifye/dashboard-core 6.5.8 → 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.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 < shiftDuration; 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 < shiftDuration; 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 < shiftDuration; 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 calculateShiftDuration = React19__namespace.default.useMemo(() => {
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
- return 11;
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
- return Math.round(duration);
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 = calculateShiftDuration;
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
- const endDecimalHour = startDecimalHour + 1;
21402
- const endHour = Math.floor(endDecimalHour) % 24;
21403
- const endMinute = Math.round(endDecimalHour % 1 * 60);
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
- const endDecimalHour = startDecimalHour + 1;
21419
- const endHour = Math.floor(endDecimalHour) % 24;
21420
- const endMinute = Math.round(endDecimalHour % 1 * 60);
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;
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 < shiftDuration; 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 < shiftDuration; 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 < shiftDuration; 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 calculateShiftDuration = React19__default.useMemo(() => {
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
- return 11;
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
- return Math.round(duration);
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 = calculateShiftDuration;
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
- const endDecimalHour = startDecimalHour + 1;
21372
- const endHour = Math.floor(endDecimalHour) % 24;
21373
- const endMinute = Math.round(endDecimalHour % 1 * 60);
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
- const endDecimalHour = startDecimalHour + 1;
21389
- const endHour = Math.floor(endDecimalHour) % 24;
21390
- const endMinute = Math.round(endDecimalHour % 1 * 60);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optifye/dashboard-core",
3
- "version": "6.5.8",
3
+ "version": "6.5.9",
4
4
  "description": "Reusable UI & logic for Optifye dashboard",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",