@burdenoff/microfe-govcitizenhub 2026.720.7 → 2026.730.1
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/govcitizenhub/GovCitizenHubRoot.d.ts.map +1 -1
- package/dist/govcitizenhub/GovCitizenHubRoot.js +44 -36
- package/dist/govcitizenhub/GovCitizenHubRoot.js.map +1 -1
- package/dist/govcitizenhub/GovCitizenHubRoutes.d.ts.map +1 -1
- package/dist/govcitizenhub/GovCitizenHubRoutes.js +134 -6
- package/dist/govcitizenhub/GovCitizenHubRoutes.js.map +1 -1
- package/dist/govcitizenhub/components/DocumentUploadField.d.ts +17 -11
- package/dist/govcitizenhub/components/DocumentUploadField.d.ts.map +1 -1
- package/dist/govcitizenhub/components/DocumentUploadField.js +45 -42
- package/dist/govcitizenhub/components/DocumentUploadField.js.map +1 -1
- package/dist/govcitizenhub/components/GovCharts.js +127 -51
- package/dist/govcitizenhub/components/GovCharts.js.map +1 -1
- package/dist/govcitizenhub/hooks/index.d.ts +1 -0
- package/dist/govcitizenhub/hooks/index.d.ts.map +1 -1
- package/dist/govcitizenhub/hooks/index.js +1 -0
- package/dist/govcitizenhub/hooks/useGovApi.d.ts +3 -0
- package/dist/govcitizenhub/hooks/useGovApi.d.ts.map +1 -1
- package/dist/govcitizenhub/hooks/useGovApi.js +1 -1
- package/dist/govcitizenhub/hooks/useGovApi.js.map +1 -1
- package/dist/govcitizenhub/hooks/useIntelligenceApi.d.ts +214 -0
- package/dist/govcitizenhub/hooks/useIntelligenceApi.d.ts.map +1 -0
- package/dist/govcitizenhub/hooks/useIntelligenceApi.js +1140 -0
- package/dist/govcitizenhub/hooks/useIntelligenceApi.js.map +1 -0
- package/dist/govcitizenhub/index.d.ts +1 -0
- package/dist/govcitizenhub/index.d.ts.map +1 -1
- package/dist/govcitizenhub/index.js +18 -0
- package/dist/govcitizenhub/pages/agencies/AgenciesPage.js +7 -7
- package/dist/govcitizenhub/pages/agencies/AgencyFormDialog.js +6 -6
- package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js +16 -16
- package/dist/govcitizenhub/pages/applications/ApplicationsPage.js +35 -35
- package/dist/govcitizenhub/pages/applications/ApplicationsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/applications/NewApplicationPage.js +1 -1
- package/dist/govcitizenhub/pages/documents/DocumentsPage.js +5 -5
- package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js +30 -30
- package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js.map +1 -1
- package/dist/govcitizenhub/pages/grievances/GrievancesPage.js +15 -15
- package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js +634 -0
- package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts +20 -0
- package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js +537 -0
- package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/AssetImage.d.ts +11 -0
- package/dist/govcitizenhub/pages/intelligence/AssetImage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/AssetImage.js +25 -0
- package/dist/govcitizenhub/pages/intelligence/AssetImage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts +15 -0
- package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js +203 -0
- package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js +497 -0
- package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/BudgetPage.js +1084 -0
- package/dist/govcitizenhub/pages/intelligence/BudgetPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts +13 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js +581 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts +11 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js +429 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts +8 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js +235 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js +534 -0
- package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js +723 -0
- package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ElectionsPage.d.ts +5 -0
- package/dist/govcitizenhub/pages/intelligence/ElectionsPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js +1029 -0
- package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/GovernancePage.d.ts +5 -0
- package/dist/govcitizenhub/pages/intelligence/GovernancePage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/GovernancePage.js +1545 -0
- package/dist/govcitizenhub/pages/intelligence/GovernancePage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js +960 -0
- package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.d.ts +13 -0
- package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js +927 -0
- package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js +620 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts +20 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js +183 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js +629 -0
- package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js +1124 -0
- package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ProjectsPage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/ProjectsPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js +1518 -0
- package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js +577 -0
- package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.d.ts +4 -0
- package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js +534 -0
- package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/TimelinePage.d.ts +5 -0
- package/dist/govcitizenhub/pages/intelligence/TimelinePage.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/TimelinePage.js +538 -0
- package/dist/govcitizenhub/pages/intelligence/TimelinePage.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts +53 -0
- package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js +138 -0
- package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/index.d.ts +27 -0
- package/dist/govcitizenhub/pages/intelligence/index.d.ts.map +1 -0
- package/dist/govcitizenhub/pages/intelligence/index.js +17 -0
- package/dist/govcitizenhub/pages/payments/PaymentsPage.js +11 -11
- package/dist/govcitizenhub/pages/payments/PaymentsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/permits/PermitsPage.js +6 -6
- package/dist/govcitizenhub/pages/services/ServiceDetailPage.js +8 -8
- package/dist/govcitizenhub/pages/services/ServiceFormDialog.js +98 -98
- package/dist/govcitizenhub/pages/services/ServiceFormDialog.js.map +1 -1
- package/dist/govcitizenhub/types/index.d.ts +1 -0
- package/dist/govcitizenhub/types/index.d.ts.map +1 -1
- package/dist/govcitizenhub/types/intelligence.d.ts +1559 -0
- package/dist/govcitizenhub/types/intelligence.d.ts.map +1 -0
- package/dist/govcitizenhub/types/intelligence.js +125 -0
- package/dist/govcitizenhub/types/intelligence.js.map +1 -0
- package/dist/index.js +19 -2
- package/dist/node_modules/recharts/es6/chart/BarChart.js +24 -0
- package/dist/node_modules/recharts/es6/chart/BarChart.js.map +1 -0
- package/dist/utils/pageContext.d.ts +1 -0
- package/dist/utils/pageContext.d.ts.map +1 -1
- package/dist/utils/pageContext.js +44 -17
- package/dist/utils/pageContext.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,927 @@
|
|
|
1
|
+
import { useGovCitizenHub as e } from "../../context/GovCitizenHubContext.js";
|
|
2
|
+
import "../../context/index.js";
|
|
3
|
+
import { cn as t } from "../../utils/cn.js";
|
|
4
|
+
import { GovAreaChart as n } from "../../components/GovCharts.js";
|
|
5
|
+
import { formatDate as r, formatNumber as i } from "../../utils/formatters.js";
|
|
6
|
+
import { EmptyState as a } from "../../components/EmptyState.js";
|
|
7
|
+
import { useGovDeleteIndicatorValue as o, useGovIndicatorSeries as s, useGovIndicatorValues as c, useGovIndicators as l, useGovRecordIndicatorValue as u, useGovUpdateIndicatorValue as d } from "../../hooks/useIntelligenceApi.js";
|
|
8
|
+
import "../../hooks/index.js";
|
|
9
|
+
import { ErrorView as f, LoadingView as p } from "../../components/StateViews.js";
|
|
10
|
+
import { SectionCard as m } from "../../components/SectionCard.js";
|
|
11
|
+
import { describeError as h, notify as g } from "../../lib/toast.js";
|
|
12
|
+
import { GOV_INDICATOR_DOMAIN_LABELS as _, GOV_VERIFICATION_LABELS as v } from "../../types/intelligence.js";
|
|
13
|
+
import { JurisdictionLayout as y, VerificationChip as b } from "./JurisdictionLayout.js";
|
|
14
|
+
import { ConfirmDialog as x } from "../../components/ConfirmDialog.js";
|
|
15
|
+
import { KeyValueList as S } from "../../components/KeyValueList.js";
|
|
16
|
+
import { useMemo as C, useState as w } from "react";
|
|
17
|
+
import { ArrowDownRight as T, ArrowUpRight as E, ChevronDown as D, ChevronRight as O, ExternalLink as k, Gauge as A, LineChart as j, Minus as M, Pencil as N, Plus as P, Target as F, Trash2 as I } from "lucide-react";
|
|
18
|
+
import { useParams as ee } from "react-router-dom";
|
|
19
|
+
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
20
|
+
import { Button as B, GlassCard as V, Input as H, Label as U, ResponsiveDialog as te, ResponsiveDialogContent as ne, ResponsiveDialogDescription as re, ResponsiveDialogFooter as ie, ResponsiveDialogHeader as ae, ResponsiveDialogTitle as oe, Select as W, SelectContent as G, SelectItem as se, SelectTrigger as ce, SelectValue as le, Textarea as ue } from "@burdenoff/fe-libs/ui";
|
|
21
|
+
//#region src/govcitizenhub/pages/intelligence/IndicatorsPage.tsx
|
|
22
|
+
var K = [
|
|
23
|
+
"DEMOGRAPHICS",
|
|
24
|
+
"ECONOMY",
|
|
25
|
+
"EDUCATION",
|
|
26
|
+
"HEALTHCARE",
|
|
27
|
+
"INFRASTRUCTURE",
|
|
28
|
+
"PUBLIC_SAFETY",
|
|
29
|
+
"ENVIRONMENT",
|
|
30
|
+
"SOCIAL_WELFARE",
|
|
31
|
+
"UTILITIES",
|
|
32
|
+
"TRANSPORT",
|
|
33
|
+
"HOUSING",
|
|
34
|
+
"GOVERNANCE",
|
|
35
|
+
"DIGITAL",
|
|
36
|
+
"TOURISM",
|
|
37
|
+
"FINANCE"
|
|
38
|
+
], de = [
|
|
39
|
+
"UNVERIFIED",
|
|
40
|
+
"OFFICIAL",
|
|
41
|
+
"COMMUNITY_VERIFIED",
|
|
42
|
+
"DISPUTED"
|
|
43
|
+
], q = 500, J = 200;
|
|
44
|
+
function Y(e, t) {
|
|
45
|
+
switch (t) {
|
|
46
|
+
case "PERCENTAGE": return i(e, { maximumFractionDigits: 1 });
|
|
47
|
+
case "RATIO": return i(e, { maximumFractionDigits: 2 });
|
|
48
|
+
case "INDEX": return i(e, { maximumFractionDigits: 1 });
|
|
49
|
+
case "CURRENCY": return i(e, { maximumFractionDigits: 2 });
|
|
50
|
+
case "COUNT": return i(e, { maximumFractionDigits: 0 });
|
|
51
|
+
case "DURATION_DAYS": return i(e, { maximumFractionDigits: 1 });
|
|
52
|
+
default: return i(e, { maximumFractionDigits: 2 });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function X(e, t) {
|
|
56
|
+
let n = Y(e, t.valueType), r = t.unit.trim();
|
|
57
|
+
return r === "%" ? `${n}%` : r ? `${n} ${r}` : t.valueType === "PERCENTAGE" ? `${n}%` : n;
|
|
58
|
+
}
|
|
59
|
+
function fe(e) {
|
|
60
|
+
switch (e) {
|
|
61
|
+
case "HIGHER_IS_BETTER": return "Higher is better";
|
|
62
|
+
case "LOWER_IS_BETTER": return "Lower is better";
|
|
63
|
+
default: return "Neutral";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function pe(e, t, n) {
|
|
67
|
+
if (!t || t.value === 0) return null;
|
|
68
|
+
let r = (e.value - t.value) / Math.abs(t.value) * 100, i = Math.abs(r) < .05, a = r > 0, o = "neutral";
|
|
69
|
+
return !i && n === "HIGHER_IS_BETTER" && (o = a ? "good" : "bad"), !i && n === "LOWER_IS_BETTER" && (o = a ? "bad" : "good"), {
|
|
70
|
+
percent: r,
|
|
71
|
+
fromPeriodLabel: t.periodLabel,
|
|
72
|
+
tone: o
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
var me = {
|
|
76
|
+
good: "bg-status-success-bg-subtle text-status-success-text",
|
|
77
|
+
bad: "bg-status-error-bg-subtle text-status-error-text",
|
|
78
|
+
neutral: "bg-bg-sunken text-text-secondary"
|
|
79
|
+
}, he = ({ change: e }) => {
|
|
80
|
+
let n = e.tone === "neutral" ? M : e.percent >= 0 ? E : T;
|
|
81
|
+
return /* @__PURE__ */ z("span", {
|
|
82
|
+
className: t("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-semibold tabular-nums", me[e.tone]),
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ R(n, {
|
|
85
|
+
className: "size-3.5",
|
|
86
|
+
"aria-hidden": "true"
|
|
87
|
+
}),
|
|
88
|
+
i(Math.abs(e.percent), { maximumFractionDigits: 1 }),
|
|
89
|
+
"%",
|
|
90
|
+
/* @__PURE__ */ z("span", {
|
|
91
|
+
className: "font-normal opacity-80",
|
|
92
|
+
children: ["vs ", e.fromPeriodLabel]
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
}, ge = (e, t) => new Date(t.periodStart).getTime() - new Date(e.periodStart).getTime();
|
|
97
|
+
function _e() {
|
|
98
|
+
let { jurisdictionId: n } = ee(), { navigateTo: r } = e(), [s, u] = w("DEMOGRAPHICS"), [d, m] = w(null), [v, b] = w(null), [S, T] = w(!1), [E, D] = w(null), [O, k] = w(null), A = l({
|
|
99
|
+
domain: s,
|
|
100
|
+
isActive: !0
|
|
101
|
+
}, { limit: J }), j = c({ jurisdictionId: n }, { limit: q }), M = o(), N = C(() => j.data?.items ?? [], [j.data]), F = C(() => {
|
|
102
|
+
let e = /* @__PURE__ */ new Map();
|
|
103
|
+
for (let t of N) {
|
|
104
|
+
let n = e.get(t.indicatorId);
|
|
105
|
+
n ? n.push(t) : e.set(t.indicatorId, [t]);
|
|
106
|
+
}
|
|
107
|
+
for (let t of e.values()) t.sort(ge);
|
|
108
|
+
return e;
|
|
109
|
+
}, [N]), I = C(() => {
|
|
110
|
+
let e = /* @__PURE__ */ new Map();
|
|
111
|
+
for (let t of N) {
|
|
112
|
+
let n = t.indicator?.domain;
|
|
113
|
+
if (!n) continue;
|
|
114
|
+
let r = e.get(n);
|
|
115
|
+
r ? r.add(t.indicatorId) : e.set(n, new Set([t.indicatorId]));
|
|
116
|
+
}
|
|
117
|
+
return e;
|
|
118
|
+
}, [N]), L = C(() => [...A.data?.items ?? []].sort((e, t) => {
|
|
119
|
+
let n = +!F.has(e.id), r = +!F.has(t.id);
|
|
120
|
+
return n === r ? e.name.localeCompare(t.name) : n - r;
|
|
121
|
+
}), [A.data, F]), H = (e) => {
|
|
122
|
+
b(e), T(!0);
|
|
123
|
+
}, U = async () => {
|
|
124
|
+
if (O) try {
|
|
125
|
+
await M.mutateAsync(O.value.id), g.success("Value deleted", `${O.indicator.name} · ${O.value.periodLabel}`), k(null);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
g.error("Could not delete this value", h(e));
|
|
128
|
+
}
|
|
129
|
+
}, te = j.data?.pageInfo.hasMore ?? !1, ne = A.isLoading || j.isLoading, re = A.isError || j.isError;
|
|
130
|
+
return /* @__PURE__ */ z(y, {
|
|
131
|
+
description: "Governed civic KPIs published for this region, by domain.",
|
|
132
|
+
actions: /* @__PURE__ */ z(B, {
|
|
133
|
+
variant: "outline",
|
|
134
|
+
onClick: () => H(null),
|
|
135
|
+
disabled: L.length === 0,
|
|
136
|
+
children: [/* @__PURE__ */ R(P, {
|
|
137
|
+
className: "mr-1.5 h-4 w-4",
|
|
138
|
+
"aria-hidden": "true"
|
|
139
|
+
}), " Record value"]
|
|
140
|
+
}),
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ z("div", {
|
|
143
|
+
className: "grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,16rem)_minmax(0,1fr)]",
|
|
144
|
+
children: [/* @__PURE__ */ R("aside", {
|
|
145
|
+
className: "min-w-0",
|
|
146
|
+
children: /* @__PURE__ */ z(V, {
|
|
147
|
+
treatment: "plain",
|
|
148
|
+
className: "overflow-hidden border-border-seam",
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ z("div", {
|
|
151
|
+
className: "border-b border-border-seam px-4 py-3",
|
|
152
|
+
children: [/* @__PURE__ */ R("h2", {
|
|
153
|
+
className: "text-sm font-semibold text-text-primary",
|
|
154
|
+
children: "Domains"
|
|
155
|
+
}), /* @__PURE__ */ R("p", {
|
|
156
|
+
className: "mt-0.5 text-xs text-text-muted",
|
|
157
|
+
children: "Badge = indicators measured for this region"
|
|
158
|
+
})]
|
|
159
|
+
}),
|
|
160
|
+
/* @__PURE__ */ R("nav", {
|
|
161
|
+
"aria-label": "Indicator domains",
|
|
162
|
+
className: "flex gap-2 overflow-x-auto p-2 lg:flex-col lg:gap-1 lg:overflow-x-visible",
|
|
163
|
+
children: K.map((e) => {
|
|
164
|
+
let n = e === s, r = I.get(e)?.size ?? 0;
|
|
165
|
+
return /* @__PURE__ */ z("button", {
|
|
166
|
+
type: "button",
|
|
167
|
+
"aria-pressed": n,
|
|
168
|
+
onClick: () => {
|
|
169
|
+
u(e), m(null);
|
|
170
|
+
},
|
|
171
|
+
className: t("flex shrink-0 items-center justify-between gap-2 rounded-lg px-3 py-2 text-sm font-medium outline-none transition-colors focus-visible:ring-1 focus-visible:ring-border-focus lg:w-full lg:shrink", n ? "bg-action-primary-bg text-action-primary-text" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"),
|
|
172
|
+
children: [/* @__PURE__ */ R("span", {
|
|
173
|
+
className: "truncate",
|
|
174
|
+
children: _[e]
|
|
175
|
+
}), /* @__PURE__ */ R("span", {
|
|
176
|
+
className: t("shrink-0 rounded-full px-1.5 py-0.5 text-xs tabular-nums", n ? "bg-[var(--color-accent-soft)] text-action-primary-text" : "bg-bg-sunken text-text-secondary"),
|
|
177
|
+
children: j.isLoading ? "—" : r
|
|
178
|
+
})]
|
|
179
|
+
}, e);
|
|
180
|
+
})
|
|
181
|
+
}),
|
|
182
|
+
te && /* @__PURE__ */ z("p", {
|
|
183
|
+
className: "border-t border-border-seam px-4 py-2.5 text-xs text-text-muted",
|
|
184
|
+
children: [
|
|
185
|
+
"Counts cover the ",
|
|
186
|
+
i(q),
|
|
187
|
+
" most recent published values for this region; more exist."
|
|
188
|
+
]
|
|
189
|
+
})
|
|
190
|
+
]
|
|
191
|
+
})
|
|
192
|
+
}), /* @__PURE__ */ R("section", {
|
|
193
|
+
className: "min-w-0",
|
|
194
|
+
children: ne ? /* @__PURE__ */ R(p, { label: "Loading indicators…" }) : re ? /* @__PURE__ */ R(f, {
|
|
195
|
+
title: "We couldn't load this domain",
|
|
196
|
+
message: h(A.error ?? j.error),
|
|
197
|
+
onRetry: () => {
|
|
198
|
+
A.refetch(), j.refetch();
|
|
199
|
+
}
|
|
200
|
+
}) : L.length === 0 ? /* @__PURE__ */ R(a, {
|
|
201
|
+
illustration: "empty-data",
|
|
202
|
+
title: `No ${_[s].toLowerCase()} indicators defined yet`,
|
|
203
|
+
description: "An indicator has to exist in the workspace catalogue before a value can be published against it for this region.",
|
|
204
|
+
action: /* @__PURE__ */ R(B, {
|
|
205
|
+
onClick: () => r("intelligence/admin/indicators"),
|
|
206
|
+
children: "Open indicator catalogue"
|
|
207
|
+
})
|
|
208
|
+
}) : /* @__PURE__ */ R("div", {
|
|
209
|
+
className: "space-y-4",
|
|
210
|
+
children: L.map((e) => /* @__PURE__ */ R(ve, {
|
|
211
|
+
indicator: e,
|
|
212
|
+
jurisdictionId: n,
|
|
213
|
+
history: F.get(e.id) ?? [],
|
|
214
|
+
expanded: d === e.id,
|
|
215
|
+
onToggle: () => m((t) => t === e.id ? null : e.id),
|
|
216
|
+
onRecord: () => H(e.id),
|
|
217
|
+
onEdit: (t) => D({
|
|
218
|
+
value: t,
|
|
219
|
+
indicator: e
|
|
220
|
+
}),
|
|
221
|
+
onDelete: (t) => k({
|
|
222
|
+
value: t,
|
|
223
|
+
indicator: e
|
|
224
|
+
})
|
|
225
|
+
}, e.id))
|
|
226
|
+
})
|
|
227
|
+
})]
|
|
228
|
+
}),
|
|
229
|
+
S && n && /* @__PURE__ */ R(be, {
|
|
230
|
+
mode: "record",
|
|
231
|
+
jurisdictionId: n,
|
|
232
|
+
indicators: L,
|
|
233
|
+
initialIndicatorId: v,
|
|
234
|
+
onClose: () => T(!1)
|
|
235
|
+
}, `record-${v ?? "any"}`),
|
|
236
|
+
E && n && /* @__PURE__ */ R(be, {
|
|
237
|
+
mode: "edit",
|
|
238
|
+
jurisdictionId: n,
|
|
239
|
+
indicators: [E.indicator],
|
|
240
|
+
initialIndicatorId: E.indicator.id,
|
|
241
|
+
existing: E.value,
|
|
242
|
+
onClose: () => D(null)
|
|
243
|
+
}, `edit-${E.value.id}`),
|
|
244
|
+
/* @__PURE__ */ R(x, {
|
|
245
|
+
open: O !== null,
|
|
246
|
+
onOpenChange: (e) => {
|
|
247
|
+
e || k(null);
|
|
248
|
+
},
|
|
249
|
+
title: "Delete this published value?",
|
|
250
|
+
description: O ? `${O.indicator.name} for ${O.value.periodLabel} will be removed from this region's record. Scorecards and benchmarks recompute immediately.` : void 0,
|
|
251
|
+
confirmLabel: "Delete value",
|
|
252
|
+
destructive: !0,
|
|
253
|
+
onConfirm: U
|
|
254
|
+
})
|
|
255
|
+
]
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
var ve = ({ indicator: e, jurisdictionId: t, history: n, expanded: r, onToggle: i, onRecord: a, onEdit: o, onDelete: s }) => {
|
|
259
|
+
let c = n[0], l = c ? pe(c, n[1], e.direction) : null, u = c?.targetValue ?? e.targetValue ?? null;
|
|
260
|
+
return /* @__PURE__ */ z(V, {
|
|
261
|
+
treatment: "plain",
|
|
262
|
+
className: "overflow-hidden border-border-seam",
|
|
263
|
+
children: [/* @__PURE__ */ z("div", {
|
|
264
|
+
className: "flex flex-wrap items-start gap-3 p-5",
|
|
265
|
+
children: [/* @__PURE__ */ z("button", {
|
|
266
|
+
type: "button",
|
|
267
|
+
onClick: i,
|
|
268
|
+
"aria-expanded": r,
|
|
269
|
+
className: "flex min-w-0 flex-1 items-start gap-3 text-left outline-none focus-visible:ring-1 focus-visible:ring-border-focus",
|
|
270
|
+
children: [/* @__PURE__ */ R("span", {
|
|
271
|
+
className: "mt-0.5 inline-flex size-9 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-text-secondary",
|
|
272
|
+
children: /* @__PURE__ */ R(r ? D : O, {
|
|
273
|
+
className: "size-4",
|
|
274
|
+
"aria-hidden": "true"
|
|
275
|
+
})
|
|
276
|
+
}), /* @__PURE__ */ z("span", {
|
|
277
|
+
className: "min-w-0 flex-1",
|
|
278
|
+
children: [/* @__PURE__ */ z("span", {
|
|
279
|
+
className: "flex flex-wrap items-center gap-2",
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ R("span", {
|
|
282
|
+
className: "truncate text-base font-semibold text-text-primary",
|
|
283
|
+
children: e.name
|
|
284
|
+
}),
|
|
285
|
+
/* @__PURE__ */ R("span", {
|
|
286
|
+
className: "rounded bg-bg-sunken px-1.5 py-0.5 font-mono text-xs text-text-muted",
|
|
287
|
+
children: e.code
|
|
288
|
+
}),
|
|
289
|
+
e.sdgGoal != null && /* @__PURE__ */ z("span", {
|
|
290
|
+
className: "inline-flex items-center rounded-full bg-[var(--color-accent-soft)] px-2.5 py-0.5 text-xs font-medium text-action-primary-text",
|
|
291
|
+
children: ["SDG ", e.sdgGoal]
|
|
292
|
+
}),
|
|
293
|
+
c && /* @__PURE__ */ R(b, { status: c.verification })
|
|
294
|
+
]
|
|
295
|
+
}), e.description && /* @__PURE__ */ R("span", {
|
|
296
|
+
className: "mt-1 line-clamp-2 block text-sm text-text-secondary",
|
|
297
|
+
children: e.description
|
|
298
|
+
})]
|
|
299
|
+
})]
|
|
300
|
+
}), /* @__PURE__ */ R("div", {
|
|
301
|
+
className: "flex shrink-0 flex-col items-end gap-1.5",
|
|
302
|
+
children: c ? /* @__PURE__ */ z(L, { children: [
|
|
303
|
+
/* @__PURE__ */ R("p", {
|
|
304
|
+
className: "text-2xl font-bold tabular-nums text-text-primary",
|
|
305
|
+
children: X(c.value, e)
|
|
306
|
+
}),
|
|
307
|
+
/* @__PURE__ */ R("p", {
|
|
308
|
+
className: "text-xs text-text-muted",
|
|
309
|
+
children: c.periodLabel
|
|
310
|
+
}),
|
|
311
|
+
l && /* @__PURE__ */ R(he, { change: l }),
|
|
312
|
+
u != null && /* @__PURE__ */ z("p", {
|
|
313
|
+
className: "inline-flex items-center gap-1 text-xs text-text-muted",
|
|
314
|
+
children: [
|
|
315
|
+
/* @__PURE__ */ R(F, {
|
|
316
|
+
className: "size-3.5",
|
|
317
|
+
"aria-hidden": "true"
|
|
318
|
+
}),
|
|
319
|
+
" Target",
|
|
320
|
+
" ",
|
|
321
|
+
X(u, e)
|
|
322
|
+
]
|
|
323
|
+
})
|
|
324
|
+
] }) : /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("p", {
|
|
325
|
+
className: "text-sm text-text-muted",
|
|
326
|
+
children: "No value published yet"
|
|
327
|
+
}), /* @__PURE__ */ z(B, {
|
|
328
|
+
variant: "outline",
|
|
329
|
+
onClick: a,
|
|
330
|
+
children: [/* @__PURE__ */ R(P, {
|
|
331
|
+
className: "mr-1.5 h-4 w-4",
|
|
332
|
+
"aria-hidden": "true"
|
|
333
|
+
}), " Record value"]
|
|
334
|
+
})] })
|
|
335
|
+
})]
|
|
336
|
+
}), r && /* @__PURE__ */ R("div", {
|
|
337
|
+
className: "border-t border-border-seam p-5",
|
|
338
|
+
children: /* @__PURE__ */ R(ye, {
|
|
339
|
+
indicator: e,
|
|
340
|
+
jurisdictionId: t,
|
|
341
|
+
history: n,
|
|
342
|
+
onRecord: a,
|
|
343
|
+
onEdit: o,
|
|
344
|
+
onDelete: s
|
|
345
|
+
})
|
|
346
|
+
})]
|
|
347
|
+
});
|
|
348
|
+
}, ye = ({ indicator: e, jurisdictionId: t, history: o, onRecord: c, onEdit: l, onDelete: u }) => {
|
|
349
|
+
let d = s(t, e.code), g = C(() => d.data?.points ?? [], [d.data]), _ = C(() => g.map((e) => ({
|
|
350
|
+
label: e.periodLabel,
|
|
351
|
+
value: e.value
|
|
352
|
+
})), [g]), v = o[0], y = v?.targetValue ?? e.targetValue ?? null, x = C(() => {
|
|
353
|
+
let e = g.map((e) => e.value);
|
|
354
|
+
return y != null && e.push(y), e.length === 0 ? null : {
|
|
355
|
+
min: Math.min(...e),
|
|
356
|
+
max: Math.max(...e)
|
|
357
|
+
};
|
|
358
|
+
}, [g, y]), w = (e) => {
|
|
359
|
+
if (!x) return 0;
|
|
360
|
+
if (x.max === x.min) return 50;
|
|
361
|
+
let t = (e - x.min) / (x.max - x.min) * 100;
|
|
362
|
+
return Math.min(100, Math.max(0, t));
|
|
363
|
+
};
|
|
364
|
+
if (d.isLoading) return /* @__PURE__ */ R(p, {
|
|
365
|
+
label: "Loading published history…",
|
|
366
|
+
className: "min-h-[16rem]"
|
|
367
|
+
});
|
|
368
|
+
if (d.isError) return /* @__PURE__ */ R(f, {
|
|
369
|
+
title: "We couldn't load this indicator's history",
|
|
370
|
+
message: h(d.error),
|
|
371
|
+
onRetry: () => {
|
|
372
|
+
d.refetch();
|
|
373
|
+
},
|
|
374
|
+
className: "min-h-[16rem]"
|
|
375
|
+
});
|
|
376
|
+
if (!d.data || g.length === 0) return /* @__PURE__ */ R(a, {
|
|
377
|
+
illustration: "empty-data",
|
|
378
|
+
title: "No published history yet",
|
|
379
|
+
description: `Nothing has been published for ${e.name} in this region. Record a value to start the series.`,
|
|
380
|
+
action: /* @__PURE__ */ z(B, {
|
|
381
|
+
onClick: c,
|
|
382
|
+
children: [/* @__PURE__ */ R(P, {
|
|
383
|
+
className: "mr-1.5 h-4 w-4",
|
|
384
|
+
"aria-hidden": "true"
|
|
385
|
+
}), " Record value"]
|
|
386
|
+
})
|
|
387
|
+
});
|
|
388
|
+
let T = [
|
|
389
|
+
{
|
|
390
|
+
label: "Unit",
|
|
391
|
+
value: e.unit
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
label: "Periodicity",
|
|
395
|
+
value: e.periodicity.toLowerCase()
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
label: "Direction",
|
|
399
|
+
value: fe(e.direction)
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
label: "Core indicator",
|
|
403
|
+
value: e.isCore ? "Yes" : "No"
|
|
404
|
+
},
|
|
405
|
+
...e.methodology ? [{
|
|
406
|
+
label: "Methodology",
|
|
407
|
+
value: e.methodology
|
|
408
|
+
}] : []
|
|
409
|
+
];
|
|
410
|
+
return /* @__PURE__ */ z("div", {
|
|
411
|
+
className: "space-y-5",
|
|
412
|
+
children: [/* @__PURE__ */ z(m, {
|
|
413
|
+
title: "Published history",
|
|
414
|
+
icon: /* @__PURE__ */ R(j, { "aria-hidden": "true" }),
|
|
415
|
+
actions: /* @__PURE__ */ z(B, {
|
|
416
|
+
variant: "outline",
|
|
417
|
+
onClick: c,
|
|
418
|
+
children: [/* @__PURE__ */ R(P, {
|
|
419
|
+
className: "mr-1.5 h-4 w-4",
|
|
420
|
+
"aria-hidden": "true"
|
|
421
|
+
}), " Record value"]
|
|
422
|
+
}),
|
|
423
|
+
children: [
|
|
424
|
+
/* @__PURE__ */ R(n, {
|
|
425
|
+
data: _,
|
|
426
|
+
emptyLabel: "No published points yet."
|
|
427
|
+
}),
|
|
428
|
+
y != null && x && /* @__PURE__ */ z("div", {
|
|
429
|
+
className: "mt-4",
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ z("div", {
|
|
432
|
+
className: "flex flex-wrap items-center justify-between gap-2 text-xs text-text-muted",
|
|
433
|
+
children: [
|
|
434
|
+
/* @__PURE__ */ R("span", { children: X(x.min, e) }),
|
|
435
|
+
/* @__PURE__ */ z("span", {
|
|
436
|
+
className: "inline-flex items-center gap-1 font-medium text-text-secondary",
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ R(F, {
|
|
439
|
+
className: "size-3.5",
|
|
440
|
+
"aria-hidden": "true"
|
|
441
|
+
}),
|
|
442
|
+
" Target",
|
|
443
|
+
" ",
|
|
444
|
+
X(y, e)
|
|
445
|
+
]
|
|
446
|
+
}),
|
|
447
|
+
/* @__PURE__ */ R("span", { children: X(x.max, e) })
|
|
448
|
+
]
|
|
449
|
+
}),
|
|
450
|
+
/* @__PURE__ */ z("div", {
|
|
451
|
+
className: "relative mt-1.5 h-2.5 rounded-full bg-bg-sunken",
|
|
452
|
+
children: [v && /* @__PURE__ */ R("span", {
|
|
453
|
+
className: "absolute inset-y-0 left-0 rounded-full bg-[var(--color-action-primary-bg)]",
|
|
454
|
+
style: { width: `${w(v.value)}%` },
|
|
455
|
+
"aria-hidden": "true"
|
|
456
|
+
}), /* @__PURE__ */ R("span", {
|
|
457
|
+
className: "absolute -inset-y-1 w-0.5 rounded-full bg-border-strong",
|
|
458
|
+
style: { left: `${w(y)}%` },
|
|
459
|
+
"aria-hidden": "true"
|
|
460
|
+
})]
|
|
461
|
+
}),
|
|
462
|
+
v && /* @__PURE__ */ z("p", {
|
|
463
|
+
className: "mt-1.5 text-xs text-text-muted",
|
|
464
|
+
children: [
|
|
465
|
+
"Latest published value ",
|
|
466
|
+
X(v.value, e),
|
|
467
|
+
" (",
|
|
468
|
+
v.periodLabel,
|
|
469
|
+
") against a target of ",
|
|
470
|
+
X(y, e),
|
|
471
|
+
"."
|
|
472
|
+
]
|
|
473
|
+
})
|
|
474
|
+
]
|
|
475
|
+
}),
|
|
476
|
+
d.data.changePercent != null && d.data.latestPeriodLabel && /* @__PURE__ */ z("p", {
|
|
477
|
+
className: "mt-4 text-sm text-text-secondary",
|
|
478
|
+
children: [
|
|
479
|
+
"Period ",
|
|
480
|
+
d.data.latestPeriodLabel,
|
|
481
|
+
" moved",
|
|
482
|
+
" ",
|
|
483
|
+
i(Math.abs(d.data.changePercent), { maximumFractionDigits: 1 }),
|
|
484
|
+
"%",
|
|
485
|
+
" ",
|
|
486
|
+
d.data.changePercent >= 0 ? "up" : "down",
|
|
487
|
+
" on the previous published period."
|
|
488
|
+
]
|
|
489
|
+
})
|
|
490
|
+
]
|
|
491
|
+
}), /* @__PURE__ */ z("div", {
|
|
492
|
+
className: "grid grid-cols-1 gap-5 xl:grid-cols-2",
|
|
493
|
+
children: [/* @__PURE__ */ z(m, {
|
|
494
|
+
title: "Indicator definition",
|
|
495
|
+
icon: /* @__PURE__ */ R(A, { "aria-hidden": "true" }),
|
|
496
|
+
children: [/* @__PURE__ */ R(S, { items: T }), (e.sourceName || e.sourceUrl) && /* @__PURE__ */ z("p", {
|
|
497
|
+
className: "mt-4 border-t border-border-seam pt-3 text-xs text-text-muted",
|
|
498
|
+
children: [
|
|
499
|
+
"Definition source: ",
|
|
500
|
+
e.sourceName ?? "Not named",
|
|
501
|
+
e.sourceUrl && /* @__PURE__ */ z(L, { children: [" · ", /* @__PURE__ */ z("a", {
|
|
502
|
+
href: e.sourceUrl,
|
|
503
|
+
target: "_blank",
|
|
504
|
+
rel: "noreferrer noopener",
|
|
505
|
+
className: "inline-flex items-center gap-1 text-action-primary-text hover:underline",
|
|
506
|
+
children: ["Open source ", /* @__PURE__ */ R(k, {
|
|
507
|
+
className: "size-3",
|
|
508
|
+
"aria-hidden": "true"
|
|
509
|
+
})]
|
|
510
|
+
})] })
|
|
511
|
+
]
|
|
512
|
+
})]
|
|
513
|
+
}), /* @__PURE__ */ z(m, {
|
|
514
|
+
title: "Published values",
|
|
515
|
+
flush: !0,
|
|
516
|
+
children: [/* @__PURE__ */ R("div", {
|
|
517
|
+
className: "overflow-x-auto",
|
|
518
|
+
children: /* @__PURE__ */ z("table", {
|
|
519
|
+
className: "w-full min-w-[32rem] border-collapse text-left",
|
|
520
|
+
children: [/* @__PURE__ */ R("thead", { children: /* @__PURE__ */ z("tr", {
|
|
521
|
+
className: "border-b border-border-seam text-xs font-medium uppercase tracking-wide text-text-muted",
|
|
522
|
+
children: [
|
|
523
|
+
/* @__PURE__ */ R("th", {
|
|
524
|
+
scope: "col",
|
|
525
|
+
className: "px-5 py-2.5 font-medium",
|
|
526
|
+
children: "Period"
|
|
527
|
+
}),
|
|
528
|
+
/* @__PURE__ */ R("th", {
|
|
529
|
+
scope: "col",
|
|
530
|
+
className: "px-3 py-2.5 text-right font-medium",
|
|
531
|
+
children: "Value"
|
|
532
|
+
}),
|
|
533
|
+
/* @__PURE__ */ R("th", {
|
|
534
|
+
scope: "col",
|
|
535
|
+
className: "px-3 py-2.5 font-medium",
|
|
536
|
+
children: "Provenance"
|
|
537
|
+
}),
|
|
538
|
+
/* @__PURE__ */ R("th", {
|
|
539
|
+
scope: "col",
|
|
540
|
+
className: "px-5 py-2.5 text-right font-medium",
|
|
541
|
+
children: "Actions"
|
|
542
|
+
})
|
|
543
|
+
]
|
|
544
|
+
}) }), /* @__PURE__ */ R("tbody", { children: o.map((t) => /* @__PURE__ */ z("tr", {
|
|
545
|
+
className: "border-b border-border-subtle last:border-0",
|
|
546
|
+
children: [
|
|
547
|
+
/* @__PURE__ */ z("td", {
|
|
548
|
+
className: "px-5 py-3",
|
|
549
|
+
children: [/* @__PURE__ */ R("p", {
|
|
550
|
+
className: "text-sm font-medium text-text-primary",
|
|
551
|
+
children: t.periodLabel
|
|
552
|
+
}), /* @__PURE__ */ z("p", {
|
|
553
|
+
className: "text-xs text-text-muted",
|
|
554
|
+
children: [
|
|
555
|
+
r(t.periodStart),
|
|
556
|
+
" – ",
|
|
557
|
+
r(t.periodEnd)
|
|
558
|
+
]
|
|
559
|
+
})]
|
|
560
|
+
}),
|
|
561
|
+
/* @__PURE__ */ R("td", {
|
|
562
|
+
className: "px-3 py-3 text-right text-sm font-semibold tabular-nums text-text-primary",
|
|
563
|
+
children: X(t.value, e)
|
|
564
|
+
}),
|
|
565
|
+
/* @__PURE__ */ R("td", {
|
|
566
|
+
className: "px-3 py-3",
|
|
567
|
+
children: /* @__PURE__ */ R(b, { status: t.verification })
|
|
568
|
+
}),
|
|
569
|
+
/* @__PURE__ */ R("td", {
|
|
570
|
+
className: "px-5 py-3",
|
|
571
|
+
children: /* @__PURE__ */ z("div", {
|
|
572
|
+
className: "flex justify-end gap-1",
|
|
573
|
+
children: [/* @__PURE__ */ R(B, {
|
|
574
|
+
variant: "ghost",
|
|
575
|
+
onClick: () => l(t),
|
|
576
|
+
"aria-label": `Edit the value for ${t.periodLabel}`,
|
|
577
|
+
children: /* @__PURE__ */ R(N, {
|
|
578
|
+
className: "h-4 w-4",
|
|
579
|
+
"aria-hidden": "true"
|
|
580
|
+
})
|
|
581
|
+
}), /* @__PURE__ */ R(B, {
|
|
582
|
+
variant: "ghost",
|
|
583
|
+
onClick: () => u(t),
|
|
584
|
+
"aria-label": `Delete the value for ${t.periodLabel}`,
|
|
585
|
+
children: /* @__PURE__ */ R(I, {
|
|
586
|
+
className: "h-4 w-4 text-status-error-text",
|
|
587
|
+
"aria-hidden": "true"
|
|
588
|
+
})
|
|
589
|
+
})]
|
|
590
|
+
})
|
|
591
|
+
})
|
|
592
|
+
]
|
|
593
|
+
}, t.id)) })]
|
|
594
|
+
})
|
|
595
|
+
}), v && /* @__PURE__ */ R("div", {
|
|
596
|
+
className: "border-t border-border-seam px-5 py-3 text-xs text-text-muted",
|
|
597
|
+
children: v.sourceName || v.sourceUrl || v.sourceDate ? /* @__PURE__ */ z("span", {
|
|
598
|
+
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
599
|
+
children: [
|
|
600
|
+
/* @__PURE__ */ R("span", { children: "Latest value source:" }),
|
|
601
|
+
v.sourceName && /* @__PURE__ */ R("span", {
|
|
602
|
+
className: "font-medium text-text-secondary",
|
|
603
|
+
children: v.sourceName
|
|
604
|
+
}),
|
|
605
|
+
v.sourceUrl && /* @__PURE__ */ z("a", {
|
|
606
|
+
href: v.sourceUrl,
|
|
607
|
+
target: "_blank",
|
|
608
|
+
rel: "noreferrer noopener",
|
|
609
|
+
className: "inline-flex items-center gap-1 text-action-primary-text hover:underline",
|
|
610
|
+
children: ["Open source ", /* @__PURE__ */ R(k, {
|
|
611
|
+
className: "size-3",
|
|
612
|
+
"aria-hidden": "true"
|
|
613
|
+
})]
|
|
614
|
+
}),
|
|
615
|
+
v.sourceDate && /* @__PURE__ */ z("span", { children: ["Dated ", r(v.sourceDate)] })
|
|
616
|
+
]
|
|
617
|
+
}) : /* @__PURE__ */ R("span", { children: "No source recorded against the latest published value." })
|
|
618
|
+
})]
|
|
619
|
+
})]
|
|
620
|
+
})]
|
|
621
|
+
});
|
|
622
|
+
}, Z = (e) => {
|
|
623
|
+
if (!e) return "";
|
|
624
|
+
let t = new Date(e);
|
|
625
|
+
return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
|
|
626
|
+
}, Q = (e) => {
|
|
627
|
+
if (!e) return null;
|
|
628
|
+
let t = /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`);
|
|
629
|
+
return Number.isNaN(t.getTime()) ? null : t.toISOString();
|
|
630
|
+
}, $ = (e) => {
|
|
631
|
+
let t = e.trim();
|
|
632
|
+
if (!t) return null;
|
|
633
|
+
let n = Number(t);
|
|
634
|
+
return Number.isFinite(n) ? n : null;
|
|
635
|
+
}, be = ({ mode: e, jurisdictionId: t, indicators: n, initialIndicatorId: r, existing: i, onClose: a }) => {
|
|
636
|
+
let o = u(), s = d(), [c, l] = w(r ?? n[0]?.id ?? ""), [f, p] = w(i?.periodLabel ?? ""), [m, _] = w(Z(i?.periodStart)), [y, b] = w(Z(i?.periodEnd)), [x, S] = w(i ? String(i.value) : ""), [C, T] = w(i?.numerator == null ? "" : String(i.numerator)), [E, D] = w(i?.denominator == null ? "" : String(i.denominator)), [O, k] = w(i?.targetValue == null ? "" : String(i.targetValue)), [A, j] = w(i?.sourceName ?? ""), [M, N] = w(i?.sourceUrl ?? ""), [P, F] = w(Z(i?.sourceDate)), [I, ee] = w(i?.verification ?? "UNVERIFIED"), [L, V] = w(i?.notes ?? ""), [K, q] = w(null), J = o.isPending || s.isPending, Y = n.find((e) => e.id === c) ?? null, X = e === "edit" && i != null, fe = async () => {
|
|
637
|
+
let e = $(x);
|
|
638
|
+
if (e === null) {
|
|
639
|
+
q("A numeric value is required.");
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
try {
|
|
643
|
+
if (X && i) {
|
|
644
|
+
let t = await s.mutateAsync({
|
|
645
|
+
id: i.id,
|
|
646
|
+
input: {
|
|
647
|
+
value: e,
|
|
648
|
+
numerator: $(C),
|
|
649
|
+
denominator: $(E),
|
|
650
|
+
targetValue: $(O),
|
|
651
|
+
periodLabel: f.trim() || null,
|
|
652
|
+
sourceName: A.trim() || null,
|
|
653
|
+
sourceUrl: M.trim() || null,
|
|
654
|
+
sourceDate: Q(P),
|
|
655
|
+
verification: I,
|
|
656
|
+
notes: L.trim() || null
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
g.success("Value updated", `${i.periodLabel} → ${t.periodLabel}`);
|
|
660
|
+
} else {
|
|
661
|
+
if (!c) {
|
|
662
|
+
q("Pick an indicator to record against.");
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
if (!f.trim()) {
|
|
666
|
+
q("A period label is required (for example 2026 or 2026-Q1).");
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
let n = Q(m), r = Q(y);
|
|
670
|
+
if (!n || !r) {
|
|
671
|
+
q("The period needs both a start and an end date.");
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
if (new Date(r).getTime() < new Date(n).getTime()) {
|
|
675
|
+
q("The period end cannot fall before the period start.");
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
let i = await o.mutateAsync({
|
|
679
|
+
indicatorId: c,
|
|
680
|
+
jurisdictionId: t,
|
|
681
|
+
periodLabel: f.trim(),
|
|
682
|
+
periodStart: n,
|
|
683
|
+
periodEnd: r,
|
|
684
|
+
value: e,
|
|
685
|
+
numerator: $(C),
|
|
686
|
+
denominator: $(E),
|
|
687
|
+
targetValue: $(O),
|
|
688
|
+
sourceName: A.trim() || null,
|
|
689
|
+
sourceUrl: M.trim() || null,
|
|
690
|
+
sourceDate: Q(P),
|
|
691
|
+
verification: I,
|
|
692
|
+
notes: L.trim() || null
|
|
693
|
+
});
|
|
694
|
+
g.success("Value recorded", `${Y?.name ?? "Indicator"} · ${i.periodLabel}`);
|
|
695
|
+
}
|
|
696
|
+
a();
|
|
697
|
+
} catch (e) {
|
|
698
|
+
q(h(e));
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
return /* @__PURE__ */ R(te, {
|
|
702
|
+
open: !0,
|
|
703
|
+
onOpenChange: (e) => {
|
|
704
|
+
!e && !J && a();
|
|
705
|
+
},
|
|
706
|
+
children: /* @__PURE__ */ z(ne, {
|
|
707
|
+
className: "sm:max-w-xl",
|
|
708
|
+
children: [
|
|
709
|
+
/* @__PURE__ */ z(ae, { children: [/* @__PURE__ */ R(oe, { children: X ? "Edit published value" : "Record an indicator value" }), /* @__PURE__ */ R(re, { children: X ? "Corrections are audited. Scorecards, benchmarks and insights recompute from the new figure." : "Publish one measured fact for this region. Provenance is what makes it citable — record the source wherever you have it." })] }),
|
|
710
|
+
/* @__PURE__ */ z("div", {
|
|
711
|
+
className: "flex max-h-[60vh] flex-col gap-4 overflow-y-auto py-2",
|
|
712
|
+
children: [
|
|
713
|
+
!X && /* @__PURE__ */ z("div", {
|
|
714
|
+
className: "grid gap-1.5",
|
|
715
|
+
children: [/* @__PURE__ */ R(U, {
|
|
716
|
+
htmlFor: "indicator-value-indicator",
|
|
717
|
+
children: "Indicator"
|
|
718
|
+
}), /* @__PURE__ */ z(W, {
|
|
719
|
+
value: c,
|
|
720
|
+
onValueChange: l,
|
|
721
|
+
children: [/* @__PURE__ */ R(ce, {
|
|
722
|
+
id: "indicator-value-indicator",
|
|
723
|
+
"aria-label": "Indicator",
|
|
724
|
+
children: /* @__PURE__ */ R(le, { placeholder: "Pick an indicator" })
|
|
725
|
+
}), /* @__PURE__ */ R(G, { children: n.map((e) => /* @__PURE__ */ z(se, {
|
|
726
|
+
value: e.id,
|
|
727
|
+
children: [
|
|
728
|
+
e.code,
|
|
729
|
+
" · ",
|
|
730
|
+
e.name
|
|
731
|
+
]
|
|
732
|
+
}, e.id)) })]
|
|
733
|
+
})]
|
|
734
|
+
}),
|
|
735
|
+
/* @__PURE__ */ z("div", {
|
|
736
|
+
className: "grid gap-4 sm:grid-cols-2",
|
|
737
|
+
children: [/* @__PURE__ */ z("div", {
|
|
738
|
+
className: "grid gap-1.5",
|
|
739
|
+
children: [/* @__PURE__ */ R(U, {
|
|
740
|
+
htmlFor: "indicator-value-period",
|
|
741
|
+
children: "Period label"
|
|
742
|
+
}), /* @__PURE__ */ R(H, {
|
|
743
|
+
id: "indicator-value-period",
|
|
744
|
+
value: f,
|
|
745
|
+
onChange: (e) => p(e.target.value),
|
|
746
|
+
placeholder: "2026 · 2026-Q1 · 2026-03"
|
|
747
|
+
})]
|
|
748
|
+
}), /* @__PURE__ */ z("div", {
|
|
749
|
+
className: "grid gap-1.5",
|
|
750
|
+
children: [/* @__PURE__ */ z(U, {
|
|
751
|
+
htmlFor: "indicator-value-value",
|
|
752
|
+
children: ["Value", Y ? ` (${Y.unit})` : ""]
|
|
753
|
+
}), /* @__PURE__ */ R(H, {
|
|
754
|
+
id: "indicator-value-value",
|
|
755
|
+
inputMode: "decimal",
|
|
756
|
+
value: x,
|
|
757
|
+
onChange: (e) => S(e.target.value)
|
|
758
|
+
})]
|
|
759
|
+
})]
|
|
760
|
+
}),
|
|
761
|
+
!X && /* @__PURE__ */ z("div", {
|
|
762
|
+
className: "grid gap-4 sm:grid-cols-2",
|
|
763
|
+
children: [/* @__PURE__ */ z("div", {
|
|
764
|
+
className: "grid gap-1.5",
|
|
765
|
+
children: [/* @__PURE__ */ R(U, {
|
|
766
|
+
htmlFor: "indicator-value-start",
|
|
767
|
+
children: "Period start"
|
|
768
|
+
}), /* @__PURE__ */ R(H, {
|
|
769
|
+
id: "indicator-value-start",
|
|
770
|
+
type: "date",
|
|
771
|
+
value: m,
|
|
772
|
+
onChange: (e) => _(e.target.value)
|
|
773
|
+
})]
|
|
774
|
+
}), /* @__PURE__ */ z("div", {
|
|
775
|
+
className: "grid gap-1.5",
|
|
776
|
+
children: [/* @__PURE__ */ R(U, {
|
|
777
|
+
htmlFor: "indicator-value-end",
|
|
778
|
+
children: "Period end"
|
|
779
|
+
}), /* @__PURE__ */ R(H, {
|
|
780
|
+
id: "indicator-value-end",
|
|
781
|
+
type: "date",
|
|
782
|
+
value: y,
|
|
783
|
+
onChange: (e) => b(e.target.value)
|
|
784
|
+
})]
|
|
785
|
+
})]
|
|
786
|
+
}),
|
|
787
|
+
/* @__PURE__ */ z("div", {
|
|
788
|
+
className: "grid gap-4 sm:grid-cols-3",
|
|
789
|
+
children: [
|
|
790
|
+
/* @__PURE__ */ z("div", {
|
|
791
|
+
className: "grid gap-1.5",
|
|
792
|
+
children: [/* @__PURE__ */ R(U, {
|
|
793
|
+
htmlFor: "indicator-value-numerator",
|
|
794
|
+
children: "Numerator"
|
|
795
|
+
}), /* @__PURE__ */ R(H, {
|
|
796
|
+
id: "indicator-value-numerator",
|
|
797
|
+
inputMode: "decimal",
|
|
798
|
+
value: C,
|
|
799
|
+
onChange: (e) => T(e.target.value)
|
|
800
|
+
})]
|
|
801
|
+
}),
|
|
802
|
+
/* @__PURE__ */ z("div", {
|
|
803
|
+
className: "grid gap-1.5",
|
|
804
|
+
children: [/* @__PURE__ */ R(U, {
|
|
805
|
+
htmlFor: "indicator-value-denominator",
|
|
806
|
+
children: "Denominator"
|
|
807
|
+
}), /* @__PURE__ */ R(H, {
|
|
808
|
+
id: "indicator-value-denominator",
|
|
809
|
+
inputMode: "decimal",
|
|
810
|
+
value: E,
|
|
811
|
+
onChange: (e) => D(e.target.value)
|
|
812
|
+
})]
|
|
813
|
+
}),
|
|
814
|
+
/* @__PURE__ */ z("div", {
|
|
815
|
+
className: "grid gap-1.5",
|
|
816
|
+
children: [/* @__PURE__ */ R(U, {
|
|
817
|
+
htmlFor: "indicator-value-target",
|
|
818
|
+
children: "Target"
|
|
819
|
+
}), /* @__PURE__ */ R(H, {
|
|
820
|
+
id: "indicator-value-target",
|
|
821
|
+
inputMode: "decimal",
|
|
822
|
+
value: O,
|
|
823
|
+
onChange: (e) => k(e.target.value)
|
|
824
|
+
})]
|
|
825
|
+
})
|
|
826
|
+
]
|
|
827
|
+
}),
|
|
828
|
+
/* @__PURE__ */ z("div", {
|
|
829
|
+
className: "grid gap-4 sm:grid-cols-2",
|
|
830
|
+
children: [/* @__PURE__ */ z("div", {
|
|
831
|
+
className: "grid gap-1.5",
|
|
832
|
+
children: [/* @__PURE__ */ R(U, {
|
|
833
|
+
htmlFor: "indicator-value-source-name",
|
|
834
|
+
children: "Source name"
|
|
835
|
+
}), /* @__PURE__ */ R(H, {
|
|
836
|
+
id: "indicator-value-source-name",
|
|
837
|
+
value: A,
|
|
838
|
+
onChange: (e) => j(e.target.value),
|
|
839
|
+
placeholder: "Who published this figure?"
|
|
840
|
+
})]
|
|
841
|
+
}), /* @__PURE__ */ z("div", {
|
|
842
|
+
className: "grid gap-1.5",
|
|
843
|
+
children: [/* @__PURE__ */ R(U, {
|
|
844
|
+
htmlFor: "indicator-value-source-url",
|
|
845
|
+
children: "Source URL"
|
|
846
|
+
}), /* @__PURE__ */ R(H, {
|
|
847
|
+
id: "indicator-value-source-url",
|
|
848
|
+
value: M,
|
|
849
|
+
onChange: (e) => N(e.target.value),
|
|
850
|
+
placeholder: "https://"
|
|
851
|
+
})]
|
|
852
|
+
})]
|
|
853
|
+
}),
|
|
854
|
+
/* @__PURE__ */ z("div", {
|
|
855
|
+
className: "grid gap-4 sm:grid-cols-2",
|
|
856
|
+
children: [/* @__PURE__ */ z("div", {
|
|
857
|
+
className: "grid gap-1.5",
|
|
858
|
+
children: [/* @__PURE__ */ R(U, {
|
|
859
|
+
htmlFor: "indicator-value-source-date",
|
|
860
|
+
children: "Source date"
|
|
861
|
+
}), /* @__PURE__ */ R(H, {
|
|
862
|
+
id: "indicator-value-source-date",
|
|
863
|
+
type: "date",
|
|
864
|
+
value: P,
|
|
865
|
+
onChange: (e) => F(e.target.value)
|
|
866
|
+
})]
|
|
867
|
+
}), /* @__PURE__ */ z("div", {
|
|
868
|
+
className: "grid gap-1.5",
|
|
869
|
+
children: [/* @__PURE__ */ R(U, {
|
|
870
|
+
htmlFor: "indicator-value-verification",
|
|
871
|
+
children: "Provenance grade"
|
|
872
|
+
}), /* @__PURE__ */ z(W, {
|
|
873
|
+
value: I,
|
|
874
|
+
onValueChange: (e) => {
|
|
875
|
+
let t = de.find((t) => t === e);
|
|
876
|
+
t && ee(t);
|
|
877
|
+
},
|
|
878
|
+
children: [/* @__PURE__ */ R(ce, {
|
|
879
|
+
id: "indicator-value-verification",
|
|
880
|
+
"aria-label": "Provenance grade",
|
|
881
|
+
children: /* @__PURE__ */ R(le, {})
|
|
882
|
+
}), /* @__PURE__ */ R(G, { children: de.map((e) => /* @__PURE__ */ R(se, {
|
|
883
|
+
value: e,
|
|
884
|
+
children: v[e]
|
|
885
|
+
}, e)) })]
|
|
886
|
+
})]
|
|
887
|
+
})]
|
|
888
|
+
}),
|
|
889
|
+
/* @__PURE__ */ z("div", {
|
|
890
|
+
className: "grid gap-1.5",
|
|
891
|
+
children: [/* @__PURE__ */ R(U, {
|
|
892
|
+
htmlFor: "indicator-value-notes",
|
|
893
|
+
children: "Notes"
|
|
894
|
+
}), /* @__PURE__ */ R(ue, {
|
|
895
|
+
id: "indicator-value-notes",
|
|
896
|
+
value: L,
|
|
897
|
+
onChange: (e) => V(e.target.value),
|
|
898
|
+
rows: 3,
|
|
899
|
+
placeholder: "Caveats, revisions, definitional changes…"
|
|
900
|
+
})]
|
|
901
|
+
}),
|
|
902
|
+
K && /* @__PURE__ */ R("p", {
|
|
903
|
+
className: "text-sm text-status-error-text",
|
|
904
|
+
children: K
|
|
905
|
+
})
|
|
906
|
+
]
|
|
907
|
+
}),
|
|
908
|
+
/* @__PURE__ */ z(ie, { children: [/* @__PURE__ */ R(B, {
|
|
909
|
+
variant: "outline",
|
|
910
|
+
onClick: a,
|
|
911
|
+
disabled: J,
|
|
912
|
+
children: "Cancel"
|
|
913
|
+
}), /* @__PURE__ */ R(B, {
|
|
914
|
+
onClick: () => {
|
|
915
|
+
fe();
|
|
916
|
+
},
|
|
917
|
+
disabled: J,
|
|
918
|
+
children: J ? "Saving…" : X ? "Save changes" : "Record value"
|
|
919
|
+
})] })
|
|
920
|
+
]
|
|
921
|
+
})
|
|
922
|
+
});
|
|
923
|
+
};
|
|
924
|
+
//#endregion
|
|
925
|
+
export { _e as IndicatorsPage, X as formatIndicatorValue };
|
|
926
|
+
|
|
927
|
+
//# sourceMappingURL=IndicatorsPage.js.map
|