@burdenoff/microfe-govcitizenhub 2026.720.7 → 2026.730.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/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 +1125 -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,960 @@
|
|
|
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 { PageLayout as n } from "../../components/PageLayout.js";
|
|
5
|
+
import { formatNumber as r } from "../../utils/formatters.js";
|
|
6
|
+
import { EmptyState as i } from "../../components/EmptyState.js";
|
|
7
|
+
import { useGovCreateIndicator as ee, useGovDeleteIndicator as a, useGovIndicators as te, useGovSeedIndicatorCatalog as o, useGovUpdateIndicator as ne } from "../../hooks/useIntelligenceApi.js";
|
|
8
|
+
import { useCursorPager as s } from "../../hooks/useCursorPager.js";
|
|
9
|
+
import "../../hooks/index.js";
|
|
10
|
+
import { ErrorView as re } from "../../components/StateViews.js";
|
|
11
|
+
import { SectionCard as c } from "../../components/SectionCard.js";
|
|
12
|
+
import { Pagination as ie } from "../../components/Pagination.js";
|
|
13
|
+
import { describeError as l, notify as u } from "../../lib/toast.js";
|
|
14
|
+
import { GOV_INDICATOR_DOMAIN_LABELS as d } from "../../types/intelligence.js";
|
|
15
|
+
import { ConfirmDialog as ae } from "../../components/ConfirmDialog.js";
|
|
16
|
+
import { useMemo as f, useState as p } from "react";
|
|
17
|
+
import { AlertTriangle as oe, ArrowDownRight as m, ArrowUpRight as h, Info as g, Minus as _, Pencil as se, Plus as ce, Search as v, Sparkles as le, Star as ue, Trash2 as de, X as y } from "lucide-react";
|
|
18
|
+
import { Fragment as fe, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
19
|
+
import { Button as S, GlassCard as C, Input as w, Label as T, ResponsiveDialog as pe, ResponsiveDialogContent as me, ResponsiveDialogDescription as he, ResponsiveDialogFooter as ge, ResponsiveDialogHeader as _e, ResponsiveDialogTitle as ve, Select as E, SelectContent as D, SelectItem as O, SelectTrigger as k, SelectValue as A, Skeleton as ye, Switch as j, Textarea as M } from "@burdenoff/fe-libs/ui";
|
|
20
|
+
//#region src/govcitizenhub/pages/intelligence/IndicatorCatalogPage.tsx
|
|
21
|
+
var N = 25, P = "ALL", F = [
|
|
22
|
+
"DEMOGRAPHICS",
|
|
23
|
+
"ECONOMY",
|
|
24
|
+
"EDUCATION",
|
|
25
|
+
"HEALTHCARE",
|
|
26
|
+
"INFRASTRUCTURE",
|
|
27
|
+
"PUBLIC_SAFETY",
|
|
28
|
+
"ENVIRONMENT",
|
|
29
|
+
"SOCIAL_WELFARE",
|
|
30
|
+
"UTILITIES",
|
|
31
|
+
"TRANSPORT",
|
|
32
|
+
"HOUSING",
|
|
33
|
+
"GOVERNANCE",
|
|
34
|
+
"DIGITAL",
|
|
35
|
+
"TOURISM",
|
|
36
|
+
"FINANCE"
|
|
37
|
+
], I = [
|
|
38
|
+
"NUMBER",
|
|
39
|
+
"PERCENTAGE",
|
|
40
|
+
"RATIO",
|
|
41
|
+
"CURRENCY",
|
|
42
|
+
"INDEX",
|
|
43
|
+
"COUNT",
|
|
44
|
+
"DURATION_DAYS"
|
|
45
|
+
], be = {
|
|
46
|
+
NUMBER: "Number",
|
|
47
|
+
PERCENTAGE: "Percentage",
|
|
48
|
+
RATIO: "Ratio",
|
|
49
|
+
CURRENCY: "Currency",
|
|
50
|
+
INDEX: "Index",
|
|
51
|
+
COUNT: "Count",
|
|
52
|
+
DURATION_DAYS: "Duration (days)"
|
|
53
|
+
}, L = [
|
|
54
|
+
"HIGHER_IS_BETTER",
|
|
55
|
+
"LOWER_IS_BETTER",
|
|
56
|
+
"NEUTRAL"
|
|
57
|
+
], xe = {
|
|
58
|
+
HIGHER_IS_BETTER: "Higher is better",
|
|
59
|
+
LOWER_IS_BETTER: "Lower is better",
|
|
60
|
+
NEUTRAL: "Neutral"
|
|
61
|
+
}, R = [
|
|
62
|
+
"ANNUAL",
|
|
63
|
+
"QUARTERLY",
|
|
64
|
+
"MONTHLY",
|
|
65
|
+
"WEEKLY",
|
|
66
|
+
"DAILY",
|
|
67
|
+
"ADHOC"
|
|
68
|
+
], Se = {
|
|
69
|
+
ANNUAL: "Annual",
|
|
70
|
+
QUARTERLY: "Quarterly",
|
|
71
|
+
MONTHLY: "Monthly",
|
|
72
|
+
WEEKLY: "Weekly",
|
|
73
|
+
DAILY: "Daily",
|
|
74
|
+
ADHOC: "Ad hoc"
|
|
75
|
+
}, Ce = Array.from({ length: 17 }, (e, t) => t + 1), z = "NONE", B = (e) => {
|
|
76
|
+
let t = e.trim();
|
|
77
|
+
if (!t) return null;
|
|
78
|
+
let n = Number(t);
|
|
79
|
+
return Number.isFinite(n) ? n : null;
|
|
80
|
+
}, V = (e) => e.trim() || null, H = ({ direction: e }) => b(e === "HIGHER_IS_BETTER" ? h : e === "LOWER_IS_BETTER" ? m : _, {
|
|
81
|
+
className: "size-3.5",
|
|
82
|
+
"aria-hidden": "true"
|
|
83
|
+
});
|
|
84
|
+
function U() {
|
|
85
|
+
let { navigateTo: m } = e(), h = s(), [_, j] = p(""), [M, I] = p(""), [L, R] = p(P), [Ce, z] = p(!1), [B, V] = p(null), [U, G] = p(null), [K, q] = p(null), [we, J] = p(!1), [Y, Te] = p([]), { data: X, isLoading: Ee, isError: De, refetch: Oe } = te({
|
|
86
|
+
domain: L === P ? void 0 : L,
|
|
87
|
+
search: M || void 0
|
|
88
|
+
}, {
|
|
89
|
+
limit: N,
|
|
90
|
+
cursor: h.cursor
|
|
91
|
+
}), ke = ee(), Z = ne(), Ae = a(), Q = o(), je = X?.items ?? [], $ = !!M || L !== P, Me = () => {
|
|
92
|
+
j(""), I(""), R(P), h.reset();
|
|
93
|
+
}, Ne = async () => {
|
|
94
|
+
if (!U) return;
|
|
95
|
+
let e = U;
|
|
96
|
+
try {
|
|
97
|
+
await Ae.mutateAsync(e.id), u.success("Indicator deleted", e.code), q(null), G(null);
|
|
98
|
+
} catch (t) {
|
|
99
|
+
let n = l(t);
|
|
100
|
+
q({
|
|
101
|
+
indicator: e,
|
|
102
|
+
message: n
|
|
103
|
+
}), u.error("The indicator was kept", n);
|
|
104
|
+
}
|
|
105
|
+
}, Pe = async (e) => {
|
|
106
|
+
try {
|
|
107
|
+
await Z.mutateAsync({
|
|
108
|
+
id: e.id,
|
|
109
|
+
input: { isActive: !1 }
|
|
110
|
+
}), u.success("Indicator deactivated", "Its recorded values are kept, and it no longer counts toward scorecards."), q(null);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
u.error("Could not deactivate the indicator", l(e));
|
|
113
|
+
}
|
|
114
|
+
}, Fe = (e) => {
|
|
115
|
+
Te((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
116
|
+
}, Ie = async () => {
|
|
117
|
+
try {
|
|
118
|
+
let e = await Q.mutateAsync(Y.length > 0 ? Y : void 0);
|
|
119
|
+
u.success("Standard catalogue seeded", `${r(e.length)} indicator definition${e.length === 1 ? "" : "s"} are now available. Existing codes were left untouched.`), J(!1);
|
|
120
|
+
} catch (e) {
|
|
121
|
+
u.error("Could not seed the catalogue", l(e));
|
|
122
|
+
}
|
|
123
|
+
}, Le = f(() => Y.length === 0 ? "Every domain" : Y.map((e) => d[e]).join(", "), [Y]);
|
|
124
|
+
return /* @__PURE__ */ x(n, {
|
|
125
|
+
title: "Indicator catalogue",
|
|
126
|
+
description: "Definitions of the civic KPIs this workspace measures. Every published statistic resolves through one of these.",
|
|
127
|
+
breadcrumbs: [{
|
|
128
|
+
label: "Community Intelligence",
|
|
129
|
+
onClick: () => m("intelligence")
|
|
130
|
+
}, { label: "Indicator catalogue" }],
|
|
131
|
+
actions: /* @__PURE__ */ x("div", {
|
|
132
|
+
className: "flex flex-wrap items-center gap-2",
|
|
133
|
+
children: [/* @__PURE__ */ x(S, {
|
|
134
|
+
variant: "outline",
|
|
135
|
+
onClick: () => J(!0),
|
|
136
|
+
children: [/* @__PURE__ */ b(le, {
|
|
137
|
+
className: "mr-1.5 h-4 w-4",
|
|
138
|
+
"aria-hidden": "true"
|
|
139
|
+
}), " Seed standard catalogue"]
|
|
140
|
+
}), /* @__PURE__ */ x(S, {
|
|
141
|
+
onClick: () => {
|
|
142
|
+
V(null), z(!0);
|
|
143
|
+
},
|
|
144
|
+
children: [/* @__PURE__ */ b(ce, {
|
|
145
|
+
className: "mr-1.5 h-4 w-4",
|
|
146
|
+
"aria-hidden": "true"
|
|
147
|
+
}), " New indicator"]
|
|
148
|
+
})]
|
|
149
|
+
}),
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ x("div", {
|
|
152
|
+
className: "mb-4 flex items-start gap-2.5 rounded-card border border-border-seam bg-bg-sunken px-4 py-3",
|
|
153
|
+
children: [/* @__PURE__ */ b(g, {
|
|
154
|
+
className: "mt-0.5 size-4 shrink-0 text-text-muted",
|
|
155
|
+
"aria-hidden": "true"
|
|
156
|
+
}), /* @__PURE__ */ x("p", {
|
|
157
|
+
className: "text-sm text-text-secondary",
|
|
158
|
+
children: [
|
|
159
|
+
"A definition says what is measured, in what unit, how often, and whether a rising value is good. Only ",
|
|
160
|
+
/* @__PURE__ */ b("span", {
|
|
161
|
+
className: "font-medium",
|
|
162
|
+
children: "core"
|
|
163
|
+
}),
|
|
164
|
+
" indicators feed the composite scorecard, weighted by their weight and normalised between their minimum and maximum."
|
|
165
|
+
]
|
|
166
|
+
})]
|
|
167
|
+
}),
|
|
168
|
+
K && /* @__PURE__ */ x("div", {
|
|
169
|
+
className: "mb-4 flex flex-wrap items-start gap-3 rounded-card bg-status-warning-bg-subtle px-4 py-3",
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ b(oe, {
|
|
172
|
+
className: "mt-0.5 size-4 shrink-0 text-status-warning-text",
|
|
173
|
+
"aria-hidden": "true"
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ x("div", {
|
|
176
|
+
className: "min-w-0 flex-1",
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ x("p", {
|
|
179
|
+
className: "text-sm font-medium text-status-warning-text",
|
|
180
|
+
children: [
|
|
181
|
+
"“",
|
|
182
|
+
K.indicator.code,
|
|
183
|
+
"” was kept"
|
|
184
|
+
]
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ b("p", {
|
|
187
|
+
className: "mt-0.5 text-sm text-status-warning-text",
|
|
188
|
+
children: K.message
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ b("p", {
|
|
191
|
+
className: "mt-1 text-xs text-status-warning-text",
|
|
192
|
+
children: "An indicator with recorded values cannot be deleted — the history behind published figures would go with it. Deactivate it instead: the values stay readable and the indicator stops counting toward scorecards."
|
|
193
|
+
})
|
|
194
|
+
]
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ x("div", {
|
|
197
|
+
className: "flex flex-wrap gap-2",
|
|
198
|
+
children: [/* @__PURE__ */ b(S, {
|
|
199
|
+
variant: "outline",
|
|
200
|
+
size: "sm",
|
|
201
|
+
onClick: () => {
|
|
202
|
+
Pe(K.indicator);
|
|
203
|
+
},
|
|
204
|
+
disabled: Z.isPending,
|
|
205
|
+
children: "Deactivate instead"
|
|
206
|
+
}), /* @__PURE__ */ b(S, {
|
|
207
|
+
variant: "outline",
|
|
208
|
+
size: "sm",
|
|
209
|
+
onClick: () => q(null),
|
|
210
|
+
"aria-label": "Dismiss",
|
|
211
|
+
children: /* @__PURE__ */ b(y, {
|
|
212
|
+
className: "h-4 w-4",
|
|
213
|
+
"aria-hidden": "true"
|
|
214
|
+
})
|
|
215
|
+
})]
|
|
216
|
+
})
|
|
217
|
+
]
|
|
218
|
+
}),
|
|
219
|
+
/* @__PURE__ */ x(c, {
|
|
220
|
+
title: "Find an indicator",
|
|
221
|
+
icon: /* @__PURE__ */ b(v, {}),
|
|
222
|
+
className: "mb-4 border-border-seam",
|
|
223
|
+
children: [/* @__PURE__ */ x("div", {
|
|
224
|
+
className: "grid gap-3 sm:grid-cols-[minmax(0,1fr)_16rem]",
|
|
225
|
+
children: [/* @__PURE__ */ x("form", {
|
|
226
|
+
className: "relative",
|
|
227
|
+
onSubmit: (e) => {
|
|
228
|
+
e.preventDefault(), I(_.trim()), h.reset();
|
|
229
|
+
},
|
|
230
|
+
children: [
|
|
231
|
+
/* @__PURE__ */ b(v, {
|
|
232
|
+
className: "pointer-events-none absolute left-3.5 top-1/2 size-4 -translate-y-1/2 text-text-muted",
|
|
233
|
+
"aria-hidden": "true"
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ b(w, {
|
|
236
|
+
value: _,
|
|
237
|
+
onChange: (e) => j(e.target.value),
|
|
238
|
+
placeholder: "Search by code or name, then press Enter…",
|
|
239
|
+
"aria-label": "Search indicators",
|
|
240
|
+
className: "h-11 pl-10 pr-24"
|
|
241
|
+
}),
|
|
242
|
+
/* @__PURE__ */ b(S, {
|
|
243
|
+
type: "submit",
|
|
244
|
+
size: "sm",
|
|
245
|
+
className: "absolute right-1.5 top-1/2 -translate-y-1/2",
|
|
246
|
+
children: "Search"
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
}), /* @__PURE__ */ x("div", {
|
|
250
|
+
className: "grid gap-1.5",
|
|
251
|
+
children: [/* @__PURE__ */ b(T, {
|
|
252
|
+
htmlFor: "indicator-domain",
|
|
253
|
+
className: "sr-only",
|
|
254
|
+
children: "Domain"
|
|
255
|
+
}), /* @__PURE__ */ x(E, {
|
|
256
|
+
value: L,
|
|
257
|
+
onValueChange: (e) => {
|
|
258
|
+
R(e), h.reset();
|
|
259
|
+
},
|
|
260
|
+
children: [/* @__PURE__ */ b(k, {
|
|
261
|
+
id: "indicator-domain",
|
|
262
|
+
className: "h-11",
|
|
263
|
+
"aria-label": "Filter by domain",
|
|
264
|
+
children: /* @__PURE__ */ b(A, {})
|
|
265
|
+
}), /* @__PURE__ */ x(D, { children: [/* @__PURE__ */ b(O, {
|
|
266
|
+
value: P,
|
|
267
|
+
children: "All domains"
|
|
268
|
+
}), F.map((e) => /* @__PURE__ */ b(O, {
|
|
269
|
+
value: e,
|
|
270
|
+
children: d[e]
|
|
271
|
+
}, e))] })]
|
|
272
|
+
})]
|
|
273
|
+
})]
|
|
274
|
+
}), $ && /* @__PURE__ */ b("div", {
|
|
275
|
+
className: "mt-3",
|
|
276
|
+
children: /* @__PURE__ */ x(S, {
|
|
277
|
+
variant: "outline",
|
|
278
|
+
size: "sm",
|
|
279
|
+
onClick: Me,
|
|
280
|
+
children: [/* @__PURE__ */ b(y, {
|
|
281
|
+
className: "mr-1.5 h-4 w-4",
|
|
282
|
+
"aria-hidden": "true"
|
|
283
|
+
}), " Clear filters"]
|
|
284
|
+
})
|
|
285
|
+
})]
|
|
286
|
+
}),
|
|
287
|
+
Ee ? /* @__PURE__ */ b("div", {
|
|
288
|
+
className: "space-y-3",
|
|
289
|
+
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ b(ye, { className: "h-12 w-full rounded-card" }, t))
|
|
290
|
+
}) : De ? /* @__PURE__ */ b(re, {
|
|
291
|
+
message: "We couldn't load the indicator catalogue.",
|
|
292
|
+
onRetry: () => {
|
|
293
|
+
Oe();
|
|
294
|
+
}
|
|
295
|
+
}) : je.length === 0 && h.page === 0 ? /* @__PURE__ */ b(i, {
|
|
296
|
+
illustration: "empty-data",
|
|
297
|
+
title: $ ? "No indicators match these filters" : "No indicators defined yet",
|
|
298
|
+
description: $ ? "Widen or clear the filters to see the rest of the catalogue." : "Seed the country-neutral standard catalogue to get going, or define the first indicator by hand.",
|
|
299
|
+
action: $ ? /* @__PURE__ */ b(S, {
|
|
300
|
+
variant: "outline",
|
|
301
|
+
onClick: Me,
|
|
302
|
+
children: "Clear filters"
|
|
303
|
+
}) : /* @__PURE__ */ x("div", {
|
|
304
|
+
className: "flex flex-wrap justify-center gap-2",
|
|
305
|
+
children: [/* @__PURE__ */ x(S, {
|
|
306
|
+
variant: "outline",
|
|
307
|
+
onClick: () => J(!0),
|
|
308
|
+
children: [/* @__PURE__ */ b(le, {
|
|
309
|
+
className: "mr-1.5 h-4 w-4",
|
|
310
|
+
"aria-hidden": "true"
|
|
311
|
+
}), " Seed standard catalogue"]
|
|
312
|
+
}), /* @__PURE__ */ x(S, {
|
|
313
|
+
onClick: () => {
|
|
314
|
+
V(null), z(!0);
|
|
315
|
+
},
|
|
316
|
+
children: [/* @__PURE__ */ b(ce, {
|
|
317
|
+
className: "mr-1.5 h-4 w-4",
|
|
318
|
+
"aria-hidden": "true"
|
|
319
|
+
}), " New indicator"]
|
|
320
|
+
})]
|
|
321
|
+
})
|
|
322
|
+
}) : /* @__PURE__ */ x(fe, { children: [/* @__PURE__ */ b(C, {
|
|
323
|
+
treatment: "plain",
|
|
324
|
+
className: "overflow-hidden border-border-seam p-0",
|
|
325
|
+
children: /* @__PURE__ */ b("div", {
|
|
326
|
+
className: "overflow-x-auto",
|
|
327
|
+
children: /* @__PURE__ */ x("table", {
|
|
328
|
+
className: "w-full text-left text-sm",
|
|
329
|
+
children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ x("tr", {
|
|
330
|
+
className: "border-b border-border-seam text-xs uppercase tracking-wide text-text-muted",
|
|
331
|
+
children: [
|
|
332
|
+
/* @__PURE__ */ b("th", {
|
|
333
|
+
className: "px-4 py-3 font-medium",
|
|
334
|
+
children: "Code"
|
|
335
|
+
}),
|
|
336
|
+
/* @__PURE__ */ b("th", {
|
|
337
|
+
className: "px-4 py-3 font-medium",
|
|
338
|
+
children: "Name"
|
|
339
|
+
}),
|
|
340
|
+
/* @__PURE__ */ b("th", {
|
|
341
|
+
className: "px-4 py-3 font-medium",
|
|
342
|
+
children: "Domain"
|
|
343
|
+
}),
|
|
344
|
+
/* @__PURE__ */ b("th", {
|
|
345
|
+
className: "px-4 py-3 font-medium",
|
|
346
|
+
children: "Unit"
|
|
347
|
+
}),
|
|
348
|
+
/* @__PURE__ */ b("th", {
|
|
349
|
+
className: "px-4 py-3 font-medium",
|
|
350
|
+
children: "Type"
|
|
351
|
+
}),
|
|
352
|
+
/* @__PURE__ */ b("th", {
|
|
353
|
+
className: "px-4 py-3 font-medium",
|
|
354
|
+
children: "Direction"
|
|
355
|
+
}),
|
|
356
|
+
/* @__PURE__ */ b("th", {
|
|
357
|
+
className: "px-4 py-3 font-medium",
|
|
358
|
+
children: "Periodicity"
|
|
359
|
+
}),
|
|
360
|
+
/* @__PURE__ */ b("th", {
|
|
361
|
+
className: "px-4 py-3 font-medium",
|
|
362
|
+
children: "Core"
|
|
363
|
+
}),
|
|
364
|
+
/* @__PURE__ */ b("th", {
|
|
365
|
+
className: "px-4 py-3 text-right font-medium",
|
|
366
|
+
children: "Weight"
|
|
367
|
+
}),
|
|
368
|
+
/* @__PURE__ */ b("th", {
|
|
369
|
+
className: "px-4 py-3 text-right font-medium",
|
|
370
|
+
children: "SDG"
|
|
371
|
+
}),
|
|
372
|
+
/* @__PURE__ */ b("th", {
|
|
373
|
+
className: "px-4 py-3 text-right font-medium",
|
|
374
|
+
children: "Min / max"
|
|
375
|
+
}),
|
|
376
|
+
/* @__PURE__ */ b("th", {
|
|
377
|
+
className: "px-4 py-3 font-medium",
|
|
378
|
+
children: "Active"
|
|
379
|
+
}),
|
|
380
|
+
/* @__PURE__ */ b("th", {
|
|
381
|
+
className: "px-4 py-3 text-right font-medium",
|
|
382
|
+
children: "Actions"
|
|
383
|
+
})
|
|
384
|
+
]
|
|
385
|
+
}) }), /* @__PURE__ */ b("tbody", {
|
|
386
|
+
className: "divide-y divide-border-subtle",
|
|
387
|
+
children: je.map((e) => /* @__PURE__ */ x("tr", {
|
|
388
|
+
className: t("transition-colors hover:bg-bg-sunken", !e.isActive && "opacity-70"),
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ b("td", {
|
|
391
|
+
className: "whitespace-nowrap px-4 py-3 align-top font-mono text-xs text-text-secondary",
|
|
392
|
+
children: e.code
|
|
393
|
+
}),
|
|
394
|
+
/* @__PURE__ */ x("td", {
|
|
395
|
+
className: "px-4 py-3 align-top",
|
|
396
|
+
children: [/* @__PURE__ */ b("p", {
|
|
397
|
+
className: "font-medium text-text-primary",
|
|
398
|
+
children: e.name
|
|
399
|
+
}), e.description && /* @__PURE__ */ b("p", {
|
|
400
|
+
className: "mt-0.5 max-w-sm text-xs text-text-muted",
|
|
401
|
+
children: e.description
|
|
402
|
+
})]
|
|
403
|
+
}),
|
|
404
|
+
/* @__PURE__ */ b("td", {
|
|
405
|
+
className: "whitespace-nowrap px-4 py-3 align-top",
|
|
406
|
+
children: /* @__PURE__ */ b("span", {
|
|
407
|
+
className: "inline-flex items-center rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
|
|
408
|
+
children: d[e.domain]
|
|
409
|
+
})
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ b("td", {
|
|
412
|
+
className: "whitespace-nowrap px-4 py-3 align-top text-text-secondary",
|
|
413
|
+
children: e.unit
|
|
414
|
+
}),
|
|
415
|
+
/* @__PURE__ */ b("td", {
|
|
416
|
+
className: "whitespace-nowrap px-4 py-3 align-top text-text-secondary",
|
|
417
|
+
children: be[e.valueType]
|
|
418
|
+
}),
|
|
419
|
+
/* @__PURE__ */ b("td", {
|
|
420
|
+
className: "whitespace-nowrap px-4 py-3 align-top",
|
|
421
|
+
children: /* @__PURE__ */ x("span", {
|
|
422
|
+
className: "inline-flex items-center gap-1.5 text-text-secondary",
|
|
423
|
+
children: [/* @__PURE__ */ b(H, { direction: e.direction }), xe[e.direction]]
|
|
424
|
+
})
|
|
425
|
+
}),
|
|
426
|
+
/* @__PURE__ */ b("td", {
|
|
427
|
+
className: "whitespace-nowrap px-4 py-3 align-top text-text-secondary",
|
|
428
|
+
children: Se[e.periodicity]
|
|
429
|
+
}),
|
|
430
|
+
/* @__PURE__ */ b("td", {
|
|
431
|
+
className: "whitespace-nowrap px-4 py-3 align-top",
|
|
432
|
+
children: e.isCore ? /* @__PURE__ */ x("span", {
|
|
433
|
+
className: "inline-flex items-center gap-1.5 rounded-full bg-[var(--color-accent-soft)] px-2.5 py-0.5 text-xs font-medium text-action-primary-text",
|
|
434
|
+
children: [/* @__PURE__ */ b(ue, {
|
|
435
|
+
className: "size-3.5",
|
|
436
|
+
"aria-hidden": "true"
|
|
437
|
+
}), " Core"]
|
|
438
|
+
}) : /* @__PURE__ */ b("span", {
|
|
439
|
+
className: "text-text-muted",
|
|
440
|
+
children: "—"
|
|
441
|
+
})
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ b("td", {
|
|
444
|
+
className: "whitespace-nowrap px-4 py-3 text-right align-top text-text-secondary tabular-nums",
|
|
445
|
+
children: r(e.weight)
|
|
446
|
+
}),
|
|
447
|
+
/* @__PURE__ */ b("td", {
|
|
448
|
+
className: "whitespace-nowrap px-4 py-3 text-right align-top text-text-secondary tabular-nums",
|
|
449
|
+
children: e.sdgGoal == null ? "—" : e.sdgGoal
|
|
450
|
+
}),
|
|
451
|
+
/* @__PURE__ */ b("td", {
|
|
452
|
+
className: "whitespace-nowrap px-4 py-3 text-right align-top text-text-secondary tabular-nums",
|
|
453
|
+
children: e.minValue == null && e.maxValue == null ? "—" : `${e.minValue == null ? "—" : r(e.minValue)} / ${e.maxValue == null ? "—" : r(e.maxValue)}`
|
|
454
|
+
}),
|
|
455
|
+
/* @__PURE__ */ b("td", {
|
|
456
|
+
className: "whitespace-nowrap px-4 py-3 align-top",
|
|
457
|
+
children: e.isActive ? /* @__PURE__ */ b("span", {
|
|
458
|
+
className: "inline-flex items-center rounded-full bg-status-success-bg-subtle px-2.5 py-0.5 text-xs font-medium text-status-success-text",
|
|
459
|
+
children: "Active"
|
|
460
|
+
}) : /* @__PURE__ */ b("span", {
|
|
461
|
+
className: "inline-flex items-center rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
|
|
462
|
+
children: "Inactive"
|
|
463
|
+
})
|
|
464
|
+
}),
|
|
465
|
+
/* @__PURE__ */ b("td", {
|
|
466
|
+
className: "whitespace-nowrap px-4 py-3 align-top",
|
|
467
|
+
children: /* @__PURE__ */ x("div", {
|
|
468
|
+
className: "flex justify-end gap-1.5",
|
|
469
|
+
children: [/* @__PURE__ */ b(S, {
|
|
470
|
+
variant: "outline",
|
|
471
|
+
size: "sm",
|
|
472
|
+
"aria-label": `Edit ${e.code}`,
|
|
473
|
+
onClick: () => {
|
|
474
|
+
V(e), z(!0);
|
|
475
|
+
},
|
|
476
|
+
children: /* @__PURE__ */ b(se, {
|
|
477
|
+
className: "h-4 w-4",
|
|
478
|
+
"aria-hidden": "true"
|
|
479
|
+
})
|
|
480
|
+
}), /* @__PURE__ */ b(S, {
|
|
481
|
+
variant: "outline",
|
|
482
|
+
size: "sm",
|
|
483
|
+
"aria-label": `Delete ${e.code}`,
|
|
484
|
+
onClick: () => {
|
|
485
|
+
q(null), G(e);
|
|
486
|
+
},
|
|
487
|
+
disabled: Ae.isPending,
|
|
488
|
+
children: /* @__PURE__ */ b(de, {
|
|
489
|
+
className: "h-4 w-4",
|
|
490
|
+
"aria-hidden": "true"
|
|
491
|
+
})
|
|
492
|
+
})]
|
|
493
|
+
})
|
|
494
|
+
})
|
|
495
|
+
]
|
|
496
|
+
}, e.id))
|
|
497
|
+
})]
|
|
498
|
+
})
|
|
499
|
+
})
|
|
500
|
+
}), /* @__PURE__ */ b(ie, {
|
|
501
|
+
page: h.page,
|
|
502
|
+
pageSize: N,
|
|
503
|
+
itemCount: je.length,
|
|
504
|
+
hasMore: X?.pageInfo.hasMore ?? !1,
|
|
505
|
+
onPageChange: (e) => h.onPageChange(e, X?.pageInfo.cursor)
|
|
506
|
+
})] }),
|
|
507
|
+
we && /* @__PURE__ */ b(pe, {
|
|
508
|
+
open: !0,
|
|
509
|
+
onOpenChange: (e) => {
|
|
510
|
+
!e && !Q.isPending && J(!1);
|
|
511
|
+
},
|
|
512
|
+
children: /* @__PURE__ */ x(me, {
|
|
513
|
+
className: "sm:max-w-lg",
|
|
514
|
+
children: [
|
|
515
|
+
/* @__PURE__ */ x(_e, { children: [/* @__PURE__ */ b(ve, { children: "Seed the standard catalogue" }), /* @__PURE__ */ b(he, { children: "Adds the country-neutral standard indicator definitions. It is additive and idempotent — an indicator whose code already exists is left exactly as it is, so nothing you have edited gets overwritten." })] }),
|
|
516
|
+
/* @__PURE__ */ x("div", {
|
|
517
|
+
className: "py-2",
|
|
518
|
+
children: [
|
|
519
|
+
/* @__PURE__ */ b("p", {
|
|
520
|
+
className: "mb-2 text-sm text-text-secondary",
|
|
521
|
+
children: "Pick the domains to seed, or leave them all unselected to seed every domain."
|
|
522
|
+
}),
|
|
523
|
+
/* @__PURE__ */ b("div", {
|
|
524
|
+
className: "flex flex-wrap gap-2",
|
|
525
|
+
children: F.map((e) => {
|
|
526
|
+
let n = Y.includes(e);
|
|
527
|
+
return /* @__PURE__ */ b("button", {
|
|
528
|
+
type: "button",
|
|
529
|
+
onClick: () => Fe(e),
|
|
530
|
+
"aria-pressed": n,
|
|
531
|
+
className: t("rounded-full border px-3 py-1.5 text-sm font-medium transition-colors", n ? "border-transparent bg-action-primary-bg text-action-primary-text" : "border-border-seam bg-bg-surface text-text-secondary hover:bg-bg-sunken hover:text-text-primary"),
|
|
532
|
+
children: d[e]
|
|
533
|
+
}, e);
|
|
534
|
+
})
|
|
535
|
+
}),
|
|
536
|
+
/* @__PURE__ */ x("p", {
|
|
537
|
+
className: "mt-3 text-xs text-text-muted",
|
|
538
|
+
children: ["Seeding: ", Le]
|
|
539
|
+
})
|
|
540
|
+
]
|
|
541
|
+
}),
|
|
542
|
+
/* @__PURE__ */ x(ge, { children: [/* @__PURE__ */ b(S, {
|
|
543
|
+
variant: "outline",
|
|
544
|
+
onClick: () => J(!1),
|
|
545
|
+
disabled: Q.isPending,
|
|
546
|
+
children: "Cancel"
|
|
547
|
+
}), /* @__PURE__ */ b(S, {
|
|
548
|
+
onClick: () => {
|
|
549
|
+
Ie();
|
|
550
|
+
},
|
|
551
|
+
disabled: Q.isPending,
|
|
552
|
+
children: Q.isPending ? "Seeding…" : "Seed catalogue"
|
|
553
|
+
})] })
|
|
554
|
+
]
|
|
555
|
+
})
|
|
556
|
+
}),
|
|
557
|
+
Ce && /* @__PURE__ */ b(W, {
|
|
558
|
+
indicator: B,
|
|
559
|
+
busy: ke.isPending || Z.isPending,
|
|
560
|
+
onClose: () => z(!1),
|
|
561
|
+
onSubmit: async (e) => {
|
|
562
|
+
if (B) {
|
|
563
|
+
let t = await Z.mutateAsync({
|
|
564
|
+
id: B.id,
|
|
565
|
+
input: {
|
|
566
|
+
name: e.name,
|
|
567
|
+
description: e.description,
|
|
568
|
+
domain: e.domain,
|
|
569
|
+
unit: e.unit,
|
|
570
|
+
valueType: e.valueType,
|
|
571
|
+
direction: e.direction,
|
|
572
|
+
periodicity: e.periodicity,
|
|
573
|
+
methodology: e.methodology,
|
|
574
|
+
targetValue: e.targetValue,
|
|
575
|
+
minValue: e.minValue,
|
|
576
|
+
maxValue: e.maxValue,
|
|
577
|
+
isCore: e.isCore,
|
|
578
|
+
weight: e.weight,
|
|
579
|
+
isActive: e.isActive,
|
|
580
|
+
sdgGoal: e.sdgGoal,
|
|
581
|
+
sourceName: e.sourceName,
|
|
582
|
+
sourceUrl: e.sourceUrl
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
u.success("Indicator updated", t.code);
|
|
586
|
+
} else {
|
|
587
|
+
let t = await ke.mutateAsync({
|
|
588
|
+
code: e.code,
|
|
589
|
+
name: e.name,
|
|
590
|
+
description: e.description,
|
|
591
|
+
domain: e.domain,
|
|
592
|
+
unit: e.unit,
|
|
593
|
+
valueType: e.valueType,
|
|
594
|
+
direction: e.direction,
|
|
595
|
+
periodicity: e.periodicity,
|
|
596
|
+
methodology: e.methodology,
|
|
597
|
+
targetValue: e.targetValue,
|
|
598
|
+
minValue: e.minValue,
|
|
599
|
+
maxValue: e.maxValue,
|
|
600
|
+
isCore: e.isCore,
|
|
601
|
+
weight: e.weight,
|
|
602
|
+
isActive: e.isActive,
|
|
603
|
+
sdgGoal: e.sdgGoal,
|
|
604
|
+
sourceName: e.sourceName,
|
|
605
|
+
sourceUrl: e.sourceUrl
|
|
606
|
+
});
|
|
607
|
+
u.success("Indicator created", t.code);
|
|
608
|
+
}
|
|
609
|
+
z(!1);
|
|
610
|
+
}
|
|
611
|
+
}, B?.id ?? "new-indicator"),
|
|
612
|
+
U && /* @__PURE__ */ b(ae, {
|
|
613
|
+
open: !0,
|
|
614
|
+
onOpenChange: (e) => {
|
|
615
|
+
e || G(null);
|
|
616
|
+
},
|
|
617
|
+
title: `Delete “${U.code}”?`,
|
|
618
|
+
description: "If this indicator already has recorded values the platform will refuse — deactivate it instead, which keeps the history and stops it counting toward scorecards.",
|
|
619
|
+
confirmLabel: "Delete indicator",
|
|
620
|
+
destructive: !0,
|
|
621
|
+
onConfirm: Ne
|
|
622
|
+
})
|
|
623
|
+
]
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
var W = ({ indicator: e, busy: t, onClose: n, onSubmit: r }) => {
|
|
627
|
+
let [i, ee] = p(e?.code ?? ""), [a, te] = p(e?.name ?? ""), [o, ne] = p(e?.description ?? ""), [s, re] = p(e?.domain ?? "GOVERNANCE"), [c, ie] = p(e?.unit ?? ""), [u, ae] = p(e?.valueType ?? "NUMBER"), [f, oe] = p(e?.direction ?? "HIGHER_IS_BETTER"), [m, h] = p(e?.periodicity ?? "ANNUAL"), [g, _] = p(e?.methodology ?? ""), [se, ce] = p(e?.targetValue == null ? "" : String(e.targetValue)), [v, le] = p(e?.minValue == null ? "" : String(e.minValue)), [ue, de] = p(e?.maxValue == null ? "" : String(e.maxValue)), [y, fe] = p(e?.isCore ?? !1), [C, ye] = p(String(e?.weight ?? 1)), [N, P] = p(e?.isActive ?? !0), [H, U] = p(e?.sdgGoal == null ? z : String(e.sdgGoal)), [W, G] = p(e?.sourceName ?? ""), [K, q] = p(e?.sourceUrl ?? ""), [we, J] = p(null), Y = B(C), Te = (!!e || !!i.trim()) && !!a.trim() && !!c.trim() && Y != null && Y > 0, X = async () => {
|
|
628
|
+
if (!(!Te || Y == null)) {
|
|
629
|
+
J(null);
|
|
630
|
+
try {
|
|
631
|
+
await r({
|
|
632
|
+
code: i.trim(),
|
|
633
|
+
name: a.trim(),
|
|
634
|
+
description: V(o),
|
|
635
|
+
domain: s,
|
|
636
|
+
unit: c.trim(),
|
|
637
|
+
valueType: u,
|
|
638
|
+
direction: f,
|
|
639
|
+
periodicity: m,
|
|
640
|
+
methodology: V(g),
|
|
641
|
+
targetValue: B(se),
|
|
642
|
+
minValue: B(v),
|
|
643
|
+
maxValue: B(ue),
|
|
644
|
+
isCore: y,
|
|
645
|
+
weight: Y,
|
|
646
|
+
isActive: N,
|
|
647
|
+
sdgGoal: H === z ? null : Number(H),
|
|
648
|
+
sourceName: V(W),
|
|
649
|
+
sourceUrl: V(K)
|
|
650
|
+
});
|
|
651
|
+
} catch (e) {
|
|
652
|
+
J(l(e));
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
return /* @__PURE__ */ b(pe, {
|
|
657
|
+
open: !0,
|
|
658
|
+
onOpenChange: (e) => {
|
|
659
|
+
!e && !t && n();
|
|
660
|
+
},
|
|
661
|
+
children: /* @__PURE__ */ x(me, {
|
|
662
|
+
className: "sm:max-w-2xl",
|
|
663
|
+
children: [
|
|
664
|
+
/* @__PURE__ */ x(_e, { children: [/* @__PURE__ */ b(ve, { children: e ? `Edit ${e.code}` : "New indicator definition" }), /* @__PURE__ */ b(he, { children: "The definition of a measurable civic KPI. Values are recorded against it per jurisdiction and period." })] }),
|
|
665
|
+
/* @__PURE__ */ x("div", {
|
|
666
|
+
className: "grid max-h-[60vh] gap-4 overflow-y-auto py-2 sm:grid-cols-2",
|
|
667
|
+
children: [
|
|
668
|
+
!e && /* @__PURE__ */ x("div", {
|
|
669
|
+
className: "grid gap-1.5",
|
|
670
|
+
children: [/* @__PURE__ */ b(T, {
|
|
671
|
+
htmlFor: "indicator-code",
|
|
672
|
+
children: "Code"
|
|
673
|
+
}), /* @__PURE__ */ b(w, {
|
|
674
|
+
id: "indicator-code",
|
|
675
|
+
value: i,
|
|
676
|
+
onChange: (e) => ee(e.target.value.toUpperCase()),
|
|
677
|
+
placeholder: "Dotted, stable and unique — e.g. EDU.LITERACY.RATE"
|
|
678
|
+
})]
|
|
679
|
+
}),
|
|
680
|
+
/* @__PURE__ */ x("div", {
|
|
681
|
+
className: e ? "grid gap-1.5 sm:col-span-2" : "grid gap-1.5",
|
|
682
|
+
children: [/* @__PURE__ */ b(T, {
|
|
683
|
+
htmlFor: "indicator-name",
|
|
684
|
+
children: "Name"
|
|
685
|
+
}), /* @__PURE__ */ b(w, {
|
|
686
|
+
id: "indicator-name",
|
|
687
|
+
value: a,
|
|
688
|
+
onChange: (e) => te(e.target.value)
|
|
689
|
+
})]
|
|
690
|
+
}),
|
|
691
|
+
/* @__PURE__ */ x("div", {
|
|
692
|
+
className: "grid gap-1.5 sm:col-span-2",
|
|
693
|
+
children: [/* @__PURE__ */ b(T, {
|
|
694
|
+
htmlFor: "indicator-description",
|
|
695
|
+
children: "Description"
|
|
696
|
+
}), /* @__PURE__ */ b(M, {
|
|
697
|
+
id: "indicator-description",
|
|
698
|
+
value: o,
|
|
699
|
+
onChange: (e) => ne(e.target.value),
|
|
700
|
+
rows: 2
|
|
701
|
+
})]
|
|
702
|
+
}),
|
|
703
|
+
/* @__PURE__ */ x("div", {
|
|
704
|
+
className: "grid gap-1.5",
|
|
705
|
+
children: [/* @__PURE__ */ b(T, {
|
|
706
|
+
htmlFor: "indicator-form-domain",
|
|
707
|
+
children: "Domain"
|
|
708
|
+
}), /* @__PURE__ */ x(E, {
|
|
709
|
+
value: s,
|
|
710
|
+
onValueChange: (e) => re(e),
|
|
711
|
+
children: [/* @__PURE__ */ b(k, {
|
|
712
|
+
id: "indicator-form-domain",
|
|
713
|
+
children: /* @__PURE__ */ b(A, {})
|
|
714
|
+
}), /* @__PURE__ */ b(D, { children: F.map((e) => /* @__PURE__ */ b(O, {
|
|
715
|
+
value: e,
|
|
716
|
+
children: d[e]
|
|
717
|
+
}, e)) })]
|
|
718
|
+
})]
|
|
719
|
+
}),
|
|
720
|
+
/* @__PURE__ */ x("div", {
|
|
721
|
+
className: "grid gap-1.5",
|
|
722
|
+
children: [/* @__PURE__ */ b(T, {
|
|
723
|
+
htmlFor: "indicator-unit",
|
|
724
|
+
children: "Unit"
|
|
725
|
+
}), /* @__PURE__ */ b(w, {
|
|
726
|
+
id: "indicator-unit",
|
|
727
|
+
value: c,
|
|
728
|
+
onChange: (e) => ie(e.target.value),
|
|
729
|
+
placeholder: "e.g. %, per 1,000, days"
|
|
730
|
+
})]
|
|
731
|
+
}),
|
|
732
|
+
/* @__PURE__ */ x("div", {
|
|
733
|
+
className: "grid gap-1.5",
|
|
734
|
+
children: [/* @__PURE__ */ b(T, {
|
|
735
|
+
htmlFor: "indicator-value-type",
|
|
736
|
+
children: "Value type"
|
|
737
|
+
}), /* @__PURE__ */ x(E, {
|
|
738
|
+
value: u,
|
|
739
|
+
onValueChange: (e) => ae(e),
|
|
740
|
+
children: [/* @__PURE__ */ b(k, {
|
|
741
|
+
id: "indicator-value-type",
|
|
742
|
+
children: /* @__PURE__ */ b(A, {})
|
|
743
|
+
}), /* @__PURE__ */ b(D, { children: I.map((e) => /* @__PURE__ */ b(O, {
|
|
744
|
+
value: e,
|
|
745
|
+
children: be[e]
|
|
746
|
+
}, e)) })]
|
|
747
|
+
})]
|
|
748
|
+
}),
|
|
749
|
+
/* @__PURE__ */ x("div", {
|
|
750
|
+
className: "grid gap-1.5",
|
|
751
|
+
children: [/* @__PURE__ */ b(T, {
|
|
752
|
+
htmlFor: "indicator-direction",
|
|
753
|
+
children: "Direction"
|
|
754
|
+
}), /* @__PURE__ */ x(E, {
|
|
755
|
+
value: f,
|
|
756
|
+
onValueChange: (e) => oe(e),
|
|
757
|
+
children: [/* @__PURE__ */ b(k, {
|
|
758
|
+
id: "indicator-direction",
|
|
759
|
+
children: /* @__PURE__ */ b(A, {})
|
|
760
|
+
}), /* @__PURE__ */ b(D, { children: L.map((e) => /* @__PURE__ */ b(O, {
|
|
761
|
+
value: e,
|
|
762
|
+
children: xe[e]
|
|
763
|
+
}, e)) })]
|
|
764
|
+
})]
|
|
765
|
+
}),
|
|
766
|
+
/* @__PURE__ */ x("div", {
|
|
767
|
+
className: "grid gap-1.5",
|
|
768
|
+
children: [/* @__PURE__ */ b(T, {
|
|
769
|
+
htmlFor: "indicator-periodicity",
|
|
770
|
+
children: "Periodicity"
|
|
771
|
+
}), /* @__PURE__ */ x(E, {
|
|
772
|
+
value: m,
|
|
773
|
+
onValueChange: (e) => h(e),
|
|
774
|
+
children: [/* @__PURE__ */ b(k, {
|
|
775
|
+
id: "indicator-periodicity",
|
|
776
|
+
children: /* @__PURE__ */ b(A, {})
|
|
777
|
+
}), /* @__PURE__ */ b(D, { children: R.map((e) => /* @__PURE__ */ b(O, {
|
|
778
|
+
value: e,
|
|
779
|
+
children: Se[e]
|
|
780
|
+
}, e)) })]
|
|
781
|
+
})]
|
|
782
|
+
}),
|
|
783
|
+
/* @__PURE__ */ x("div", {
|
|
784
|
+
className: "grid gap-1.5",
|
|
785
|
+
children: [/* @__PURE__ */ b(T, {
|
|
786
|
+
htmlFor: "indicator-sdg",
|
|
787
|
+
children: "UN SDG goal"
|
|
788
|
+
}), /* @__PURE__ */ x(E, {
|
|
789
|
+
value: H,
|
|
790
|
+
onValueChange: U,
|
|
791
|
+
children: [/* @__PURE__ */ b(k, {
|
|
792
|
+
id: "indicator-sdg",
|
|
793
|
+
children: /* @__PURE__ */ b(A, {})
|
|
794
|
+
}), /* @__PURE__ */ x(D, { children: [/* @__PURE__ */ b(O, {
|
|
795
|
+
value: z,
|
|
796
|
+
children: "Not mapped"
|
|
797
|
+
}), Ce.map((e) => /* @__PURE__ */ x(O, {
|
|
798
|
+
value: String(e),
|
|
799
|
+
children: ["Goal ", e]
|
|
800
|
+
}, e))] })]
|
|
801
|
+
})]
|
|
802
|
+
}),
|
|
803
|
+
/* @__PURE__ */ x("div", {
|
|
804
|
+
className: "grid gap-1.5",
|
|
805
|
+
children: [/* @__PURE__ */ b(T, {
|
|
806
|
+
htmlFor: "indicator-target",
|
|
807
|
+
children: "Target value"
|
|
808
|
+
}), /* @__PURE__ */ b(w, {
|
|
809
|
+
id: "indicator-target",
|
|
810
|
+
type: "number",
|
|
811
|
+
step: "any",
|
|
812
|
+
value: se,
|
|
813
|
+
onChange: (e) => ce(e.target.value)
|
|
814
|
+
})]
|
|
815
|
+
}),
|
|
816
|
+
/* @__PURE__ */ x("div", {
|
|
817
|
+
className: "grid gap-1.5",
|
|
818
|
+
children: [/* @__PURE__ */ b(T, {
|
|
819
|
+
htmlFor: "indicator-min",
|
|
820
|
+
children: "Scoring minimum"
|
|
821
|
+
}), /* @__PURE__ */ b(w, {
|
|
822
|
+
id: "indicator-min",
|
|
823
|
+
type: "number",
|
|
824
|
+
step: "any",
|
|
825
|
+
value: v,
|
|
826
|
+
onChange: (e) => le(e.target.value)
|
|
827
|
+
})]
|
|
828
|
+
}),
|
|
829
|
+
/* @__PURE__ */ x("div", {
|
|
830
|
+
className: "grid gap-1.5",
|
|
831
|
+
children: [/* @__PURE__ */ b(T, {
|
|
832
|
+
htmlFor: "indicator-max",
|
|
833
|
+
children: "Scoring maximum"
|
|
834
|
+
}), /* @__PURE__ */ b(w, {
|
|
835
|
+
id: "indicator-max",
|
|
836
|
+
type: "number",
|
|
837
|
+
step: "any",
|
|
838
|
+
value: ue,
|
|
839
|
+
onChange: (e) => de(e.target.value)
|
|
840
|
+
})]
|
|
841
|
+
}),
|
|
842
|
+
/* @__PURE__ */ x("div", {
|
|
843
|
+
className: "grid gap-1.5",
|
|
844
|
+
children: [
|
|
845
|
+
/* @__PURE__ */ b(T, {
|
|
846
|
+
htmlFor: "indicator-weight",
|
|
847
|
+
children: "Weight"
|
|
848
|
+
}),
|
|
849
|
+
/* @__PURE__ */ b(w, {
|
|
850
|
+
id: "indicator-weight",
|
|
851
|
+
type: "number",
|
|
852
|
+
min: "0",
|
|
853
|
+
step: "any",
|
|
854
|
+
value: C,
|
|
855
|
+
onChange: (e) => ye(e.target.value)
|
|
856
|
+
}),
|
|
857
|
+
(Y == null || Y <= 0) && /* @__PURE__ */ b("p", {
|
|
858
|
+
className: "text-xs text-status-error-text",
|
|
859
|
+
children: "Weight must be greater than zero."
|
|
860
|
+
})
|
|
861
|
+
]
|
|
862
|
+
}),
|
|
863
|
+
/* @__PURE__ */ x("div", {
|
|
864
|
+
className: "grid gap-1.5 sm:col-span-2",
|
|
865
|
+
children: [/* @__PURE__ */ b(T, {
|
|
866
|
+
htmlFor: "indicator-methodology",
|
|
867
|
+
children: "Methodology"
|
|
868
|
+
}), /* @__PURE__ */ b(M, {
|
|
869
|
+
id: "indicator-methodology",
|
|
870
|
+
value: g,
|
|
871
|
+
onChange: (e) => _(e.target.value),
|
|
872
|
+
rows: 2,
|
|
873
|
+
placeholder: "How the figure is calculated, and from what"
|
|
874
|
+
})]
|
|
875
|
+
}),
|
|
876
|
+
/* @__PURE__ */ x("div", {
|
|
877
|
+
className: "grid gap-1.5",
|
|
878
|
+
children: [/* @__PURE__ */ b(T, {
|
|
879
|
+
htmlFor: "indicator-source-name",
|
|
880
|
+
children: "Source name"
|
|
881
|
+
}), /* @__PURE__ */ b(w, {
|
|
882
|
+
id: "indicator-source-name",
|
|
883
|
+
value: W,
|
|
884
|
+
onChange: (e) => G(e.target.value)
|
|
885
|
+
})]
|
|
886
|
+
}),
|
|
887
|
+
/* @__PURE__ */ x("div", {
|
|
888
|
+
className: "grid gap-1.5",
|
|
889
|
+
children: [/* @__PURE__ */ b(T, {
|
|
890
|
+
htmlFor: "indicator-source-url",
|
|
891
|
+
children: "Source URL"
|
|
892
|
+
}), /* @__PURE__ */ b(w, {
|
|
893
|
+
id: "indicator-source-url",
|
|
894
|
+
value: K,
|
|
895
|
+
onChange: (e) => q(e.target.value),
|
|
896
|
+
placeholder: "https://…"
|
|
897
|
+
})]
|
|
898
|
+
}),
|
|
899
|
+
/* @__PURE__ */ x("div", {
|
|
900
|
+
className: "flex items-center justify-between gap-3 rounded-lg border border-border-seam px-3 py-2.5",
|
|
901
|
+
children: [/* @__PURE__ */ x("div", {
|
|
902
|
+
className: "min-w-0",
|
|
903
|
+
children: [/* @__PURE__ */ b(T, {
|
|
904
|
+
htmlFor: "indicator-core",
|
|
905
|
+
children: "Core indicator"
|
|
906
|
+
}), /* @__PURE__ */ b("p", {
|
|
907
|
+
className: "mt-0.5 text-xs text-text-muted",
|
|
908
|
+
children: "Counts toward the composite scorecard."
|
|
909
|
+
})]
|
|
910
|
+
}), /* @__PURE__ */ b(j, {
|
|
911
|
+
id: "indicator-core",
|
|
912
|
+
checked: y,
|
|
913
|
+
onCheckedChange: fe,
|
|
914
|
+
"aria-label": "Core indicator"
|
|
915
|
+
})]
|
|
916
|
+
}),
|
|
917
|
+
/* @__PURE__ */ x("div", {
|
|
918
|
+
className: "flex items-center justify-between gap-3 rounded-lg border border-border-seam px-3 py-2.5",
|
|
919
|
+
children: [/* @__PURE__ */ x("div", {
|
|
920
|
+
className: "min-w-0",
|
|
921
|
+
children: [/* @__PURE__ */ b(T, {
|
|
922
|
+
htmlFor: "indicator-active",
|
|
923
|
+
children: "Active"
|
|
924
|
+
}), /* @__PURE__ */ b("p", {
|
|
925
|
+
className: "mt-0.5 text-xs text-text-muted",
|
|
926
|
+
children: "Inactive keeps the history but stops new scoring."
|
|
927
|
+
})]
|
|
928
|
+
}), /* @__PURE__ */ b(j, {
|
|
929
|
+
id: "indicator-active",
|
|
930
|
+
checked: N,
|
|
931
|
+
onCheckedChange: P,
|
|
932
|
+
"aria-label": "Active"
|
|
933
|
+
})]
|
|
934
|
+
}),
|
|
935
|
+
we && /* @__PURE__ */ b("p", {
|
|
936
|
+
className: "rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text sm:col-span-2",
|
|
937
|
+
children: we
|
|
938
|
+
})
|
|
939
|
+
]
|
|
940
|
+
}),
|
|
941
|
+
/* @__PURE__ */ x(ge, { children: [/* @__PURE__ */ b(S, {
|
|
942
|
+
variant: "outline",
|
|
943
|
+
onClick: n,
|
|
944
|
+
disabled: t,
|
|
945
|
+
children: "Cancel"
|
|
946
|
+
}), /* @__PURE__ */ b(S, {
|
|
947
|
+
onClick: () => {
|
|
948
|
+
X();
|
|
949
|
+
},
|
|
950
|
+
disabled: !Te || t,
|
|
951
|
+
children: t ? "Saving…" : e ? "Save changes" : "Create indicator"
|
|
952
|
+
})] })
|
|
953
|
+
]
|
|
954
|
+
})
|
|
955
|
+
});
|
|
956
|
+
};
|
|
957
|
+
//#endregion
|
|
958
|
+
export { U as IndicatorCatalogPage };
|
|
959
|
+
|
|
960
|
+
//# sourceMappingURL=IndicatorCatalogPage.js.map
|