@burdenoff/microfe-ecoimpacthub 2026.819.2 → 2026.819.4
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/dev/main.d.ts.map +1 -1
- package/dist/ecoimpacthub/EcoImpactHubAdminRoot.d.ts.map +1 -1
- package/dist/ecoimpacthub/EcoImpactHubAdminRoot.js +161 -146
- package/dist/ecoimpacthub/EcoImpactHubAdminRoot.js.map +1 -1
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.d.ts +4 -1
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.d.ts.map +1 -1
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.js +37 -7
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.js.map +1 -1
- package/dist/ecoimpacthub/types/index.d.ts +9 -0
- package/dist/ecoimpacthub/types/index.d.ts.map +1 -1
- package/package.json +4 -1
package/dist/dev/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/dev/main.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/dev/main.tsx"],"names":[],"mappings":"AAMA,OAAO,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EcoImpactHubAdminRoot.d.ts","sourceRoot":"","sources":["../../src/ecoimpacthub/EcoImpactHubAdminRoot.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"EcoImpactHubAdminRoot.d.ts","sourceRoot":"","sources":["../../src/ecoimpacthub/EcoImpactHubAdminRoot.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA8BhC,OAAO,KAAK,EACV,qBAAqB,EAStB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAwkBD,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAmBhE,CAAC;AAEF,OAAO,EAAE,qBAAqB,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -4,24 +4,24 @@ import { formatCo2e as n, formatDate as r, formatEnumLabel as i } from "./utils/
|
|
|
4
4
|
import { StatusBadge as a } from "./components/StatusBadge.js";
|
|
5
5
|
import { ErrorView as o, LoadingView as s, Section as c } from "./components/StateViews.js";
|
|
6
6
|
import { EmptyState as l } from "./components/EmptyState.js";
|
|
7
|
-
import {
|
|
8
|
-
import { Tabs as
|
|
9
|
-
import { DataTable as
|
|
10
|
-
import { Pagination as
|
|
11
|
-
import { FilterTabs as
|
|
12
|
-
import { useMemo as
|
|
13
|
-
import { QueryClient as
|
|
14
|
-
import { FeatureFlagProvider as
|
|
15
|
-
import { Factory as
|
|
16
|
-
import { Fragment as
|
|
17
|
-
import { Button as
|
|
18
|
-
import { PermissionProvider as
|
|
7
|
+
import { useEcoApproveReport as u, useEcoArchiveSite as d, useEcoCarbonEntries as f, useEcoPublishReport as p, useEcoRejectReport as m, useEcoReports as h, useEcoSensors as g, useEcoSetSensorStatus as _, useEcoSites as v, useEcoSubmitReportForApproval as y, useEcoVerifyCarbonEntry as b } from "./hooks/useEcoImpactHubApi.js";
|
|
8
|
+
import { Tabs as x } from "./components/Tabs.js";
|
|
9
|
+
import { DataTable as S } from "./components/DataTable.js";
|
|
10
|
+
import { Pagination as C } from "./components/Pagination.js";
|
|
11
|
+
import { FilterTabs as w } from "./components/FilterTabs.js";
|
|
12
|
+
import { useMemo as T, useState as E } from "react";
|
|
13
|
+
import { QueryClient as D, QueryClientProvider as O } from "@tanstack/react-query";
|
|
14
|
+
import { FeatureFlagProvider as k } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
15
|
+
import { Factory as A, FileText as j, MapPin as M, Radio as N, ShieldCheck as P } from "lucide-react";
|
|
16
|
+
import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
17
|
+
import { Button as R } from "@burdenoff/fe-libs/ui";
|
|
18
|
+
import { PermissionProvider as z } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
19
19
|
//#region src/ecoimpacthub/EcoImpactHubAdminRoot.tsx
|
|
20
|
-
var
|
|
20
|
+
var B = new D({ defaultOptions: { queries: {
|
|
21
21
|
staleTime: 30 * 1e3,
|
|
22
22
|
retry: 1,
|
|
23
23
|
refetchOnWindowFocus: !1
|
|
24
|
-
} } }),
|
|
24
|
+
} } }), V = 12, H = [
|
|
25
25
|
{
|
|
26
26
|
value: "ALL",
|
|
27
27
|
label: "All"
|
|
@@ -38,7 +38,7 @@ var L = new w({ defaultOptions: { queries: {
|
|
|
38
38
|
value: "ARCHIVED",
|
|
39
39
|
label: "Archived"
|
|
40
40
|
}
|
|
41
|
-
],
|
|
41
|
+
], U = [
|
|
42
42
|
{
|
|
43
43
|
value: "ALL",
|
|
44
44
|
label: "All"
|
|
@@ -63,7 +63,7 @@ var L = new w({ defaultOptions: { queries: {
|
|
|
63
63
|
value: "RETIRED",
|
|
64
64
|
label: "Retired"
|
|
65
65
|
}
|
|
66
|
-
],
|
|
66
|
+
], W = [
|
|
67
67
|
{
|
|
68
68
|
value: "ALL",
|
|
69
69
|
label: "All"
|
|
@@ -84,7 +84,7 @@ var L = new w({ defaultOptions: { queries: {
|
|
|
84
84
|
value: "ADJUSTED",
|
|
85
85
|
label: "Adjusted"
|
|
86
86
|
}
|
|
87
|
-
],
|
|
87
|
+
], G = [
|
|
88
88
|
{
|
|
89
89
|
value: "ALL",
|
|
90
90
|
label: "All"
|
|
@@ -106,12 +106,12 @@ var L = new w({ defaultOptions: { queries: {
|
|
|
106
106
|
label: "Archived"
|
|
107
107
|
}
|
|
108
108
|
];
|
|
109
|
-
function
|
|
110
|
-
let t =
|
|
111
|
-
return e.status === "ARCHIVED" ? /* @__PURE__ */
|
|
109
|
+
function K({ site: e }) {
|
|
110
|
+
let t = d();
|
|
111
|
+
return e.status === "ARCHIVED" ? /* @__PURE__ */ I("span", {
|
|
112
112
|
className: "text-xs text-text-secondary",
|
|
113
113
|
children: "Archived"
|
|
114
|
-
}) : /* @__PURE__ */
|
|
114
|
+
}) : /* @__PURE__ */ I(R, {
|
|
115
115
|
variant: "outline",
|
|
116
116
|
size: "sm",
|
|
117
117
|
onClick: () => t.mutate(e.id),
|
|
@@ -119,20 +119,20 @@ function U({ site: e }) {
|
|
|
119
119
|
children: "Archive"
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
let [e, t] =
|
|
122
|
+
function q() {
|
|
123
|
+
let [e, t] = E("ALL"), { data: n, isLoading: u, error: d, refetch: f } = v({
|
|
124
124
|
status: e === "ALL" ? void 0 : e,
|
|
125
125
|
pagination: { limit: 100 }
|
|
126
|
-
}), p =
|
|
126
|
+
}), p = T(() => [
|
|
127
127
|
{
|
|
128
128
|
key: "name",
|
|
129
129
|
header: "Site",
|
|
130
|
-
render: (e) => /* @__PURE__ */
|
|
130
|
+
render: (e) => /* @__PURE__ */ L("div", {
|
|
131
131
|
className: "min-w-0",
|
|
132
|
-
children: [/* @__PURE__ */
|
|
132
|
+
children: [/* @__PURE__ */ I("p", {
|
|
133
133
|
className: "font-medium text-text-primary truncate",
|
|
134
134
|
children: e.name
|
|
135
|
-
}), e.code && /* @__PURE__ */
|
|
135
|
+
}), e.code && /* @__PURE__ */ I("p", {
|
|
136
136
|
className: "text-xs text-text-secondary",
|
|
137
137
|
children: e.code
|
|
138
138
|
})]
|
|
@@ -153,7 +153,7 @@ function W() {
|
|
|
153
153
|
{
|
|
154
154
|
key: "status",
|
|
155
155
|
header: "Status",
|
|
156
|
-
render: (e) => /* @__PURE__ */
|
|
156
|
+
render: (e) => /* @__PURE__ */ I(a, { status: e.status })
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
key: "created",
|
|
@@ -166,31 +166,31 @@ function W() {
|
|
|
166
166
|
key: "actions",
|
|
167
167
|
header: "Actions",
|
|
168
168
|
align: "right",
|
|
169
|
-
render: (e) => /* @__PURE__ */
|
|
169
|
+
render: (e) => /* @__PURE__ */ I(K, { site: e })
|
|
170
170
|
}
|
|
171
171
|
], []);
|
|
172
|
-
if (u) return /* @__PURE__ */
|
|
173
|
-
if (d) return /* @__PURE__ */
|
|
172
|
+
if (u) return /* @__PURE__ */ I(s, { label: "Loading sites…" });
|
|
173
|
+
if (d) return /* @__PURE__ */ I(o, {
|
|
174
174
|
title: "Could not load sites",
|
|
175
175
|
message: d.message,
|
|
176
176
|
onRetry: f
|
|
177
177
|
});
|
|
178
178
|
let m = n?.items ?? [];
|
|
179
|
-
return /* @__PURE__ */
|
|
179
|
+
return /* @__PURE__ */ L(c, {
|
|
180
180
|
title: "Site registry",
|
|
181
181
|
description: "Pause monitoring or archive decommissioned sites.",
|
|
182
|
-
children: [/* @__PURE__ */
|
|
182
|
+
children: [/* @__PURE__ */ I("div", {
|
|
183
183
|
className: "mb-4",
|
|
184
|
-
children: /* @__PURE__ */
|
|
185
|
-
options:
|
|
184
|
+
children: /* @__PURE__ */ I(w, {
|
|
185
|
+
options: H,
|
|
186
186
|
value: e,
|
|
187
187
|
onChange: t
|
|
188
188
|
})
|
|
189
|
-
}), m.length === 0 ? /* @__PURE__ */
|
|
190
|
-
icon: /* @__PURE__ */
|
|
189
|
+
}), m.length === 0 ? /* @__PURE__ */ I(l, {
|
|
190
|
+
icon: /* @__PURE__ */ I(M, { size: 40 }),
|
|
191
191
|
title: "No sites found",
|
|
192
192
|
description: `There are no ${e === "ALL" ? "" : e.toLowerCase()} sites in this workspace.`
|
|
193
|
-
}) : /* @__PURE__ */
|
|
193
|
+
}) : /* @__PURE__ */ I(S, {
|
|
194
194
|
columns: p,
|
|
195
195
|
rows: m,
|
|
196
196
|
rowKey: (e) => e.id,
|
|
@@ -201,18 +201,18 @@ function W() {
|
|
|
201
201
|
})]
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
var
|
|
204
|
+
var J = {
|
|
205
205
|
ONLINE: "MAINTENANCE",
|
|
206
206
|
OFFLINE: "MAINTENANCE",
|
|
207
207
|
DEGRADED: "MAINTENANCE",
|
|
208
208
|
MAINTENANCE: "ONLINE",
|
|
209
209
|
RETIRED: null
|
|
210
210
|
};
|
|
211
|
-
function
|
|
212
|
-
let t =
|
|
213
|
-
return /* @__PURE__ */
|
|
211
|
+
function Y({ sensor: e }) {
|
|
212
|
+
let t = _(), n = J[e.status];
|
|
213
|
+
return /* @__PURE__ */ L("div", {
|
|
214
214
|
className: "flex flex-wrap items-center justify-end gap-2",
|
|
215
|
-
children: [n && /* @__PURE__ */
|
|
215
|
+
children: [n && /* @__PURE__ */ I(R, {
|
|
216
216
|
variant: "outline",
|
|
217
217
|
size: "sm",
|
|
218
218
|
onClick: () => t.mutate({
|
|
@@ -221,7 +221,7 @@ function K({ sensor: e }) {
|
|
|
221
221
|
}),
|
|
222
222
|
disabled: t.isPending,
|
|
223
223
|
children: n === "MAINTENANCE" ? "Send to maintenance" : "Bring online"
|
|
224
|
-
}), e.status !== "RETIRED" && /* @__PURE__ */
|
|
224
|
+
}), e.status !== "RETIRED" && /* @__PURE__ */ I(R, {
|
|
225
225
|
variant: "outline",
|
|
226
226
|
size: "sm",
|
|
227
227
|
onClick: () => t.mutate({
|
|
@@ -233,17 +233,17 @@ function K({ sensor: e }) {
|
|
|
233
233
|
})]
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
let [e, t] =
|
|
236
|
+
function X() {
|
|
237
|
+
let [e, t] = E("ALL"), { data: n, isLoading: u, error: d, refetch: f } = g({ status: e === "ALL" ? void 0 : e }), p = T(() => [
|
|
238
238
|
{
|
|
239
239
|
key: "name",
|
|
240
240
|
header: "Sensor",
|
|
241
|
-
render: (e) => /* @__PURE__ */
|
|
241
|
+
render: (e) => /* @__PURE__ */ L("div", {
|
|
242
242
|
className: "min-w-0",
|
|
243
|
-
children: [/* @__PURE__ */
|
|
243
|
+
children: [/* @__PURE__ */ I("p", {
|
|
244
244
|
className: "font-medium text-text-primary truncate",
|
|
245
245
|
children: e.name
|
|
246
|
-
}), e.hardwareId && /* @__PURE__ */
|
|
246
|
+
}), e.hardwareId && /* @__PURE__ */ I("p", {
|
|
247
247
|
className: "font-mono text-xs text-text-secondary",
|
|
248
248
|
children: e.hardwareId
|
|
249
249
|
})]
|
|
@@ -258,7 +258,7 @@ function q() {
|
|
|
258
258
|
{
|
|
259
259
|
key: "site",
|
|
260
260
|
header: "Site ID",
|
|
261
|
-
render: (e) => /* @__PURE__ */
|
|
261
|
+
render: (e) => /* @__PURE__ */ I("span", {
|
|
262
262
|
className: "font-mono text-xs text-text-secondary",
|
|
263
263
|
children: e.siteId
|
|
264
264
|
}),
|
|
@@ -267,7 +267,7 @@ function q() {
|
|
|
267
267
|
{
|
|
268
268
|
key: "status",
|
|
269
269
|
header: "Status",
|
|
270
|
-
render: (e) => /* @__PURE__ */
|
|
270
|
+
render: (e) => /* @__PURE__ */ I(a, { status: e.status })
|
|
271
271
|
},
|
|
272
272
|
{
|
|
273
273
|
key: "lastReading",
|
|
@@ -280,33 +280,33 @@ function q() {
|
|
|
280
280
|
key: "actions",
|
|
281
281
|
header: "Actions",
|
|
282
282
|
align: "right",
|
|
283
|
-
render: (e) => /* @__PURE__ */
|
|
283
|
+
render: (e) => /* @__PURE__ */ I(Y, { sensor: e })
|
|
284
284
|
}
|
|
285
285
|
], []);
|
|
286
|
-
if (u) return /* @__PURE__ */
|
|
287
|
-
if (d) return /* @__PURE__ */
|
|
286
|
+
if (u) return /* @__PURE__ */ I(s, { label: "Loading sensors…" });
|
|
287
|
+
if (d) return /* @__PURE__ */ I(o, {
|
|
288
288
|
title: "Could not load sensors",
|
|
289
289
|
message: d.message,
|
|
290
290
|
onRetry: f
|
|
291
291
|
});
|
|
292
|
-
let
|
|
293
|
-
return /* @__PURE__ */
|
|
292
|
+
let m = n?.items ?? [];
|
|
293
|
+
return /* @__PURE__ */ L(c, {
|
|
294
294
|
title: "Sensor fleet",
|
|
295
295
|
description: "Retire hardware or move sensors into maintenance.",
|
|
296
|
-
children: [/* @__PURE__ */
|
|
296
|
+
children: [/* @__PURE__ */ I("div", {
|
|
297
297
|
className: "mb-4",
|
|
298
|
-
children: /* @__PURE__ */
|
|
299
|
-
options:
|
|
298
|
+
children: /* @__PURE__ */ I(w, {
|
|
299
|
+
options: U,
|
|
300
300
|
value: e,
|
|
301
301
|
onChange: t
|
|
302
302
|
})
|
|
303
|
-
}),
|
|
304
|
-
icon: /* @__PURE__ */ N
|
|
303
|
+
}), m.length === 0 ? /* @__PURE__ */ I(l, {
|
|
304
|
+
icon: /* @__PURE__ */ I(N, { size: 40 }),
|
|
305
305
|
title: "No sensors found",
|
|
306
306
|
description: `There are no ${e === "ALL" ? "" : e.toLowerCase()} sensors in this workspace.`
|
|
307
|
-
}) : /* @__PURE__ */
|
|
307
|
+
}) : /* @__PURE__ */ I(S, {
|
|
308
308
|
columns: p,
|
|
309
|
-
rows:
|
|
309
|
+
rows: m,
|
|
310
310
|
rowKey: (e) => e.id,
|
|
311
311
|
defaultSort: {
|
|
312
312
|
key: "lastReading",
|
|
@@ -315,12 +315,12 @@ function q() {
|
|
|
315
315
|
})]
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
let t =
|
|
320
|
-
return e.status === "VERIFIED" ? /* @__PURE__ */
|
|
318
|
+
function Z({ entry: e }) {
|
|
319
|
+
let t = b();
|
|
320
|
+
return e.status === "VERIFIED" ? /* @__PURE__ */ I("span", {
|
|
321
321
|
className: "text-xs text-text-secondary",
|
|
322
322
|
children: "Verified"
|
|
323
|
-
}) : /* @__PURE__ */
|
|
323
|
+
}) : /* @__PURE__ */ I(R, {
|
|
324
324
|
variant: "outline",
|
|
325
325
|
size: "sm",
|
|
326
326
|
onClick: () => t.mutate(e.id),
|
|
@@ -328,23 +328,23 @@ function J({ entry: e }) {
|
|
|
328
328
|
children: "Verify"
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
let [e, t] =
|
|
331
|
+
function Q() {
|
|
332
|
+
let [e, t] = E("ALL"), [u, d] = E(0), [p, m] = E([]), h = u > 0 ? p[u - 1] : void 0, { data: g, isLoading: _, error: v, refetch: y } = f({
|
|
333
333
|
status: e === "ALL" ? void 0 : e,
|
|
334
334
|
pagination: {
|
|
335
|
-
limit:
|
|
335
|
+
limit: V,
|
|
336
336
|
cursor: h
|
|
337
337
|
}
|
|
338
|
-
}),
|
|
338
|
+
}), b = T(() => [
|
|
339
339
|
{
|
|
340
340
|
key: "category",
|
|
341
341
|
header: "Category",
|
|
342
|
-
render: (e) => /* @__PURE__ */
|
|
342
|
+
render: (e) => /* @__PURE__ */ L("div", {
|
|
343
343
|
className: "min-w-0",
|
|
344
|
-
children: [/* @__PURE__ */
|
|
344
|
+
children: [/* @__PURE__ */ I("p", {
|
|
345
345
|
className: "font-medium text-text-primary truncate",
|
|
346
346
|
children: e.category
|
|
347
|
-
}), e.factor && /* @__PURE__ */
|
|
347
|
+
}), e.factor && /* @__PURE__ */ I("p", {
|
|
348
348
|
className: "text-xs text-text-secondary",
|
|
349
349
|
children: e.factor.name
|
|
350
350
|
})]
|
|
@@ -372,79 +372,94 @@ function Y() {
|
|
|
372
372
|
{
|
|
373
373
|
key: "status",
|
|
374
374
|
header: "Status",
|
|
375
|
-
render: (e) => /* @__PURE__ */
|
|
375
|
+
render: (e) => /* @__PURE__ */ I(a, { status: e.status })
|
|
376
376
|
},
|
|
377
377
|
{
|
|
378
378
|
key: "actions",
|
|
379
379
|
header: "Actions",
|
|
380
380
|
align: "right",
|
|
381
|
-
render: (e) => /* @__PURE__ */
|
|
381
|
+
render: (e) => /* @__PURE__ */ I(Z, { entry: e })
|
|
382
382
|
}
|
|
383
|
-
], []),
|
|
384
|
-
e > u && g?.pageInfo.cursor ? m((e) => [...e, g.pageInfo.cursor]) : e < u && m((e) => e.slice(0, -1)),
|
|
383
|
+
], []), x = (e) => {
|
|
384
|
+
e > u && g?.pageInfo.cursor ? m((e) => [...e, g.pageInfo.cursor]) : e < u && m((e) => e.slice(0, -1)), d(e);
|
|
385
385
|
};
|
|
386
|
-
if (_) return /* @__PURE__ */
|
|
387
|
-
if (v) return /* @__PURE__ */
|
|
386
|
+
if (_) return /* @__PURE__ */ I(s, { label: "Loading carbon entries…" });
|
|
387
|
+
if (v) return /* @__PURE__ */ I(o, {
|
|
388
388
|
title: "Could not load carbon entries",
|
|
389
389
|
message: v.message,
|
|
390
|
-
onRetry:
|
|
390
|
+
onRetry: y
|
|
391
391
|
});
|
|
392
|
-
let
|
|
393
|
-
return /* @__PURE__ */
|
|
392
|
+
let D = g?.items ?? [];
|
|
393
|
+
return /* @__PURE__ */ L(c, {
|
|
394
394
|
title: "Carbon ledger",
|
|
395
395
|
description: "Verify DRAFT/RECORDED entries across all sites and scopes.",
|
|
396
|
-
children: [/* @__PURE__ */
|
|
396
|
+
children: [/* @__PURE__ */ I("div", {
|
|
397
397
|
className: "mb-4",
|
|
398
|
-
children: /* @__PURE__ */
|
|
399
|
-
options:
|
|
398
|
+
children: /* @__PURE__ */ I(w, {
|
|
399
|
+
options: W,
|
|
400
400
|
value: e,
|
|
401
401
|
onChange: (e) => {
|
|
402
|
-
t(e),
|
|
402
|
+
t(e), d(0), m([]);
|
|
403
403
|
}
|
|
404
404
|
})
|
|
405
|
-
}),
|
|
406
|
-
icon: /* @__PURE__ */
|
|
405
|
+
}), D.length === 0 ? /* @__PURE__ */ I(l, {
|
|
406
|
+
icon: /* @__PURE__ */ I(A, { size: 40 }),
|
|
407
407
|
title: "No carbon entries found",
|
|
408
408
|
description: `There are no ${e === "ALL" ? "" : e.toLowerCase()} entries in this workspace.`
|
|
409
|
-
}) : /* @__PURE__ */
|
|
410
|
-
columns:
|
|
411
|
-
rows:
|
|
409
|
+
}) : /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I(S, {
|
|
410
|
+
columns: b,
|
|
411
|
+
rows: D,
|
|
412
412
|
rowKey: (e) => e.id,
|
|
413
413
|
defaultSort: {
|
|
414
414
|
key: "period",
|
|
415
415
|
dir: "desc"
|
|
416
416
|
}
|
|
417
|
-
}), /* @__PURE__ */
|
|
417
|
+
}), /* @__PURE__ */ I(C, {
|
|
418
418
|
page: u,
|
|
419
|
-
pageSize:
|
|
420
|
-
itemCount:
|
|
419
|
+
pageSize: V,
|
|
420
|
+
itemCount: D.length,
|
|
421
421
|
hasMore: g?.pageInfo.hasMore ?? !1,
|
|
422
|
-
onPageChange:
|
|
422
|
+
onPageChange: x
|
|
423
423
|
})] })]
|
|
424
424
|
});
|
|
425
425
|
}
|
|
426
|
-
function
|
|
427
|
-
let t =
|
|
428
|
-
return e.status === "PUBLISHED" || e.status === "ARCHIVED" ? /* @__PURE__ */
|
|
426
|
+
function $({ report: e }) {
|
|
427
|
+
let t = y(), n = u(), r = m(), a = p(), o = t.isPending || n.isPending || r.isPending || a.isPending;
|
|
428
|
+
return e.status === "PUBLISHED" || e.status === "ARCHIVED" ? /* @__PURE__ */ I("span", {
|
|
429
429
|
className: "text-xs text-text-secondary",
|
|
430
430
|
children: i(e.status)
|
|
431
|
-
}) : /* @__PURE__ */
|
|
431
|
+
}) : e.status === "DRAFT" ? /* @__PURE__ */ I(R, {
|
|
432
432
|
variant: "outline",
|
|
433
433
|
size: "sm",
|
|
434
|
-
onClick: () => t.mutate(
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
children:
|
|
434
|
+
onClick: () => t.mutate(e.id),
|
|
435
|
+
disabled: o,
|
|
436
|
+
children: "Submit for approval"
|
|
437
|
+
}) : /* @__PURE__ */ L("div", {
|
|
438
|
+
className: "flex flex-wrap items-center justify-end gap-2",
|
|
439
|
+
children: [/* @__PURE__ */ I(R, {
|
|
440
|
+
variant: "default",
|
|
441
|
+
size: "sm",
|
|
442
|
+
onClick: () => n.mutate(e.id),
|
|
443
|
+
disabled: o,
|
|
444
|
+
children: "Approve"
|
|
445
|
+
}), /* @__PURE__ */ I(R, {
|
|
446
|
+
variant: "outline",
|
|
447
|
+
size: "sm",
|
|
448
|
+
onClick: () => r.mutate({
|
|
449
|
+
reportId: e.id,
|
|
450
|
+
reason: "Rejected from admin panel"
|
|
451
|
+
}),
|
|
452
|
+
disabled: o,
|
|
453
|
+
children: "Reject"
|
|
454
|
+
})]
|
|
440
455
|
});
|
|
441
456
|
}
|
|
442
|
-
function
|
|
443
|
-
let [e, t] =
|
|
457
|
+
function ee() {
|
|
458
|
+
let [e, t] = E("ALL"), { data: n, isLoading: u, error: d, refetch: f } = h(e === "ALL" ? void 0 : e, { limit: 100 }), p = T(() => [
|
|
444
459
|
{
|
|
445
460
|
key: "title",
|
|
446
461
|
header: "Report",
|
|
447
|
-
render: (e) => /* @__PURE__ */
|
|
462
|
+
render: (e) => /* @__PURE__ */ I("p", {
|
|
448
463
|
className: "font-medium text-text-primary truncate",
|
|
449
464
|
children: e.title
|
|
450
465
|
}),
|
|
@@ -464,7 +479,7 @@ function Z() {
|
|
|
464
479
|
{
|
|
465
480
|
key: "status",
|
|
466
481
|
header: "Status",
|
|
467
|
-
render: (e) => /* @__PURE__ */
|
|
482
|
+
render: (e) => /* @__PURE__ */ I(a, { status: e.status })
|
|
468
483
|
},
|
|
469
484
|
{
|
|
470
485
|
key: "published",
|
|
@@ -477,33 +492,33 @@ function Z() {
|
|
|
477
492
|
key: "actions",
|
|
478
493
|
header: "Actions",
|
|
479
494
|
align: "right",
|
|
480
|
-
render: (e) => /* @__PURE__ */
|
|
495
|
+
render: (e) => /* @__PURE__ */ I($, { report: e })
|
|
481
496
|
}
|
|
482
497
|
], []);
|
|
483
|
-
if (u) return /* @__PURE__ */
|
|
484
|
-
if (d) return /* @__PURE__ */
|
|
498
|
+
if (u) return /* @__PURE__ */ I(s, { label: "Loading reports…" });
|
|
499
|
+
if (d) return /* @__PURE__ */ I(o, {
|
|
485
500
|
title: "Could not load reports",
|
|
486
501
|
message: d.message,
|
|
487
502
|
onRetry: f
|
|
488
503
|
});
|
|
489
|
-
let
|
|
490
|
-
return /* @__PURE__ */
|
|
504
|
+
let m = n?.items ?? [];
|
|
505
|
+
return /* @__PURE__ */ L(c, {
|
|
491
506
|
title: "Sustainability reports",
|
|
492
|
-
description: "
|
|
493
|
-
children: [/* @__PURE__ */
|
|
507
|
+
description: "Submit draft reports for approval, then approve, reject, or publish them.",
|
|
508
|
+
children: [/* @__PURE__ */ I("div", {
|
|
494
509
|
className: "mb-4",
|
|
495
|
-
children: /* @__PURE__ */
|
|
496
|
-
options:
|
|
510
|
+
children: /* @__PURE__ */ I(w, {
|
|
511
|
+
options: G,
|
|
497
512
|
value: e,
|
|
498
513
|
onChange: t
|
|
499
514
|
})
|
|
500
|
-
}),
|
|
501
|
-
icon: /* @__PURE__ */
|
|
515
|
+
}), m.length === 0 ? /* @__PURE__ */ I(l, {
|
|
516
|
+
icon: /* @__PURE__ */ I(j, { size: 40 }),
|
|
502
517
|
title: "No reports found",
|
|
503
518
|
description: `There are no ${e === "ALL" ? "" : e.toLowerCase()} reports in this workspace.`
|
|
504
|
-
}) : /* @__PURE__ */
|
|
505
|
-
columns:
|
|
506
|
-
rows:
|
|
519
|
+
}) : /* @__PURE__ */ I(S, {
|
|
520
|
+
columns: p,
|
|
521
|
+
rows: m,
|
|
507
522
|
rowKey: (e) => e.id,
|
|
508
523
|
defaultSort: {
|
|
509
524
|
key: "period",
|
|
@@ -512,68 +527,68 @@ function Z() {
|
|
|
512
527
|
})]
|
|
513
528
|
});
|
|
514
529
|
}
|
|
515
|
-
function
|
|
516
|
-
let [e, n] =
|
|
530
|
+
function te() {
|
|
531
|
+
let [e, n] = E("sites"), r = T(() => [
|
|
517
532
|
{
|
|
518
533
|
value: "sites",
|
|
519
534
|
label: "Sites",
|
|
520
|
-
icon: /* @__PURE__ */
|
|
535
|
+
icon: /* @__PURE__ */ I(M, { size: 18 })
|
|
521
536
|
},
|
|
522
537
|
{
|
|
523
538
|
value: "sensors",
|
|
524
539
|
label: "Sensors",
|
|
525
|
-
icon: /* @__PURE__ */ N
|
|
540
|
+
icon: /* @__PURE__ */ I(N, { size: 18 })
|
|
526
541
|
},
|
|
527
542
|
{
|
|
528
543
|
value: "carbon",
|
|
529
544
|
label: "Carbon Ledger",
|
|
530
|
-
icon: /* @__PURE__ */
|
|
545
|
+
icon: /* @__PURE__ */ I(A, { size: 18 })
|
|
531
546
|
},
|
|
532
547
|
{
|
|
533
548
|
value: "reports",
|
|
534
549
|
label: "Reports",
|
|
535
|
-
icon: /* @__PURE__ */
|
|
550
|
+
icon: /* @__PURE__ */ I(j, { size: 18 })
|
|
536
551
|
}
|
|
537
552
|
], []);
|
|
538
|
-
return /* @__PURE__ */
|
|
553
|
+
return /* @__PURE__ */ L(t, {
|
|
539
554
|
title: "EcoImpactHub Admin",
|
|
540
555
|
description: "Site, sensor, carbon-ledger and report governance.",
|
|
541
|
-
actions: /* @__PURE__ */
|
|
556
|
+
actions: /* @__PURE__ */ L("span", {
|
|
542
557
|
className: "inline-flex items-center gap-2 text-sm text-text-secondary",
|
|
543
|
-
children: [/* @__PURE__ */
|
|
558
|
+
children: [/* @__PURE__ */ I(P, { size: 18 }), "Workspace-scoped"]
|
|
544
559
|
}),
|
|
545
|
-
children: [/* @__PURE__ */
|
|
560
|
+
children: [/* @__PURE__ */ I(x, {
|
|
546
561
|
items: r,
|
|
547
562
|
value: e,
|
|
548
563
|
onChange: n
|
|
549
|
-
}), /* @__PURE__ */
|
|
564
|
+
}), /* @__PURE__ */ L("div", {
|
|
550
565
|
className: "mt-6",
|
|
551
566
|
children: [
|
|
552
|
-
e === "sites" && /* @__PURE__ */
|
|
553
|
-
e === "sensors" && /* @__PURE__ */
|
|
554
|
-
e === "carbon" && /* @__PURE__ */
|
|
555
|
-
e === "reports" && /* @__PURE__ */
|
|
567
|
+
e === "sites" && /* @__PURE__ */ I(q, {}),
|
|
568
|
+
e === "sensors" && /* @__PURE__ */ I(X, {}),
|
|
569
|
+
e === "carbon" && /* @__PURE__ */ I(Q, {}),
|
|
570
|
+
e === "reports" && /* @__PURE__ */ I(ee, {})
|
|
556
571
|
]
|
|
557
572
|
})]
|
|
558
573
|
});
|
|
559
574
|
}
|
|
560
|
-
var
|
|
561
|
-
client:
|
|
562
|
-
children: /* @__PURE__ */
|
|
575
|
+
var ne = (t) => /* @__PURE__ */ I(O, {
|
|
576
|
+
client: B,
|
|
577
|
+
children: /* @__PURE__ */ I(k, {
|
|
563
578
|
workspaceId: t.workspaceId ?? null,
|
|
564
579
|
gateway: "global",
|
|
565
580
|
defaultEnabled: !0,
|
|
566
|
-
children: /* @__PURE__ */
|
|
581
|
+
children: /* @__PURE__ */ I(z, {
|
|
567
582
|
scopeId: t.workspaceId ?? null,
|
|
568
583
|
gateway: "workspace",
|
|
569
|
-
children: /* @__PURE__ */
|
|
584
|
+
children: /* @__PURE__ */ I(e, {
|
|
570
585
|
...t,
|
|
571
|
-
children: /* @__PURE__ */
|
|
586
|
+
children: /* @__PURE__ */ I(te, {})
|
|
572
587
|
})
|
|
573
588
|
})
|
|
574
589
|
})
|
|
575
590
|
});
|
|
576
591
|
//#endregion
|
|
577
|
-
export {
|
|
592
|
+
export { ne as EcoImpactHubAdminRoot };
|
|
578
593
|
|
|
579
594
|
//# sourceMappingURL=EcoImpactHubAdminRoot.js.map
|