@epcare/esm-report-builder 0.1.1-pre.13
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/.eslintignore +5 -0
- package/.eslintrc.js +19 -0
- package/.prettierrc +8 -0
- package/LICENSE +401 -0
- package/README.md +317 -0
- package/dist/184.js +2 -0
- package/dist/184.js.LICENSE.txt +14 -0
- package/dist/184.js.map +1 -0
- package/dist/211.js +1 -0
- package/dist/211.js.map +1 -0
- package/dist/300.js +1 -0
- package/dist/311.js +1 -0
- package/dist/311.js.map +1 -0
- package/dist/44.js +2 -0
- package/dist/44.js.LICENSE.txt +30 -0
- package/dist/44.js.map +1 -0
- package/dist/478.js +2 -0
- package/dist/478.js.LICENSE.txt +9 -0
- package/dist/478.js.map +1 -0
- package/dist/535.js +1 -0
- package/dist/535.js.map +1 -0
- package/dist/540.js +2 -0
- package/dist/540.js.LICENSE.txt +9 -0
- package/dist/540.js.map +1 -0
- package/dist/710.js +1 -0
- package/dist/710.js.map +1 -0
- package/dist/729.js +1 -0
- package/dist/729.js.map +1 -0
- package/dist/872.js +1 -0
- package/dist/872.js.map +1 -0
- package/dist/917.js +1 -0
- package/dist/917.js.map +1 -0
- package/dist/961.js +2 -0
- package/dist/961.js.LICENSE.txt +19 -0
- package/dist/961.js.map +1 -0
- package/dist/972.js +2 -0
- package/dist/972.js.LICENSE.txt +21 -0
- package/dist/972.js.map +1 -0
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-report-builder.js +1 -0
- package/dist/openmrs-esm-report-builder.js.buildmanifest.json +482 -0
- package/dist/openmrs-esm-report-builder.js.map +1 -0
- package/dist/routes.json +1 -0
- package/e2e/core/env.ts +5 -0
- package/e2e/core/global-setup.ts +34 -0
- package/e2e/core/test.ts +21 -0
- package/e2e/pages/app-shell.page.ts +34 -0
- package/e2e/pages/etl-sources.page.ts +35 -0
- package/e2e/pages/report-sections.page.ts +20 -0
- package/e2e/pages/section-preview.modal.ts +29 -0
- package/e2e/specs/etl-sources.spec.ts +51 -0
- package/e2e/specs/navigation.spec.ts +13 -0
- package/e2e/specs/section-preview-validation.spec.ts +38 -0
- package/e2e/specs/section-preview.spec.ts +94 -0
- package/e2e/tsconfig.json +11 -0
- package/example.env +5 -0
- package/jest.config.js +28 -0
- package/package.json +102 -0
- package/playwright.config.ts +28 -0
- package/src/admin-card-link.extension.module.scss +55 -0
- package/src/admin-card-link.extension.tsx +24 -0
- package/src/components/admin/admin-page.component.tsx +31 -0
- package/src/components/admin/age-categories-page.component.tsx +109 -0
- package/src/components/admin/age-groups-page.component.tsx +146 -0
- package/src/components/admin/etl-sources-page.component.tsx +344 -0
- package/src/components/admin/report-categories-page.component.tsx +256 -0
- package/src/components/admin/report-library-page.component.tsx +540 -0
- package/src/components/ai-support/ai-assist-button.component.tsx +30 -0
- package/src/components/ai-support/ai-assist-modal.component.tsx +81 -0
- package/src/components/ai-support/ai.service.ts +21 -0
- package/src/components/ai-support/ai.types.ts +12 -0
- package/src/components/app-shell/report-builder-shell.component.tsx +120 -0
- package/src/components/app-shell/report-builder-shell.scss +15 -0
- package/src/components/data-themes/data-theme-form.component.tsx +59 -0
- package/src/components/data-themes/data-theme-modal.component.tsx +349 -0
- package/src/components/data-themes/data-themes-page.component.tsx +132 -0
- package/src/components/data-themes/data-themes-table.component.tsx +91 -0
- package/src/components/data-themes/icon-registry.ts +35 -0
- package/src/components/data-themes/sections/data-theme-basics.section.tsx +63 -0
- package/src/components/data-themes/sections/data-theme-condition-columns.section.tsx +397 -0
- package/src/components/data-themes/sections/data-theme-fields-editor.section.tsx +125 -0
- package/src/components/data-themes/sections/data-theme-metadata.section.tsx +245 -0
- package/src/components/data-themes/sections/data-theme-preview.section.tsx +115 -0
- package/src/components/data-themes/sections/data-theme-source.section.tsx +184 -0
- package/src/components/indicators/README.md +24 -0
- package/src/components/indicators/base-indicator-basic-fields.component.tsx +18 -0
- package/src/components/indicators/base-indicator-basics.section.tsx +54 -0
- package/src/components/indicators/base-indicator-countby.section.tsx +25 -0
- package/src/components/indicators/base-indicator-criteria.section.tsx +83 -0
- package/src/components/indicators/base-indicator-details-form.component.tsx +80 -0
- package/src/components/indicators/base-indicator-theme-unit-fields.component.tsx +39 -0
- package/src/components/indicators/create-base-indicator-modal.component.tsx +501 -0
- package/src/components/indicators/create-composite-base-indicator-modal.component.tsx +297 -0
- package/src/components/indicators/create-final-indicator-modal.component.tsx +260 -0
- package/src/components/indicators/diagnosis-filters-form.component.tsx +101 -0
- package/src/components/indicators/disaggregation-panel.component.tsx +93 -0
- package/src/components/indicators/handler/concept-search-multiselect.component.tsx +153 -0
- package/src/components/indicators/handler/question-answer-concept-search.component.tsx +336 -0
- package/src/components/indicators/indicator-status-tag.component.tsx +9 -0
- package/src/components/indicators/indicators-page.component.tsx +481 -0
- package/src/components/indicators/indicators-page.scss +121 -0
- package/src/components/indicators/indicators-table.component.tsx +166 -0
- package/src/components/indicators/preview-table.component.tsx +31 -0
- package/src/components/indicators/sections/composite-indicator-basics.section.tsx +36 -0
- package/src/components/indicators/sections/composite-indicator-picker.section.tsx +161 -0
- package/src/components/indicators/sections/composite-indicator-sql-preview.section.tsx +31 -0
- package/src/components/indicators/sections/final-indicator-basics.section.tsx +46 -0
- package/src/components/indicators/sections/final-indicator-disaggregation.section.tsx +47 -0
- package/src/components/indicators/sections/final-indicator-picker.section.tsx +92 -0
- package/src/components/indicators/sections/final-indicator-preview.section.tsx +20 -0
- package/src/components/indicators/sections/final-indicator-results-preview.section.tsx +65 -0
- package/src/components/indicators/sections/indicator-basics.section.tsx +40 -0
- package/src/components/indicators/sections/indicator-conditions.section.tsx +194 -0
- package/src/components/indicators/sections/indicator-sql-preview.section.tsx +26 -0
- package/src/components/indicators/sections/indicator-theme.section.tsx +48 -0
- package/src/components/indicators/sql-preview.component.tsx +19 -0
- package/src/components/indicators/types/base-indicator-form.types.ts +17 -0
- package/src/components/indicators/types/base-indicator-theme.constants.ts +8 -0
- package/src/components/indicators/types/composite-indicator.types.ts +21 -0
- package/src/components/indicators/types/condition-ui.types.ts +11 -0
- package/src/components/indicators/types/data-theme-config.types.ts +88 -0
- package/src/components/indicators/types/indicator-types.ts +56 -0
- package/src/components/indicators/types/sql-builders.ts +43 -0
- package/src/components/indicators/utils/composite-indicator-sql.utils.ts +206 -0
- package/src/components/indicators/utils/concept-preload.utils.ts +21 -0
- package/src/components/indicators/utils/final-indicator-sql.utils.ts +124 -0
- package/src/components/indicators/utils/indicator-conditions-hydration.utils.ts +254 -0
- package/src/components/indicators/utils/indicator-sql.utils.ts +185 -0
- package/src/components/landing/landing-action-item.component.tsx +50 -0
- package/src/components/landing/landing-action-list.component.tsx +12 -0
- package/src/components/landing/landing-activity-list.component.tsx +47 -0
- package/src/components/landing/landing-footer-grid.component.tsx +45 -0
- package/src/components/landing/landing-hero.component.tsx +18 -0
- package/src/components/landing/landing-section-card.component.tsx +33 -0
- package/src/components/landing/report-builder-landing-page.component.tsx +103 -0
- package/src/components/landing/report-builder-landing-page.scss +131 -0
- package/src/components/report/dashboard/reports-table.component.tsx +145 -0
- package/src/components/report/definition/panels/properties-panel.component.tsx +38 -0
- package/src/components/report/definition/panels/report-structure-panel.component.tsx +61 -0
- package/src/components/report/definition/panels/selection-panel.component.tsx +58 -0
- package/src/components/report/definition/report-definition-editor.component.tsx +99 -0
- package/src/components/report/definition/report-definition.types.ts +66 -0
- package/src/components/report/design/panels/IndicatorPropertiesPanel.scss +33 -0
- package/src/components/report/design/panels/IndicatorPropertiesPanel.tsx +389 -0
- package/src/components/report/design/panels/JsonPreviewPanel.scss +32 -0
- package/src/components/report/design/panels/JsonPreviewPanel.tsx +104 -0
- package/src/components/report/design/panels/mapping-preview-panel.component.tsx +82 -0
- package/src/components/report/design/panels/mapping-preview-panel.scss +55 -0
- package/src/components/report/design/panels/template-structure-panel.component.tsx +296 -0
- package/src/components/report/design/panels/template-structure-panel.scss +81 -0
- package/src/components/report/design/report-design-editor.component.tsx +894 -0
- package/src/components/report/design/report-design.types.ts +43 -0
- package/src/components/report/design/report-design.utils.ts +86 -0
- package/src/components/report/panels/report-detail.component.tsx +71 -0
- package/src/components/report/panels/report-panel-shell.component.tsx +60 -0
- package/src/components/report/report-dashboard.page.component.tsx +75 -0
- package/src/components/report/report-editor.page.component.tsx +466 -0
- package/src/components/report/report.routes.tsx +30 -0
- package/src/components/report-sections/create-report-section-modal.component.tsx +278 -0
- package/src/components/report-sections/hooks/useAgeCategories.ts +25 -0
- package/src/components/report-sections/hooks/useSectionEditorState.ts +306 -0
- package/src/components/report-sections/panels/Dhis2MappingPanel.tsx +157 -0
- package/src/components/report-sections/panels/DisaggregationPanel.tsx +97 -0
- package/src/components/report-sections/panels/IndicatorPickerPanel.tsx +143 -0
- package/src/components/report-sections/panels/SectionBasicsPanel.tsx +27 -0
- package/src/components/report-sections/report-section-preview-modal.component.tsx +418 -0
- package/src/components/report-sections/report-sections-page.component.tsx +313 -0
- package/src/components/report-sections/section-types.ts +55 -0
- package/src/components/report-sections/section-utils.ts +46 -0
- package/src/components/report-sections/sections-page.scss +79 -0
- package/src/components/run-reports/run-reports-page.component.tsx +23 -0
- package/src/components/shared/header/builder-header-actions.component.tsx +38 -0
- package/src/components/shared/header/header.component.tsx +85 -0
- package/src/components/shared/header/header.scss +150 -0
- package/src/components/shared/header/illustration.component.tsx +34 -0
- package/src/components/shared/indicator-properties-panel/IndicatorPropertiesPanel.scss +33 -0
- package/src/components/shared/indicator-properties-panel/IndicatorPropertiesPanel.tsx +389 -0
- package/src/components/shared/json-preview-panel/JsonPreviewPanel.scss +32 -0
- package/src/components/shared/json-preview-panel/JsonPreviewPanel.tsx +104 -0
- package/src/components/shared/mapping-preview-panel/mapping-preview-panel.component.tsx +82 -0
- package/src/components/shared/mapping-preview-panel/mapping-preview-panel.scss +55 -0
- package/src/components/shared/preview/query-results-preview.component.tsx +204 -0
- package/src/components/shared/template-structure-panel/template-structure-panel.component.tsx +296 -0
- package/src/components/shared/template-structure-panel/template-structure-panel.scss +81 -0
- package/src/config-schema.ts +23 -0
- package/src/globals.d.ts +14 -0
- package/src/hooks/theme/useDataThemes.ts +28 -0
- package/src/hooks/theme/useMambaTableMeta.ts +34 -0
- package/src/hooks/theme/useMambaTables.ts +63 -0
- package/src/index.ts +23 -0
- package/src/resources/agegroup/agegroups.api.ts +58 -0
- package/src/resources/concepts/concept-mapper.ts +21 -0
- package/src/resources/concepts/concept-types.ts +31 -0
- package/src/resources/concepts/concepts.resource.ts +44 -0
- package/src/resources/concepts/useConceptSearch.ts +41 -0
- package/src/resources/etl-source/etl-source.api.ts +65 -0
- package/src/resources/indicator/indicators.api.ts +125 -0
- package/src/resources/openmrs-api.ts +24 -0
- package/src/resources/preview/sql-preview.api.ts +54 -0
- package/src/resources/report/reports.api.ts +117 -0
- package/src/resources/report-category/report-category.api.ts +41 -0
- package/src/resources/report-library/report-library.api.ts +63 -0
- package/src/resources/report-section/report-sections.api.ts +73 -0
- package/src/resources/report-section/section-preview.api.ts +21 -0
- package/src/resources/theme/data-theme.api.ts +88 -0
- package/src/resources/theme/mamba-schema.api.ts +31 -0
- package/src/resources/theme/mamba-table-meta.api.ts +45 -0
- package/src/root.component.tsx +20 -0
- package/src/routes/report-builder.routes.tsx +66 -0
- package/src/routes/report-builder.scss +56 -0
- package/src/routes.json +21 -0
- package/src/sample-template.ts +121 -0
- package/src/template-utils.ts +110 -0
- package/src/types/carbon-react-inert.d.ts +13 -0
- package/src/types/condition-operators.ts +49 -0
- package/src/types/theme/data-theme.types.ts +88 -0
- package/src/utils/html-entities.utils.ts +23 -0
- package/tools/setup-tests.ts +1 -0
- package/translations/en.json +4 -0
- package/tsconfig.json +43 -0
- package/webpack.config.js +14 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
DataTable,
|
|
5
|
+
DataTableHeader,
|
|
6
|
+
DataTableSkeleton,
|
|
7
|
+
Modal,
|
|
8
|
+
Search,
|
|
9
|
+
Stack,
|
|
10
|
+
TextArea,
|
|
11
|
+
TextInput,
|
|
12
|
+
Table,
|
|
13
|
+
TableBody,
|
|
14
|
+
TableCell,
|
|
15
|
+
TableContainer,
|
|
16
|
+
TableHead,
|
|
17
|
+
TableHeader,
|
|
18
|
+
TableRow,
|
|
19
|
+
Tag,
|
|
20
|
+
InlineNotification,
|
|
21
|
+
} from '@carbon/react';
|
|
22
|
+
import { Add, Edit, TrashCan } from '@carbon/icons-react';
|
|
23
|
+
import Header from '../shared/header/header.component';
|
|
24
|
+
import {
|
|
25
|
+
createReportCategory,
|
|
26
|
+
deleteReportCategory,
|
|
27
|
+
listReportCategories,
|
|
28
|
+
ReportCategoryDto,
|
|
29
|
+
updateReportCategory,
|
|
30
|
+
} from '../../resources/report-category/report-category.api';
|
|
31
|
+
|
|
32
|
+
type FormState = {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const headers: DataTableHeader[] = [
|
|
38
|
+
{ key: 'name', header: 'Name' },
|
|
39
|
+
{ key: 'description', header: 'Description' },
|
|
40
|
+
{ key: 'status', header: 'Status' },
|
|
41
|
+
{ key: 'actions', header: 'Actions' },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
const emptyForm: FormState = { name: '', description: '' };
|
|
45
|
+
|
|
46
|
+
const ReportCategoriesPage: React.FC = () => {
|
|
47
|
+
const [q, setQ] = React.useState('');
|
|
48
|
+
const [rows, setRows] = React.useState<ReportCategoryDto[]>([]);
|
|
49
|
+
const [loading, setLoading] = React.useState(false);
|
|
50
|
+
const [error, setError] = React.useState<string | null>(null);
|
|
51
|
+
|
|
52
|
+
const [open, setOpen] = React.useState(false);
|
|
53
|
+
const [mode, setMode] = React.useState<'create' | 'edit'>('create');
|
|
54
|
+
const [editing, setEditing] = React.useState<ReportCategoryDto | null>(null);
|
|
55
|
+
const [form, setForm] = React.useState<FormState>(emptyForm);
|
|
56
|
+
const [saving, setSaving] = React.useState(false);
|
|
57
|
+
|
|
58
|
+
const load = React.useCallback(async (signal?: AbortSignal) => {
|
|
59
|
+
setLoading(true);
|
|
60
|
+
setError(null);
|
|
61
|
+
try {
|
|
62
|
+
const data = await listReportCategories(q, signal);
|
|
63
|
+
setRows(data);
|
|
64
|
+
} catch (e: any) {
|
|
65
|
+
setError(e?.message ?? 'Failed to load report categories');
|
|
66
|
+
} finally {
|
|
67
|
+
setLoading(false);
|
|
68
|
+
}
|
|
69
|
+
}, [q]);
|
|
70
|
+
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
const ac = new AbortController();
|
|
73
|
+
load(ac.signal);
|
|
74
|
+
return () => ac.abort();
|
|
75
|
+
}, [load]);
|
|
76
|
+
|
|
77
|
+
const openCreate = () => {
|
|
78
|
+
setMode('create');
|
|
79
|
+
setEditing(null);
|
|
80
|
+
setForm(emptyForm);
|
|
81
|
+
setOpen(true);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const openEdit = (row: ReportCategoryDto) => {
|
|
85
|
+
setMode('edit');
|
|
86
|
+
setEditing(row);
|
|
87
|
+
setForm({
|
|
88
|
+
name: row.name ?? '',
|
|
89
|
+
description: row.description ?? '',
|
|
90
|
+
});
|
|
91
|
+
setOpen(true);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const onSave = async () => {
|
|
95
|
+
if (!form.name.trim()) return;
|
|
96
|
+
setSaving(true);
|
|
97
|
+
setError(null);
|
|
98
|
+
try {
|
|
99
|
+
const payload = {
|
|
100
|
+
name: form.name.trim(),
|
|
101
|
+
description: form.description.trim() || undefined,
|
|
102
|
+
};
|
|
103
|
+
if (mode === 'create') {
|
|
104
|
+
await createReportCategory(payload);
|
|
105
|
+
} else if (editing?.uuid) {
|
|
106
|
+
await updateReportCategory(editing.uuid, payload);
|
|
107
|
+
}
|
|
108
|
+
setOpen(false);
|
|
109
|
+
const ac = new AbortController();
|
|
110
|
+
await load(ac.signal);
|
|
111
|
+
} catch (e: any) {
|
|
112
|
+
setError(e?.message ?? 'Failed to save report category');
|
|
113
|
+
} finally {
|
|
114
|
+
setSaving(false);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const onDelete = async (row: ReportCategoryDto) => {
|
|
119
|
+
if (!row?.uuid) return;
|
|
120
|
+
const yes = window.confirm(`Retire report category "${row.name}"?`);
|
|
121
|
+
if (!yes) return;
|
|
122
|
+
try {
|
|
123
|
+
await deleteReportCategory(row.uuid);
|
|
124
|
+
const ac = new AbortController();
|
|
125
|
+
await load(ac.signal);
|
|
126
|
+
} catch (e: any) {
|
|
127
|
+
setError(e?.message ?? 'Failed to retire report category');
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const tableRows = rows.map((row) => ({
|
|
132
|
+
id: row.uuid,
|
|
133
|
+
name: row.name,
|
|
134
|
+
description: row.description || '—',
|
|
135
|
+
status: row.retired ? 'Retired' : 'Active',
|
|
136
|
+
actions: '',
|
|
137
|
+
}));
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<Stack gap={5}>
|
|
141
|
+
<Header
|
|
142
|
+
title="Report Categories"
|
|
143
|
+
subtitle="Manage shared categories used to classify reports across the builder."
|
|
144
|
+
actions={
|
|
145
|
+
<Button size="sm" renderIcon={Add} onClick={openCreate}>
|
|
146
|
+
New Category
|
|
147
|
+
</Button>
|
|
148
|
+
}
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<div style={{ padding: '0 1rem 1rem', display: 'grid', gap: '1rem' }}>
|
|
152
|
+
<Search
|
|
153
|
+
size="lg"
|
|
154
|
+
labelText="Search"
|
|
155
|
+
placeholder="Search report categories…"
|
|
156
|
+
value={q}
|
|
157
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setQ(e.target.value)}
|
|
158
|
+
/>
|
|
159
|
+
|
|
160
|
+
{error ? (
|
|
161
|
+
<InlineNotification lowContrast kind="error" title="Error" subtitle={error} />
|
|
162
|
+
) : null}
|
|
163
|
+
|
|
164
|
+
{loading ? (
|
|
165
|
+
<DataTableSkeleton rowCount={5} columnCount={4} showHeader={false} showToolbar={false} />
|
|
166
|
+
) : (
|
|
167
|
+
<DataTable rows={tableRows} headers={headers}>
|
|
168
|
+
{({ rows: dtRows, headers, getHeaderProps, getRowProps }) => (
|
|
169
|
+
<TableContainer>
|
|
170
|
+
<Table useZebraStyles>
|
|
171
|
+
<TableHead>
|
|
172
|
+
<TableRow>
|
|
173
|
+
{headers.map((header) => (
|
|
174
|
+
<TableHeader key={header.key} {...getHeaderProps({ header })}>
|
|
175
|
+
{header.header}
|
|
176
|
+
</TableHeader>
|
|
177
|
+
))}
|
|
178
|
+
</TableRow>
|
|
179
|
+
</TableHead>
|
|
180
|
+
<TableBody>
|
|
181
|
+
{dtRows.map((dtRow) => {
|
|
182
|
+
const source = rows.find((x) => x.uuid === dtRow.id);
|
|
183
|
+
return (
|
|
184
|
+
<TableRow key={dtRow.id} {...getRowProps({ row: dtRow })}>
|
|
185
|
+
<TableCell>{source?.name}</TableCell>
|
|
186
|
+
<TableCell>{source?.description || '—'}</TableCell>
|
|
187
|
+
<TableCell>
|
|
188
|
+
<Tag type={source?.retired ? 'gray' : 'green'}>{source?.retired ? 'Retired' : 'Active'}</Tag>
|
|
189
|
+
</TableCell>
|
|
190
|
+
<TableCell>
|
|
191
|
+
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
|
192
|
+
<Button
|
|
193
|
+
kind="ghost"
|
|
194
|
+
size="sm"
|
|
195
|
+
renderIcon={Edit}
|
|
196
|
+
iconDescription="Edit"
|
|
197
|
+
onClick={() => source && openEdit(source)}
|
|
198
|
+
>
|
|
199
|
+
Edit
|
|
200
|
+
</Button>
|
|
201
|
+
<Button
|
|
202
|
+
kind="ghost"
|
|
203
|
+
size="sm"
|
|
204
|
+
renderIcon={TrashCan}
|
|
205
|
+
iconDescription="Retire"
|
|
206
|
+
onClick={() => source && onDelete(source)}
|
|
207
|
+
>
|
|
208
|
+
Retire
|
|
209
|
+
</Button>
|
|
210
|
+
</div>
|
|
211
|
+
</TableCell>
|
|
212
|
+
</TableRow>
|
|
213
|
+
);
|
|
214
|
+
})}
|
|
215
|
+
</TableBody>
|
|
216
|
+
</Table>
|
|
217
|
+
</TableContainer>
|
|
218
|
+
)}
|
|
219
|
+
</DataTable>
|
|
220
|
+
)}
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
<Modal
|
|
224
|
+
open={open}
|
|
225
|
+
modalHeading={mode === 'create' ? 'Create Report Category' : 'Edit Report Category'}
|
|
226
|
+
primaryButtonText={saving ? 'Saving…' : mode === 'create' ? 'Create' : 'Save'}
|
|
227
|
+
secondaryButtonText="Cancel"
|
|
228
|
+
onRequestClose={() => !saving && setOpen(false)}
|
|
229
|
+
onRequestSubmit={onSave}
|
|
230
|
+
primaryButtonDisabled={saving || !form.name.trim()}
|
|
231
|
+
>
|
|
232
|
+
<Stack gap={5}>
|
|
233
|
+
<TextInput
|
|
234
|
+
id="report-category-name"
|
|
235
|
+
labelText="Name"
|
|
236
|
+
value={form.name}
|
|
237
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
238
|
+
setForm((prev) => ({ ...prev, name: e.target.value }))
|
|
239
|
+
}
|
|
240
|
+
/>
|
|
241
|
+
<TextArea
|
|
242
|
+
id="report-category-description"
|
|
243
|
+
labelText="Description"
|
|
244
|
+
rows={4}
|
|
245
|
+
value={form.description}
|
|
246
|
+
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) =>
|
|
247
|
+
setForm((prev) => ({ ...prev, description: e.target.value }))
|
|
248
|
+
}
|
|
249
|
+
/>
|
|
250
|
+
</Stack>
|
|
251
|
+
</Modal>
|
|
252
|
+
</Stack>
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export default ReportCategoriesPage;
|