andoncloud-dashboard-toolkit 1.5.82 → 1.5.83
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.ts +55 -36
- package/dist/index.js +316 -297
- package/dist/index.js.map +1 -1
- package/package.json +32 -32
package/dist/index.js
CHANGED
|
@@ -6,8 +6,6 @@ import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
|
|
|
6
6
|
import { AccessBlocker, AccessGuard, Checkbox, fetch, refreshUserData, registerTranslations, useAccess, useStore } from "andoncloud-sdk";
|
|
7
7
|
import dayjs from "dayjs";
|
|
8
8
|
import gql from "graphql-tag";
|
|
9
|
-
import isoWeek from "dayjs/plugin/isoWeek.js";
|
|
10
|
-
import quarterOfYear from "dayjs/plugin/quarterOfYear.js";
|
|
11
9
|
import "dayjs/locale/pl.js";
|
|
12
10
|
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
|
13
11
|
import { DateCalendar } from "@mui/x-date-pickers/DateCalendar";
|
|
@@ -17,6 +15,8 @@ import isBetween from "dayjs/plugin/isBetween.js";
|
|
|
17
15
|
import { mergeSx } from "merge-sx";
|
|
18
16
|
import LockIcon from "@mui/icons-material/Lock";
|
|
19
17
|
import SearchIcon from "@mui/icons-material/Search";
|
|
18
|
+
import isoWeek from "dayjs/plugin/isoWeek.js";
|
|
19
|
+
import quarterOfYear from "dayjs/plugin/quarterOfYear.js";
|
|
20
20
|
import TextTruncate from "react-text-truncate";
|
|
21
21
|
import durationPlugin from "dayjs/plugin/duration.js";
|
|
22
22
|
import { keyframes } from "@mui/system";
|
|
@@ -124,6 +124,11 @@ let InsightsAggregation = /* @__PURE__ */ function(InsightsAggregation) {
|
|
|
124
124
|
InsightsAggregation["Weekly"] = "WEEKLY";
|
|
125
125
|
return InsightsAggregation;
|
|
126
126
|
}({});
|
|
127
|
+
let InsightsPeriodView = /* @__PURE__ */ function(InsightsPeriodView) {
|
|
128
|
+
InsightsPeriodView["Breakdown"] = "BREAKDOWN";
|
|
129
|
+
InsightsPeriodView["Comparison"] = "COMPARISON";
|
|
130
|
+
return InsightsPeriodView;
|
|
131
|
+
}({});
|
|
127
132
|
let MetricTypeEnum = /* @__PURE__ */ function(MetricTypeEnum) {
|
|
128
133
|
MetricTypeEnum["Counter"] = "COUNTER";
|
|
129
134
|
MetricTypeEnum["Empty"] = "EMPTY";
|
|
@@ -3645,8 +3650,6 @@ const GetWorkplacePerformanceInsightsDocument = gql`
|
|
|
3645
3650
|
totalUptimePercentage
|
|
3646
3651
|
totalDowntime
|
|
3647
3652
|
totalDowntimePercentage
|
|
3648
|
-
offScheduleDuration
|
|
3649
|
-
offScheduleSeconds
|
|
3650
3653
|
mtbf
|
|
3651
3654
|
mttr
|
|
3652
3655
|
reasons {
|
|
@@ -3721,7 +3724,6 @@ const ListReasonsDocument = gql`
|
|
|
3721
3724
|
leaf
|
|
3722
3725
|
name
|
|
3723
3726
|
statusColor
|
|
3724
|
-
reasonGroupId
|
|
3725
3727
|
}
|
|
3726
3728
|
}
|
|
3727
3729
|
`;
|
|
@@ -3885,14 +3887,6 @@ const ListWorkplaceAssignmentsDocument = gql`
|
|
|
3885
3887
|
const ListWorkplacesDocument = gql`
|
|
3886
3888
|
query listWorkplaces($filter: WorkplaceFilter) {
|
|
3887
3889
|
workplaces(filter: $filter) {
|
|
3888
|
-
currentStatusChange {
|
|
3889
|
-
id
|
|
3890
|
-
reason {
|
|
3891
|
-
id
|
|
3892
|
-
name
|
|
3893
|
-
statusColor
|
|
3894
|
-
}
|
|
3895
|
-
}
|
|
3896
3890
|
deactivated
|
|
3897
3891
|
departmentId
|
|
3898
3892
|
id
|
|
@@ -4997,7 +4991,7 @@ const resolveInitialValues = (values) => {
|
|
|
4997
4991
|
if (!values) return void 0;
|
|
4998
4992
|
const today = dayjs().format("YYYY-MM-DD");
|
|
4999
4993
|
return {
|
|
5000
|
-
dayType: values.dayType ??
|
|
4994
|
+
dayType: values.dayType ?? "PRODUCTION",
|
|
5001
4995
|
dateRange: values.dateRange ?? {
|
|
5002
4996
|
from: `${today}T00:00:00`,
|
|
5003
4997
|
to: `${today}T23:59:59`
|
|
@@ -5007,6 +5001,236 @@ const resolveInitialValues = (values) => {
|
|
|
5007
5001
|
};
|
|
5008
5002
|
};
|
|
5009
5003
|
//#endregion
|
|
5004
|
+
//#region src/locales/index.ts
|
|
5005
|
+
const resources = {
|
|
5006
|
+
en: { translation: {
|
|
5007
|
+
"Are you sure you want to delete this widget?": "Are you sure you want to delete this widget?",
|
|
5008
|
+
Cancel: "Cancel",
|
|
5009
|
+
Delete: "Delete",
|
|
5010
|
+
widgetCard: {
|
|
5011
|
+
"error": "Widget encountered an error",
|
|
5012
|
+
"retry": "Retry",
|
|
5013
|
+
"openSettings": "Open widget settings",
|
|
5014
|
+
"showVersion": "Show widget version",
|
|
5015
|
+
"deleteWidget": "Delete widget"
|
|
5016
|
+
},
|
|
5017
|
+
dashboardFilters: {
|
|
5018
|
+
"dayType": {
|
|
5019
|
+
"label": "Day type",
|
|
5020
|
+
"calendar": "Calendar",
|
|
5021
|
+
"production": "Production"
|
|
5022
|
+
},
|
|
5023
|
+
"shifts": {
|
|
5024
|
+
"label": "Shifts",
|
|
5025
|
+
"allShifts": "All shifts"
|
|
5026
|
+
},
|
|
5027
|
+
"dateRange": {
|
|
5028
|
+
"label": "Date range",
|
|
5029
|
+
"from": "From",
|
|
5030
|
+
"to": "To"
|
|
5031
|
+
},
|
|
5032
|
+
"search": {
|
|
5033
|
+
"placeholder": "Search periods...",
|
|
5034
|
+
"noResults": "No periods found"
|
|
5035
|
+
},
|
|
5036
|
+
"premium": { "indicator": "Premium" },
|
|
5037
|
+
"periods": {
|
|
5038
|
+
"currentShift": "Current shift",
|
|
5039
|
+
"lastShift": "Previous shift",
|
|
5040
|
+
"today": "Today",
|
|
5041
|
+
"yesterday": "Yesterday",
|
|
5042
|
+
"last7Days": "Last 7 days",
|
|
5043
|
+
"last14Days": "Last 14 days",
|
|
5044
|
+
"last30Days": "Last 30 days",
|
|
5045
|
+
"last90Days": "Last 90 days",
|
|
5046
|
+
"last180Days": "Last 180 days",
|
|
5047
|
+
"last365Days": "Last 365 days",
|
|
5048
|
+
"currentWeek": "Current week",
|
|
5049
|
+
"currentMonth": "Current month",
|
|
5050
|
+
"currentQuarter": "Current quarter",
|
|
5051
|
+
"currentYear": "Current year",
|
|
5052
|
+
"previousWeek": "Previous week",
|
|
5053
|
+
"previousMonth": "Previous month",
|
|
5054
|
+
"previousQuarter": "Previous quarter",
|
|
5055
|
+
"previousYear": "Previous year",
|
|
5056
|
+
"last2Weeks": "Last 2 weeks",
|
|
5057
|
+
"last4Weeks": "Last 4 weeks",
|
|
5058
|
+
"last8Weeks": "Last 8 weeks",
|
|
5059
|
+
"last12Weeks": "Last 12 weeks",
|
|
5060
|
+
"last3Months": "Last 3 months",
|
|
5061
|
+
"last6Months": "Last 6 months",
|
|
5062
|
+
"last12Months": "Last 12 months",
|
|
5063
|
+
"week": "Week {{week}}"
|
|
5064
|
+
},
|
|
5065
|
+
"accessDenied": {
|
|
5066
|
+
"title": "Premium feature",
|
|
5067
|
+
"close": "Close"
|
|
5068
|
+
}
|
|
5069
|
+
}
|
|
5070
|
+
} },
|
|
5071
|
+
pl: { translation: {
|
|
5072
|
+
"Are you sure you want to delete this widget?": "Czy na pewno usunąć ten widżet?",
|
|
5073
|
+
Cancel: "Anuluj",
|
|
5074
|
+
Delete: "Usuń",
|
|
5075
|
+
widgetCard: {
|
|
5076
|
+
"error": "Widżet napotkał błąd",
|
|
5077
|
+
"retry": "Ponów",
|
|
5078
|
+
"openSettings": "Otwórz ustawienia widżetu",
|
|
5079
|
+
"showVersion": "Pokaż wersję widżetu",
|
|
5080
|
+
"deleteWidget": "Usuń widżet"
|
|
5081
|
+
},
|
|
5082
|
+
dashboardFilters: {
|
|
5083
|
+
"dayType": {
|
|
5084
|
+
"label": "Typ dnia",
|
|
5085
|
+
"calendar": "Kalendarzowy",
|
|
5086
|
+
"production": "Produkcyjny"
|
|
5087
|
+
},
|
|
5088
|
+
"shifts": {
|
|
5089
|
+
"label": "Zmiany",
|
|
5090
|
+
"allShifts": "Wszystkie zmiany"
|
|
5091
|
+
},
|
|
5092
|
+
"dateRange": {
|
|
5093
|
+
"label": "Zakres dat",
|
|
5094
|
+
"from": "Od",
|
|
5095
|
+
"to": "Do"
|
|
5096
|
+
},
|
|
5097
|
+
"search": {
|
|
5098
|
+
"placeholder": "Szukaj okresów...",
|
|
5099
|
+
"noResults": "Nie znaleziono okresów"
|
|
5100
|
+
},
|
|
5101
|
+
"premium": { "indicator": "Premium" },
|
|
5102
|
+
"periods": {
|
|
5103
|
+
"currentShift": "Aktualna zmiana",
|
|
5104
|
+
"lastShift": "Poprzednia zmiana",
|
|
5105
|
+
"today": "Dzisiaj",
|
|
5106
|
+
"yesterday": "Wczoraj",
|
|
5107
|
+
"last7Days": "Ostatnie 7 dni",
|
|
5108
|
+
"last14Days": "Ostatnie 14 dni",
|
|
5109
|
+
"last30Days": "Ostatnie 30 dni",
|
|
5110
|
+
"last90Days": "Ostatnie 90 dni",
|
|
5111
|
+
"last180Days": "Ostatnie 180 dni",
|
|
5112
|
+
"last365Days": "Ostatnie 365 dni",
|
|
5113
|
+
"currentWeek": "Bieżący tydzień",
|
|
5114
|
+
"currentMonth": "Bieżący miesiąc",
|
|
5115
|
+
"currentQuarter": "Bieżący kwartał",
|
|
5116
|
+
"currentYear": "Bieżący rok",
|
|
5117
|
+
"previousWeek": "Poprzedni tydzień",
|
|
5118
|
+
"previousMonth": "Poprzedni miesiąc",
|
|
5119
|
+
"previousQuarter": "Poprzedni kwartał",
|
|
5120
|
+
"previousYear": "Poprzedni rok",
|
|
5121
|
+
"last2Weeks": "Ostatnie 2 tygodnie",
|
|
5122
|
+
"last4Weeks": "Ostatnie 4 tygodnie",
|
|
5123
|
+
"last8Weeks": "Ostatnie 8 tygodni",
|
|
5124
|
+
"last12Weeks": "Ostatnie 12 tygodni",
|
|
5125
|
+
"last3Months": "Ostatnie 3 miesiące",
|
|
5126
|
+
"last6Months": "Ostatnie 6 miesięcy",
|
|
5127
|
+
"last12Months": "Ostatnie 12 miesięcy",
|
|
5128
|
+
"week": "Tydzień {{week}}"
|
|
5129
|
+
},
|
|
5130
|
+
"accessDenied": {
|
|
5131
|
+
"title": "Funkcja Premium",
|
|
5132
|
+
"close": "Zamknij"
|
|
5133
|
+
}
|
|
5134
|
+
}
|
|
5135
|
+
} }
|
|
5136
|
+
};
|
|
5137
|
+
//#endregion
|
|
5138
|
+
//#region src/components/DashboardFilters/AccessDeniedModal/styles.ts
|
|
5139
|
+
const styles$6 = { dialog: {
|
|
5140
|
+
"& .MuiDialog-paper": { borderRadius: "6px" },
|
|
5141
|
+
"& .MuiDialogContent-root": { padding: 0 }
|
|
5142
|
+
} };
|
|
5143
|
+
//#endregion
|
|
5144
|
+
//#region src/components/DashboardFilters/AccessDeniedModal/index.tsx
|
|
5145
|
+
const FEATURE_KEY$1 = "feature.dashboard_extended_date_ranges";
|
|
5146
|
+
const AccessDeniedModal = ({ open, onClose, accessState, buttons, daysSinceExpiry, cooldownInfo, workplaceId, onFeatureRequest }) => {
|
|
5147
|
+
const handleTrialRequest = useCallback(() => Promise.resolve(false), []);
|
|
5148
|
+
const handleFeatureRequest = useCallback(async (payload) => {
|
|
5149
|
+
const success = onFeatureRequest ? await onFeatureRequest(payload) : false;
|
|
5150
|
+
if (success) onClose();
|
|
5151
|
+
return success;
|
|
5152
|
+
}, [onFeatureRequest, onClose]);
|
|
5153
|
+
const { t } = useTranslation();
|
|
5154
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
5155
|
+
open,
|
|
5156
|
+
onClose,
|
|
5157
|
+
sx: styles$6.dialog,
|
|
5158
|
+
"data-testid": "dashboard-filters.access-denied-dialog",
|
|
5159
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("dashboardFilters.accessDenied.title") }), /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsx(AccessBlocker, {
|
|
5160
|
+
accessState,
|
|
5161
|
+
buttons,
|
|
5162
|
+
daysSinceExpiry: daysSinceExpiry ?? void 0,
|
|
5163
|
+
featureKey: FEATURE_KEY$1,
|
|
5164
|
+
workplaceId,
|
|
5165
|
+
cooldownInfo,
|
|
5166
|
+
onTrialRequest: handleTrialRequest,
|
|
5167
|
+
onFeatureRequest: handleFeatureRequest
|
|
5168
|
+
}), /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, {
|
|
5169
|
+
onClick: onClose,
|
|
5170
|
+
children: t("dashboardFilters.accessDenied.close")
|
|
5171
|
+
}) })] })]
|
|
5172
|
+
});
|
|
5173
|
+
};
|
|
5174
|
+
//#endregion
|
|
5175
|
+
//#region src/components/DashboardFilters/DayTypeSelector/styles.ts
|
|
5176
|
+
const styles$5 = {
|
|
5177
|
+
container: {
|
|
5178
|
+
display: "flex",
|
|
5179
|
+
alignItems: "center",
|
|
5180
|
+
gap: (theme) => theme.spacing(1)
|
|
5181
|
+
},
|
|
5182
|
+
label: {
|
|
5183
|
+
fontSize: "0.875rem",
|
|
5184
|
+
whiteSpace: "nowrap",
|
|
5185
|
+
color: (theme) => theme.palette.common.white
|
|
5186
|
+
},
|
|
5187
|
+
toggleGroup: { "& .MuiToggleButton-root": {
|
|
5188
|
+
padding: (theme) => theme.spacing(.5, 1.5),
|
|
5189
|
+
fontSize: "0.875rem",
|
|
5190
|
+
opacity: .7,
|
|
5191
|
+
color: (theme) => theme.palette.text.primary,
|
|
5192
|
+
textTransform: "none",
|
|
5193
|
+
borderRadius: "6px",
|
|
5194
|
+
"&.Mui-selected": {
|
|
5195
|
+
opacity: 1,
|
|
5196
|
+
color: (theme) => theme.palette.common.white,
|
|
5197
|
+
backgroundColor: (theme) => theme.palette.primary.main,
|
|
5198
|
+
"&:hover": { backgroundColor: (theme) => theme.palette.primary.dark }
|
|
5199
|
+
}
|
|
5200
|
+
} }
|
|
5201
|
+
};
|
|
5202
|
+
//#endregion
|
|
5203
|
+
//#region src/components/DashboardFilters/DayTypeSelector/index.tsx
|
|
5204
|
+
const DayTypeSelector = ({ value, onChange }) => {
|
|
5205
|
+
const { t } = useTranslation();
|
|
5206
|
+
const handleChange = useCallback((_event, newValue) => {
|
|
5207
|
+
if (newValue !== null) onChange(newValue);
|
|
5208
|
+
}, [onChange]);
|
|
5209
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
5210
|
+
sx: styles$5.container,
|
|
5211
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
5212
|
+
sx: styles$5.label,
|
|
5213
|
+
children: t("dashboardFilters.dayType.label")
|
|
5214
|
+
}), /* @__PURE__ */ jsxs(ToggleButtonGroup, {
|
|
5215
|
+
value,
|
|
5216
|
+
exclusive: true,
|
|
5217
|
+
onChange: handleChange,
|
|
5218
|
+
size: "small",
|
|
5219
|
+
sx: styles$5.toggleGroup,
|
|
5220
|
+
"data-testid": "dashboard-filters.day-type-selector",
|
|
5221
|
+
children: [/* @__PURE__ */ jsx(ToggleButton, {
|
|
5222
|
+
value: "CALENDAR",
|
|
5223
|
+
"data-testid": "dashboard-filters.day-type-calendar",
|
|
5224
|
+
children: t("dashboardFilters.dayType.calendar")
|
|
5225
|
+
}), /* @__PURE__ */ jsx(ToggleButton, {
|
|
5226
|
+
value: "PRODUCTION",
|
|
5227
|
+
"data-testid": "dashboard-filters.day-type-production",
|
|
5228
|
+
children: t("dashboardFilters.dayType.production")
|
|
5229
|
+
})]
|
|
5230
|
+
})]
|
|
5231
|
+
});
|
|
5232
|
+
};
|
|
5233
|
+
//#endregion
|
|
5010
5234
|
//#region src/helpers/shifts.ts
|
|
5011
5235
|
const setDate = (date, shiftDate) => {
|
|
5012
5236
|
return shiftDate.year(date.year()).month(date.month()).date(date.date());
|
|
@@ -5091,7 +5315,7 @@ const formatDateTime = (date, time) => {
|
|
|
5091
5315
|
return date.hour(hours).minute(minutes).second(seconds || 0).format("YYYY-MM-DDTHH:mm:ss");
|
|
5092
5316
|
};
|
|
5093
5317
|
const createDateRange = (startDate, endDate, dayType, boundaries) => {
|
|
5094
|
-
if (dayType ===
|
|
5318
|
+
if (dayType === "CALENDAR") return {
|
|
5095
5319
|
from: formatDateTime(startDate, "00:00:00"),
|
|
5096
5320
|
to: formatDateTime(endDate, "23:59:59")
|
|
5097
5321
|
};
|
|
@@ -5427,7 +5651,7 @@ const getShiftTimeRange = (shift) => {
|
|
|
5427
5651
|
return `${parseShiftTime(shift.startedAt).slice(0, 5)} - ${parseShiftTime(shift.finishedAt).slice(0, 5)}`;
|
|
5428
5652
|
};
|
|
5429
5653
|
const getNextMidnight = (ctx) => {
|
|
5430
|
-
if (ctx.dayType ===
|
|
5654
|
+
if (ctx.dayType === "PRODUCTION" && ctx.shifts.length > 0) {
|
|
5431
5655
|
const [h, m, s] = getTimeBoundaries(ctx.shifts, ctx.selectedShiftIds).startTime.split(":").map(Number);
|
|
5432
5656
|
return dayjs().add(1, "day").hour(h).minute(m).second(s || 0).millisecond(0).toDate();
|
|
5433
5657
|
}
|
|
@@ -5464,230 +5688,6 @@ const getNextBoundary = (periodId, ctx) => {
|
|
|
5464
5688
|
}
|
|
5465
5689
|
};
|
|
5466
5690
|
//#endregion
|
|
5467
|
-
//#region src/locales/index.ts
|
|
5468
|
-
const resources = {
|
|
5469
|
-
en: { translation: {
|
|
5470
|
-
"Are you sure you want to delete this widget?": "Are you sure you want to delete this widget?",
|
|
5471
|
-
Cancel: "Cancel",
|
|
5472
|
-
Delete: "Delete",
|
|
5473
|
-
widgetCard: {
|
|
5474
|
-
"error": "Widget encountered an error",
|
|
5475
|
-
"retry": "Retry"
|
|
5476
|
-
},
|
|
5477
|
-
dashboardFilters: {
|
|
5478
|
-
"dayType": {
|
|
5479
|
-
"label": "Day type",
|
|
5480
|
-
"calendar": "Calendar",
|
|
5481
|
-
"production": "Production"
|
|
5482
|
-
},
|
|
5483
|
-
"shifts": {
|
|
5484
|
-
"label": "Shifts",
|
|
5485
|
-
"allShifts": "All shifts"
|
|
5486
|
-
},
|
|
5487
|
-
"dateRange": {
|
|
5488
|
-
"label": "Date range",
|
|
5489
|
-
"from": "From",
|
|
5490
|
-
"to": "To"
|
|
5491
|
-
},
|
|
5492
|
-
"search": {
|
|
5493
|
-
"placeholder": "Search periods...",
|
|
5494
|
-
"noResults": "No periods found"
|
|
5495
|
-
},
|
|
5496
|
-
"premium": { "indicator": "Premium" },
|
|
5497
|
-
"periods": {
|
|
5498
|
-
"currentShift": "Current shift",
|
|
5499
|
-
"lastShift": "Previous shift",
|
|
5500
|
-
"today": "Today",
|
|
5501
|
-
"yesterday": "Yesterday",
|
|
5502
|
-
"last7Days": "Last 7 days",
|
|
5503
|
-
"last14Days": "Last 14 days",
|
|
5504
|
-
"last30Days": "Last 30 days",
|
|
5505
|
-
"last90Days": "Last 90 days",
|
|
5506
|
-
"last180Days": "Last 180 days",
|
|
5507
|
-
"last365Days": "Last 365 days",
|
|
5508
|
-
"currentWeek": "Current week",
|
|
5509
|
-
"currentMonth": "Current month",
|
|
5510
|
-
"currentQuarter": "Current quarter",
|
|
5511
|
-
"currentYear": "Current year",
|
|
5512
|
-
"previousWeek": "Previous week",
|
|
5513
|
-
"previousMonth": "Previous month",
|
|
5514
|
-
"previousQuarter": "Previous quarter",
|
|
5515
|
-
"previousYear": "Previous year",
|
|
5516
|
-
"last2Weeks": "Last 2 weeks",
|
|
5517
|
-
"last4Weeks": "Last 4 weeks",
|
|
5518
|
-
"last8Weeks": "Last 8 weeks",
|
|
5519
|
-
"last12Weeks": "Last 12 weeks",
|
|
5520
|
-
"last3Months": "Last 3 months",
|
|
5521
|
-
"last6Months": "Last 6 months",
|
|
5522
|
-
"last12Months": "Last 12 months",
|
|
5523
|
-
"week": "Week {{week}}"
|
|
5524
|
-
},
|
|
5525
|
-
"accessDenied": {
|
|
5526
|
-
"title": "Premium feature",
|
|
5527
|
-
"close": "Close"
|
|
5528
|
-
}
|
|
5529
|
-
}
|
|
5530
|
-
} },
|
|
5531
|
-
pl: { translation: {
|
|
5532
|
-
"Are you sure you want to delete this widget?": "Czy na pewno usunąć ten widżet?",
|
|
5533
|
-
Cancel: "Anuluj",
|
|
5534
|
-
Delete: "Usuń",
|
|
5535
|
-
widgetCard: {
|
|
5536
|
-
"error": "Widżet napotkał błąd",
|
|
5537
|
-
"retry": "Ponów"
|
|
5538
|
-
},
|
|
5539
|
-
dashboardFilters: {
|
|
5540
|
-
"dayType": {
|
|
5541
|
-
"label": "Typ dnia",
|
|
5542
|
-
"calendar": "Kalendarzowy",
|
|
5543
|
-
"production": "Produkcyjny"
|
|
5544
|
-
},
|
|
5545
|
-
"shifts": {
|
|
5546
|
-
"label": "Zmiany",
|
|
5547
|
-
"allShifts": "Wszystkie zmiany"
|
|
5548
|
-
},
|
|
5549
|
-
"dateRange": {
|
|
5550
|
-
"label": "Zakres dat",
|
|
5551
|
-
"from": "Od",
|
|
5552
|
-
"to": "Do"
|
|
5553
|
-
},
|
|
5554
|
-
"search": {
|
|
5555
|
-
"placeholder": "Szukaj okresów...",
|
|
5556
|
-
"noResults": "Nie znaleziono okresów"
|
|
5557
|
-
},
|
|
5558
|
-
"premium": { "indicator": "Premium" },
|
|
5559
|
-
"periods": {
|
|
5560
|
-
"currentShift": "Aktualna zmiana",
|
|
5561
|
-
"lastShift": "Poprzednia zmiana",
|
|
5562
|
-
"today": "Dzisiaj",
|
|
5563
|
-
"yesterday": "Wczoraj",
|
|
5564
|
-
"last7Days": "Ostatnie 7 dni",
|
|
5565
|
-
"last14Days": "Ostatnie 14 dni",
|
|
5566
|
-
"last30Days": "Ostatnie 30 dni",
|
|
5567
|
-
"last90Days": "Ostatnie 90 dni",
|
|
5568
|
-
"last180Days": "Ostatnie 180 dni",
|
|
5569
|
-
"last365Days": "Ostatnie 365 dni",
|
|
5570
|
-
"currentWeek": "Bieżący tydzień",
|
|
5571
|
-
"currentMonth": "Bieżący miesiąc",
|
|
5572
|
-
"currentQuarter": "Bieżący kwartał",
|
|
5573
|
-
"currentYear": "Bieżący rok",
|
|
5574
|
-
"previousWeek": "Poprzedni tydzień",
|
|
5575
|
-
"previousMonth": "Poprzedni miesiąc",
|
|
5576
|
-
"previousQuarter": "Poprzedni kwartał",
|
|
5577
|
-
"previousYear": "Poprzedni rok",
|
|
5578
|
-
"last2Weeks": "Ostatnie 2 tygodnie",
|
|
5579
|
-
"last4Weeks": "Ostatnie 4 tygodnie",
|
|
5580
|
-
"last8Weeks": "Ostatnie 8 tygodni",
|
|
5581
|
-
"last12Weeks": "Ostatnie 12 tygodni",
|
|
5582
|
-
"last3Months": "Ostatnie 3 miesiące",
|
|
5583
|
-
"last6Months": "Ostatnie 6 miesięcy",
|
|
5584
|
-
"last12Months": "Ostatnie 12 miesięcy",
|
|
5585
|
-
"week": "Tydzień {{week}}"
|
|
5586
|
-
},
|
|
5587
|
-
"accessDenied": {
|
|
5588
|
-
"title": "Funkcja Premium",
|
|
5589
|
-
"close": "Zamknij"
|
|
5590
|
-
}
|
|
5591
|
-
}
|
|
5592
|
-
} }
|
|
5593
|
-
};
|
|
5594
|
-
//#endregion
|
|
5595
|
-
//#region src/components/DashboardFilters/AccessDeniedModal/styles.ts
|
|
5596
|
-
const styles$6 = { dialog: {
|
|
5597
|
-
"& .MuiDialog-paper": { borderRadius: "6px" },
|
|
5598
|
-
"& .MuiDialogContent-root": { padding: 0 }
|
|
5599
|
-
} };
|
|
5600
|
-
//#endregion
|
|
5601
|
-
//#region src/components/DashboardFilters/AccessDeniedModal/index.tsx
|
|
5602
|
-
const FEATURE_KEY$1 = "feature.dashboard_extended_date_ranges";
|
|
5603
|
-
const AccessDeniedModal = ({ open, onClose, accessState, buttons, daysSinceExpiry, cooldownInfo, workplaceId, onFeatureRequest }) => {
|
|
5604
|
-
const handleTrialRequest = useCallback(() => Promise.resolve(false), []);
|
|
5605
|
-
const handleFeatureRequest = useCallback(async (payload) => {
|
|
5606
|
-
const success = onFeatureRequest ? await onFeatureRequest(payload) : false;
|
|
5607
|
-
if (success) onClose();
|
|
5608
|
-
return success;
|
|
5609
|
-
}, [onFeatureRequest, onClose]);
|
|
5610
|
-
const { t } = useTranslation();
|
|
5611
|
-
return /* @__PURE__ */ jsxs(Dialog, {
|
|
5612
|
-
open,
|
|
5613
|
-
onClose,
|
|
5614
|
-
sx: styles$6.dialog,
|
|
5615
|
-
"data-testid": "dashboard-filters.access-denied-dialog",
|
|
5616
|
-
children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("dashboardFilters.accessDenied.title") }), /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsx(AccessBlocker, {
|
|
5617
|
-
accessState,
|
|
5618
|
-
buttons,
|
|
5619
|
-
daysSinceExpiry: daysSinceExpiry ?? void 0,
|
|
5620
|
-
featureKey: FEATURE_KEY$1,
|
|
5621
|
-
workplaceId,
|
|
5622
|
-
cooldownInfo,
|
|
5623
|
-
onTrialRequest: handleTrialRequest,
|
|
5624
|
-
onFeatureRequest: handleFeatureRequest
|
|
5625
|
-
}), /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, {
|
|
5626
|
-
onClick: onClose,
|
|
5627
|
-
children: t("dashboardFilters.accessDenied.close")
|
|
5628
|
-
}) })] })]
|
|
5629
|
-
});
|
|
5630
|
-
};
|
|
5631
|
-
//#endregion
|
|
5632
|
-
//#region src/components/DashboardFilters/DayTypeSelector/styles.ts
|
|
5633
|
-
const styles$5 = {
|
|
5634
|
-
container: {
|
|
5635
|
-
display: "flex",
|
|
5636
|
-
alignItems: "center",
|
|
5637
|
-
gap: (theme) => theme.spacing(1)
|
|
5638
|
-
},
|
|
5639
|
-
label: {
|
|
5640
|
-
fontSize: "0.875rem",
|
|
5641
|
-
whiteSpace: "nowrap",
|
|
5642
|
-
color: (theme) => theme.palette.common.white
|
|
5643
|
-
},
|
|
5644
|
-
toggleGroup: { "& .MuiToggleButton-root": {
|
|
5645
|
-
padding: (theme) => theme.spacing(.5, 1.5),
|
|
5646
|
-
fontSize: "0.875rem",
|
|
5647
|
-
opacity: .7,
|
|
5648
|
-
color: (theme) => theme.palette.text.primary,
|
|
5649
|
-
textTransform: "none",
|
|
5650
|
-
borderRadius: "6px",
|
|
5651
|
-
"&.Mui-selected": {
|
|
5652
|
-
opacity: 1,
|
|
5653
|
-
color: (theme) => theme.palette.common.white,
|
|
5654
|
-
backgroundColor: (theme) => theme.palette.primary.main,
|
|
5655
|
-
"&:hover": { backgroundColor: (theme) => theme.palette.primary.dark }
|
|
5656
|
-
}
|
|
5657
|
-
} }
|
|
5658
|
-
};
|
|
5659
|
-
//#endregion
|
|
5660
|
-
//#region src/components/DashboardFilters/DayTypeSelector/index.tsx
|
|
5661
|
-
const DayTypeSelector = ({ value, onChange }) => {
|
|
5662
|
-
const { t } = useTranslation();
|
|
5663
|
-
const handleChange = useCallback((_event, newValue) => {
|
|
5664
|
-
if (newValue !== null) onChange(newValue);
|
|
5665
|
-
}, [onChange]);
|
|
5666
|
-
return /* @__PURE__ */ jsxs(Box, {
|
|
5667
|
-
sx: styles$5.container,
|
|
5668
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
5669
|
-
sx: styles$5.label,
|
|
5670
|
-
children: t("dashboardFilters.dayType.label")
|
|
5671
|
-
}), /* @__PURE__ */ jsxs(ToggleButtonGroup, {
|
|
5672
|
-
value,
|
|
5673
|
-
exclusive: true,
|
|
5674
|
-
onChange: handleChange,
|
|
5675
|
-
size: "small",
|
|
5676
|
-
sx: styles$5.toggleGroup,
|
|
5677
|
-
"data-testid": "dashboard-filters.day-type-selector",
|
|
5678
|
-
children: [/* @__PURE__ */ jsx(ToggleButton, {
|
|
5679
|
-
value: DayType.Calendar,
|
|
5680
|
-
"data-testid": "dashboard-filters.day-type-calendar",
|
|
5681
|
-
children: t("dashboardFilters.dayType.calendar")
|
|
5682
|
-
}), /* @__PURE__ */ jsx(ToggleButton, {
|
|
5683
|
-
value: DayType.Production,
|
|
5684
|
-
"data-testid": "dashboard-filters.day-type-production",
|
|
5685
|
-
children: t("dashboardFilters.dayType.production")
|
|
5686
|
-
})]
|
|
5687
|
-
})]
|
|
5688
|
-
});
|
|
5689
|
-
};
|
|
5690
|
-
//#endregion
|
|
5691
5691
|
//#region src/components/DashboardFilters/PeriodList/styles.ts
|
|
5692
5692
|
const styles$4 = {
|
|
5693
5693
|
container: {
|
|
@@ -5744,7 +5744,7 @@ const PeriodList = ({ dayType, shifts, selectedShiftIds, selectedPeriodId, hasAc
|
|
|
5744
5744
|
}, 300);
|
|
5745
5745
|
}, []);
|
|
5746
5746
|
const timeRangeLabel = useMemo(() => {
|
|
5747
|
-
if (dayType !==
|
|
5747
|
+
if (dayType !== "PRODUCTION" || shifts.length === 0) return null;
|
|
5748
5748
|
return getTimeRangeLabel(shifts, selectedShiftIds);
|
|
5749
5749
|
}, [
|
|
5750
5750
|
dayType,
|
|
@@ -5769,7 +5769,7 @@ const PeriodList = ({ dayType, shifts, selectedShiftIds, selectedPeriodId, hasAc
|
|
|
5769
5769
|
}, [shifts]);
|
|
5770
5770
|
const filteredPeriods = useMemo(() => {
|
|
5771
5771
|
let available = periods.filter((period) => {
|
|
5772
|
-
if (period.category === "shift_based" && dayType ===
|
|
5772
|
+
if (period.category === "shift_based" && dayType === "CALENDAR") return false;
|
|
5773
5773
|
return true;
|
|
5774
5774
|
});
|
|
5775
5775
|
if (debouncedQuery.trim()) {
|
|
@@ -6026,20 +6026,7 @@ const styles$2 = {
|
|
|
6026
6026
|
fontSize: "0.875rem",
|
|
6027
6027
|
opacity: .8
|
|
6028
6028
|
},
|
|
6029
|
-
select:
|
|
6030
|
-
minWidth: 200,
|
|
6031
|
-
maxWidth: 350,
|
|
6032
|
-
"& .MuiInputBase-input.Mui-disabled": {
|
|
6033
|
-
WebkitTextFillColor: theme.palette.text.primary,
|
|
6034
|
-
opacity: .6
|
|
6035
|
-
},
|
|
6036
|
-
"& .MuiSelect-icon.Mui-disabled": {
|
|
6037
|
-
color: theme.palette.text.primary,
|
|
6038
|
-
opacity: .6
|
|
6039
|
-
},
|
|
6040
|
-
"& .Mui-disabled .MuiOutlinedInput-notchedOutline": { borderColor: theme.palette.divider },
|
|
6041
|
-
"&:has(.Mui-disabled) .MuiInputLabel-root": { color: theme.palette.text.primary }
|
|
6042
|
-
}),
|
|
6029
|
+
select: { minWidth: 200 },
|
|
6043
6030
|
menuItem: { padding: (theme) => theme.spacing(.5, 1) },
|
|
6044
6031
|
listItemText: {
|
|
6045
6032
|
"& .MuiListItemText-primary": { fontSize: "0.875rem" },
|
|
@@ -6052,7 +6039,7 @@ const styles$2 = {
|
|
|
6052
6039
|
};
|
|
6053
6040
|
//#endregion
|
|
6054
6041
|
//#region src/components/DashboardFilters/ShiftSelector/index.tsx
|
|
6055
|
-
const ShiftSelector = ({ shifts, selectedShiftIds, onChange
|
|
6042
|
+
const ShiftSelector = ({ shifts, selectedShiftIds, onChange }) => {
|
|
6056
6043
|
const { t } = useTranslation();
|
|
6057
6044
|
const handleChange = useCallback((event) => {
|
|
6058
6045
|
const value = event.target.value;
|
|
@@ -6060,15 +6047,12 @@ const ShiftSelector = ({ shifts, selectedShiftIds, onChange, disabled = false })
|
|
|
6060
6047
|
}, [onChange]);
|
|
6061
6048
|
const renderValue = useCallback((selected) => {
|
|
6062
6049
|
if (selected.length === 0) return t("dashboardFilters.shifts.allShifts");
|
|
6063
|
-
|
|
6064
|
-
if (selectedNames.length === 1) return selectedNames[0];
|
|
6065
|
-
return `${selectedNames[0]} (+${selectedNames.length - 1})`;
|
|
6050
|
+
return shifts.filter((s) => selected.includes(s.id)).map((s) => s.name).join(", ");
|
|
6066
6051
|
}, [shifts, t]);
|
|
6067
6052
|
return /* @__PURE__ */ jsx(Box, {
|
|
6068
6053
|
sx: styles$2.container,
|
|
6069
6054
|
children: /* @__PURE__ */ jsxs(FormControl, {
|
|
6070
6055
|
size: "small",
|
|
6071
|
-
disabled,
|
|
6072
6056
|
sx: styles$2.select,
|
|
6073
6057
|
"data-testid": "dashboard-filters.shift-selector",
|
|
6074
6058
|
children: [/* @__PURE__ */ jsx(InputLabel, {
|
|
@@ -6081,6 +6065,7 @@ const ShiftSelector = ({ shifts, selectedShiftIds, onChange, disabled = false })
|
|
|
6081
6065
|
onChange: handleChange,
|
|
6082
6066
|
renderValue,
|
|
6083
6067
|
label: t("dashboardFilters.shifts.label"),
|
|
6068
|
+
inputProps: { "aria-label": t("dashboardFilters.shifts.label") },
|
|
6084
6069
|
children: shifts.map((shift) => /* @__PURE__ */ jsxs(MenuItem, {
|
|
6085
6070
|
value: shift.id,
|
|
6086
6071
|
sx: styles$2.menuItem,
|
|
@@ -6107,7 +6092,7 @@ const buildCoreState = (values, shifts) => {
|
|
|
6107
6092
|
if (!values) {
|
|
6108
6093
|
const shiftId = shifts?.length ? resolveShiftIdForPeriod("current_shift", shifts) : null;
|
|
6109
6094
|
return {
|
|
6110
|
-
dayType:
|
|
6095
|
+
dayType: "PRODUCTION",
|
|
6111
6096
|
selectedPeriodId: "current_shift",
|
|
6112
6097
|
customDateRange: null,
|
|
6113
6098
|
shiftIds: shiftId ? [shiftId] : []
|
|
@@ -6267,7 +6252,6 @@ const styles$1 = {
|
|
|
6267
6252
|
};
|
|
6268
6253
|
//#endregion
|
|
6269
6254
|
//#region src/components/DashboardFilters/index.tsx
|
|
6270
|
-
registerTranslations(resources);
|
|
6271
6255
|
const FEATURE_KEY = "feature.dashboard_extended_date_ranges";
|
|
6272
6256
|
const DashboardFilters = ({ initialValues, onChange, shifts = [], onFeatureRequest }) => {
|
|
6273
6257
|
const { hasAccess, accessState, buttons, cooldownInfo, features } = useAccess([FEATURE_KEY]);
|
|
@@ -6276,14 +6260,11 @@ const DashboardFilters = ({ initialValues, onChange, shifts = [], onFeatureReque
|
|
|
6276
6260
|
const dateFieldRef = useRef(null);
|
|
6277
6261
|
const { filterValues, selectedPeriodId, handlers } = useDashboardFilters(useMemo(() => resolveInitialValues(initialValues), [initialValues]), shifts, onChange);
|
|
6278
6262
|
const { t } = useTranslation();
|
|
6263
|
+
registerTranslations(resources);
|
|
6279
6264
|
const daysSinceExpiry = useMemo(() => {
|
|
6280
6265
|
return features.find((f) => f.featureKey === FEATURE_KEY)?.daysSinceExpiry ?? null;
|
|
6281
6266
|
}, [features]);
|
|
6282
6267
|
const filteredButtons = useMemo(() => buttons.filter((b) => b.action !== "start_trial"), [buttons]);
|
|
6283
|
-
const isShiftLocked = useMemo(() => {
|
|
6284
|
-
if (!selectedPeriodId) return false;
|
|
6285
|
-
return periods.find((p) => p.id === selectedPeriodId)?.category === "shift_based";
|
|
6286
|
-
}, [selectedPeriodId]);
|
|
6287
6268
|
const handlePeriodSelect = useCallback((period, dateRange) => {
|
|
6288
6269
|
if (period.needAccess && !hasAccess) {
|
|
6289
6270
|
setAccessModalOpen(true);
|
|
@@ -6325,8 +6306,7 @@ const DashboardFilters = ({ initialValues, onChange, shifts = [], onFeatureReque
|
|
|
6325
6306
|
}), /* @__PURE__ */ jsx(ShiftSelector, {
|
|
6326
6307
|
shifts,
|
|
6327
6308
|
selectedShiftIds: filterValues.shiftIds,
|
|
6328
|
-
onChange: handlers.handleShiftChange
|
|
6329
|
-
disabled: isShiftLocked
|
|
6309
|
+
onChange: handlers.handleShiftChange
|
|
6330
6310
|
})]
|
|
6331
6311
|
}),
|
|
6332
6312
|
/* @__PURE__ */ jsx(Popover, {
|
|
@@ -6580,12 +6560,12 @@ const MetricCard = ({ title, metricLabel, metricValue, progressValue, extraValue
|
|
|
6580
6560
|
const value = metricValue.textValue;
|
|
6581
6561
|
if (!value) return "";
|
|
6582
6562
|
switch (metricValue.unit) {
|
|
6583
|
-
case
|
|
6563
|
+
case "DURATION": {
|
|
6584
6564
|
const duration = dayjs.duration(Number(value), "seconds");
|
|
6585
6565
|
return `${Math.floor(duration.asMinutes())}m ${duration.seconds()}s`;
|
|
6586
6566
|
}
|
|
6587
|
-
case
|
|
6588
|
-
case
|
|
6567
|
+
case "PERCENT": return `${formatFloat(parseFloat(value) * 100)}%`;
|
|
6568
|
+
case "ROUND": return formatFloat(parseFloat(value));
|
|
6589
6569
|
default: return value;
|
|
6590
6570
|
}
|
|
6591
6571
|
};
|
|
@@ -6593,9 +6573,9 @@ const MetricCard = ({ title, metricLabel, metricValue, progressValue, extraValue
|
|
|
6593
6573
|
const getBackgroundColor = () => {
|
|
6594
6574
|
const statusColor = getStatusColor();
|
|
6595
6575
|
if (statusColor) switch (statusColor) {
|
|
6596
|
-
case
|
|
6597
|
-
case
|
|
6598
|
-
case
|
|
6576
|
+
case "green": return "#32D74B";
|
|
6577
|
+
case "yellow": return "#FFC12F";
|
|
6578
|
+
case "red": return "#FF3B2F";
|
|
6599
6579
|
default: return "#BBBBBBBF";
|
|
6600
6580
|
}
|
|
6601
6581
|
return "#FFFFFFBF";
|
|
@@ -6603,9 +6583,9 @@ const MetricCard = ({ title, metricLabel, metricValue, progressValue, extraValue
|
|
|
6603
6583
|
const getBackground = () => {
|
|
6604
6584
|
const statusColor = getStatusColor();
|
|
6605
6585
|
if (statusColor) switch (statusColor) {
|
|
6606
|
-
case
|
|
6607
|
-
case
|
|
6608
|
-
case
|
|
6586
|
+
case "green": return "linear-gradient(180deg, #31BF59 0%, #32D74B 100%)";
|
|
6587
|
+
case "yellow": return "linear-gradient(360deg, #FFD60A 0%, #FFC12F 100%)";
|
|
6588
|
+
case "red": return "linear-gradient(0deg, #F05C53 0%, #FF3B2F 100%)";
|
|
6609
6589
|
default: return "rgba(187, 187, 187, 0.75)";
|
|
6610
6590
|
}
|
|
6611
6591
|
return "rgba(255, 255, 255, 0.75)";
|
|
@@ -6869,10 +6849,7 @@ var GraphqlWsClient = class {
|
|
|
6869
6849
|
if (keys.length !== 1) throw new Error(`Expected exactly one response key, got: ${keys.join(", ")}`);
|
|
6870
6850
|
return data[keys[0]];
|
|
6871
6851
|
};
|
|
6872
|
-
if (!this.actionCableClient)
|
|
6873
|
-
console.warn("[dashboard-toolkit] WebSocket client not available — skipping subscription");
|
|
6874
|
-
return { unsubscribe: () => {} };
|
|
6875
|
-
}
|
|
6852
|
+
if (!this.actionCableClient) throw new Error("No WS client available");
|
|
6876
6853
|
return this.actionCableClient.request({
|
|
6877
6854
|
query,
|
|
6878
6855
|
variables
|
|
@@ -6955,7 +6932,7 @@ const ErrorFallback = ({ resetErrorBoundary }) => {
|
|
|
6955
6932
|
sx: container,
|
|
6956
6933
|
children: [/* @__PURE__ */ jsx(Typography, {
|
|
6957
6934
|
variant: "body2",
|
|
6958
|
-
color: "text.
|
|
6935
|
+
color: "text.secondary",
|
|
6959
6936
|
children: t("widgetCard.error")
|
|
6960
6937
|
}), /* @__PURE__ */ jsx(Button, {
|
|
6961
6938
|
variant: "outlined",
|
|
@@ -7125,7 +7102,6 @@ const styles = {
|
|
|
7125
7102
|
};
|
|
7126
7103
|
//#endregion
|
|
7127
7104
|
//#region src/components/WidgetCard/index.tsx
|
|
7128
|
-
registerTranslations(resources);
|
|
7129
7105
|
const WidgetCard = forwardRef(({ children, title, Widget, id, getDisplayName, getTitle, thumbnail, url, wsUrl, lang, filters, openSettingsModal, onSettingsModalOpened, onSettingsModalClosed, sidePanelOpened, updateSidePanelProps, onDelete, editMode, version, requiredFeatures, extraPermissions, ...cardProps }, ref) => {
|
|
7130
7106
|
const { graphqlSdk } = useGqlClients({
|
|
7131
7107
|
url,
|
|
@@ -7144,6 +7120,7 @@ const WidgetCard = forwardRef(({ children, title, Widget, id, getDisplayName, ge
|
|
|
7144
7120
|
setWidgetSettings(newSettings);
|
|
7145
7121
|
}, []);
|
|
7146
7122
|
const { t } = useTranslation();
|
|
7123
|
+
registerTranslations(resources);
|
|
7147
7124
|
const displayTitle = useCallback(() => {
|
|
7148
7125
|
const trimmed = widgetSettings?.customTitle?.trim();
|
|
7149
7126
|
if (trimmed) return trimmed;
|
|
@@ -7214,6 +7191,7 @@ const WidgetCard = forwardRef(({ children, title, Widget, id, getDisplayName, ge
|
|
|
7214
7191
|
sx: styles.settingsButton,
|
|
7215
7192
|
onClick: handleOpenSettingsModal,
|
|
7216
7193
|
disabled: !hasAccess,
|
|
7194
|
+
"aria-label": t("widgetCard.openSettings"),
|
|
7217
7195
|
"data-testid": "widget-card.settings-button",
|
|
7218
7196
|
children: /* @__PURE__ */ jsx(Settings, {})
|
|
7219
7197
|
}),
|
|
@@ -7222,6 +7200,7 @@ const WidgetCard = forwardRef(({ children, title, Widget, id, getDisplayName, ge
|
|
|
7222
7200
|
children: /* @__PURE__ */ jsx(Button, {
|
|
7223
7201
|
color: "secondary",
|
|
7224
7202
|
sx: styles.infoButton,
|
|
7203
|
+
"aria-label": t("widgetCard.showVersion"),
|
|
7225
7204
|
"data-testid": "widget-card.info-button",
|
|
7226
7205
|
children: /* @__PURE__ */ jsx(Info, {})
|
|
7227
7206
|
})
|
|
@@ -7243,6 +7222,7 @@ const WidgetCard = forwardRef(({ children, title, Widget, id, getDisplayName, ge
|
|
|
7243
7222
|
setRemoveTooltipOpened(true);
|
|
7244
7223
|
},
|
|
7245
7224
|
loading: deleteInProgress,
|
|
7225
|
+
"aria-label": t("widgetCard.deleteWidget"),
|
|
7246
7226
|
"data-testid": "widget-card.delete-button",
|
|
7247
7227
|
children: /* @__PURE__ */ jsx(Delete, {})
|
|
7248
7228
|
})
|
|
@@ -7279,9 +7259,9 @@ const WidgetCard = forwardRef(({ children, title, Widget, id, getDisplayName, ge
|
|
|
7279
7259
|
children: /* @__PURE__ */ jsx(AccessGuard, {
|
|
7280
7260
|
features: requiredFeatures,
|
|
7281
7261
|
extraPermissions,
|
|
7262
|
+
backgroundImage: thumbnail,
|
|
7282
7263
|
onTrialRequest: handleTrialRequest,
|
|
7283
7264
|
onFeatureRequest: handleFeatureRequest,
|
|
7284
|
-
backgroundImage: thumbnail,
|
|
7285
7265
|
children: /* @__PURE__ */ jsx(WidgetErrorBoundary, { children: /* @__PURE__ */ jsx(Widget, {
|
|
7286
7266
|
id,
|
|
7287
7267
|
url,
|
|
@@ -7289,9 +7269,7 @@ const WidgetCard = forwardRef(({ children, title, Widget, id, getDisplayName, ge
|
|
|
7289
7269
|
lang,
|
|
7290
7270
|
filters,
|
|
7291
7271
|
onDataChange: handleDataChange,
|
|
7292
|
-
onDataSync: handleDataChange,
|
|
7293
7272
|
onSettingsChange: handleSettingsChange,
|
|
7294
|
-
onSettingsSync: handleSettingsChange,
|
|
7295
7273
|
openSettingsModal,
|
|
7296
7274
|
onSettingsModalOpened,
|
|
7297
7275
|
onSettingsModalClosed,
|
|
@@ -7320,10 +7298,10 @@ const getValidAggregations = (dateRange) => {
|
|
|
7320
7298
|
const days = to.diff(from, "day");
|
|
7321
7299
|
const months = to.diff(from, "month");
|
|
7322
7300
|
const valid = [];
|
|
7323
|
-
if (days <= MAX_DAYS_HOURLY) valid.push(
|
|
7324
|
-
if (days >= MIN_DAYS_DAILY && days <= MAX_DAYS_DAILY) valid.push(
|
|
7325
|
-
if (days >= MIN_DAYS_WEEKLY && months <= MAX_MONTHS_WEEKLY) valid.push(
|
|
7326
|
-
if (months >= MIN_MONTHS_MONTHLY && months <= MAX_MONTHS_MONTHLY) valid.push(
|
|
7301
|
+
if (days <= MAX_DAYS_HOURLY) valid.push("HOURLY");
|
|
7302
|
+
if (days >= MIN_DAYS_DAILY && days <= MAX_DAYS_DAILY) valid.push("DAILY");
|
|
7303
|
+
if (days >= MIN_DAYS_WEEKLY && months <= MAX_MONTHS_WEEKLY) valid.push("WEEKLY");
|
|
7304
|
+
if (months >= MIN_MONTHS_MONTHLY && months <= MAX_MONTHS_MONTHLY) valid.push("MONTHLY");
|
|
7327
7305
|
return valid;
|
|
7328
7306
|
};
|
|
7329
7307
|
const resolveAutoAggregation = (dateRange) => {
|
|
@@ -7331,10 +7309,10 @@ const resolveAutoAggregation = (dateRange) => {
|
|
|
7331
7309
|
const to = dayjs(dateRange.dateTo);
|
|
7332
7310
|
const days = to.diff(from, "day");
|
|
7333
7311
|
const months = to.diff(from, "month");
|
|
7334
|
-
if (days <= 1) return
|
|
7335
|
-
if (days <= 13) return
|
|
7336
|
-
if (months < 3) return
|
|
7337
|
-
return
|
|
7312
|
+
if (days <= 1) return "HOURLY";
|
|
7313
|
+
if (days <= 13) return "DAILY";
|
|
7314
|
+
if (months < 3) return "WEEKLY";
|
|
7315
|
+
return "MONTHLY";
|
|
7338
7316
|
};
|
|
7339
7317
|
const resolveAggregation = (dateRange, savedAggregation) => {
|
|
7340
7318
|
if (savedAggregation) {
|
|
@@ -7343,6 +7321,47 @@ const resolveAggregation = (dateRange, savedAggregation) => {
|
|
|
7343
7321
|
return resolveAutoAggregation(dateRange);
|
|
7344
7322
|
};
|
|
7345
7323
|
//#endregion
|
|
7324
|
+
//#region src/helpers/period-view.ts
|
|
7325
|
+
const COMPARED_PERIODS_MIN = 2;
|
|
7326
|
+
const COMPARED_PERIODS_MAX = 13;
|
|
7327
|
+
const DEFAULT_COMPARED_PERIODS = 7;
|
|
7328
|
+
const MAX_DAYS_FOR_COMPARISON_DEFAULT = 6;
|
|
7329
|
+
const getValidComparedPeriods = () => ({
|
|
7330
|
+
min: COMPARED_PERIODS_MIN,
|
|
7331
|
+
max: COMPARED_PERIODS_MAX
|
|
7332
|
+
});
|
|
7333
|
+
const resolvePeriodViewDefault = (dateRange) => {
|
|
7334
|
+
if (dayjs(dateRange.dateTo).diff(dayjs(dateRange.dateFrom), "day") <= MAX_DAYS_FOR_COMPARISON_DEFAULT) return {
|
|
7335
|
+
periodView: "COMPARISON",
|
|
7336
|
+
comparedPeriods: DEFAULT_COMPARED_PERIODS
|
|
7337
|
+
};
|
|
7338
|
+
return {
|
|
7339
|
+
periodView: "BREAKDOWN",
|
|
7340
|
+
aggregation: resolveAutoAggregation(dateRange)
|
|
7341
|
+
};
|
|
7342
|
+
};
|
|
7343
|
+
const isValidSavedBreakdown = (savedSettings, dateRange) => {
|
|
7344
|
+
if (savedSettings.periodView !== "BREAKDOWN") return false;
|
|
7345
|
+
if (!savedSettings.aggregation) return false;
|
|
7346
|
+
return getValidAggregations(dateRange).includes(savedSettings.aggregation);
|
|
7347
|
+
};
|
|
7348
|
+
const isValidSavedComparison = (savedSettings) => {
|
|
7349
|
+
if (savedSettings.periodView !== "COMPARISON") return false;
|
|
7350
|
+
const n = savedSettings.comparedPeriods;
|
|
7351
|
+
return typeof n === "number" && n >= COMPARED_PERIODS_MIN && n <= COMPARED_PERIODS_MAX;
|
|
7352
|
+
};
|
|
7353
|
+
const resolvePeriodView = (dateRange, savedSettings, widgetDefault) => {
|
|
7354
|
+
if (isValidSavedBreakdown(savedSettings, dateRange)) return {
|
|
7355
|
+
periodView: "BREAKDOWN",
|
|
7356
|
+
aggregation: savedSettings.aggregation
|
|
7357
|
+
};
|
|
7358
|
+
if (isValidSavedComparison(savedSettings)) return {
|
|
7359
|
+
periodView: "COMPARISON",
|
|
7360
|
+
comparedPeriods: savedSettings.comparedPeriods
|
|
7361
|
+
};
|
|
7362
|
+
return widgetDefault(dateRange);
|
|
7363
|
+
};
|
|
7364
|
+
//#endregion
|
|
7346
7365
|
//#region src/helpers/time.ts
|
|
7347
7366
|
const generateTimeRange = (start, end, unit, step) => {
|
|
7348
7367
|
const result = [];
|
|
@@ -7356,8 +7375,8 @@ const generateTimeRange = (start, end, unit, step) => {
|
|
|
7356
7375
|
};
|
|
7357
7376
|
//#endregion
|
|
7358
7377
|
//#region src/version.ts
|
|
7359
|
-
const LIBRARY_VERSION = "1.5.
|
|
7378
|
+
const LIBRARY_VERSION = "1.5.83";
|
|
7360
7379
|
//#endregion
|
|
7361
|
-
export { AccessRequestTypeEnum, ActualStaffingCountsDocument, AndonLightColor, ApplicationInfoDocument, AssignOperatorDocument, AssignOperatorToWorkplaceDocument, AvailabilityInsightsDocument, AvailabilityStatus, BulkUpsertStaffingPlansDocument, CompanyConfigDocument, ConfirmTooltip, CounterDirectoriesDocument, CounterKindEnum, CountersDocument, CreateDashboardDocument, CreateOrderDocument, CreateProductDocument, CreateStaffingPlanDocument, CreateStatusChangeDocument, CreateUserPresenceDocument, CreateWidgetDocument, CurrentUserDocument, DashboardFilters, DashboardsDocument, DayType, DepartmentsDocument, EditWorkOrderDocument, FloorPlansDocument, GetAvailabilityInsightsDocument, GetCompanyConfigDocument, GetProductionInsightsDocument, GetStatusInsightsDocument, GetWorkOrdersInsightsDocument, GetWorkplacePerformanceInsightsDocument, GraphqlWsClient, InsightsAggregation, ListActualStaffingCountsDocument, ListFloorPlansDocument, ListMetricValuesDocument, ListMetricsDocument, ListReasonsDocument, ListShiftsDocument, ListStaffingPlansDocument, ListStatusChangesDocument, ListWorkOrdersDocument, ListWorkplaceAssignmentsDocument, ListWorkplacesDocument, MetricCard, MetricTypeEnum, MetricUnitEnum, MetricValuesDocument, MetricsDocument, NotificationsDocument, OrdersDocument, OrdersExecutionsDocument, PauseOrderExecutionDocument, Period, PresenceStatusEnum, ProductionInsightsDocument, ProductionMode, ProductsDocument, ReasonsDocument, ReasonsRecommendationDocument, RemoveDashboardDocument, RemoveStaffingPlanDocument, RemoveUserPresenceDocument, RemoveWidgetDocument, RemoveWorkplaceUsersPresencesDocument, RequestFeatureAccessDocument, ScreenEnum, SetCounterDocument, ShiftsDocument, SortableSelect, StaffingPlansDocument, StandardRatesDocument, StartOrderExecutionDocument, StartTrialDocument, StatusChangeTransitionPermissionsDocument, StatusChangesDocument, StatusInsightsDocument, StatusScreenDisplayBlocksEnum, StopOrderExecutionDocument, TrainingStatus, UnassignOperatorDocument, UnassignOperatorFromWorkplaceDocument, UpdateDashboardDocument, UpdateNotificationDocument, UpdateOrderDocument, UpdateOrderExecutionDocument, UpdateStaffingPlanDocument, UpdateStatusChangeDocument, UpdateWidgetDocument, UpdateWorkOrderDocument, UsersDocument, UsersPresencesDocument, WidgetCard, WidgetDocument, WidgetErrorBoundary, WidgetsDocument, WorkOrderCreationMethodEnum, WorkOrderPriorityEnum, WorkOrderStatusEnum, WorkOrdersDocument, WorkOrdersInsightsDocument, WorkplaceAssignmentsDocument, WorkplaceEvent, WorkplaceEventDocument, WorkplacePerformanceInsightsDocument, WorkplacesDocument, findPeriodById, generateTimeRange, getCurrentShift, getGqlWsClient, getGraphqlSdk, getNextBoundary, getRecentShift, getSdk, getShiftTimeRange, getTimeRangeLabel, getValidAggregations, normalizeShifts, periods, resolveAggregation, resolveShiftIdForPeriod, useGqlClients, LIBRARY_VERSION as version };
|
|
7380
|
+
export { AccessRequestTypeEnum, ActualStaffingCountsDocument, AndonLightColor, ApplicationInfoDocument, AssignOperatorDocument, AssignOperatorToWorkplaceDocument, AvailabilityInsightsDocument, AvailabilityStatus, BulkUpsertStaffingPlansDocument, CompanyConfigDocument, ConfirmTooltip, CounterDirectoriesDocument, CounterKindEnum, CountersDocument, CreateDashboardDocument, CreateOrderDocument, CreateProductDocument, CreateStaffingPlanDocument, CreateStatusChangeDocument, CreateUserPresenceDocument, CreateWidgetDocument, CurrentUserDocument, DashboardFilters, DashboardsDocument, DayType, DepartmentsDocument, EditWorkOrderDocument, FloorPlansDocument, GetAvailabilityInsightsDocument, GetCompanyConfigDocument, GetProductionInsightsDocument, GetStatusInsightsDocument, GetWorkOrdersInsightsDocument, GetWorkplacePerformanceInsightsDocument, GraphqlWsClient, InsightsAggregation, InsightsPeriodView, ListActualStaffingCountsDocument, ListFloorPlansDocument, ListMetricValuesDocument, ListMetricsDocument, ListReasonsDocument, ListShiftsDocument, ListStaffingPlansDocument, ListStatusChangesDocument, ListWorkOrdersDocument, ListWorkplaceAssignmentsDocument, ListWorkplacesDocument, MetricCard, MetricTypeEnum, MetricUnitEnum, MetricValuesDocument, MetricsDocument, NotificationsDocument, OrdersDocument, OrdersExecutionsDocument, PauseOrderExecutionDocument, Period, PresenceStatusEnum, ProductionInsightsDocument, ProductionMode, ProductsDocument, ReasonsDocument, ReasonsRecommendationDocument, RemoveDashboardDocument, RemoveStaffingPlanDocument, RemoveUserPresenceDocument, RemoveWidgetDocument, RemoveWorkplaceUsersPresencesDocument, RequestFeatureAccessDocument, ScreenEnum, SetCounterDocument, ShiftsDocument, SortableSelect, StaffingPlansDocument, StandardRatesDocument, StartOrderExecutionDocument, StartTrialDocument, StatusChangeTransitionPermissionsDocument, StatusChangesDocument, StatusInsightsDocument, StatusScreenDisplayBlocksEnum, StopOrderExecutionDocument, TrainingStatus, UnassignOperatorDocument, UnassignOperatorFromWorkplaceDocument, UpdateDashboardDocument, UpdateNotificationDocument, UpdateOrderDocument, UpdateOrderExecutionDocument, UpdateStaffingPlanDocument, UpdateStatusChangeDocument, UpdateWidgetDocument, UpdateWorkOrderDocument, UsersDocument, UsersPresencesDocument, WidgetCard, WidgetDocument, WidgetErrorBoundary, WidgetsDocument, WorkOrderCreationMethodEnum, WorkOrderPriorityEnum, WorkOrderStatusEnum, WorkOrdersDocument, WorkOrdersInsightsDocument, WorkplaceAssignmentsDocument, WorkplaceEvent, WorkplaceEventDocument, WorkplacePerformanceInsightsDocument, WorkplacesDocument, findPeriodById, generateTimeRange, getCurrentShift, getGqlWsClient, getGraphqlSdk, getNextBoundary, getRecentShift, getSdk, getShiftTimeRange, getTimeRangeLabel, getValidAggregations, getValidComparedPeriods, normalizeShifts, periods, resolveAggregation, resolveAutoAggregation, resolvePeriodView, resolvePeriodViewDefault, resolveShiftIdForPeriod, useGqlClients, LIBRARY_VERSION as version };
|
|
7362
7381
|
|
|
7363
7382
|
//# sourceMappingURL=index.js.map
|