@burdenoff/microfe-ecoimpacthub 2026.1124.1 → 2026.1124.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/ecoimpacthub/EcoImpactHubRoutes.js +43 -39
- package/dist/ecoimpacthub/EcoImpactHubRoutes.js.map +1 -1
- package/dist/ecoimpacthub/hooks/index.d.ts +1 -0
- package/dist/ecoimpacthub/hooks/index.js +3 -2
- package/dist/ecoimpacthub/hooks/useEcoAiOperations.d.ts +15 -0
- package/dist/ecoimpacthub/hooks/useEcoAiOperations.js +90 -0
- package/dist/ecoimpacthub/hooks/useEcoAiOperations.js.map +1 -0
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.js +1 -1
- package/dist/ecoimpacthub/hooks/useEcoImpactHubApi.js.map +1 -1
- package/dist/ecoimpacthub/pages/ai/AiOperationsPage.d.ts +21 -0
- package/dist/ecoimpacthub/pages/ai/AiOperationsPage.js +536 -0
- package/dist/ecoimpacthub/pages/ai/AiOperationsPage.js.map +1 -0
- package/dist/ecoimpacthub/pages/carbon/CarbonPage.js +346 -320
- package/dist/ecoimpacthub/pages/carbon/CarbonPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/observations/ObservationsPage.js +165 -143
- package/dist/ecoimpacthub/pages/observations/ObservationsPage.js.map +1 -1
- package/dist/ecoimpacthub/pages/reports/ReportDetailPage.js +346 -185
- package/dist/ecoimpacthub/pages/reports/ReportDetailPage.js.map +1 -1
- package/dist/ecoimpacthub/types/index.d.ts +83 -0
- package/dist/ecoimpacthub/utils/pageContext.js +2 -1
- package/dist/ecoimpacthub/utils/pageContext.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,244 +1,411 @@
|
|
|
1
1
|
import { useEcoImpactHub as e } from "../../context/EcoImpactHubContext.js";
|
|
2
2
|
import { PageLayout as t } from "../../components/PageLayout.js";
|
|
3
3
|
import { StatusBadge as n } from "../../components/StatusBadge.js";
|
|
4
|
-
import { ErrorView as
|
|
5
|
-
import { EmptyState as
|
|
6
|
-
import { EvidenceUpload as
|
|
7
|
-
import { FileLink as
|
|
8
|
-
import { useEcoAddReportLineItem as
|
|
9
|
-
import { useActiveEcoEntity as
|
|
10
|
-
import {
|
|
4
|
+
import { ErrorView as ee, LoadingView as te, Section as ne } from "../../components/StateViews.js";
|
|
5
|
+
import { EmptyState as re } from "../../components/EmptyState.js";
|
|
6
|
+
import { EvidenceUpload as ie } from "../../components/EvidenceUpload.js";
|
|
7
|
+
import { FileLink as ae } from "../../components/FileLink.js";
|
|
8
|
+
import { useEcoAddReportLineItem as oe, useEcoPublishReport as r, useEcoReport as i } from "../../hooks/useEcoImpactHubApi.js";
|
|
9
|
+
import { useActiveEcoEntity as a } from "../../hooks/useActiveEcoEntity.js";
|
|
10
|
+
import { useEcoAiDraftReportLineItems as o, useEcoAiReportReadiness as se } from "../../hooks/useEcoAiOperations.js";
|
|
11
|
+
import { EcoDiscussion as ce } from "../../components/EcoDiscussion.js";
|
|
11
12
|
import "../../context/index.js";
|
|
12
13
|
import "../../hooks/index.js";
|
|
13
|
-
import { formatDate as
|
|
14
|
-
import { FrameworkBadge as
|
|
15
|
-
import { useMemo as
|
|
16
|
-
import { ArrowLeft as
|
|
17
|
-
import { useParams as
|
|
18
|
-
import { Fragment as
|
|
19
|
-
import { Button as
|
|
14
|
+
import { formatDate as s, formatNumber as c } from "../../utils/formatters.js";
|
|
15
|
+
import { FrameworkBadge as l } from "../badges.js";
|
|
16
|
+
import { useMemo as u, useState as d } from "react";
|
|
17
|
+
import { AlertTriangle as le, ArrowLeft as ue, CheckCircle2 as de, ExternalLink as f, ListPlus as p, Send as fe, ShieldAlert as pe, Sparkles as m } from "lucide-react";
|
|
18
|
+
import { useParams as h } from "react-router";
|
|
19
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
20
|
+
import { Button as y, GlassCard as b, Input as x, Label as S, ResponsiveDialog as C, ResponsiveDialogContent as w, ResponsiveDialogDescription as T, ResponsiveDialogFooter as E, ResponsiveDialogHeader as D, ResponsiveDialogTitle as O } from "@burdenoff/fe-libs/ui";
|
|
20
21
|
// src/ecoimpacthub/pages/reports/ReportDetailPage.tsx
|
|
21
|
-
function
|
|
22
|
-
return /* @__PURE__ */
|
|
22
|
+
function k({ label: e, children: t }) {
|
|
23
|
+
return /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
|
|
23
24
|
className: "text-xs text-text-tertiary",
|
|
24
25
|
children: e
|
|
25
|
-
}), /* @__PURE__ */
|
|
26
|
+
}), /* @__PURE__ */ _("dd", {
|
|
26
27
|
className: "mt-1 text-sm text-text-primary",
|
|
27
28
|
children: t
|
|
28
29
|
})] });
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
let { id:
|
|
32
|
-
|
|
33
|
-
let
|
|
31
|
+
function A() {
|
|
32
|
+
let { id: A } = h(), { navigateTo: j } = e(), { data: M, isLoading: me, isError: N, refetch: P } = i(A);
|
|
33
|
+
a(M?.id, M?.title);
|
|
34
|
+
let F = oe(), I = r(), L = o(), R = se(A), [he, z] = d(!1), [ge, B] = d(!1), [V, H] = d(null), [U, W] = d({
|
|
34
35
|
label: "",
|
|
35
36
|
value: "",
|
|
36
37
|
unit: "",
|
|
37
38
|
category: "",
|
|
38
39
|
carbonEntryId: ""
|
|
39
|
-
}), [
|
|
40
|
-
let e = new Set(
|
|
40
|
+
}), [G, K] = d(null), [q, J] = d(null), Y = u(() => M?.lineItems ?? [], [M]), _e = u(() => Y.reduce((e, t) => e + t.value, 0), [Y]), X = u(() => {
|
|
41
|
+
let e = new Set(Y.map((e) => e.unit));
|
|
41
42
|
return e.size === 1 ? [...e][0] : null;
|
|
42
|
-
}, [
|
|
43
|
-
if (
|
|
43
|
+
}, [Y]);
|
|
44
|
+
if (me) return /* @__PURE__ */ _(t, {
|
|
44
45
|
title: "Report",
|
|
45
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ _(te, {})
|
|
46
47
|
});
|
|
47
|
-
if (
|
|
48
|
+
if (N || !M) return /* @__PURE__ */ _(t, {
|
|
48
49
|
title: "Report",
|
|
49
|
-
children: /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ _(ee, {
|
|
50
51
|
message: "This report could not be loaded.",
|
|
51
|
-
onRetry: () =>
|
|
52
|
+
onRetry: () => P()
|
|
52
53
|
})
|
|
53
54
|
});
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
let Z = M.status === "PUBLISHED", Q = async () => {
|
|
56
|
+
if (A) {
|
|
57
|
+
if (!U.label.trim() || !U.value || !U.unit.trim()) K("Label, value and unit are required.");
|
|
58
|
+
else {
|
|
59
|
+
K(null);
|
|
60
|
+
try {
|
|
61
|
+
await F.mutateAsync({
|
|
62
|
+
reportId: A,
|
|
63
|
+
label: U.label.trim(),
|
|
64
|
+
value: Number(U.value),
|
|
65
|
+
unit: U.unit.trim(),
|
|
66
|
+
category: U.category.trim() || null,
|
|
67
|
+
carbonEntryId: U.carbonEntryId.trim() || null
|
|
68
|
+
}), z(!1), W({
|
|
69
|
+
label: "",
|
|
70
|
+
value: "",
|
|
71
|
+
unit: "",
|
|
72
|
+
category: "",
|
|
73
|
+
carbonEntryId: ""
|
|
74
|
+
});
|
|
75
|
+
} catch (e) {
|
|
76
|
+
K(e instanceof Error ? e.message : "Failed to add line item.");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, ve = async () => {
|
|
81
|
+
if (A) {
|
|
82
|
+
K(null);
|
|
83
|
+
try {
|
|
84
|
+
await I.mutateAsync({
|
|
85
|
+
id: A,
|
|
86
|
+
fileId: q?.fileId ?? null
|
|
87
|
+
}), J(null), B(!1);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
K(e instanceof Error ? e.message : "Failed to publish report.");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, ye = async () => {
|
|
93
|
+
if (A) {
|
|
94
|
+
K(null), H(null);
|
|
95
|
+
try {
|
|
96
|
+
let e = await L.mutateAsync(A);
|
|
97
|
+
H(e.draftedCount > 0 ? `Drafted ${e.draftedCount} cited ${e.framework} line item(s) (AgentRun ${e.agentRunId}). Verify source links before publishing.` : `No new line items drafted (${e.skippedDisclosures.length} disclosure(s) already covered or missing workspace source data).`), await P(), await R.refetch();
|
|
98
|
+
} catch (e) {
|
|
99
|
+
K(e instanceof Error ? e.message : "Failed to draft line items with AI.");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, $ = R.data, be = Y.some((e) => e.aiDrafted);
|
|
103
|
+
return /* @__PURE__ */ v(t, {
|
|
104
|
+
title: /* @__PURE__ */ v("span", {
|
|
57
105
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2",
|
|
58
|
-
children: [/* @__PURE__ */
|
|
106
|
+
children: [/* @__PURE__ */ _("span", {
|
|
59
107
|
className: "text-text-primary",
|
|
60
|
-
children:
|
|
61
|
-
}), /* @__PURE__ */
|
|
108
|
+
children: M.title
|
|
109
|
+
}), /* @__PURE__ */ _(l, { framework: M.framework })]
|
|
62
110
|
}),
|
|
63
|
-
description: `Reporting period ${
|
|
64
|
-
actions: /* @__PURE__ */
|
|
111
|
+
description: `Reporting period ${s(M.periodStart)} – ${s(M.periodEnd)}`,
|
|
112
|
+
actions: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(n, { status: M.status }), /* @__PURE__ */ v(y, {
|
|
65
113
|
variant: "ghost",
|
|
66
|
-
onClick: () =>
|
|
67
|
-
children: [/* @__PURE__ */
|
|
114
|
+
onClick: () => j("reports"),
|
|
115
|
+
children: [/* @__PURE__ */ _(ue, { className: "mr-1.5 h-4 w-4" }), " Back"]
|
|
68
116
|
})] }),
|
|
69
117
|
children: [
|
|
70
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ v("div", {
|
|
71
119
|
className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
|
|
72
|
-
children: [/* @__PURE__ */
|
|
120
|
+
children: [/* @__PURE__ */ v(b, {
|
|
73
121
|
treatment: "glass",
|
|
74
122
|
className: "p-6 lg:col-span-2",
|
|
75
|
-
children: [/* @__PURE__ */
|
|
123
|
+
children: [/* @__PURE__ */ v("dl", {
|
|
76
124
|
className: "grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3",
|
|
77
125
|
children: [
|
|
78
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ _(k, {
|
|
79
127
|
label: "Framework",
|
|
80
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ _(l, { framework: M.framework })
|
|
81
129
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ _(k, {
|
|
83
131
|
label: "Status",
|
|
84
|
-
children: /* @__PURE__ */
|
|
132
|
+
children: /* @__PURE__ */ _(n, { status: M.status })
|
|
85
133
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ _(k, {
|
|
87
135
|
label: "Period",
|
|
88
|
-
children: /* @__PURE__ */
|
|
136
|
+
children: /* @__PURE__ */ v("span", {
|
|
89
137
|
className: "tabular-nums",
|
|
90
138
|
children: [
|
|
91
|
-
|
|
139
|
+
s(M.periodStart),
|
|
92
140
|
" – ",
|
|
93
|
-
|
|
141
|
+
s(M.periodEnd)
|
|
94
142
|
]
|
|
95
143
|
})
|
|
96
144
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ _(k, {
|
|
98
146
|
label: "Published",
|
|
99
|
-
children:
|
|
147
|
+
children: s(M.publishedAt)
|
|
100
148
|
}),
|
|
101
|
-
/* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ _(k, {
|
|
102
150
|
label: "Line items",
|
|
103
|
-
children: /* @__PURE__ */
|
|
151
|
+
children: /* @__PURE__ */ _("span", {
|
|
104
152
|
className: "tabular-nums",
|
|
105
|
-
children:
|
|
153
|
+
children: Y.length
|
|
106
154
|
})
|
|
107
155
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ _(k, {
|
|
109
157
|
label: "Attachment",
|
|
110
|
-
children:
|
|
158
|
+
children: M.file?.id ? /* @__PURE__ */ _(ae, { fileId: M.file.id }) : /* @__PURE__ */ _("span", {
|
|
111
159
|
className: "text-text-tertiary",
|
|
112
160
|
children: "—"
|
|
113
161
|
})
|
|
114
162
|
})
|
|
115
163
|
]
|
|
116
|
-
}),
|
|
164
|
+
}), M.summary && /* @__PURE__ */ _("p", {
|
|
117
165
|
className: "mt-5 rounded-lg bg-bg-sunken/60 p-3 text-sm text-text-secondary",
|
|
118
|
-
children:
|
|
166
|
+
children: M.summary
|
|
119
167
|
})]
|
|
120
|
-
}), /* @__PURE__ */
|
|
168
|
+
}), /* @__PURE__ */ v(b, {
|
|
121
169
|
treatment: "glass",
|
|
122
170
|
className: "flex flex-col gap-3 p-6",
|
|
123
171
|
children: [
|
|
124
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ _("p", {
|
|
125
173
|
className: "text-xs font-medium uppercase tracking-wide text-text-tertiary",
|
|
126
174
|
children: "Actions"
|
|
127
175
|
}),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
onClick: () =>
|
|
130
|
-
children: [/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ v(y, {
|
|
177
|
+
onClick: () => z(!0),
|
|
178
|
+
children: [/* @__PURE__ */ _(p, { className: "mr-1.5 h-4 w-4" }), " Add line item"]
|
|
131
179
|
}),
|
|
132
|
-
|
|
180
|
+
!Z && /* @__PURE__ */ v(y, {
|
|
181
|
+
variant: "outline",
|
|
182
|
+
"data-testid": "eco-report-draft-ai",
|
|
183
|
+
onClick: ye,
|
|
184
|
+
disabled: L.isPending,
|
|
185
|
+
children: [/* @__PURE__ */ _(m, { className: "mr-1.5 h-4 w-4" }), L.isPending ? "Drafting with AI…" : "Draft line items with AI"]
|
|
186
|
+
}),
|
|
187
|
+
Z ? /* @__PURE__ */ v("p", {
|
|
133
188
|
className: "mt-1 text-sm text-text-secondary",
|
|
134
189
|
children: [
|
|
135
190
|
"Published ",
|
|
136
|
-
|
|
191
|
+
s(M.publishedAt),
|
|
137
192
|
". This disclosure is finalised."
|
|
138
193
|
]
|
|
139
|
-
}) : /* @__PURE__ */
|
|
194
|
+
}) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(ie, {
|
|
140
195
|
id: "reportAttachment",
|
|
141
196
|
label: "Attach file (optional)",
|
|
142
|
-
value:
|
|
143
|
-
onChange:
|
|
197
|
+
value: q,
|
|
198
|
+
onChange: J,
|
|
144
199
|
hint: "Attach the signed report PDF or supporting document, then publish."
|
|
145
|
-
}), /* @__PURE__ */
|
|
200
|
+
}), /* @__PURE__ */ v(y, {
|
|
146
201
|
variant: "outline",
|
|
147
|
-
onClick:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
try {
|
|
151
|
-
await U.mutateAsync({
|
|
152
|
-
id: I,
|
|
153
|
-
fileId: X?.fileId ?? null
|
|
154
|
-
}), Z(null);
|
|
155
|
-
} catch (e) {
|
|
156
|
-
Y(e instanceof Error ? e.message : "Failed to publish report.");
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
disabled: U.isPending,
|
|
161
|
-
children: [/* @__PURE__ */ w(x, { className: "mr-1.5 h-4 w-4" }), U.isPending ? "Publishing…" : "Publish report"]
|
|
202
|
+
onClick: () => B(!0),
|
|
203
|
+
disabled: I.isPending,
|
|
204
|
+
children: [/* @__PURE__ */ _(fe, { className: "mr-1.5 h-4 w-4" }), I.isPending ? "Publishing…" : "Publish report"]
|
|
162
205
|
})] })
|
|
163
206
|
]
|
|
164
207
|
})]
|
|
165
208
|
}),
|
|
166
|
-
|
|
209
|
+
G && /* @__PURE__ */ _("p", {
|
|
167
210
|
className: "mt-4 text-sm text-status-error-text",
|
|
168
|
-
children:
|
|
211
|
+
children: G
|
|
212
|
+
}),
|
|
213
|
+
V && /* @__PURE__ */ _("p", {
|
|
214
|
+
role: "status",
|
|
215
|
+
className: "mt-4 text-sm text-status-success-text",
|
|
216
|
+
children: V
|
|
217
|
+
}),
|
|
218
|
+
$ && /* @__PURE__ */ v(b, {
|
|
219
|
+
treatment: "glass",
|
|
220
|
+
className: "mt-6 space-y-3 p-5",
|
|
221
|
+
"data-testid": "eco-report-readiness-card",
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ v("div", {
|
|
224
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
225
|
+
children: [/* @__PURE__ */ v("div", {
|
|
226
|
+
className: "flex items-center gap-2",
|
|
227
|
+
children: [$.readyToPublish ? /* @__PURE__ */ _(de, {
|
|
228
|
+
className: "h-4 w-4 text-status-success-text",
|
|
229
|
+
"aria-hidden": "true"
|
|
230
|
+
}) : /* @__PURE__ */ _(le, {
|
|
231
|
+
className: "h-4 w-4 text-status-warning-text",
|
|
232
|
+
"aria-hidden": "true"
|
|
233
|
+
}), /* @__PURE__ */ v("h2", {
|
|
234
|
+
className: "text-sm font-semibold text-text-primary",
|
|
235
|
+
children: [
|
|
236
|
+
$.framework,
|
|
237
|
+
" Disclosure Readiness — ",
|
|
238
|
+
$.coveragePct,
|
|
239
|
+
"% (",
|
|
240
|
+
$.coveredCount,
|
|
241
|
+
"/",
|
|
242
|
+
$.totalDisclosures,
|
|
243
|
+
")"
|
|
244
|
+
]
|
|
245
|
+
})]
|
|
246
|
+
}), /* @__PURE__ */ _(n, { status: $.readyToPublish ? "READY" : "IN_REVIEW" })]
|
|
247
|
+
}),
|
|
248
|
+
$.draftCarbonWarnings.length > 0 && /* @__PURE__ */ _("div", {
|
|
249
|
+
className: "rounded-lg border border-border-seam bg-status-warning-bg-subtle px-3 py-2 text-xs text-status-warning-text",
|
|
250
|
+
children: $.draftCarbonWarnings.map((e, t) => /* @__PURE__ */ _("p", { children: e }, t))
|
|
251
|
+
}),
|
|
252
|
+
/* @__PURE__ */ _("div", {
|
|
253
|
+
className: "grid gap-2 sm:grid-cols-2",
|
|
254
|
+
children: $.disclosures.map((e) => /* @__PURE__ */ v("div", {
|
|
255
|
+
className: "flex items-start justify-between gap-2 rounded-md border border-border-seam bg-bg-sunken/40 px-3 py-2 text-xs",
|
|
256
|
+
children: [/* @__PURE__ */ v("div", {
|
|
257
|
+
className: "min-w-0",
|
|
258
|
+
children: [/* @__PURE__ */ v("p", {
|
|
259
|
+
className: "font-medium text-text-primary",
|
|
260
|
+
children: [
|
|
261
|
+
e.disclosureCode,
|
|
262
|
+
" · ",
|
|
263
|
+
e.label
|
|
264
|
+
]
|
|
265
|
+
}), e.gapReason && /* @__PURE__ */ _("p", {
|
|
266
|
+
className: "text-text-tertiary",
|
|
267
|
+
children: e.gapReason
|
|
268
|
+
})]
|
|
269
|
+
}), /* @__PURE__ */ _(n, { status: e.covered ? "VERIFIED" : "DRAFT" })]
|
|
270
|
+
}, e.disclosureCode))
|
|
271
|
+
})
|
|
272
|
+
]
|
|
273
|
+
}),
|
|
274
|
+
be && /* @__PURE__ */ v("div", {
|
|
275
|
+
role: "note",
|
|
276
|
+
"data-testid": "eco-report-ai-disclaimer",
|
|
277
|
+
className: "mt-4 flex items-start gap-2 rounded-lg border border-border-seam bg-status-warning-bg-subtle px-4 py-3 text-xs text-status-warning-text",
|
|
278
|
+
children: [/* @__PURE__ */ _(pe, {
|
|
279
|
+
className: "mt-0.5 h-4 w-4 shrink-0",
|
|
280
|
+
"aria-hidden": "true"
|
|
281
|
+
}), /* @__PURE__ */ _("p", { children: "AI-drafted disclosures are assembled from workspace records and carry mandatory source citations. Review every cited record before human publication." })]
|
|
169
282
|
}),
|
|
170
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ _(ne, {
|
|
171
284
|
title: "Line items",
|
|
172
285
|
description: "Quantified disclosures that make up this report.",
|
|
173
|
-
action: /* @__PURE__ */
|
|
286
|
+
action: /* @__PURE__ */ v(y, {
|
|
174
287
|
size: "sm",
|
|
175
|
-
onClick: () =>
|
|
176
|
-
children: [/* @__PURE__ */
|
|
288
|
+
onClick: () => z(!0),
|
|
289
|
+
children: [/* @__PURE__ */ _(p, { className: "mr-1.5 h-4 w-4" }), " Add line item"]
|
|
177
290
|
}),
|
|
178
|
-
children:
|
|
291
|
+
children: Y.length === 0 ? /* @__PURE__ */ _(re, {
|
|
179
292
|
illustration: "empty-data",
|
|
180
293
|
title: "No line items",
|
|
181
294
|
description: "Add a line item to record a quantified disclosure for this report.",
|
|
182
|
-
action: /* @__PURE__ */
|
|
295
|
+
action: /* @__PURE__ */ v(y, {
|
|
183
296
|
size: "sm",
|
|
184
|
-
onClick: () =>
|
|
185
|
-
children: [/* @__PURE__ */
|
|
297
|
+
onClick: () => z(!0),
|
|
298
|
+
children: [/* @__PURE__ */ _(p, { className: "mr-1.5 h-4 w-4" }), " Add line item"]
|
|
186
299
|
})
|
|
187
|
-
}) : /* @__PURE__ */
|
|
300
|
+
}) : /* @__PURE__ */ _(b, {
|
|
188
301
|
treatment: "plain",
|
|
189
302
|
className: "overflow-hidden",
|
|
190
|
-
children: /* @__PURE__ */
|
|
303
|
+
children: /* @__PURE__ */ _("div", {
|
|
191
304
|
className: "overflow-x-auto",
|
|
192
|
-
children: /* @__PURE__ */
|
|
305
|
+
children: /* @__PURE__ */ v("table", {
|
|
193
306
|
className: "w-full border-collapse text-sm",
|
|
194
307
|
children: [
|
|
195
|
-
/* @__PURE__ */
|
|
308
|
+
/* @__PURE__ */ _("thead", { children: /* @__PURE__ */ v("tr", {
|
|
196
309
|
className: "border-b border-border-seam text-left",
|
|
197
310
|
children: [
|
|
198
|
-
/* @__PURE__ */
|
|
311
|
+
/* @__PURE__ */ _("th", {
|
|
199
312
|
className: "px-4 py-3 font-medium text-text-secondary",
|
|
200
313
|
children: "Line item"
|
|
201
314
|
}),
|
|
202
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ _("th", {
|
|
203
316
|
className: "hidden px-4 py-3 font-medium text-text-secondary md:table-cell",
|
|
204
317
|
children: "Category"
|
|
205
318
|
}),
|
|
206
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ _("th", {
|
|
320
|
+
className: "px-4 py-3 font-medium text-text-secondary",
|
|
321
|
+
children: "Source citation"
|
|
322
|
+
}),
|
|
323
|
+
/* @__PURE__ */ _("th", {
|
|
207
324
|
className: "px-4 py-3 text-right font-medium text-text-secondary",
|
|
208
325
|
children: "Value"
|
|
209
326
|
})
|
|
210
327
|
]
|
|
211
328
|
}) }),
|
|
212
|
-
/* @__PURE__ */
|
|
329
|
+
/* @__PURE__ */ _("tbody", { children: Y.map((e) => /* @__PURE__ */ v("tr", {
|
|
213
330
|
className: "border-b border-border-seam/60",
|
|
214
331
|
children: [
|
|
215
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ v("td", {
|
|
216
333
|
className: "px-4 py-3 font-medium text-text-primary",
|
|
217
|
-
children:
|
|
334
|
+
children: [/* @__PURE__ */ v("div", {
|
|
335
|
+
className: "flex flex-wrap items-center gap-2",
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ _("span", { children: e.label }),
|
|
338
|
+
e.disclosureCode && /* @__PURE__ */ _("span", {
|
|
339
|
+
className: "rounded bg-bg-sunken px-1.5 py-0.5 font-mono text-xs text-text-secondary",
|
|
340
|
+
children: e.disclosureCode
|
|
341
|
+
}),
|
|
342
|
+
e.aiDrafted && /* @__PURE__ */ v("span", {
|
|
343
|
+
className: "inline-flex items-center gap-1 rounded bg-status-warning-bg-subtle px-1.5 py-0.5 text-xs font-medium text-status-warning-text",
|
|
344
|
+
children: [/* @__PURE__ */ _(m, {
|
|
345
|
+
className: "h-3 w-3",
|
|
346
|
+
"aria-hidden": "true"
|
|
347
|
+
}), " AI-drafted"]
|
|
348
|
+
})
|
|
349
|
+
]
|
|
350
|
+
}), e.aiRationale && /* @__PURE__ */ _("p", {
|
|
351
|
+
className: "mt-1 text-xs font-normal text-text-tertiary",
|
|
352
|
+
children: e.aiRationale
|
|
353
|
+
})]
|
|
218
354
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
355
|
+
/* @__PURE__ */ _("td", {
|
|
220
356
|
className: "hidden px-4 py-3 text-text-secondary md:table-cell",
|
|
221
357
|
children: e.category ?? "—"
|
|
222
358
|
}),
|
|
223
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ _("td", {
|
|
360
|
+
className: "px-4 py-3 text-xs",
|
|
361
|
+
children: e.carbonEntryId ? /* @__PURE__ */ v("button", {
|
|
362
|
+
type: "button",
|
|
363
|
+
onClick: () => j(`carbon?highlight=${e.carbonEntryId}`),
|
|
364
|
+
className: "inline-flex items-center gap-1 font-medium text-text-primary underline underline-offset-2",
|
|
365
|
+
children: [/* @__PURE__ */ _(f, {
|
|
366
|
+
className: "h-3 w-3",
|
|
367
|
+
"aria-hidden": "true"
|
|
368
|
+
}), " Carbon entry"]
|
|
369
|
+
}) : e.sourceMeasurementId ? /* @__PURE__ */ v("button", {
|
|
370
|
+
type: "button",
|
|
371
|
+
onClick: () => j("monitoring"),
|
|
372
|
+
className: "inline-flex items-center gap-1 font-medium text-text-primary underline underline-offset-2",
|
|
373
|
+
children: [/* @__PURE__ */ _(f, {
|
|
374
|
+
className: "h-3 w-3",
|
|
375
|
+
"aria-hidden": "true"
|
|
376
|
+
}), " Monitoring"]
|
|
377
|
+
}) : e.sourceMetricId ? /* @__PURE__ */ v("button", {
|
|
378
|
+
type: "button",
|
|
379
|
+
onClick: () => j("metrics"),
|
|
380
|
+
className: "inline-flex items-center gap-1 font-medium text-text-primary underline underline-offset-2",
|
|
381
|
+
children: [/* @__PURE__ */ _(f, {
|
|
382
|
+
className: "h-3 w-3",
|
|
383
|
+
"aria-hidden": "true"
|
|
384
|
+
}), " ESG metric"]
|
|
385
|
+
}) : /* @__PURE__ */ _("span", {
|
|
386
|
+
className: "text-text-tertiary",
|
|
387
|
+
children: "Manual entry"
|
|
388
|
+
})
|
|
389
|
+
}),
|
|
390
|
+
/* @__PURE__ */ v("td", {
|
|
224
391
|
className: "px-4 py-3 text-right text-text-primary tabular-nums",
|
|
225
392
|
children: [
|
|
226
|
-
|
|
393
|
+
c(e.value),
|
|
227
394
|
" ",
|
|
228
395
|
e.unit
|
|
229
396
|
]
|
|
230
397
|
})
|
|
231
398
|
]
|
|
232
399
|
}, e.id)) }),
|
|
233
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ _("tfoot", { children: /* @__PURE__ */ v("tr", {
|
|
234
401
|
className: "border-t-2 border-border-seam bg-bg-sunken/40",
|
|
235
|
-
children: [/* @__PURE__ */
|
|
402
|
+
children: [/* @__PURE__ */ _("td", {
|
|
236
403
|
className: "px-4 py-3 text-sm font-semibold text-text-primary",
|
|
237
|
-
colSpan:
|
|
404
|
+
colSpan: 3,
|
|
238
405
|
children: "Total"
|
|
239
|
-
}), /* @__PURE__ */
|
|
406
|
+
}), /* @__PURE__ */ v("td", {
|
|
240
407
|
className: "px-4 py-3 text-right text-base font-bold text-text-primary tabular-nums",
|
|
241
|
-
children: [
|
|
408
|
+
children: [c(_e), X ? ` ${X}` : ""]
|
|
242
409
|
})]
|
|
243
410
|
}) })
|
|
244
411
|
]
|
|
@@ -246,97 +413,116 @@ function I() {
|
|
|
246
413
|
})
|
|
247
414
|
})
|
|
248
415
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
416
|
+
/* @__PURE__ */ _(C, {
|
|
417
|
+
open: ge,
|
|
418
|
+
onOpenChange: B,
|
|
419
|
+
children: /* @__PURE__ */ v(w, { children: [/* @__PURE__ */ v(D, { children: [/* @__PURE__ */ _(O, { children: "Confirm publishing ESG report" }), /* @__PURE__ */ v(T, { children: [
|
|
420
|
+
"Publishing finalises ",
|
|
421
|
+
M.title,
|
|
422
|
+
" (",
|
|
423
|
+
M.framework,
|
|
424
|
+
") and prevents further AI drafting. Confirm you have reviewed all cited disclosures."
|
|
425
|
+
] })] }), /* @__PURE__ */ v(E, { children: [/* @__PURE__ */ _(y, {
|
|
426
|
+
variant: "ghost",
|
|
427
|
+
onClick: () => B(!1),
|
|
428
|
+
children: "Cancel"
|
|
429
|
+
}), /* @__PURE__ */ _(y, {
|
|
430
|
+
onClick: ve,
|
|
431
|
+
disabled: I.isPending,
|
|
432
|
+
children: I.isPending ? "Publishing…" : "Confirm publish"
|
|
433
|
+
})] })] })
|
|
434
|
+
}),
|
|
435
|
+
/* @__PURE__ */ _(ce, {
|
|
250
436
|
entityType: "ecoimpacthub-report",
|
|
251
|
-
entityId:
|
|
437
|
+
entityId: M.id,
|
|
252
438
|
description: "Coordinate review and sign-off on this disclosure with your team."
|
|
253
439
|
}),
|
|
254
|
-
/* @__PURE__ */
|
|
255
|
-
open:
|
|
256
|
-
onOpenChange:
|
|
257
|
-
children: /* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ _(C, {
|
|
441
|
+
open: he,
|
|
442
|
+
onOpenChange: z,
|
|
443
|
+
children: /* @__PURE__ */ v(w, { children: [
|
|
444
|
+
/* @__PURE__ */ v(D, { children: [/* @__PURE__ */ _(O, { children: "Add line item" }), /* @__PURE__ */ v(T, { children: [
|
|
259
445
|
"Record a quantified disclosure for ",
|
|
260
|
-
|
|
446
|
+
M.title,
|
|
261
447
|
"."
|
|
262
448
|
] })] }),
|
|
263
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ v("div", {
|
|
264
450
|
className: "grid gap-4 py-2",
|
|
265
451
|
children: [
|
|
266
|
-
/* @__PURE__ */
|
|
452
|
+
/* @__PURE__ */ v("div", {
|
|
267
453
|
className: "grid gap-1.5",
|
|
268
|
-
children: [/* @__PURE__ */
|
|
454
|
+
children: [/* @__PURE__ */ _(S, {
|
|
269
455
|
htmlFor: "liLabel",
|
|
270
456
|
children: "Label *"
|
|
271
|
-
}), /* @__PURE__ */
|
|
457
|
+
}), /* @__PURE__ */ _(x, {
|
|
272
458
|
id: "liLabel",
|
|
273
|
-
value:
|
|
274
|
-
onChange: (e) =>
|
|
275
|
-
...
|
|
459
|
+
value: U.label,
|
|
460
|
+
onChange: (e) => W({
|
|
461
|
+
...U,
|
|
276
462
|
label: e.target.value
|
|
277
463
|
}),
|
|
278
464
|
placeholder: "Scope 1 emissions"
|
|
279
465
|
})]
|
|
280
466
|
}),
|
|
281
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ v("div", {
|
|
282
468
|
className: "grid gap-2 sm:grid-cols-2",
|
|
283
|
-
children: [/* @__PURE__ */
|
|
469
|
+
children: [/* @__PURE__ */ v("div", {
|
|
284
470
|
className: "grid gap-1.5",
|
|
285
|
-
children: [/* @__PURE__ */
|
|
471
|
+
children: [/* @__PURE__ */ _(S, {
|
|
286
472
|
htmlFor: "liValue",
|
|
287
473
|
children: "Value *"
|
|
288
|
-
}), /* @__PURE__ */
|
|
474
|
+
}), /* @__PURE__ */ _(x, {
|
|
289
475
|
id: "liValue",
|
|
290
476
|
type: "number",
|
|
291
477
|
step: "any",
|
|
292
|
-
value:
|
|
293
|
-
onChange: (e) =>
|
|
294
|
-
...
|
|
478
|
+
value: U.value,
|
|
479
|
+
onChange: (e) => W({
|
|
480
|
+
...U,
|
|
295
481
|
value: e.target.value
|
|
296
482
|
}),
|
|
297
483
|
placeholder: "1250"
|
|
298
484
|
})]
|
|
299
|
-
}), /* @__PURE__ */
|
|
485
|
+
}), /* @__PURE__ */ v("div", {
|
|
300
486
|
className: "grid gap-1.5",
|
|
301
|
-
children: [/* @__PURE__ */
|
|
487
|
+
children: [/* @__PURE__ */ _(S, {
|
|
302
488
|
htmlFor: "liUnit",
|
|
303
489
|
children: "Unit *"
|
|
304
|
-
}), /* @__PURE__ */
|
|
490
|
+
}), /* @__PURE__ */ _(x, {
|
|
305
491
|
id: "liUnit",
|
|
306
|
-
value:
|
|
307
|
-
onChange: (e) =>
|
|
308
|
-
...
|
|
492
|
+
value: U.unit,
|
|
493
|
+
onChange: (e) => W({
|
|
494
|
+
...U,
|
|
309
495
|
unit: e.target.value
|
|
310
496
|
}),
|
|
311
497
|
placeholder: "t CO₂e"
|
|
312
498
|
})]
|
|
313
499
|
})]
|
|
314
500
|
}),
|
|
315
|
-
/* @__PURE__ */
|
|
501
|
+
/* @__PURE__ */ v("div", {
|
|
316
502
|
className: "grid gap-1.5",
|
|
317
|
-
children: [/* @__PURE__ */
|
|
503
|
+
children: [/* @__PURE__ */ _(S, {
|
|
318
504
|
htmlFor: "liCategory",
|
|
319
505
|
children: "Category"
|
|
320
|
-
}), /* @__PURE__ */
|
|
506
|
+
}), /* @__PURE__ */ _(x, {
|
|
321
507
|
id: "liCategory",
|
|
322
|
-
value:
|
|
323
|
-
onChange: (e) =>
|
|
324
|
-
...
|
|
508
|
+
value: U.category,
|
|
509
|
+
onChange: (e) => W({
|
|
510
|
+
...U,
|
|
325
511
|
category: e.target.value
|
|
326
512
|
}),
|
|
327
513
|
placeholder: "Optional grouping, e.g. Energy"
|
|
328
514
|
})]
|
|
329
515
|
}),
|
|
330
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ v("div", {
|
|
331
517
|
className: "grid gap-1.5",
|
|
332
|
-
children: [/* @__PURE__ */
|
|
518
|
+
children: [/* @__PURE__ */ _(S, {
|
|
333
519
|
htmlFor: "liCarbonEntry",
|
|
334
520
|
children: "Carbon entry ID"
|
|
335
|
-
}), /* @__PURE__ */
|
|
521
|
+
}), /* @__PURE__ */ _(x, {
|
|
336
522
|
id: "liCarbonEntry",
|
|
337
|
-
value:
|
|
338
|
-
onChange: (e) =>
|
|
339
|
-
...
|
|
523
|
+
value: U.carbonEntryId,
|
|
524
|
+
onChange: (e) => W({
|
|
525
|
+
...U,
|
|
340
526
|
carbonEntryId: e.target.value
|
|
341
527
|
}),
|
|
342
528
|
placeholder: "Optional linked carbon-ledger entry"
|
|
@@ -344,45 +530,20 @@ function I() {
|
|
|
344
530
|
})
|
|
345
531
|
]
|
|
346
532
|
}),
|
|
347
|
-
/* @__PURE__ */
|
|
533
|
+
/* @__PURE__ */ v(E, { children: [/* @__PURE__ */ _(y, {
|
|
348
534
|
variant: "outline",
|
|
349
|
-
onClick: () =>
|
|
535
|
+
onClick: () => z(!1),
|
|
350
536
|
children: "Cancel"
|
|
351
|
-
}), /* @__PURE__ */
|
|
352
|
-
onClick:
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
else {
|
|
356
|
-
Y(null);
|
|
357
|
-
try {
|
|
358
|
-
await H.mutateAsync({
|
|
359
|
-
reportId: I,
|
|
360
|
-
label: K.label.trim(),
|
|
361
|
-
value: Number(K.value),
|
|
362
|
-
unit: K.unit.trim(),
|
|
363
|
-
category: K.category.trim() || null,
|
|
364
|
-
carbonEntryId: K.carbonEntryId.trim() || null
|
|
365
|
-
}), G(!1), q({
|
|
366
|
-
label: "",
|
|
367
|
-
value: "",
|
|
368
|
-
unit: "",
|
|
369
|
-
category: "",
|
|
370
|
-
carbonEntryId: ""
|
|
371
|
-
});
|
|
372
|
-
} catch (e) {
|
|
373
|
-
Y(e instanceof Error ? e.message : "Failed to add line item.");
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
disabled: H.isPending,
|
|
379
|
-
children: H.isPending ? "Adding…" : "Add line item"
|
|
537
|
+
}), /* @__PURE__ */ _(y, {
|
|
538
|
+
onClick: Q,
|
|
539
|
+
disabled: F.isPending,
|
|
540
|
+
children: F.isPending ? "Adding…" : "Add line item"
|
|
380
541
|
})] })
|
|
381
542
|
] })
|
|
382
543
|
})
|
|
383
544
|
]
|
|
384
545
|
});
|
|
385
546
|
}
|
|
386
|
-
export {
|
|
547
|
+
export { A as ReportDetailPage };
|
|
387
548
|
|
|
388
549
|
//# sourceMappingURL=ReportDetailPage.js.map
|