@burdenoff/microfe-theglobalfuel 2026.704.1 → 2026.705.2
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/node_modules/{.bun/clsx@2.1.1/node_modules/clsx → clsx}/dist/clsx.js +1 -1
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
- package/dist/node_modules/{.bun/tailwind-merge@3.5.0/node_modules/tailwind-merge → tailwind-merge}/dist/bundle-mjs.js +212 -170
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
- package/dist/theglobalfuel/components/DataTable.js +37 -27
- package/dist/theglobalfuel/components/DataTable.js.map +1 -1
- package/dist/theglobalfuel/hooks/index.js +1 -0
- package/dist/theglobalfuel/hooks/useNotify.js +19 -0
- package/dist/theglobalfuel/hooks/useNotify.js.map +1 -0
- package/dist/theglobalfuel/hooks/useTheFiles.js +4 -1
- package/dist/theglobalfuel/hooks/useTheFiles.js.map +1 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +59 -31
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.js +367 -321
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.js.map +1 -1
- package/dist/theglobalfuel/pages/assets/AssetsPage.js +66 -54
- package/dist/theglobalfuel/pages/assets/AssetsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/compliance/CompliancePage.js +346 -182
- package/dist/theglobalfuel/pages/compliance/CompliancePage.js.map +1 -1
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js +418 -390
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js.map +1 -1
- package/dist/theglobalfuel/pages/contracts/ContractsPage.js +238 -230
- package/dist/theglobalfuel/pages/contracts/ContractsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.js +5 -3
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.js.map +1 -1
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.js +201 -177
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/inventory/InventoryPage.js +271 -238
- package/dist/theglobalfuel/pages/inventory/InventoryPage.js.map +1 -1
- package/dist/theglobalfuel/pages/production/ProductionPage.js +185 -177
- package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
- package/dist/theglobalfuel/pages/reserves/ReservesPage.js +160 -138
- package/dist/theglobalfuel/pages/reserves/ReservesPage.js.map +1 -1
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js +250 -198
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js.map +1 -1
- package/dist/theglobalfuel/utils/cn.js +2 -2
- package/dist/theglobalfuel/utils/formatters.js +6 -1
- package/dist/theglobalfuel/utils/formatters.js.map +1 -1
- package/dist/theglobalfuel/utils/transitions.js +70 -0
- package/dist/theglobalfuel/utils/transitions.js.map +1 -0
- package/package.json +1 -1
- package/dist/dev/main.d.ts +0 -2
- package/dist/dev/main.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js.map +0 -1
- package/dist/node_modules/.bun/tailwind-merge@3.5.0/node_modules/tailwind-merge/dist/bundle-mjs.js.map +0 -1
- package/dist/theglobalfuel/TheGlobalFuelRoot.d.ts +0 -5
- package/dist/theglobalfuel/TheGlobalFuelRoot.d.ts.map +0 -1
- package/dist/theglobalfuel/TheGlobalFuelRoutes.d.ts +0 -4
- package/dist/theglobalfuel/TheGlobalFuelRoutes.d.ts.map +0 -1
- package/dist/theglobalfuel/components/DataTable.d.ts +0 -28
- package/dist/theglobalfuel/components/DataTable.d.ts.map +0 -1
- package/dist/theglobalfuel/components/EmptyState.d.ts +0 -18
- package/dist/theglobalfuel/components/EmptyState.d.ts.map +0 -1
- package/dist/theglobalfuel/components/EvidenceUpload.d.ts +0 -14
- package/dist/theglobalfuel/components/EvidenceUpload.d.ts.map +0 -1
- package/dist/theglobalfuel/components/FileLink.d.ts +0 -15
- package/dist/theglobalfuel/components/FileLink.d.ts.map +0 -1
- package/dist/theglobalfuel/components/FilterTabs.d.ts +0 -18
- package/dist/theglobalfuel/components/FilterTabs.d.ts.map +0 -1
- package/dist/theglobalfuel/components/MetricsCard.d.ts +0 -23
- package/dist/theglobalfuel/components/MetricsCard.d.ts.map +0 -1
- package/dist/theglobalfuel/components/MiniBar.d.ts +0 -16
- package/dist/theglobalfuel/components/MiniBar.d.ts.map +0 -1
- package/dist/theglobalfuel/components/PageLayout.d.ts +0 -16
- package/dist/theglobalfuel/components/PageLayout.d.ts.map +0 -1
- package/dist/theglobalfuel/components/Pagination.d.ts +0 -22
- package/dist/theglobalfuel/components/Pagination.d.ts.map +0 -1
- package/dist/theglobalfuel/components/StateViews.d.ts +0 -24
- package/dist/theglobalfuel/components/StateViews.d.ts.map +0 -1
- package/dist/theglobalfuel/components/StatusBadge.d.ts +0 -9
- package/dist/theglobalfuel/components/StatusBadge.d.ts.map +0 -1
- package/dist/theglobalfuel/components/Tabs.d.ts +0 -17
- package/dist/theglobalfuel/components/Tabs.d.ts.map +0 -1
- package/dist/theglobalfuel/components/TheDiscussion.d.ts +0 -18
- package/dist/theglobalfuel/components/TheDiscussion.d.ts.map +0 -1
- package/dist/theglobalfuel/components/TheTags.d.ts +0 -17
- package/dist/theglobalfuel/components/TheTags.d.ts.map +0 -1
- package/dist/theglobalfuel/components/index.d.ts +0 -19
- package/dist/theglobalfuel/components/index.d.ts.map +0 -1
- package/dist/theglobalfuel/context/TheGlobalFuelContext.d.ts +0 -16
- package/dist/theglobalfuel/context/TheGlobalFuelContext.d.ts.map +0 -1
- package/dist/theglobalfuel/context/index.d.ts +0 -6
- package/dist/theglobalfuel/context/index.d.ts.map +0 -1
- package/dist/theglobalfuel/hooks/index.d.ts +0 -10
- package/dist/theglobalfuel/hooks/index.d.ts.map +0 -1
- package/dist/theglobalfuel/hooks/useCursorPager.d.ts +0 -33
- package/dist/theglobalfuel/hooks/useCursorPager.d.ts.map +0 -1
- package/dist/theglobalfuel/hooks/useTheComments.d.ts +0 -36
- package/dist/theglobalfuel/hooks/useTheComments.d.ts.map +0 -1
- package/dist/theglobalfuel/hooks/useTheFiles.d.ts +0 -47
- package/dist/theglobalfuel/hooks/useTheFiles.d.ts.map +0 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +0 -75
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +0 -1
- package/dist/theglobalfuel/hooks/useTheTags.d.ts +0 -44
- package/dist/theglobalfuel/hooks/useTheTags.d.ts.map +0 -1
- package/dist/theglobalfuel/index.d.ts +0 -9
- package/dist/theglobalfuel/index.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts +0 -13
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts +0 -10
- package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts +0 -11
- package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts +0 -9
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts +0 -8
- package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts +0 -13
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts +0 -12
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts +0 -11
- package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/production/ProductionPage.d.ts +0 -11
- package/dist/theglobalfuel/pages/production/ProductionPage.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts +0 -10
- package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts.map +0 -1
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts +0 -10
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts.map +0 -1
- package/dist/theglobalfuel/types/index.d.ts +0 -376
- package/dist/theglobalfuel/types/index.d.ts.map +0 -1
- package/dist/theglobalfuel/utils/cn.d.ts +0 -4
- package/dist/theglobalfuel/utils/cn.d.ts.map +0 -1
- package/dist/theglobalfuel/utils/formatters.d.ts +0 -36
- package/dist/theglobalfuel/utils/formatters.d.ts.map +0 -1
- package/dist/theglobalfuel/utils/i18n.d.ts +0 -6
- package/dist/theglobalfuel/utils/i18n.d.ts.map +0 -1
- package/dist/theglobalfuel/utils/index.d.ts +0 -9
- package/dist/theglobalfuel/utils/index.d.ts.map +0 -1
- package/dist/theglobalfuel/utils/navigation.d.ts +0 -14
- package/dist/theglobalfuel/utils/navigation.d.ts.map +0 -1
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { PageLayout as e } from "../../components/PageLayout.js";
|
|
2
2
|
import { MetricsCard as t } from "../../components/MetricsCard.js";
|
|
3
|
-
import { formatDate as n, formatEnumLabel as r, formatPercent as i, formatRelativeTime as
|
|
4
|
-
import { StatusBadge as
|
|
5
|
-
import { MiniBar as
|
|
6
|
-
import { DataTable as
|
|
7
|
-
import { ErrorView as
|
|
8
|
-
import { EmptyState as
|
|
9
|
-
import { useTheAssets as
|
|
10
|
-
import { useCursorPager as
|
|
3
|
+
import { formatDate as n, formatEnumLabel as r, formatPercent as i, formatRelativeTime as ee, formatTonnesCo2e as a, toBackendDate as o } from "../../utils/formatters.js";
|
|
4
|
+
import { StatusBadge as te } from "../../components/StatusBadge.js";
|
|
5
|
+
import { MiniBar as s } from "../../components/MiniBar.js";
|
|
6
|
+
import { DataTable as c } from "../../components/DataTable.js";
|
|
7
|
+
import { ErrorView as l, LoadingView as u } from "../../components/StateViews.js";
|
|
8
|
+
import { EmptyState as d } from "../../components/EmptyState.js";
|
|
9
|
+
import { useTheAssets as ne, useTheEmissionRecords as re, useTheRecordEmission as ie, useTheVerifyEmission as ae } from "../../hooks/useTheGlobalFuelApi.js";
|
|
10
|
+
import { useCursorPager as oe } from "../../hooks/useCursorPager.js";
|
|
11
|
+
import { useNotify as se } from "../../hooks/useNotify.js";
|
|
11
12
|
import "../../hooks/index.js";
|
|
12
|
-
import { FilterTabs as
|
|
13
|
-
import { Pagination as
|
|
14
|
-
import { useMemo as
|
|
15
|
-
import { CheckCircle2 as
|
|
16
|
-
import { Fragment as
|
|
17
|
-
import { Button as
|
|
13
|
+
import { FilterTabs as ce } from "../../components/FilterTabs.js";
|
|
14
|
+
import { Pagination as le } from "../../components/Pagination.js";
|
|
15
|
+
import { useMemo as f, useState as p } from "react";
|
|
16
|
+
import { CheckCircle2 as ue, Circle as m, Cloud as h, Factory as g, Flame as _, Plus as v, Truck as de, Zap as fe } from "lucide-react";
|
|
17
|
+
import { Fragment as pe, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
18
|
+
import { Button as x, Input as S, Label as C, ResponsiveDialog as me, ResponsiveDialogContent as he, ResponsiveDialogDescription as ge, ResponsiveDialogFooter as _e, ResponsiveDialogHeader as ve, ResponsiveDialogTitle as ye, Select as w, SelectContent as T, SelectItem as E, SelectTrigger as D, SelectValue as O, Textarea as k } from "@burdenoff/fe-libs/ui";
|
|
18
19
|
//#region src/theglobalfuel/pages/emissions/EmissionsPage.tsx
|
|
19
|
-
var
|
|
20
|
+
var A = [
|
|
20
21
|
"SCOPE_1",
|
|
21
22
|
"SCOPE_2",
|
|
22
23
|
"SCOPE_3"
|
|
23
|
-
],
|
|
24
|
+
], j = [
|
|
24
25
|
{
|
|
25
26
|
value: "ALL",
|
|
26
27
|
label: "All scopes"
|
|
@@ -37,47 +38,47 @@ var j = [
|
|
|
37
38
|
value: "SCOPE_3",
|
|
38
39
|
label: "Scope 3"
|
|
39
40
|
}
|
|
40
|
-
],
|
|
41
|
+
], M = {
|
|
41
42
|
SCOPE_1: "bg-status-error-text",
|
|
42
43
|
SCOPE_2: "bg-status-warning-text",
|
|
43
44
|
SCOPE_3: "bg-accent"
|
|
44
|
-
},
|
|
45
|
+
}, N = 25, P = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), F = () => ({
|
|
45
46
|
assetId: "",
|
|
46
47
|
scope: "SCOPE_1",
|
|
47
48
|
co2eTonnes: "",
|
|
48
|
-
periodStart:
|
|
49
|
-
periodEnd:
|
|
49
|
+
periodStart: P(),
|
|
50
|
+
periodEnd: P(),
|
|
50
51
|
source: "",
|
|
51
52
|
methodology: "",
|
|
52
53
|
notes: ""
|
|
53
|
-
}),
|
|
54
|
+
}), I = (e, t, n) => {
|
|
54
55
|
if (t <= 0) return;
|
|
55
56
|
let r = e / t * 100;
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
+
return /* @__PURE__ */ b("div", {
|
|
57
58
|
className: "space-y-2",
|
|
58
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ y(s, {
|
|
59
60
|
value: r,
|
|
60
|
-
barClassName:
|
|
61
|
+
barClassName: M[n],
|
|
61
62
|
height: 4
|
|
62
|
-
}), /* @__PURE__ */
|
|
63
|
+
}), /* @__PURE__ */ b("p", {
|
|
63
64
|
className: "text-xs tabular-nums text-text-tertiary",
|
|
64
65
|
children: [i(r), " of total"]
|
|
65
66
|
})]
|
|
66
67
|
});
|
|
67
68
|
};
|
|
68
|
-
function
|
|
69
|
-
let
|
|
69
|
+
function L() {
|
|
70
|
+
let i = se(), [s, M] = p("ALL"), [P, L] = p("ALL"), R = oe(), [be, z] = p(!1), [B, V] = p(F), [H, U] = p(null), [W, G] = p(null), K = ne({ pagination: { limit: 100 } }), xe = f(() => {
|
|
70
71
|
let e = {};
|
|
71
|
-
for (let t of
|
|
72
|
+
for (let t of K.data?.items ?? []) e[t.id] = t.name;
|
|
72
73
|
return e;
|
|
73
|
-
}, [
|
|
74
|
-
scope:
|
|
75
|
-
assetId:
|
|
74
|
+
}, [K.data]), q = K.data?.items ?? [], { data: J, isLoading: Se, isError: Ce, refetch: we } = re({
|
|
75
|
+
scope: s === "ALL" ? void 0 : s,
|
|
76
|
+
assetId: P === "ALL" ? void 0 : P,
|
|
76
77
|
pagination: {
|
|
77
|
-
limit:
|
|
78
|
+
limit: N,
|
|
78
79
|
cursor: R.cursor
|
|
79
80
|
}
|
|
80
|
-
}),
|
|
81
|
+
}), Y = ie(), Te = ae(), X = f(() => J?.items ?? [], [J]), { total: Z, byScope: Q } = f(() => {
|
|
81
82
|
let e = {
|
|
82
83
|
SCOPE_1: 0,
|
|
83
84
|
SCOPE_2: 0,
|
|
@@ -88,18 +89,18 @@ function R() {
|
|
|
88
89
|
total: t,
|
|
89
90
|
byScope: e
|
|
90
91
|
};
|
|
91
|
-
}, [X]),
|
|
92
|
+
}, [X]), Ee = [
|
|
92
93
|
{
|
|
93
94
|
key: "scope",
|
|
94
95
|
header: "Scope",
|
|
95
|
-
render: (e) => /* @__PURE__ */
|
|
96
|
+
render: (e) => /* @__PURE__ */ y(te, { status: e.scope })
|
|
96
97
|
},
|
|
97
98
|
{
|
|
98
99
|
key: "asset",
|
|
99
100
|
header: "Asset",
|
|
100
|
-
render: (e) => /* @__PURE__ */
|
|
101
|
+
render: (e) => /* @__PURE__ */ y("span", {
|
|
101
102
|
className: "text-text-secondary",
|
|
102
|
-
children: e.assetId ?
|
|
103
|
+
children: e.assetId ? xe[e.assetId] ?? `${e.assetId.slice(0, 8)}…` : "—"
|
|
103
104
|
})
|
|
104
105
|
},
|
|
105
106
|
{
|
|
@@ -107,9 +108,9 @@ function R() {
|
|
|
107
108
|
header: "CO₂e",
|
|
108
109
|
align: "right",
|
|
109
110
|
sortValue: (e) => e.co2eTonnes,
|
|
110
|
-
render: (e) => /* @__PURE__ */
|
|
111
|
+
render: (e) => /* @__PURE__ */ y("span", {
|
|
111
112
|
className: "tabular-nums font-medium text-text-primary",
|
|
112
|
-
children:
|
|
113
|
+
children: a(e.co2eTonnes)
|
|
113
114
|
})
|
|
114
115
|
},
|
|
115
116
|
{
|
|
@@ -117,7 +118,7 @@ function R() {
|
|
|
117
118
|
header: "Period",
|
|
118
119
|
hideOnMobile: !0,
|
|
119
120
|
sortValue: (e) => new Date(e.periodStart).getTime(),
|
|
120
|
-
render: (e) => /* @__PURE__ */
|
|
121
|
+
render: (e) => /* @__PURE__ */ b("span", {
|
|
121
122
|
className: "text-text-secondary",
|
|
122
123
|
children: [
|
|
123
124
|
n(e.periodStart),
|
|
@@ -130,7 +131,7 @@ function R() {
|
|
|
130
131
|
key: "source",
|
|
131
132
|
header: "Source",
|
|
132
133
|
hideOnMobile: !0,
|
|
133
|
-
render: (e) => /* @__PURE__ */
|
|
134
|
+
render: (e) => /* @__PURE__ */ y("span", {
|
|
134
135
|
className: "text-text-secondary",
|
|
135
136
|
children: e.source ?? "—"
|
|
136
137
|
})
|
|
@@ -138,15 +139,22 @@ function R() {
|
|
|
138
139
|
{
|
|
139
140
|
key: "verified",
|
|
140
141
|
header: "Verified",
|
|
141
|
-
render: (e) => e.verified ? /* @__PURE__ */
|
|
142
|
+
render: (e) => e.verified ? /* @__PURE__ */ b("span", {
|
|
142
143
|
className: "inline-flex items-center gap-1.5 text-status-success-text",
|
|
143
|
-
children: [
|
|
144
|
-
className: "
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ y(ue, { className: "h-4 w-4" }),
|
|
146
|
+
/* @__PURE__ */ y("span", {
|
|
147
|
+
className: "text-xs font-medium",
|
|
148
|
+
children: "Verified"
|
|
149
|
+
}),
|
|
150
|
+
e.verifiedAt && /* @__PURE__ */ y("span", {
|
|
151
|
+
className: "text-xs font-normal tabular-nums text-text-tertiary",
|
|
152
|
+
children: n(e.verifiedAt)
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
}) : /* @__PURE__ */ b("span", {
|
|
148
156
|
className: "inline-flex items-center gap-1.5 text-text-tertiary",
|
|
149
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [/* @__PURE__ */ y(m, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ y("span", {
|
|
150
158
|
className: "text-xs",
|
|
151
159
|
children: "Unverified"
|
|
152
160
|
})]
|
|
@@ -157,43 +165,84 @@ function R() {
|
|
|
157
165
|
header: "Logged",
|
|
158
166
|
align: "right",
|
|
159
167
|
hideOnMobile: !0,
|
|
160
|
-
render: (e) => /* @__PURE__ */
|
|
168
|
+
render: (e) => /* @__PURE__ */ y("span", {
|
|
161
169
|
className: "text-text-tertiary",
|
|
162
|
-
children:
|
|
170
|
+
children: ee(e.createdAt)
|
|
163
171
|
})
|
|
164
172
|
},
|
|
165
173
|
{
|
|
166
174
|
key: "verify",
|
|
167
175
|
header: "",
|
|
168
176
|
align: "right",
|
|
169
|
-
render: (e) => e.verified ? null : /* @__PURE__ */
|
|
177
|
+
render: (e) => e.verified ? null : /* @__PURE__ */ y(x, {
|
|
170
178
|
size: "sm",
|
|
171
179
|
variant: "outline",
|
|
172
|
-
onClick: () =>
|
|
173
|
-
|
|
174
|
-
|
|
180
|
+
onClick: () => {
|
|
181
|
+
G(e.id), Te.mutate(e.id, {
|
|
182
|
+
onSuccess: () => i.success("Emission verified"),
|
|
183
|
+
onError: (e) => i.fromError(e),
|
|
184
|
+
onSettled: () => G(null)
|
|
185
|
+
});
|
|
186
|
+
},
|
|
187
|
+
disabled: W === e.id,
|
|
188
|
+
children: W === e.id ? "Verifying…" : "Verify"
|
|
175
189
|
})
|
|
176
190
|
}
|
|
177
191
|
], $ = () => {
|
|
178
|
-
V(
|
|
192
|
+
V(F()), U(null), z(!0);
|
|
193
|
+
}, De = async () => {
|
|
194
|
+
let e = Number(B.co2eTonnes);
|
|
195
|
+
if (!B.co2eTonnes || Number.isNaN(e) || e <= 0) {
|
|
196
|
+
let e = "CO₂e (tonnes) must be greater than zero.";
|
|
197
|
+
U(e), i.error(e);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (!B.periodStart || !B.periodEnd) {
|
|
201
|
+
U("Period start and end are required.");
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
let t = o(B.periodStart), n = o(B.periodEnd);
|
|
205
|
+
if (!t || !n) {
|
|
206
|
+
U("Period start and end are required.");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (new Date(n).getTime() < new Date(t).getTime()) {
|
|
210
|
+
U("Period end must be on or after the period start.");
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
U(null);
|
|
214
|
+
try {
|
|
215
|
+
await Y.mutateAsync({
|
|
216
|
+
assetId: B.assetId || null,
|
|
217
|
+
scope: B.scope,
|
|
218
|
+
co2eTonnes: e,
|
|
219
|
+
periodStart: t,
|
|
220
|
+
periodEnd: n,
|
|
221
|
+
source: B.source.trim() || null,
|
|
222
|
+
methodology: B.methodology.trim() || null,
|
|
223
|
+
notes: B.notes.trim() || null
|
|
224
|
+
}), i.success("Emission recorded"), z(!1), V(F());
|
|
225
|
+
} catch (e) {
|
|
226
|
+
i.fromError(e), U(e instanceof Error ? e.message : "Failed to record emission.");
|
|
227
|
+
}
|
|
179
228
|
};
|
|
180
|
-
return /* @__PURE__ */
|
|
229
|
+
return /* @__PURE__ */ b(e, {
|
|
181
230
|
title: "Emissions",
|
|
182
231
|
description: "ESG greenhouse-gas ledger across every asset — GHG Protocol Scope 1 / 2 / 3, with third-party verification.",
|
|
183
|
-
actions: /* @__PURE__ */ x
|
|
232
|
+
actions: /* @__PURE__ */ b(x, {
|
|
184
233
|
onClick: $,
|
|
185
|
-
children: [/* @__PURE__ */
|
|
234
|
+
children: [/* @__PURE__ */ y(v, { className: "mr-1.5 h-4 w-4" }), " Record emission"]
|
|
186
235
|
}),
|
|
187
236
|
children: [
|
|
188
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ b("div", {
|
|
189
238
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
190
239
|
children: [
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
icon: /* @__PURE__ */
|
|
193
|
-
value: X.length > 0 ?
|
|
240
|
+
/* @__PURE__ */ y(t, {
|
|
241
|
+
icon: /* @__PURE__ */ y(g, { className: "h-5 w-5" }),
|
|
242
|
+
value: X.length > 0 ? a(Z) : "—",
|
|
194
243
|
label: "CO₂e on this page",
|
|
195
244
|
featured: !0,
|
|
196
|
-
footer: /* @__PURE__ */
|
|
245
|
+
footer: /* @__PURE__ */ b("p", {
|
|
197
246
|
className: "text-xs tabular-nums text-text-tertiary",
|
|
198
247
|
children: [
|
|
199
248
|
X.length,
|
|
@@ -203,115 +252,118 @@ function R() {
|
|
|
203
252
|
]
|
|
204
253
|
})
|
|
205
254
|
}),
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
icon: /* @__PURE__ */
|
|
208
|
-
value: X.length > 0 ?
|
|
255
|
+
/* @__PURE__ */ y(t, {
|
|
256
|
+
icon: /* @__PURE__ */ y(_, { className: "h-5 w-5" }),
|
|
257
|
+
value: X.length > 0 ? a(Q.SCOPE_1) : "—",
|
|
209
258
|
label: "Scope 1 · Direct",
|
|
210
|
-
footer:
|
|
259
|
+
footer: I(Q.SCOPE_1, Z, "SCOPE_1")
|
|
211
260
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
icon: /* @__PURE__ */
|
|
214
|
-
value: X.length > 0 ?
|
|
261
|
+
/* @__PURE__ */ y(t, {
|
|
262
|
+
icon: /* @__PURE__ */ y(fe, { className: "h-5 w-5" }),
|
|
263
|
+
value: X.length > 0 ? a(Q.SCOPE_2) : "—",
|
|
215
264
|
label: "Scope 2 · Purchased energy",
|
|
216
|
-
footer:
|
|
265
|
+
footer: I(Q.SCOPE_2, Z, "SCOPE_2")
|
|
217
266
|
}),
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
icon: /* @__PURE__ */
|
|
220
|
-
value: X.length > 0 ?
|
|
267
|
+
/* @__PURE__ */ y(t, {
|
|
268
|
+
icon: /* @__PURE__ */ y(de, { className: "h-5 w-5" }),
|
|
269
|
+
value: X.length > 0 ? a(Q.SCOPE_3) : "—",
|
|
221
270
|
label: "Scope 3 · Value chain",
|
|
222
|
-
footer:
|
|
271
|
+
footer: I(Q.SCOPE_3, Z, "SCOPE_3")
|
|
223
272
|
})
|
|
224
273
|
]
|
|
225
274
|
}),
|
|
226
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ b("div", {
|
|
227
276
|
className: "mt-6 mb-5 flex flex-wrap items-center gap-3",
|
|
228
|
-
children: [/* @__PURE__ */
|
|
229
|
-
options:
|
|
230
|
-
value:
|
|
277
|
+
children: [/* @__PURE__ */ y(ce, {
|
|
278
|
+
options: j,
|
|
279
|
+
value: s,
|
|
231
280
|
onChange: (e) => {
|
|
232
|
-
|
|
281
|
+
M(e), R.reset();
|
|
233
282
|
}
|
|
234
|
-
}), /* @__PURE__ */
|
|
235
|
-
value:
|
|
283
|
+
}), /* @__PURE__ */ b(w, {
|
|
284
|
+
value: P,
|
|
236
285
|
onValueChange: (e) => {
|
|
237
|
-
|
|
286
|
+
L(e), R.reset();
|
|
238
287
|
},
|
|
239
|
-
children: [/* @__PURE__ */
|
|
288
|
+
children: [/* @__PURE__ */ y(D, {
|
|
240
289
|
className: "w-56",
|
|
241
|
-
|
|
242
|
-
|
|
290
|
+
"aria-label": "Filter by asset",
|
|
291
|
+
children: /* @__PURE__ */ y(O, { placeholder: "All assets" })
|
|
292
|
+
}), /* @__PURE__ */ b(T, { children: [/* @__PURE__ */ y(E, {
|
|
243
293
|
value: "ALL",
|
|
244
294
|
children: "All assets"
|
|
245
|
-
}),
|
|
295
|
+
}), q.map((e) => /* @__PURE__ */ y(E, {
|
|
246
296
|
value: e.id,
|
|
247
297
|
children: e.name
|
|
248
298
|
}, e.id))] })]
|
|
249
299
|
})]
|
|
250
300
|
}),
|
|
251
|
-
|
|
301
|
+
Se ? /* @__PURE__ */ y(u, { label: "Loading emission records…" }) : Ce ? /* @__PURE__ */ y(l, {
|
|
252
302
|
message: "Couldn't load emission records.",
|
|
253
|
-
onRetry: () =>
|
|
254
|
-
}) : X.length === 0 ? /* @__PURE__ */
|
|
303
|
+
onRetry: () => we()
|
|
304
|
+
}) : X.length === 0 ? /* @__PURE__ */ y(d, {
|
|
255
305
|
illustration: "empty-data",
|
|
256
|
-
icon: /* @__PURE__ */
|
|
306
|
+
icon: /* @__PURE__ */ y(h, { className: "h-10 w-10" }),
|
|
257
307
|
title: "No emissions recorded",
|
|
258
|
-
description:
|
|
259
|
-
action: /* @__PURE__ */ x
|
|
308
|
+
description: s === "ALL" && P === "ALL" ? "Record a CO₂e figure to start building your Scope 1–3 emissions ledger." : "No emission records match these filters.",
|
|
309
|
+
action: /* @__PURE__ */ b(x, {
|
|
260
310
|
onClick: $,
|
|
261
|
-
children: [/* @__PURE__ */
|
|
311
|
+
children: [/* @__PURE__ */ y(v, { className: "mr-1.5 h-4 w-4" }), " Record emission"]
|
|
262
312
|
})
|
|
263
|
-
}) : /* @__PURE__ */
|
|
264
|
-
columns:
|
|
313
|
+
}) : /* @__PURE__ */ b(pe, { children: [/* @__PURE__ */ y(c, {
|
|
314
|
+
columns: Ee,
|
|
265
315
|
rows: X,
|
|
266
316
|
rowKey: (e) => e.id,
|
|
267
317
|
defaultSort: {
|
|
268
318
|
key: "period",
|
|
269
319
|
dir: "desc"
|
|
270
320
|
}
|
|
271
|
-
}), /* @__PURE__ */
|
|
321
|
+
}), /* @__PURE__ */ y(le, {
|
|
272
322
|
page: R.page,
|
|
273
|
-
pageSize:
|
|
323
|
+
pageSize: N,
|
|
274
324
|
itemCount: X.length,
|
|
275
|
-
hasMore:
|
|
276
|
-
onPageChange: (e) => R.onPageChange(e,
|
|
325
|
+
hasMore: J?.pageInfo?.hasMore ?? !1,
|
|
326
|
+
onPageChange: (e) => R.onPageChange(e, J?.pageInfo?.cursor)
|
|
277
327
|
})] }),
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
open:
|
|
328
|
+
/* @__PURE__ */ y(me, {
|
|
329
|
+
open: be,
|
|
280
330
|
onOpenChange: (e) => {
|
|
281
|
-
z(e), e || (V(
|
|
331
|
+
z(e), e || (V(F()), U(null));
|
|
282
332
|
},
|
|
283
|
-
children: /* @__PURE__ */
|
|
284
|
-
|
|
285
|
-
|
|
333
|
+
children: /* @__PURE__ */ b(he, { children: [/* @__PURE__ */ b(ve, { children: [/* @__PURE__ */ y(ye, { children: "Record emission" }), /* @__PURE__ */ y(ge, { children: "Log a CO₂e figure for a reporting period — optionally attributed to an asset." })] }), /* @__PURE__ */ b("form", {
|
|
334
|
+
onSubmit: (e) => {
|
|
335
|
+
e.preventDefault(), De();
|
|
336
|
+
},
|
|
337
|
+
children: [/* @__PURE__ */ b("div", {
|
|
286
338
|
className: "grid gap-4 py-2",
|
|
287
339
|
children: [
|
|
288
|
-
/* @__PURE__ */
|
|
340
|
+
/* @__PURE__ */ b("div", {
|
|
289
341
|
className: "grid gap-2 sm:grid-cols-2",
|
|
290
|
-
children: [/* @__PURE__ */
|
|
342
|
+
children: [/* @__PURE__ */ b("div", {
|
|
291
343
|
className: "grid gap-1.5",
|
|
292
|
-
children: [/* @__PURE__ */
|
|
344
|
+
children: [/* @__PURE__ */ y(C, {
|
|
293
345
|
htmlFor: "emScope",
|
|
294
346
|
children: "Scope"
|
|
295
|
-
}), /* @__PURE__ */
|
|
347
|
+
}), /* @__PURE__ */ b(w, {
|
|
296
348
|
value: B.scope,
|
|
297
349
|
onValueChange: (e) => V({
|
|
298
350
|
...B,
|
|
299
351
|
scope: e
|
|
300
352
|
}),
|
|
301
|
-
children: [/* @__PURE__ */
|
|
353
|
+
children: [/* @__PURE__ */ y(D, {
|
|
302
354
|
id: "emScope",
|
|
303
|
-
children: /* @__PURE__ */
|
|
304
|
-
}), /* @__PURE__ */
|
|
355
|
+
children: /* @__PURE__ */ y(O, {})
|
|
356
|
+
}), /* @__PURE__ */ y(T, { children: A.map((e) => /* @__PURE__ */ y(E, {
|
|
305
357
|
value: e,
|
|
306
358
|
children: r(e)
|
|
307
359
|
}, e)) })]
|
|
308
360
|
})]
|
|
309
|
-
}), /* @__PURE__ */
|
|
361
|
+
}), /* @__PURE__ */ b("div", {
|
|
310
362
|
className: "grid gap-1.5",
|
|
311
|
-
children: [/* @__PURE__ */
|
|
363
|
+
children: [/* @__PURE__ */ y(C, {
|
|
312
364
|
htmlFor: "emCo2e",
|
|
313
365
|
children: "CO₂e (tonnes) *"
|
|
314
|
-
}), /* @__PURE__ */
|
|
366
|
+
}), /* @__PURE__ */ y(S, {
|
|
315
367
|
id: "emCo2e",
|
|
316
368
|
type: "number",
|
|
317
369
|
min: "0",
|
|
@@ -325,34 +377,34 @@ function R() {
|
|
|
325
377
|
})]
|
|
326
378
|
})]
|
|
327
379
|
}),
|
|
328
|
-
/* @__PURE__ */
|
|
380
|
+
/* @__PURE__ */ b("div", {
|
|
329
381
|
className: "grid gap-1.5",
|
|
330
|
-
children: [/* @__PURE__ */
|
|
382
|
+
children: [/* @__PURE__ */ y(C, {
|
|
331
383
|
htmlFor: "emAsset",
|
|
332
384
|
children: "Asset"
|
|
333
|
-
}), /* @__PURE__ */
|
|
385
|
+
}), /* @__PURE__ */ b(w, {
|
|
334
386
|
value: B.assetId,
|
|
335
387
|
onValueChange: (e) => V({
|
|
336
388
|
...B,
|
|
337
389
|
assetId: e
|
|
338
390
|
}),
|
|
339
|
-
children: [/* @__PURE__ */
|
|
391
|
+
children: [/* @__PURE__ */ y(D, {
|
|
340
392
|
id: "emAsset",
|
|
341
|
-
children: /* @__PURE__ */
|
|
342
|
-
}), /* @__PURE__ */
|
|
393
|
+
children: /* @__PURE__ */ y(O, { placeholder: "Optional — org-wide if unset" })
|
|
394
|
+
}), /* @__PURE__ */ y(T, { children: q.map((e) => /* @__PURE__ */ y(E, {
|
|
343
395
|
value: e.id,
|
|
344
396
|
children: e.name
|
|
345
397
|
}, e.id)) })]
|
|
346
398
|
})]
|
|
347
399
|
}),
|
|
348
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ b("div", {
|
|
349
401
|
className: "grid gap-2 sm:grid-cols-2",
|
|
350
|
-
children: [/* @__PURE__ */
|
|
402
|
+
children: [/* @__PURE__ */ b("div", {
|
|
351
403
|
className: "grid gap-1.5",
|
|
352
|
-
children: [/* @__PURE__ */
|
|
404
|
+
children: [/* @__PURE__ */ y(C, {
|
|
353
405
|
htmlFor: "emStart",
|
|
354
406
|
children: "Period start *"
|
|
355
|
-
}), /* @__PURE__ */
|
|
407
|
+
}), /* @__PURE__ */ y(S, {
|
|
356
408
|
id: "emStart",
|
|
357
409
|
type: "date",
|
|
358
410
|
value: B.periodStart,
|
|
@@ -361,12 +413,12 @@ function R() {
|
|
|
361
413
|
periodStart: e.target.value
|
|
362
414
|
})
|
|
363
415
|
})]
|
|
364
|
-
}), /* @__PURE__ */
|
|
416
|
+
}), /* @__PURE__ */ b("div", {
|
|
365
417
|
className: "grid gap-1.5",
|
|
366
|
-
children: [/* @__PURE__ */
|
|
418
|
+
children: [/* @__PURE__ */ y(C, {
|
|
367
419
|
htmlFor: "emEnd",
|
|
368
420
|
children: "Period end *"
|
|
369
|
-
}), /* @__PURE__ */
|
|
421
|
+
}), /* @__PURE__ */ y(S, {
|
|
370
422
|
id: "emEnd",
|
|
371
423
|
type: "date",
|
|
372
424
|
value: B.periodEnd,
|
|
@@ -377,14 +429,14 @@ function R() {
|
|
|
377
429
|
})]
|
|
378
430
|
})]
|
|
379
431
|
}),
|
|
380
|
-
/* @__PURE__ */
|
|
432
|
+
/* @__PURE__ */ b("div", {
|
|
381
433
|
className: "grid gap-2 sm:grid-cols-2",
|
|
382
|
-
children: [/* @__PURE__ */
|
|
434
|
+
children: [/* @__PURE__ */ b("div", {
|
|
383
435
|
className: "grid gap-1.5",
|
|
384
|
-
children: [/* @__PURE__ */
|
|
436
|
+
children: [/* @__PURE__ */ y(C, {
|
|
385
437
|
htmlFor: "emSource",
|
|
386
438
|
children: "Source"
|
|
387
|
-
}), /* @__PURE__ */
|
|
439
|
+
}), /* @__PURE__ */ y(S, {
|
|
388
440
|
id: "emSource",
|
|
389
441
|
value: B.source,
|
|
390
442
|
onChange: (e) => V({
|
|
@@ -393,12 +445,12 @@ function R() {
|
|
|
393
445
|
}),
|
|
394
446
|
placeholder: "Flaring, grid electricity…"
|
|
395
447
|
})]
|
|
396
|
-
}), /* @__PURE__ */
|
|
448
|
+
}), /* @__PURE__ */ b("div", {
|
|
397
449
|
className: "grid gap-1.5",
|
|
398
|
-
children: [/* @__PURE__ */
|
|
450
|
+
children: [/* @__PURE__ */ y(C, {
|
|
399
451
|
htmlFor: "emMethod",
|
|
400
452
|
children: "Methodology"
|
|
401
|
-
}), /* @__PURE__ */
|
|
453
|
+
}), /* @__PURE__ */ y(S, {
|
|
402
454
|
id: "emMethod",
|
|
403
455
|
value: B.methodology,
|
|
404
456
|
onChange: (e) => V({
|
|
@@ -409,12 +461,12 @@ function R() {
|
|
|
409
461
|
})]
|
|
410
462
|
})]
|
|
411
463
|
}),
|
|
412
|
-
/* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ b("div", {
|
|
413
465
|
className: "grid gap-1.5",
|
|
414
|
-
children: [/* @__PURE__ */
|
|
466
|
+
children: [/* @__PURE__ */ y(C, {
|
|
415
467
|
htmlFor: "emNotes",
|
|
416
468
|
children: "Notes"
|
|
417
|
-
}), /* @__PURE__ */
|
|
469
|
+
}), /* @__PURE__ */ y(k, {
|
|
418
470
|
id: "emNotes",
|
|
419
471
|
rows: 2,
|
|
420
472
|
value: B.notes,
|
|
@@ -425,55 +477,27 @@ function R() {
|
|
|
425
477
|
placeholder: "Optional context about this figure."
|
|
426
478
|
})]
|
|
427
479
|
}),
|
|
428
|
-
H && /* @__PURE__ */
|
|
480
|
+
H && /* @__PURE__ */ y("p", {
|
|
429
481
|
className: "text-sm text-status-error-text",
|
|
430
482
|
children: H
|
|
431
483
|
})
|
|
432
484
|
]
|
|
433
|
-
}),
|
|
434
|
-
|
|
485
|
+
}), /* @__PURE__ */ b(_e, { children: [/* @__PURE__ */ y(x, {
|
|
486
|
+
type: "button",
|
|
435
487
|
variant: "outline",
|
|
436
488
|
onClick: () => z(!1),
|
|
437
489
|
children: "Cancel"
|
|
438
|
-
}), /* @__PURE__ */
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
if (!B.periodStart || !B.periodEnd) {
|
|
445
|
-
U("Period start and end are required.");
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
if (new Date(B.periodEnd).getTime() < new Date(B.periodStart).getTime()) {
|
|
449
|
-
U("Period end must be on or after the period start.");
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
U(null);
|
|
453
|
-
try {
|
|
454
|
-
await J.mutateAsync({
|
|
455
|
-
assetId: B.assetId || null,
|
|
456
|
-
scope: B.scope,
|
|
457
|
-
co2eTonnes: Number(B.co2eTonnes),
|
|
458
|
-
periodStart: new Date(B.periodStart).toISOString(),
|
|
459
|
-
periodEnd: new Date(B.periodEnd).toISOString(),
|
|
460
|
-
source: B.source.trim() || null,
|
|
461
|
-
methodology: B.methodology.trim() || null,
|
|
462
|
-
notes: B.notes.trim() || null
|
|
463
|
-
}), z(!1), V(I());
|
|
464
|
-
} catch (e) {
|
|
465
|
-
U(e instanceof Error ? e.message : "Failed to record emission.");
|
|
466
|
-
}
|
|
467
|
-
},
|
|
468
|
-
disabled: J.isPending,
|
|
469
|
-
children: J.isPending ? "Recording…" : "Record emission"
|
|
470
|
-
})] })
|
|
471
|
-
] })
|
|
490
|
+
}), /* @__PURE__ */ y(x, {
|
|
491
|
+
type: "submit",
|
|
492
|
+
disabled: Y.isPending,
|
|
493
|
+
children: Y.isPending ? "Recording…" : "Record emission"
|
|
494
|
+
})] })]
|
|
495
|
+
})] })
|
|
472
496
|
})
|
|
473
497
|
]
|
|
474
498
|
});
|
|
475
499
|
}
|
|
476
500
|
//#endregion
|
|
477
|
-
export {
|
|
501
|
+
export { L as EmissionsPage };
|
|
478
502
|
|
|
479
503
|
//# sourceMappingURL=EmissionsPage.js.map
|