@burdenoff/microfe-movethewheels 2026.1107.1 → 2026.1107.3
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/MoveTheWheelsRoutes.js +9 -5
- package/dist/components/DispatchDecisionCard.js +203 -0
- package/dist/generated/tracking-quality-operations.d.ts +137 -0
- package/dist/hooks/useDispatchPlan.js +88 -0
- package/dist/movethewheels/components/DispatchDecisionCard.d.ts +16 -0
- package/dist/movethewheels/hooks/useDispatchPlan.d.ts +79 -0
- package/dist/movethewheels/pages/DispatchPlanPage.d.ts +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/wand-sparkles.js +38 -0
- package/dist/pages/DispatchPlanPage.js +374 -0
- package/dist/pages/ReportsPage.js +289 -286
- package/dist/pages/RoutesPage.js +85 -80
- package/package.json +1 -1
- package/src/generated/tracking-quality-operations.ts +156 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +2 -0
- package/src/movethewheels/components/DispatchDecisionCard.tsx +243 -0
- package/src/movethewheels/hooks/useDispatchPlan.ts +286 -0
- package/src/movethewheels/pages/DispatchPlanPage.tsx +505 -0
- package/src/movethewheels/pages/ReportsPage.tsx +14 -4
- package/src/movethewheels/pages/RoutesPage.tsx +9 -2
|
@@ -5,343 +5,346 @@ import { LoaderCircle as r } from "../node_modules/lucide-react/dist/esm/icons/l
|
|
|
5
5
|
import { Pencil as i } from "../node_modules/lucide-react/dist/esm/icons/pencil.js";
|
|
6
6
|
import { Play as a } from "../node_modules/lucide-react/dist/esm/icons/play.js";
|
|
7
7
|
import { Plus as o } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
|
|
8
|
-
import { RefreshCw as
|
|
9
|
-
import { Trash2 as
|
|
10
|
-
import { useMoveTheWheels as
|
|
11
|
-
import { executeGraphQL as
|
|
12
|
-
import { formatCurrency as
|
|
13
|
-
import { useModuleSettings as
|
|
14
|
-
import { Badge as
|
|
15
|
-
import { PageLayout as
|
|
16
|
-
import { FormError as
|
|
17
|
-
import { Notice as
|
|
18
|
-
import { CREATE_MTW_REPORT_MUTATION as
|
|
19
|
-
import { useCallback as
|
|
20
|
-
import { Fragment as
|
|
8
|
+
import { RefreshCw as ee } from "../node_modules/lucide-react/dist/esm/icons/refresh-cw.js";
|
|
9
|
+
import { Trash2 as te } from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
|
|
10
|
+
import { useMoveTheWheels as s } from "../providers/MoveTheWheelsProvider.js";
|
|
11
|
+
import { executeGraphQL as c } from "../utils/graphqlClient.js";
|
|
12
|
+
import { formatCurrency as l, formatDate as u, formatDateTime as d, formatDistance as f, formatWeight as p } from "../utils/formatters.js";
|
|
13
|
+
import { useModuleSettings as ne } from "../providers/ModuleSettingsProvider.js";
|
|
14
|
+
import { Badge as re, Button as m, Card as h, CardContent as g, CardDescription as ie, CardHeader as ae, CardTitle as _, Dialog as oe, DialogContent as se, DialogDescription as ce, DialogFooter as le, DialogHeader as ue, DialogTitle as de, Input as v, Label as y, Select as b, SelectContent as x, SelectItem as S, SelectTrigger as C, SelectValue as w, Skeleton as T, Switch as fe, Table as pe, TableBody as me, TableCell as E, TableHead as D, TableHeader as he, TableRow as O, Textarea as k } from "../components/ui.js";
|
|
15
|
+
import { PageLayout as ge } from "../components/PageLayout.js";
|
|
16
|
+
import { FormError as A } from "../components/FormError.js";
|
|
17
|
+
import { Notice as _e, useNotice as ve } from "../components/Notice.js";
|
|
18
|
+
import { CREATE_MTW_REPORT_MUTATION as ye, DELETE_MTW_REPORT_MUTATION as be, FREQUENCY_OPTIONS as j, GENERATE_MTW_REPORT_MUTATION as xe, MTW_REPORTS_QUERY as Se, MTW_REPORT_RUNS_QUERY as Ce, MTW_REPORT_RUN_EXPORT_QUERY as we, MTW_REPORT_RUN_QUERY as Te, REPORT_TYPE_OPTIONS as M, UPDATE_MTW_REPORT_MUTATION as Ee, WEEKDAY_LABELS as N, formatCell as P, formatMetric as F, metricLabel as I, newReportInput as L, reportInputError as R, reportToInput as De, reportTypeLabel as Oe, scheduleSummary as ke, suggestedPeriodDays as z, toServiceInput as Ae } from "../utils/reports.js";
|
|
19
|
+
import { useCallback as je, useEffect as Me, useMemo as Ne, useState as B } from "react";
|
|
20
|
+
import { Fragment as Pe, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
21
|
+
import { clearGraphqlFetchResponseCache as Fe } from "@burdenoff/fe-libs/shared/graphql";
|
|
21
22
|
import { EmphasisPanel as Ie, PagePurpose as Le } from "@burdenoff/fe-libs/ui";
|
|
22
|
-
import { PermissionProvider as
|
|
23
|
+
import { PermissionProvider as U, usePermissions as Re } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
23
24
|
//#region src/movethewheels/pages/ReportsPage.tsx
|
|
24
|
-
var
|
|
25
|
-
currency:
|
|
26
|
-
distance:
|
|
27
|
-
weight:
|
|
25
|
+
var W = {
|
|
26
|
+
currency: l,
|
|
27
|
+
distance: f,
|
|
28
|
+
weight: p
|
|
28
29
|
};
|
|
29
30
|
function ze(e, t, n) {
|
|
30
31
|
let r = URL.createObjectURL(new Blob([t], { type: n })), i = document.createElement("a");
|
|
31
32
|
i.href = r, i.download = e, document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function G(e, t) {
|
|
34
35
|
return e instanceof Error && e.message ? e.message : t;
|
|
35
36
|
}
|
|
36
37
|
function Be(e) {
|
|
37
38
|
return e === "COMPLETED" ? "default" : e === "FAILED" ? "destructive" : e === "RUNNING" ? "secondary" : "outline";
|
|
38
39
|
}
|
|
39
40
|
function Ve(e) {
|
|
40
|
-
return `${
|
|
41
|
+
return `${d(e.periodStart)} – ${d(e.periodEnd)}`;
|
|
41
42
|
}
|
|
42
43
|
function He() {
|
|
43
|
-
let { workspaceId: e } =
|
|
44
|
-
return /* @__PURE__ */
|
|
44
|
+
let { workspaceId: e } = s();
|
|
45
|
+
return /* @__PURE__ */ V(U, {
|
|
45
46
|
scopeId: e ?? null,
|
|
46
47
|
gateway: "workspace",
|
|
47
|
-
children: /* @__PURE__ */
|
|
48
|
+
children: /* @__PURE__ */ V(K, {})
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
let { apiGatewayUrl: t, authToken:
|
|
51
|
+
function K() {
|
|
52
|
+
let { apiGatewayUrl: t, authToken: l, workspaceToken: u, workspaceId: f, tenantId: p, currentUser: v } = s(), { settings: y } = ne(), b = Re(), x = Ne(() => ({
|
|
52
53
|
apiGatewayUrl: t,
|
|
53
|
-
authToken:
|
|
54
|
-
workspaceToken:
|
|
55
|
-
workspaceId:
|
|
56
|
-
tenantId:
|
|
57
|
-
actorId:
|
|
54
|
+
authToken: l,
|
|
55
|
+
workspaceToken: u,
|
|
56
|
+
workspaceId: f,
|
|
57
|
+
tenantId: p,
|
|
58
|
+
actorId: v?.id
|
|
58
59
|
}), [
|
|
59
60
|
t,
|
|
60
|
-
|
|
61
|
+
l,
|
|
62
|
+
u,
|
|
61
63
|
f,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
p,
|
|
65
|
+
v?.id
|
|
66
|
+
]), [S, C] = B([]), [w, fe] = B(!0), [k, j] = B(null), [N, P] = B(null), [F, I] = B([]), [L, R] = B(null), [De, z] = B(!1), [U, W] = B(null), [He, K] = B(null), [Ge, q] = B(null), [J, Y] = B(null), [Ke, qe] = B(0), X = je(() => {
|
|
67
|
+
Fe(), qe((e) => e + 1);
|
|
68
|
+
}, []), { message: Je, notify: Ye } = ve(), Xe = !!(f && v?.id && b.scopeId === f && !b.isLoading && !b.error), Z = je((e) => !Xe || b.isSuperAdmin || b.hasPermission(`mtw-report:${e}`), [Xe, b]), Q = S.find((e) => e.id === N) ?? null;
|
|
69
|
+
Me(() => {
|
|
70
|
+
if (!x.workspaceId) return;
|
|
68
71
|
let e = !1;
|
|
69
|
-
return
|
|
70
|
-
e || (
|
|
72
|
+
return fe(!0), c(x, Se, { pagination: { limit: 100 } }).then((t) => {
|
|
73
|
+
e || (C(t.mtwReports), j(null), P((e) => e && t.mtwReports.some((t) => t.id === e) ? e : t.mtwReports[0]?.id ?? null));
|
|
71
74
|
}).catch((t) => {
|
|
72
|
-
e ||
|
|
75
|
+
e || j(G(t, "Could not load the reports"));
|
|
73
76
|
}).finally(() => {
|
|
74
|
-
e ||
|
|
77
|
+
e || fe(!1);
|
|
75
78
|
}), () => {
|
|
76
79
|
e = !0;
|
|
77
80
|
};
|
|
78
|
-
}, [
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
+
}, [x, Ke]);
|
|
82
|
+
let Ze = je(async (e) => {
|
|
83
|
+
z(!0);
|
|
81
84
|
try {
|
|
82
|
-
|
|
85
|
+
R((await c(x, Te, {
|
|
83
86
|
id: e,
|
|
84
87
|
rows: { limit: 50 }
|
|
85
88
|
})).mtwReportRun);
|
|
86
89
|
} catch (e) {
|
|
87
|
-
G(
|
|
90
|
+
K(G(e, "Could not load the report run"));
|
|
88
91
|
} finally {
|
|
89
|
-
|
|
92
|
+
z(!1);
|
|
90
93
|
}
|
|
91
|
-
}, [
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
+
}, [x]), $ = Q?.latestRun?.id ?? null;
|
|
95
|
+
Me(() => {
|
|
96
|
+
if (I([]), R(null), !N) return;
|
|
94
97
|
let e = !1;
|
|
95
|
-
return
|
|
96
|
-
reportId:
|
|
98
|
+
return c(x, Ce, {
|
|
99
|
+
reportId: N,
|
|
97
100
|
pagination: { limit: 30 }
|
|
98
101
|
}).then((t) => {
|
|
99
|
-
e ||
|
|
102
|
+
e || I(t.mtwReportRuns);
|
|
100
103
|
}).catch((t) => {
|
|
101
|
-
e || G(
|
|
102
|
-
}), $ &&
|
|
104
|
+
e || K(G(t, "Could not load the run history"));
|
|
105
|
+
}), $ && Ze($), () => {
|
|
103
106
|
e = !0;
|
|
104
107
|
};
|
|
105
108
|
}, [
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
x,
|
|
110
|
+
N,
|
|
108
111
|
$,
|
|
109
|
-
|
|
112
|
+
Ze
|
|
110
113
|
]);
|
|
111
|
-
let
|
|
112
|
-
|
|
114
|
+
let Qe = async (e) => {
|
|
115
|
+
W(`generate:${e.id}`), K(null);
|
|
113
116
|
try {
|
|
114
|
-
let t = (await
|
|
115
|
-
t.status === "COMPLETED" ?
|
|
117
|
+
let t = (await c(x, xe, { id: e.id }, "SINGLE_ATTEMPT")).generateMtwReport;
|
|
118
|
+
t.status === "COMPLETED" ? Ye(`"${e.name}" generated.`) : K(t.error ?? "The report could not be generated."), P(e.id), X();
|
|
116
119
|
} catch (e) {
|
|
117
|
-
G(
|
|
120
|
+
K(G(e, "Could not generate the report"));
|
|
118
121
|
} finally {
|
|
119
|
-
|
|
122
|
+
W(null);
|
|
120
123
|
}
|
|
121
|
-
},
|
|
122
|
-
|
|
124
|
+
}, $e = async (e, t) => {
|
|
125
|
+
W(`download:${e}:${t}`), K(null);
|
|
123
126
|
try {
|
|
124
|
-
let n = (await
|
|
127
|
+
let n = (await c(x, we, {
|
|
125
128
|
runId: e,
|
|
126
129
|
format: t
|
|
127
130
|
})).mtwReportRunExport;
|
|
128
131
|
ze(n.filename, n.content, n.contentType);
|
|
129
132
|
} catch (e) {
|
|
130
|
-
G(
|
|
133
|
+
K(G(e, "Could not download the report"));
|
|
131
134
|
} finally {
|
|
132
|
-
|
|
135
|
+
W(null);
|
|
133
136
|
}
|
|
134
|
-
},
|
|
135
|
-
|
|
137
|
+
}, et = async (e) => {
|
|
138
|
+
W(`delete:${e.id}`), K(null);
|
|
136
139
|
try {
|
|
137
|
-
await
|
|
140
|
+
await c(x, be, { id: e.id }, "SINGLE_ATTEMPT"), Ye(`"${e.name}" deleted.`), Y(null), N === e.id && P(null), X();
|
|
138
141
|
} catch (e) {
|
|
139
|
-
G(
|
|
142
|
+
K(G(e, "Could not delete the report"));
|
|
140
143
|
} finally {
|
|
141
|
-
|
|
144
|
+
W(null);
|
|
142
145
|
}
|
|
143
146
|
};
|
|
144
|
-
return /* @__PURE__ */
|
|
147
|
+
return /* @__PURE__ */ H(ge, {
|
|
145
148
|
title: "Reports",
|
|
146
149
|
subtitle: "Scheduled and on-demand reports over your logistics data",
|
|
147
|
-
icon: /* @__PURE__ */
|
|
150
|
+
icon: /* @__PURE__ */ V(n, { size: 24 }),
|
|
148
151
|
maxWidth: "full",
|
|
149
|
-
headerActions: /* @__PURE__ */
|
|
152
|
+
headerActions: /* @__PURE__ */ H("div", {
|
|
150
153
|
className: "flex flex-wrap gap-2",
|
|
151
|
-
children: [/* @__PURE__ */
|
|
154
|
+
children: [/* @__PURE__ */ H(m, {
|
|
152
155
|
variant: "outline",
|
|
153
|
-
onClick:
|
|
154
|
-
children: [/* @__PURE__ */
|
|
156
|
+
onClick: X,
|
|
157
|
+
children: [/* @__PURE__ */ V(ee, {
|
|
155
158
|
size: 16,
|
|
156
159
|
className: "mr-2"
|
|
157
160
|
}), " Refresh"]
|
|
158
|
-
}), Z("create") && /* @__PURE__ */
|
|
161
|
+
}), Z("create") && /* @__PURE__ */ H(m, {
|
|
159
162
|
onClick: () => q("new"),
|
|
160
|
-
children: [/* @__PURE__ */
|
|
163
|
+
children: [/* @__PURE__ */ V(o, {
|
|
161
164
|
size: 16,
|
|
162
165
|
className: "mr-2"
|
|
163
166
|
}), " New report"]
|
|
164
167
|
})]
|
|
165
168
|
}),
|
|
166
169
|
children: [
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
icon: /* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ V(Le, {
|
|
171
|
+
icon: /* @__PURE__ */ V(n, { size: 18 }),
|
|
169
172
|
children: "Save the reports you need and generate them whenever you like, or have them generated every day, week or month. Each generation keeps its figures and rows so you can compare periods and download them as CSV or JSON."
|
|
170
173
|
}),
|
|
171
|
-
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
174
|
+
k && /* @__PURE__ */ V(A, { message: k }),
|
|
175
|
+
/* @__PURE__ */ V(A, { message: He }),
|
|
176
|
+
/* @__PURE__ */ V(_e, { message: Je }),
|
|
177
|
+
/* @__PURE__ */ H("div", {
|
|
175
178
|
className: "grid grid-cols-1 gap-6 xl:grid-cols-3",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
179
|
+
children: [/* @__PURE__ */ H(Ie, {
|
|
177
180
|
className: "space-y-3 xl:col-span-1",
|
|
178
|
-
children: [/* @__PURE__ */
|
|
181
|
+
children: [/* @__PURE__ */ V("h2", {
|
|
179
182
|
className: "text-base font-semibold text-text-primary",
|
|
180
183
|
children: "Saved reports"
|
|
181
|
-
}),
|
|
184
|
+
}), w && S.length === 0 ? /* @__PURE__ */ H("div", {
|
|
182
185
|
className: "space-y-3",
|
|
183
186
|
"aria-busy": "true",
|
|
184
|
-
children: [/* @__PURE__ */
|
|
185
|
-
}) :
|
|
187
|
+
children: [/* @__PURE__ */ V(T, { className: "h-16 w-full" }), /* @__PURE__ */ V(T, { className: "h-16 w-full" })]
|
|
188
|
+
}) : S.length === 0 ? /* @__PURE__ */ H("div", {
|
|
186
189
|
className: "rounded-lg border border-dashed border-border-default p-6 text-center text-sm text-text-secondary",
|
|
187
|
-
children: [/* @__PURE__ */
|
|
190
|
+
children: [/* @__PURE__ */ V("p", { children: "No reports yet." }), Z("create") && /* @__PURE__ */ H(m, {
|
|
188
191
|
className: "mt-4",
|
|
189
192
|
onClick: () => q("new"),
|
|
190
|
-
children: [/* @__PURE__ */
|
|
193
|
+
children: [/* @__PURE__ */ V(o, {
|
|
191
194
|
size: 16,
|
|
192
195
|
className: "mr-2"
|
|
193
196
|
}), " Create your first report"]
|
|
194
197
|
})]
|
|
195
|
-
}) : /* @__PURE__ */
|
|
198
|
+
}) : /* @__PURE__ */ V("ul", {
|
|
196
199
|
className: "space-y-2",
|
|
197
200
|
"aria-label": "Saved reports",
|
|
198
|
-
children:
|
|
201
|
+
children: S.map((e) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H("button", {
|
|
199
202
|
type: "button",
|
|
200
|
-
onClick: () =>
|
|
201
|
-
"aria-current": e.id ===
|
|
202
|
-
className: `w-full rounded-lg border px-3 py-2 text-left transition-colors ${e.id ===
|
|
203
|
+
onClick: () => P(e.id),
|
|
204
|
+
"aria-current": e.id === N ? "true" : void 0,
|
|
205
|
+
className: `w-full rounded-lg border px-3 py-2 text-left transition-colors ${e.id === N ? "border-border-primary bg-surface-secondary" : "border-border-default hover:bg-surface-secondary"}`,
|
|
203
206
|
children: [
|
|
204
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ H("span", {
|
|
205
208
|
className: "flex items-center justify-between gap-2",
|
|
206
|
-
children: [/* @__PURE__ */
|
|
209
|
+
children: [/* @__PURE__ */ V("span", {
|
|
207
210
|
className: "truncate text-sm font-medium text-text-primary",
|
|
208
211
|
children: e.name
|
|
209
|
-
}), /* @__PURE__ */
|
|
212
|
+
}), /* @__PURE__ */ V(re, {
|
|
210
213
|
variant: "outline",
|
|
211
214
|
children: Oe(e.type)
|
|
212
215
|
})]
|
|
213
216
|
}),
|
|
214
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ V("span", {
|
|
215
218
|
className: "mt-1 block text-xs text-text-secondary",
|
|
216
219
|
children: ke(e)
|
|
217
220
|
}),
|
|
218
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ V("span", {
|
|
219
222
|
className: "mt-1 block text-xs text-text-tertiary",
|
|
220
|
-
children: e.lastGeneratedAt ? `Last generated ${
|
|
223
|
+
children: e.lastGeneratedAt ? `Last generated ${d(e.lastGeneratedAt)}` : "Never generated"
|
|
221
224
|
})
|
|
222
225
|
]
|
|
223
226
|
}) }, e.id))
|
|
224
227
|
})]
|
|
225
|
-
}), /* @__PURE__ */
|
|
228
|
+
}), /* @__PURE__ */ V("div", {
|
|
226
229
|
className: "space-y-6 xl:col-span-2",
|
|
227
|
-
children: Q ? /* @__PURE__ */
|
|
228
|
-
/* @__PURE__ */
|
|
230
|
+
children: Q ? /* @__PURE__ */ H(Pe, { children: [
|
|
231
|
+
/* @__PURE__ */ V(h, { children: /* @__PURE__ */ H(ae, {
|
|
229
232
|
className: "flex flex-row flex-wrap items-start justify-between gap-3",
|
|
230
|
-
children: [/* @__PURE__ */
|
|
233
|
+
children: [/* @__PURE__ */ H("div", {
|
|
231
234
|
className: "min-w-0 space-y-1",
|
|
232
235
|
children: [
|
|
233
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ V(_, {
|
|
234
237
|
className: "text-lg",
|
|
235
238
|
children: Q.name
|
|
236
239
|
}),
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ V(ie, { children: Q.description || M.find((e) => e.value === Q.type)?.description }),
|
|
241
|
+
/* @__PURE__ */ H("p", {
|
|
239
242
|
className: "flex flex-wrap items-center gap-2 text-xs text-text-secondary",
|
|
240
243
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ V(e, { size: 14 }),
|
|
245
|
+
/* @__PURE__ */ V("span", { children: ke(Q) }),
|
|
246
|
+
/* @__PURE__ */ H("span", { children: [
|
|
244
247
|
"· Covers the last ",
|
|
245
248
|
Q.periodDays,
|
|
246
249
|
" day(s)"
|
|
247
250
|
] }),
|
|
248
|
-
Q.nextRunAt && /* @__PURE__ */
|
|
251
|
+
Q.nextRunAt && /* @__PURE__ */ H("span", { children: ["· Next run ", d(Q.nextRunAt)] })
|
|
249
252
|
]
|
|
250
253
|
})
|
|
251
254
|
]
|
|
252
|
-
}), /* @__PURE__ */
|
|
255
|
+
}), /* @__PURE__ */ H("div", {
|
|
253
256
|
className: "flex flex-wrap gap-2",
|
|
254
257
|
children: [
|
|
255
|
-
Z("generate") && /* @__PURE__ */
|
|
256
|
-
onClick: () => void
|
|
257
|
-
disabled:
|
|
258
|
+
Z("generate") && /* @__PURE__ */ H(m, {
|
|
259
|
+
onClick: () => void Qe(Q),
|
|
260
|
+
disabled: U !== null,
|
|
258
261
|
"aria-label": `Generate ${Q.name} now`,
|
|
259
|
-
children: [
|
|
262
|
+
children: [U === `generate:${Q.id}` ? /* @__PURE__ */ V(r, {
|
|
260
263
|
size: 16,
|
|
261
264
|
className: "mr-2 animate-spin"
|
|
262
|
-
}) : /* @__PURE__ */
|
|
265
|
+
}) : /* @__PURE__ */ V(a, {
|
|
263
266
|
size: 16,
|
|
264
267
|
className: "mr-2"
|
|
265
268
|
}), "Generate now"]
|
|
266
269
|
}),
|
|
267
|
-
Z("update") && /* @__PURE__ */
|
|
270
|
+
Z("update") && /* @__PURE__ */ H(m, {
|
|
268
271
|
variant: "outline",
|
|
269
272
|
onClick: () => q(Q),
|
|
270
|
-
disabled:
|
|
271
|
-
children: [/* @__PURE__ */
|
|
273
|
+
disabled: U !== null,
|
|
274
|
+
children: [/* @__PURE__ */ V(i, {
|
|
272
275
|
size: 16,
|
|
273
276
|
className: "mr-2"
|
|
274
277
|
}), " Edit"]
|
|
275
278
|
}),
|
|
276
|
-
Z("delete") && /* @__PURE__ */
|
|
279
|
+
Z("delete") && /* @__PURE__ */ V(m, {
|
|
277
280
|
variant: "outline",
|
|
278
281
|
onClick: () => Y(Q),
|
|
279
|
-
disabled:
|
|
282
|
+
disabled: U !== null,
|
|
280
283
|
"aria-label": `Delete ${Q.name}`,
|
|
281
|
-
children: /* @__PURE__ */
|
|
284
|
+
children: /* @__PURE__ */ V(te, { size: 16 })
|
|
282
285
|
})
|
|
283
286
|
]
|
|
284
287
|
})]
|
|
285
288
|
}) }),
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
run:
|
|
289
|
+
/* @__PURE__ */ V(Ue, {
|
|
290
|
+
run: L,
|
|
288
291
|
isLoading: De,
|
|
289
292
|
hasRuns: !!Q.latestRun,
|
|
290
|
-
busy:
|
|
291
|
-
onDownload: (e, t) => void
|
|
293
|
+
busy: U,
|
|
294
|
+
onDownload: (e, t) => void $e(e, t)
|
|
292
295
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ H(h, { children: [/* @__PURE__ */ H(ae, { children: [/* @__PURE__ */ V(_, {
|
|
294
297
|
className: "text-base",
|
|
295
298
|
children: "Run history"
|
|
296
|
-
}), /* @__PURE__ */
|
|
299
|
+
}), /* @__PURE__ */ V(ie, { children: "The latest 30 generations are kept. Select one to preview it." })] }), /* @__PURE__ */ V(g, { children: F.length === 0 ? /* @__PURE__ */ V("p", {
|
|
297
300
|
className: "text-sm text-text-secondary",
|
|
298
301
|
children: "No runs yet."
|
|
299
|
-
}) : /* @__PURE__ */
|
|
302
|
+
}) : /* @__PURE__ */ V("div", {
|
|
300
303
|
className: "overflow-x-auto",
|
|
301
|
-
children: /* @__PURE__ */
|
|
302
|
-
/* @__PURE__ */
|
|
303
|
-
/* @__PURE__ */
|
|
304
|
-
/* @__PURE__ */
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
-
/* @__PURE__ */
|
|
304
|
+
children: /* @__PURE__ */ H(pe, { children: [/* @__PURE__ */ V(he, { children: /* @__PURE__ */ H(O, { children: [
|
|
305
|
+
/* @__PURE__ */ V(D, { children: "Generated" }),
|
|
306
|
+
/* @__PURE__ */ V(D, { children: "Period" }),
|
|
307
|
+
/* @__PURE__ */ V(D, { children: "Trigger" }),
|
|
308
|
+
/* @__PURE__ */ V(D, { children: "Status" }),
|
|
309
|
+
/* @__PURE__ */ V(D, {
|
|
307
310
|
className: "text-right",
|
|
308
311
|
children: "Rows"
|
|
309
312
|
}),
|
|
310
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ V(D, {
|
|
311
314
|
className: "text-right",
|
|
312
315
|
children: "Download"
|
|
313
316
|
})
|
|
314
|
-
] }) }), /* @__PURE__ */
|
|
315
|
-
className: e.id ===
|
|
317
|
+
] }) }), /* @__PURE__ */ V(me, { children: F.map((e) => /* @__PURE__ */ H(O, {
|
|
318
|
+
className: e.id === L?.id ? "bg-surface-secondary" : void 0,
|
|
316
319
|
children: [
|
|
317
|
-
/* @__PURE__ */
|
|
320
|
+
/* @__PURE__ */ V(E, { children: /* @__PURE__ */ V("button", {
|
|
318
321
|
type: "button",
|
|
319
322
|
className: "text-left font-medium text-text-primary underline-offset-2 hover:underline",
|
|
320
|
-
onClick: () => void
|
|
321
|
-
children:
|
|
323
|
+
onClick: () => void Ze(e.id),
|
|
324
|
+
children: d(e.startedAt)
|
|
322
325
|
}) }),
|
|
323
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ V(E, {
|
|
324
327
|
className: "whitespace-nowrap text-xs",
|
|
325
328
|
children: Ve(e)
|
|
326
329
|
}),
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ V(E, { children: e.trigger === "SCHEDULED" ? "Scheduled" : "Manual" }),
|
|
331
|
+
/* @__PURE__ */ V(E, { children: /* @__PURE__ */ V(re, {
|
|
329
332
|
variant: Be(e.status),
|
|
330
333
|
children: e.status
|
|
331
334
|
}) }),
|
|
332
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ V(E, {
|
|
333
336
|
className: "text-right",
|
|
334
337
|
children: e.rowCount.toLocaleString()
|
|
335
338
|
}),
|
|
336
|
-
/* @__PURE__ */
|
|
339
|
+
/* @__PURE__ */ V(E, {
|
|
337
340
|
className: "text-right",
|
|
338
|
-
children: e.status === "COMPLETED" ? /* @__PURE__ */
|
|
341
|
+
children: e.status === "COMPLETED" ? /* @__PURE__ */ V("span", {
|
|
339
342
|
className: "inline-flex gap-1",
|
|
340
|
-
children: ["CSV", "JSON"].map((t) => /* @__PURE__ */
|
|
343
|
+
children: ["CSV", "JSON"].map((t) => /* @__PURE__ */ V(m, {
|
|
341
344
|
variant: "ghost",
|
|
342
345
|
size: "sm",
|
|
343
|
-
disabled:
|
|
344
|
-
onClick: () => void
|
|
346
|
+
disabled: U !== null,
|
|
347
|
+
onClick: () => void $e(e.id, t),
|
|
345
348
|
children: t
|
|
346
349
|
}, t))
|
|
347
350
|
}) : "—"
|
|
@@ -349,36 +352,36 @@ function G() {
|
|
|
349
352
|
]
|
|
350
353
|
}, e.id)) })] })
|
|
351
354
|
}) })] })
|
|
352
|
-
] }) : !
|
|
355
|
+
] }) : !w && /* @__PURE__ */ V(h, { children: /* @__PURE__ */ V(g, {
|
|
353
356
|
className: "p-6 text-sm text-text-secondary",
|
|
354
357
|
children: "Select a report to see its latest figures and run history."
|
|
355
358
|
}) })
|
|
356
359
|
})]
|
|
357
360
|
}),
|
|
358
|
-
|
|
359
|
-
report:
|
|
360
|
-
defaultTimezone:
|
|
361
|
+
Ge && /* @__PURE__ */ V(We, {
|
|
362
|
+
report: Ge === "new" ? null : Ge,
|
|
363
|
+
defaultTimezone: y.timezone ?? "UTC",
|
|
361
364
|
onClose: () => q(null),
|
|
362
365
|
onSave: async (e, t) => {
|
|
363
|
-
let n = t ? await
|
|
366
|
+
let n = t ? await c(x, Ee, {
|
|
364
367
|
id: t.id,
|
|
365
|
-
input:
|
|
366
|
-
}, "SINGLE_ATTEMPT").then((e) => e.updateMtwReport) : await
|
|
367
|
-
|
|
368
|
+
input: Ae(e)
|
|
369
|
+
}, "SINGLE_ATTEMPT").then((e) => e.updateMtwReport) : await c(x, ye, { input: Ae(e) }, "SINGLE_ATTEMPT").then((e) => e.createMtwReport);
|
|
370
|
+
Ye(t ? `"${n.name}" saved.` : `"${n.name}" created.`), q(null), P(n.id), X();
|
|
368
371
|
}
|
|
369
372
|
}),
|
|
370
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ V(oe, {
|
|
371
374
|
open: J !== null,
|
|
372
375
|
onOpenChange: (e) => !e && Y(null),
|
|
373
|
-
children: /* @__PURE__ */
|
|
376
|
+
children: /* @__PURE__ */ H(se, { children: [/* @__PURE__ */ H(ue, { children: [/* @__PURE__ */ V(de, { children: "Delete this report?" }), /* @__PURE__ */ V(ce, { children: J ? `"${J.name}" stops being generated and leaves the list. This cannot be undone.` : "" })] }), /* @__PURE__ */ H(le, { children: [/* @__PURE__ */ V(m, {
|
|
374
377
|
variant: "outline",
|
|
375
378
|
onClick: () => Y(null),
|
|
376
379
|
children: "Cancel"
|
|
377
|
-
}), /* @__PURE__ */
|
|
380
|
+
}), /* @__PURE__ */ H(m, {
|
|
378
381
|
variant: "destructive",
|
|
379
|
-
disabled:
|
|
380
|
-
onClick: () => J && void
|
|
381
|
-
children: [
|
|
382
|
+
disabled: U !== null,
|
|
383
|
+
onClick: () => J && void et(J),
|
|
384
|
+
children: [U?.startsWith("delete:") && /* @__PURE__ */ V(r, {
|
|
382
385
|
size: 16,
|
|
383
386
|
className: "mr-2 animate-spin"
|
|
384
387
|
}), "Delete report"]
|
|
@@ -388,67 +391,67 @@ function G() {
|
|
|
388
391
|
});
|
|
389
392
|
}
|
|
390
393
|
function Ue({ run: e, isLoading: n, hasRuns: i, busy: a, onDownload: o }) {
|
|
391
|
-
return n && !e ? /* @__PURE__ */
|
|
394
|
+
return n && !e ? /* @__PURE__ */ V(h, { children: /* @__PURE__ */ H(g, {
|
|
392
395
|
className: "space-y-3 p-6",
|
|
393
396
|
"aria-busy": "true",
|
|
394
|
-
children: [/* @__PURE__ */
|
|
395
|
-
}) }) : e ? /* @__PURE__ */
|
|
397
|
+
children: [/* @__PURE__ */ V(T, { className: "h-20 w-full" }), /* @__PURE__ */ V(T, { className: "h-40 w-full" })]
|
|
398
|
+
}) }) : e ? /* @__PURE__ */ H(h, {
|
|
396
399
|
"data-testid": "mtw-report-run",
|
|
397
|
-
children: [/* @__PURE__ */
|
|
400
|
+
children: [/* @__PURE__ */ H(ae, {
|
|
398
401
|
className: "flex flex-row flex-wrap items-start justify-between gap-3",
|
|
399
|
-
children: [/* @__PURE__ */
|
|
402
|
+
children: [/* @__PURE__ */ H("div", {
|
|
400
403
|
className: "space-y-1",
|
|
401
|
-
children: [/* @__PURE__ */
|
|
404
|
+
children: [/* @__PURE__ */ H(_, {
|
|
402
405
|
className: "text-base",
|
|
403
406
|
children: [
|
|
404
407
|
e.trigger === "SCHEDULED" ? "Scheduled run" : "Run",
|
|
405
408
|
" of",
|
|
406
409
|
" ",
|
|
407
|
-
|
|
410
|
+
d(e.startedAt)
|
|
408
411
|
]
|
|
409
|
-
}), /* @__PURE__ */
|
|
410
|
-
}), /* @__PURE__ */
|
|
412
|
+
}), /* @__PURE__ */ H(ie, { children: ["Covers ", Ve(e)] })]
|
|
413
|
+
}), /* @__PURE__ */ H("div", {
|
|
411
414
|
className: "flex items-center gap-2",
|
|
412
|
-
children: [/* @__PURE__ */
|
|
415
|
+
children: [/* @__PURE__ */ V(re, {
|
|
413
416
|
variant: Be(e.status),
|
|
414
417
|
children: e.status
|
|
415
|
-
}), e.status === "COMPLETED" && ["CSV", "JSON"].map((n) => /* @__PURE__ */
|
|
418
|
+
}), e.status === "COMPLETED" && ["CSV", "JSON"].map((n) => /* @__PURE__ */ H(m, {
|
|
416
419
|
variant: "outline",
|
|
417
420
|
size: "sm",
|
|
418
421
|
disabled: a !== null,
|
|
419
422
|
onClick: () => o(e.id, n),
|
|
420
|
-
children: [a === `download:${e.id}:${n}` ? /* @__PURE__ */
|
|
423
|
+
children: [a === `download:${e.id}:${n}` ? /* @__PURE__ */ V(r, {
|
|
421
424
|
size: 14,
|
|
422
425
|
className: "mr-2 animate-spin"
|
|
423
|
-
}) : /* @__PURE__ */
|
|
426
|
+
}) : /* @__PURE__ */ V(t, {
|
|
424
427
|
size: 14,
|
|
425
428
|
className: "mr-2"
|
|
426
429
|
}), n]
|
|
427
430
|
}, n))]
|
|
428
431
|
})]
|
|
429
|
-
}), /* @__PURE__ */
|
|
432
|
+
}), /* @__PURE__ */ H(g, {
|
|
430
433
|
className: "space-y-6",
|
|
431
434
|
children: [
|
|
432
|
-
e.status === "FAILED" && /* @__PURE__ */
|
|
433
|
-
e.metrics.length > 0 && /* @__PURE__ */
|
|
435
|
+
e.status === "FAILED" && /* @__PURE__ */ V(A, { message: e.error ?? "This run failed." }),
|
|
436
|
+
e.metrics.length > 0 && /* @__PURE__ */ V("dl", {
|
|
434
437
|
className: "grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-4",
|
|
435
|
-
children: e.metrics.map((e) => /* @__PURE__ */
|
|
438
|
+
children: e.metrics.map((e) => /* @__PURE__ */ H("div", {
|
|
436
439
|
className: "rounded-lg border border-border-default px-3 py-2",
|
|
437
|
-
children: [/* @__PURE__ */
|
|
440
|
+
children: [/* @__PURE__ */ V("dt", {
|
|
438
441
|
className: "text-xs text-text-secondary",
|
|
439
|
-
children:
|
|
440
|
-
}), /* @__PURE__ */
|
|
442
|
+
children: I(e)
|
|
443
|
+
}), /* @__PURE__ */ V("dd", {
|
|
441
444
|
className: "text-lg font-semibold text-text-primary",
|
|
442
|
-
children:
|
|
445
|
+
children: F(e, W)
|
|
443
446
|
})]
|
|
444
447
|
}, e.key))
|
|
445
448
|
}),
|
|
446
|
-
e.status === "COMPLETED" && (e.rowCount === 0 ? /* @__PURE__ */
|
|
449
|
+
e.status === "COMPLETED" && (e.rowCount === 0 ? /* @__PURE__ */ V("p", {
|
|
447
450
|
className: "text-sm text-text-secondary",
|
|
448
451
|
children: "The period had no rows for this report."
|
|
449
|
-
}) : /* @__PURE__ */
|
|
452
|
+
}) : /* @__PURE__ */ H("div", {
|
|
450
453
|
className: "space-y-2",
|
|
451
|
-
children: [/* @__PURE__ */
|
|
454
|
+
children: [/* @__PURE__ */ H("p", {
|
|
452
455
|
className: "text-xs text-text-secondary",
|
|
453
456
|
children: [
|
|
454
457
|
"Showing ",
|
|
@@ -459,252 +462,252 @@ function Ue({ run: e, isLoading: n, hasRuns: i, busy: a, onDownload: o }) {
|
|
|
459
462
|
" rows. Download the run for all of them.",
|
|
460
463
|
e.truncated && " The period had more rows than a run keeps (5,000); the figures above still cover all of them."
|
|
461
464
|
]
|
|
462
|
-
}), /* @__PURE__ */
|
|
465
|
+
}), /* @__PURE__ */ V("div", {
|
|
463
466
|
className: "max-h-[28rem] overflow-auto rounded-lg border border-border-default",
|
|
464
|
-
children: /* @__PURE__ */
|
|
467
|
+
children: /* @__PURE__ */ H(pe, { children: [/* @__PURE__ */ V(he, { children: /* @__PURE__ */ V(O, { children: e.columns.map((e) => /* @__PURE__ */ V(D, {
|
|
465
468
|
className: "whitespace-nowrap",
|
|
466
469
|
children: e.label
|
|
467
|
-
}, e.key)) }) }), /* @__PURE__ */
|
|
470
|
+
}, e.key)) }) }), /* @__PURE__ */ V(me, { children: e.rows.map((t, n) => /* @__PURE__ */ V(O, { children: e.columns.map((e) => /* @__PURE__ */ V(E, {
|
|
468
471
|
className: "whitespace-nowrap text-xs",
|
|
469
|
-
children: e.kind === "CURRENCY" && typeof t[e.key] == "number" ?
|
|
472
|
+
children: e.kind === "CURRENCY" && typeof t[e.key] == "number" ? l(t[e.key], typeof t.currency == "string" ? t.currency : void 0) : P(t[e.key], e, (e) => u(e))
|
|
470
473
|
}, e.key)) }, n)) })] })
|
|
471
474
|
})]
|
|
472
475
|
}))
|
|
473
476
|
]
|
|
474
477
|
})]
|
|
475
|
-
}) : /* @__PURE__ */
|
|
478
|
+
}) : /* @__PURE__ */ V(h, { children: /* @__PURE__ */ V(g, {
|
|
476
479
|
className: "p-6 text-sm text-text-secondary",
|
|
477
480
|
children: i ? "Select a run to preview it." : "This report has not been generated yet. Use \"Generate now\" to produce the first run."
|
|
478
481
|
}) });
|
|
479
482
|
}
|
|
480
483
|
function We({ report: e, defaultTimezone: t, onClose: n, onSave: i }) {
|
|
481
|
-
let [a, o] =
|
|
484
|
+
let [a, o] = B(() => e ? De(e) : L(t)), [ee, te] = B(String(a.periodDays)), [s, c] = B(!1), [l, u] = B(null), d = {
|
|
482
485
|
...a,
|
|
483
|
-
periodDays: Number(
|
|
484
|
-
},
|
|
485
|
-
|
|
486
|
+
periodDays: Number(ee)
|
|
487
|
+
}, f = R(d), p = (e, t) => {
|
|
488
|
+
u(null), o((n) => ({
|
|
486
489
|
...n,
|
|
487
490
|
[e]: t
|
|
488
491
|
}));
|
|
489
|
-
},
|
|
490
|
-
if (t.preventDefault(),
|
|
491
|
-
f
|
|
492
|
+
}, ne = async (t) => {
|
|
493
|
+
if (t.preventDefault(), f) {
|
|
494
|
+
u(f);
|
|
492
495
|
return;
|
|
493
496
|
}
|
|
494
|
-
|
|
497
|
+
c(!0), u(null);
|
|
495
498
|
try {
|
|
496
|
-
await i(
|
|
499
|
+
await i(d, e);
|
|
497
500
|
} catch (e) {
|
|
498
|
-
|
|
501
|
+
u(G(e, "Could not save the report"));
|
|
499
502
|
} finally {
|
|
500
|
-
|
|
503
|
+
c(!1);
|
|
501
504
|
}
|
|
502
505
|
};
|
|
503
|
-
return /* @__PURE__ */
|
|
506
|
+
return /* @__PURE__ */ V(oe, {
|
|
504
507
|
open: !0,
|
|
505
|
-
onOpenChange: (e) => !e && !
|
|
506
|
-
children: /* @__PURE__ */
|
|
508
|
+
onOpenChange: (e) => !e && !s && n(),
|
|
509
|
+
children: /* @__PURE__ */ H(se, {
|
|
507
510
|
className: "max-h-[90vh] overflow-y-auto sm:max-w-xl",
|
|
508
|
-
children: [/* @__PURE__ */
|
|
511
|
+
children: [/* @__PURE__ */ H(ue, { children: [/* @__PURE__ */ V(de, { children: e ? "Edit report" : "New report" }), /* @__PURE__ */ V(ce, { children: "Choose what the report covers and, if you like, when it is generated automatically." })] }), /* @__PURE__ */ H("form", {
|
|
509
512
|
className: "space-y-4",
|
|
510
|
-
onSubmit: (e) => void
|
|
513
|
+
onSubmit: (e) => void ne(e),
|
|
511
514
|
"aria-label": "Report",
|
|
512
515
|
children: [
|
|
513
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ H("div", {
|
|
514
517
|
className: "space-y-2",
|
|
515
|
-
children: [/* @__PURE__ */
|
|
518
|
+
children: [/* @__PURE__ */ V(y, {
|
|
516
519
|
htmlFor: "mtw-report-name",
|
|
517
520
|
children: "Name"
|
|
518
|
-
}), /* @__PURE__ */
|
|
521
|
+
}), /* @__PURE__ */ V(v, {
|
|
519
522
|
id: "mtw-report-name",
|
|
520
523
|
value: a.name,
|
|
521
524
|
maxLength: 120,
|
|
522
|
-
onChange: (e) =>
|
|
525
|
+
onChange: (e) => p("name", e.target.value),
|
|
523
526
|
placeholder: "Weekly operations review"
|
|
524
527
|
})]
|
|
525
528
|
}),
|
|
526
|
-
/* @__PURE__ */
|
|
529
|
+
/* @__PURE__ */ H("div", {
|
|
527
530
|
className: "space-y-2",
|
|
528
531
|
children: [
|
|
529
|
-
/* @__PURE__ */
|
|
532
|
+
/* @__PURE__ */ V(y, {
|
|
530
533
|
htmlFor: "mtw-report-type",
|
|
531
534
|
children: "Report type"
|
|
532
535
|
}),
|
|
533
|
-
/* @__PURE__ */
|
|
536
|
+
/* @__PURE__ */ H(b, {
|
|
534
537
|
value: a.type,
|
|
535
538
|
onValueChange: (e) => {
|
|
536
|
-
let t =
|
|
537
|
-
t &&
|
|
539
|
+
let t = M.find((t) => t.value === e);
|
|
540
|
+
t && p("type", t.value);
|
|
538
541
|
},
|
|
539
|
-
children: [/* @__PURE__ */
|
|
542
|
+
children: [/* @__PURE__ */ V(C, {
|
|
540
543
|
id: "mtw-report-type",
|
|
541
544
|
"aria-label": "Report type",
|
|
542
|
-
children: /* @__PURE__ */
|
|
543
|
-
}), /* @__PURE__ */
|
|
545
|
+
children: /* @__PURE__ */ V(w, {})
|
|
546
|
+
}), /* @__PURE__ */ V(x, { children: M.map((e) => /* @__PURE__ */ V(S, {
|
|
544
547
|
value: e.value,
|
|
545
548
|
children: e.label
|
|
546
549
|
}, e.value)) })]
|
|
547
550
|
}),
|
|
548
|
-
/* @__PURE__ */
|
|
551
|
+
/* @__PURE__ */ V("p", {
|
|
549
552
|
className: "text-xs text-text-secondary",
|
|
550
|
-
children:
|
|
553
|
+
children: M.find((e) => e.value === a.type)?.description
|
|
551
554
|
})
|
|
552
555
|
]
|
|
553
556
|
}),
|
|
554
|
-
/* @__PURE__ */
|
|
557
|
+
/* @__PURE__ */ H("div", {
|
|
555
558
|
className: "space-y-2",
|
|
556
|
-
children: [/* @__PURE__ */
|
|
559
|
+
children: [/* @__PURE__ */ V(y, {
|
|
557
560
|
htmlFor: "mtw-report-description",
|
|
558
561
|
children: "Description (optional)"
|
|
559
|
-
}), /* @__PURE__ */
|
|
562
|
+
}), /* @__PURE__ */ V(k, {
|
|
560
563
|
id: "mtw-report-description",
|
|
561
564
|
value: a.description,
|
|
562
565
|
maxLength: 1e3,
|
|
563
566
|
rows: 2,
|
|
564
|
-
onChange: (e) =>
|
|
567
|
+
onChange: (e) => p("description", e.target.value)
|
|
565
568
|
})]
|
|
566
569
|
}),
|
|
567
|
-
/* @__PURE__ */
|
|
570
|
+
/* @__PURE__ */ H("div", {
|
|
568
571
|
className: "grid grid-cols-1 gap-4 md:grid-cols-2",
|
|
569
|
-
children: [/* @__PURE__ */
|
|
572
|
+
children: [/* @__PURE__ */ H("div", {
|
|
570
573
|
className: "space-y-2",
|
|
571
|
-
children: [/* @__PURE__ */
|
|
574
|
+
children: [/* @__PURE__ */ V(y, {
|
|
572
575
|
htmlFor: "mtw-report-frequency",
|
|
573
576
|
children: "Generate"
|
|
574
|
-
}), /* @__PURE__ */
|
|
577
|
+
}), /* @__PURE__ */ H(b, {
|
|
575
578
|
value: a.frequency,
|
|
576
579
|
onValueChange: (t) => {
|
|
577
|
-
let n =
|
|
578
|
-
n && (
|
|
580
|
+
let n = j.find((e) => e.value === t);
|
|
581
|
+
n && (p("frequency", n.value), e || te(String(z(n.value))));
|
|
579
582
|
},
|
|
580
|
-
children: [/* @__PURE__ */
|
|
583
|
+
children: [/* @__PURE__ */ V(C, {
|
|
581
584
|
id: "mtw-report-frequency",
|
|
582
585
|
"aria-label": "Generate",
|
|
583
|
-
children: /* @__PURE__ */
|
|
584
|
-
}), /* @__PURE__ */
|
|
586
|
+
children: /* @__PURE__ */ V(w, {})
|
|
587
|
+
}), /* @__PURE__ */ V(x, { children: j.map((e) => /* @__PURE__ */ V(S, {
|
|
585
588
|
value: e.value,
|
|
586
589
|
children: e.label
|
|
587
590
|
}, e.value)) })]
|
|
588
591
|
})]
|
|
589
|
-
}), /* @__PURE__ */
|
|
592
|
+
}), /* @__PURE__ */ H("div", {
|
|
590
593
|
className: "space-y-2",
|
|
591
|
-
children: [/* @__PURE__ */
|
|
594
|
+
children: [/* @__PURE__ */ V(y, {
|
|
592
595
|
htmlFor: "mtw-report-period",
|
|
593
596
|
children: "Covers the last (days)"
|
|
594
|
-
}), /* @__PURE__ */
|
|
597
|
+
}), /* @__PURE__ */ V(v, {
|
|
595
598
|
id: "mtw-report-period",
|
|
596
599
|
type: "number",
|
|
597
600
|
inputMode: "numeric",
|
|
598
601
|
min: 1,
|
|
599
602
|
max: 366,
|
|
600
603
|
step: 1,
|
|
601
|
-
value:
|
|
604
|
+
value: ee,
|
|
602
605
|
onChange: (e) => {
|
|
603
|
-
|
|
606
|
+
u(null), te(e.target.value);
|
|
604
607
|
}
|
|
605
608
|
})]
|
|
606
609
|
})]
|
|
607
610
|
}),
|
|
608
|
-
a.frequency !== "NONE" && /* @__PURE__ */
|
|
611
|
+
a.frequency !== "NONE" && /* @__PURE__ */ H("div", {
|
|
609
612
|
className: "grid grid-cols-1 gap-4 md:grid-cols-3",
|
|
610
613
|
children: [
|
|
611
|
-
a.frequency === "WEEKLY" && /* @__PURE__ */
|
|
614
|
+
a.frequency === "WEEKLY" && /* @__PURE__ */ H("div", {
|
|
612
615
|
className: "space-y-2",
|
|
613
|
-
children: [/* @__PURE__ */
|
|
616
|
+
children: [/* @__PURE__ */ V(y, {
|
|
614
617
|
htmlFor: "mtw-report-weekday",
|
|
615
618
|
children: "Day"
|
|
616
|
-
}), /* @__PURE__ */
|
|
619
|
+
}), /* @__PURE__ */ H(b, {
|
|
617
620
|
value: String(a.runWeekday),
|
|
618
|
-
onValueChange: (e) =>
|
|
619
|
-
children: [/* @__PURE__ */
|
|
621
|
+
onValueChange: (e) => p("runWeekday", Number(e)),
|
|
622
|
+
children: [/* @__PURE__ */ V(C, {
|
|
620
623
|
id: "mtw-report-weekday",
|
|
621
624
|
"aria-label": "Day",
|
|
622
|
-
children: /* @__PURE__ */
|
|
623
|
-
}), /* @__PURE__ */
|
|
625
|
+
children: /* @__PURE__ */ V(w, {})
|
|
626
|
+
}), /* @__PURE__ */ V(x, { children: N.map((e, t) => /* @__PURE__ */ V(S, {
|
|
624
627
|
value: String(t + 1),
|
|
625
628
|
children: e
|
|
626
629
|
}, e)) })]
|
|
627
630
|
})]
|
|
628
631
|
}),
|
|
629
|
-
a.frequency === "MONTHLY" && /* @__PURE__ */
|
|
632
|
+
a.frequency === "MONTHLY" && /* @__PURE__ */ H("div", {
|
|
630
633
|
className: "space-y-2",
|
|
631
|
-
children: [/* @__PURE__ */
|
|
634
|
+
children: [/* @__PURE__ */ V(y, {
|
|
632
635
|
htmlFor: "mtw-report-monthday",
|
|
633
636
|
children: "Day of month"
|
|
634
|
-
}), /* @__PURE__ */
|
|
637
|
+
}), /* @__PURE__ */ H(b, {
|
|
635
638
|
value: String(a.runMonthDay),
|
|
636
|
-
onValueChange: (e) =>
|
|
637
|
-
children: [/* @__PURE__ */
|
|
639
|
+
onValueChange: (e) => p("runMonthDay", Number(e)),
|
|
640
|
+
children: [/* @__PURE__ */ V(C, {
|
|
638
641
|
id: "mtw-report-monthday",
|
|
639
642
|
"aria-label": "Day of month",
|
|
640
|
-
children: /* @__PURE__ */
|
|
641
|
-
}), /* @__PURE__ */
|
|
643
|
+
children: /* @__PURE__ */ V(w, {})
|
|
644
|
+
}), /* @__PURE__ */ V(x, {
|
|
642
645
|
className: "max-h-72",
|
|
643
|
-
children: Array.from({ length: 28 }, (e, t) => /* @__PURE__ */
|
|
646
|
+
children: Array.from({ length: 28 }, (e, t) => /* @__PURE__ */ V(S, {
|
|
644
647
|
value: String(t + 1),
|
|
645
648
|
children: t + 1
|
|
646
649
|
}, t + 1))
|
|
647
650
|
})]
|
|
648
651
|
})]
|
|
649
652
|
}),
|
|
650
|
-
/* @__PURE__ */
|
|
653
|
+
/* @__PURE__ */ H("div", {
|
|
651
654
|
className: "space-y-2",
|
|
652
|
-
children: [/* @__PURE__ */
|
|
655
|
+
children: [/* @__PURE__ */ V(y, {
|
|
653
656
|
htmlFor: "mtw-report-hour",
|
|
654
657
|
children: "Time"
|
|
655
|
-
}), /* @__PURE__ */
|
|
658
|
+
}), /* @__PURE__ */ H(b, {
|
|
656
659
|
value: String(a.runHour),
|
|
657
|
-
onValueChange: (e) =>
|
|
658
|
-
children: [/* @__PURE__ */
|
|
660
|
+
onValueChange: (e) => p("runHour", Number(e)),
|
|
661
|
+
children: [/* @__PURE__ */ V(C, {
|
|
659
662
|
id: "mtw-report-hour",
|
|
660
663
|
"aria-label": "Time",
|
|
661
|
-
children: /* @__PURE__ */
|
|
662
|
-
}), /* @__PURE__ */
|
|
664
|
+
children: /* @__PURE__ */ V(w, {})
|
|
665
|
+
}), /* @__PURE__ */ V(x, {
|
|
663
666
|
className: "max-h-72",
|
|
664
|
-
children: Array.from({ length: 24 }, (e, t) => /* @__PURE__ */
|
|
667
|
+
children: Array.from({ length: 24 }, (e, t) => /* @__PURE__ */ V(S, {
|
|
665
668
|
value: String(t),
|
|
666
669
|
children: `${String(t).padStart(2, "0")}:00`
|
|
667
670
|
}, t))
|
|
668
671
|
})]
|
|
669
672
|
})]
|
|
670
673
|
}),
|
|
671
|
-
/* @__PURE__ */
|
|
674
|
+
/* @__PURE__ */ H("div", {
|
|
672
675
|
className: "space-y-2",
|
|
673
|
-
children: [/* @__PURE__ */
|
|
676
|
+
children: [/* @__PURE__ */ V(y, {
|
|
674
677
|
htmlFor: "mtw-report-timezone",
|
|
675
678
|
children: "Time zone"
|
|
676
|
-
}), /* @__PURE__ */
|
|
679
|
+
}), /* @__PURE__ */ V(v, {
|
|
677
680
|
id: "mtw-report-timezone",
|
|
678
681
|
value: a.timezone,
|
|
679
|
-
onChange: (e) =>
|
|
682
|
+
onChange: (e) => p("timezone", e.target.value),
|
|
680
683
|
placeholder: "Asia/Kolkata"
|
|
681
684
|
})]
|
|
682
685
|
})
|
|
683
686
|
]
|
|
684
687
|
}),
|
|
685
|
-
a.frequency !== "NONE" && /* @__PURE__ */
|
|
688
|
+
a.frequency !== "NONE" && /* @__PURE__ */ H("div", {
|
|
686
689
|
className: "flex items-center justify-between gap-3 rounded-lg border border-border-default px-3 py-2",
|
|
687
|
-
children: [/* @__PURE__ */
|
|
690
|
+
children: [/* @__PURE__ */ V(y, {
|
|
688
691
|
htmlFor: "mtw-report-active",
|
|
689
692
|
className: "text-sm",
|
|
690
693
|
children: "Generate automatically"
|
|
691
|
-
}), /* @__PURE__ */
|
|
694
|
+
}), /* @__PURE__ */ V(fe, {
|
|
692
695
|
id: "mtw-report-active",
|
|
693
696
|
checked: a.isActive,
|
|
694
|
-
onCheckedChange: (e) =>
|
|
697
|
+
onCheckedChange: (e) => p("isActive", e)
|
|
695
698
|
})]
|
|
696
699
|
}),
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
700
|
+
/* @__PURE__ */ V(A, { message: l }),
|
|
701
|
+
/* @__PURE__ */ H(le, { children: [/* @__PURE__ */ V(m, {
|
|
699
702
|
type: "button",
|
|
700
703
|
variant: "outline",
|
|
701
704
|
onClick: n,
|
|
702
|
-
disabled:
|
|
705
|
+
disabled: s,
|
|
703
706
|
children: "Cancel"
|
|
704
|
-
}), /* @__PURE__ */
|
|
707
|
+
}), /* @__PURE__ */ H(m, {
|
|
705
708
|
type: "submit",
|
|
706
|
-
disabled:
|
|
707
|
-
children: [
|
|
709
|
+
disabled: s,
|
|
710
|
+
children: [s && /* @__PURE__ */ V(r, {
|
|
708
711
|
size: 16,
|
|
709
712
|
className: "mr-2 animate-spin"
|
|
710
713
|
}), e ? "Save report" : "Create report"]
|