@kenyaemr/esm-reports-app 5.4.4-pre.483
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/.turbo/turbo-build.log +7 -0
- package/dist/1072.js +1 -0
- package/dist/1072.js.map +1 -0
- package/dist/1148.js +1 -0
- package/dist/1148.js.map +1 -0
- package/dist/1278.js +1 -0
- package/dist/1278.js.map +1 -0
- package/dist/1442.js +1 -0
- package/dist/1442.js.map +1 -0
- package/dist/15.js +1 -0
- package/dist/15.js.map +1 -0
- package/dist/1620.js +1 -0
- package/dist/1620.js.map +1 -0
- package/dist/1789.js +1 -0
- package/dist/1789.js.map +1 -0
- package/dist/1831.js +1 -0
- package/dist/1831.js.map +1 -0
- package/dist/1844.js +1 -0
- package/dist/1844.js.map +1 -0
- package/dist/1854.js +1 -0
- package/dist/1854.js.map +1 -0
- package/dist/1919.js +1 -0
- package/dist/1919.js.map +1 -0
- package/dist/1946.js +1 -0
- package/dist/1946.js.map +1 -0
- package/dist/2146.js +1 -0
- package/dist/2146.js.map +1 -0
- package/dist/2152.js +1 -0
- package/dist/2152.js.map +1 -0
- package/dist/2202.js +1 -0
- package/dist/2202.js.map +1 -0
- package/dist/2394.js +1 -0
- package/dist/2394.js.map +1 -0
- package/dist/2534.js +1 -0
- package/dist/2534.js.map +1 -0
- package/dist/2537.js +1 -0
- package/dist/2537.js.map +1 -0
- package/dist/2556.js +1 -0
- package/dist/2556.js.map +1 -0
- package/dist/2648.js +1 -0
- package/dist/2648.js.map +1 -0
- package/dist/2842.js +1 -0
- package/dist/2842.js.map +1 -0
- package/dist/2916.js +1 -0
- package/dist/2916.js.map +1 -0
- package/dist/2924.js +1 -0
- package/dist/2924.js.map +1 -0
- package/dist/2947.js +1 -0
- package/dist/2947.js.map +1 -0
- package/dist/3032.js +1 -0
- package/dist/3032.js.map +1 -0
- package/dist/310.js +1 -0
- package/dist/310.js.map +1 -0
- package/dist/3285.js +1 -0
- package/dist/3285.js.map +1 -0
- package/dist/3335.js +1 -0
- package/dist/3335.js.map +1 -0
- package/dist/335.js +1 -0
- package/dist/335.js.map +1 -0
- package/dist/3378.js +1 -0
- package/dist/3378.js.map +1 -0
- package/dist/3504.js +1 -0
- package/dist/3504.js.map +1 -0
- package/dist/356.js +1 -0
- package/dist/356.js.map +1 -0
- package/dist/3569.js +1 -0
- package/dist/3569.js.map +1 -0
- package/dist/3723.js +1 -0
- package/dist/3723.js.map +1 -0
- package/dist/3745.js +1 -0
- package/dist/3745.js.map +1 -0
- package/dist/3813.js +1 -0
- package/dist/3813.js.map +1 -0
- package/dist/393.js +6 -0
- package/dist/393.js.map +1 -0
- package/dist/3953.js +1 -0
- package/dist/3953.js.map +1 -0
- package/dist/3989.js +1 -0
- package/dist/3989.js.map +1 -0
- package/dist/3997.js +1 -0
- package/dist/3997.js.map +1 -0
- package/dist/4178.js +1 -0
- package/dist/4178.js.map +1 -0
- package/dist/4487.js +11 -0
- package/dist/4487.js.map +1 -0
- package/dist/4588.js +1 -0
- package/dist/4588.js.map +1 -0
- package/dist/4637.js +1 -0
- package/dist/4637.js.map +1 -0
- package/dist/466.js +1 -0
- package/dist/466.js.map +1 -0
- package/dist/4817.js +1 -0
- package/dist/4817.js.map +1 -0
- package/dist/4962.js +1 -0
- package/dist/4962.js.map +1 -0
- package/dist/500.js +1 -0
- package/dist/500.js.map +1 -0
- package/dist/5055.js +1 -0
- package/dist/5055.js.map +1 -0
- package/dist/5086.js +1 -0
- package/dist/5086.js.map +1 -0
- package/dist/510.js +1 -0
- package/dist/510.js.map +1 -0
- package/dist/5117.js +1 -0
- package/dist/5117.js.map +1 -0
- package/dist/5279.js +1 -0
- package/dist/5279.js.map +1 -0
- package/dist/5366.js +1 -0
- package/dist/5366.js.map +1 -0
- package/dist/5598.js +1 -0
- package/dist/5598.js.map +1 -0
- package/dist/5676.js +1 -0
- package/dist/5676.js.map +1 -0
- package/dist/5731.js +5 -0
- package/dist/5731.js.map +1 -0
- package/dist/5792.js +1 -0
- package/dist/5792.js.map +1 -0
- package/dist/5809.js +1 -0
- package/dist/5809.js.map +1 -0
- package/dist/5825.js +1 -0
- package/dist/5825.js.map +1 -0
- package/dist/5932.js +1 -0
- package/dist/5932.js.map +1 -0
- package/dist/5941.js +1 -0
- package/dist/5941.js.map +1 -0
- package/dist/5967.js +1 -0
- package/dist/5967.js.map +1 -0
- package/dist/6104.js +1 -0
- package/dist/6104.js.map +1 -0
- package/dist/6273.js +1 -0
- package/dist/6273.js.map +1 -0
- package/dist/6337.js +1 -0
- package/dist/6337.js.map +1 -0
- package/dist/6357.js +1 -0
- package/dist/6357.js.map +1 -0
- package/dist/6427.js +1 -0
- package/dist/6427.js.map +1 -0
- package/dist/6478.js +7 -0
- package/dist/6478.js.map +1 -0
- package/dist/6508.js +1 -0
- package/dist/6508.js.map +1 -0
- package/dist/6561.js +1 -0
- package/dist/6561.js.map +1 -0
- package/dist/6567.js +1 -0
- package/dist/6567.js.map +1 -0
- package/dist/6634.js +1 -0
- package/dist/6634.js.map +1 -0
- package/dist/689.js +1 -0
- package/dist/689.js.map +1 -0
- package/dist/6998.js +1 -0
- package/dist/6998.js.map +1 -0
- package/dist/7022.js +1 -0
- package/dist/7022.js.map +1 -0
- package/dist/7085.js +1 -0
- package/dist/7085.js.map +1 -0
- package/dist/7209.js +1 -0
- package/dist/7209.js.map +1 -0
- package/dist/7360.js +1 -0
- package/dist/7360.js.map +1 -0
- package/dist/740.js +1 -0
- package/dist/740.js.map +1 -0
- package/dist/7454.js +1 -0
- package/dist/7454.js.map +1 -0
- package/dist/7478.js +1 -0
- package/dist/7478.js.map +1 -0
- package/dist/7782.js +1 -0
- package/dist/7782.js.map +1 -0
- package/dist/781.js +1 -0
- package/dist/781.js.map +1 -0
- package/dist/8028.js +1 -0
- package/dist/8028.js.map +1 -0
- package/dist/8196.js +1 -0
- package/dist/8196.js.map +1 -0
- package/dist/820.js +1 -0
- package/dist/820.js.map +1 -0
- package/dist/8240.js +1 -0
- package/dist/8240.js.map +1 -0
- package/dist/8472.js +1 -0
- package/dist/8472.js.map +1 -0
- package/dist/8607.js +1 -0
- package/dist/8607.js.map +1 -0
- package/dist/8762.js +1 -0
- package/dist/8762.js.map +1 -0
- package/dist/8924.js +1 -0
- package/dist/8924.js.map +1 -0
- package/dist/9011.js +1 -0
- package/dist/9011.js.map +1 -0
- package/dist/9060.js +1 -0
- package/dist/9060.js.map +1 -0
- package/dist/9061.js +1 -0
- package/dist/9061.js.map +1 -0
- package/dist/9087.js +1 -0
- package/dist/9087.js.map +1 -0
- package/dist/9168.js +1 -0
- package/dist/9168.js.map +1 -0
- package/dist/9425.js +1 -0
- package/dist/9520.js +1 -0
- package/dist/9520.js.map +1 -0
- package/dist/9547.js +1 -0
- package/dist/9547.js.map +1 -0
- package/dist/9612.js +1 -0
- package/dist/9612.js.map +1 -0
- package/dist/9771.js +1 -0
- package/dist/9771.js.map +1 -0
- package/dist/9774.js +1 -0
- package/dist/9774.js.map +1 -0
- package/dist/9806.js +1 -0
- package/dist/9806.js.map +1 -0
- package/dist/9885.js +1 -0
- package/dist/9885.js.map +1 -0
- package/dist/992.js +1 -0
- package/dist/992.js.map +1 -0
- package/dist/kenyaemr-esm-reports-app.js +6 -0
- package/dist/kenyaemr-esm-reports-app.js.buildmanifest.json +2960 -0
- package/dist/kenyaemr-esm-reports-app.js.map +1 -0
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/package.json +49 -0
- package/rspack.config.js +1 -0
- package/src/components/group-reports.component.tsx +98 -0
- package/src/components/group-reports.scss +13 -0
- package/src/components/header/header.component.tsx +20 -0
- package/src/components/header/header.scss +5 -0
- package/src/components/report-download-menu/report-download-menu.component.tsx +71 -0
- package/src/components/report-history/report-history.component.tsx +334 -0
- package/src/components/report-history/report-history.scss +175 -0
- package/src/components/report-table/report-panel.component.tsx +20 -0
- package/src/components/report-table/report-table.component.tsx +162 -0
- package/src/components/report-table/report-table.scss +10 -0
- package/src/components/report-view/report-view.component.tsx +183 -0
- package/src/components/report-view/report-view.scss +111 -0
- package/src/components/utils.tsx +65 -0
- package/src/config-schema.ts +1 -0
- package/src/declarations.d.ts +2 -0
- package/src/hooks/useReportData.tsx +20 -0
- package/src/hooks/useReportDefinition.tsx +33 -0
- package/src/hooks/useReportRequests.tsx +26 -0
- package/src/hooks/useReports.tsx +30 -0
- package/src/index.ts +20 -0
- package/src/root.component.tsx +24 -0
- package/src/routes.json +40 -0
- package/src/types/index.ts +96 -0
- package/src/usePrintPreview.tsx +17 -0
- package/src/workspaces/report-request.workspace.scss +61 -0
- package/src/workspaces/report-request.workspaces.tsx +266 -0
- package/translations/am.json +49 -0
- package/translations/en.json +49 -0
- package/translations/fr.json +50 -0
- package/translations/sw.json +49 -0
- package/tsconfig.json +5 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use '@carbon/type';
|
|
4
|
+
|
|
5
|
+
.form {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
height: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.formContainer {
|
|
13
|
+
margin: layout.$spacing-05;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: layout.$spacing-05;
|
|
17
|
+
overflow-y: auto;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.reportName {
|
|
21
|
+
@include type.type-style('heading-03');
|
|
22
|
+
color: colors.$gray-100;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.reportDescription {
|
|
26
|
+
@include type.type-style('body-01');
|
|
27
|
+
color: colors.$gray-70;
|
|
28
|
+
margin-top: layout.$spacing-02;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.emptyState {
|
|
32
|
+
@include type.type-style('body-01');
|
|
33
|
+
color: colors.$gray-70;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.datePicker {
|
|
37
|
+
width: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.tablet {
|
|
41
|
+
padding: layout.$spacing-06 layout.$spacing-05;
|
|
42
|
+
background-color: colors.$white;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.desktop {
|
|
46
|
+
padding: 0;
|
|
47
|
+
|
|
48
|
+
& button {
|
|
49
|
+
max-width: 50% !important;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.buttonContainer {
|
|
54
|
+
max-width: 50%;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.inlineLoading {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: layout.$spacing-03;
|
|
61
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
ButtonSet,
|
|
7
|
+
Checkbox,
|
|
8
|
+
Form,
|
|
9
|
+
FormGroup,
|
|
10
|
+
InlineLoading,
|
|
11
|
+
NumberInput,
|
|
12
|
+
SkeletonText,
|
|
13
|
+
Stack,
|
|
14
|
+
TextInput,
|
|
15
|
+
} from '@carbon/react';
|
|
16
|
+
import classNames from 'classnames';
|
|
17
|
+
import {
|
|
18
|
+
ErrorState,
|
|
19
|
+
OpenmrsDatePicker,
|
|
20
|
+
ResponsiveWrapper,
|
|
21
|
+
Workspace2,
|
|
22
|
+
navigate,
|
|
23
|
+
showSnackbar,
|
|
24
|
+
useLayoutType,
|
|
25
|
+
type Workspace2DefinitionProps,
|
|
26
|
+
} from '@openmrs/esm-framework';
|
|
27
|
+
|
|
28
|
+
import styles from './report-request.workspace.scss';
|
|
29
|
+
import { requestReport, useReportDefinition } from '../hooks/useReportDefinition';
|
|
30
|
+
import { type ReportParameter, type ReportWithDefinition } from '../types';
|
|
31
|
+
|
|
32
|
+
type ReportRequestWorkspacesProps = {
|
|
33
|
+
reportUuid: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const isDateType = (type: string) => type === 'java.util.Date';
|
|
37
|
+
const isBooleanType = (type: string) => type === 'java.lang.Boolean';
|
|
38
|
+
const isNumberType = (type: string) => ['java.lang.Integer', 'java.lang.Long', 'java.lang.Double'].includes(type);
|
|
39
|
+
|
|
40
|
+
const humanizeName = (name: string) =>
|
|
41
|
+
name
|
|
42
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
43
|
+
.replace(/[_-]+/g, ' ')
|
|
44
|
+
.replace(/^./, (char) => char.toUpperCase())
|
|
45
|
+
.trim();
|
|
46
|
+
|
|
47
|
+
const formatDateParam = (date: Date) => {
|
|
48
|
+
const year = date.getFullYear();
|
|
49
|
+
const month = `${date.getMonth() + 1}`.padStart(2, '0');
|
|
50
|
+
const day = `${date.getDate()}`.padStart(2, '0');
|
|
51
|
+
return `${year}-${month}-${day}`;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const getDefaultValue = (parameter: ReportParameter) => {
|
|
55
|
+
if (isBooleanType(parameter.type)) {
|
|
56
|
+
return parameter.defaultValue === true || parameter.defaultValue === 'true';
|
|
57
|
+
}
|
|
58
|
+
if (isDateType(parameter.type)) {
|
|
59
|
+
return parameter.defaultValue ? new Date(parameter.defaultValue as string) : null;
|
|
60
|
+
}
|
|
61
|
+
return parameter.defaultValue ?? '-1';
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const serializeValue = (parameter: ReportParameter, value: unknown) => {
|
|
65
|
+
if (value === null || value === undefined) {
|
|
66
|
+
return '';
|
|
67
|
+
}
|
|
68
|
+
if (isDateType(parameter.type)) {
|
|
69
|
+
return value instanceof Date ? formatDateParam(value) : '';
|
|
70
|
+
}
|
|
71
|
+
if (isBooleanType(parameter.type)) {
|
|
72
|
+
return String(Boolean(value));
|
|
73
|
+
}
|
|
74
|
+
return String(value);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type ReportRequestFormProps = {
|
|
78
|
+
report: ReportWithDefinition;
|
|
79
|
+
parameters: Array<ReportParameter>;
|
|
80
|
+
closeWorkspace: Workspace2DefinitionProps<ReportRequestWorkspacesProps>['closeWorkspace'];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const ReportRequestForm: React.FC<ReportRequestFormProps> = ({ report, parameters, closeWorkspace }) => {
|
|
84
|
+
const { t } = useTranslation();
|
|
85
|
+
const isTablet = useLayoutType() === 'tablet';
|
|
86
|
+
|
|
87
|
+
const {
|
|
88
|
+
control,
|
|
89
|
+
handleSubmit,
|
|
90
|
+
formState: { isSubmitting, isDirty },
|
|
91
|
+
} = useForm<Record<string, unknown>>({
|
|
92
|
+
defaultValues: Object.fromEntries(parameters.map((parameter) => [parameter.name, getDefaultValue(parameter)])),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const onSubmit = async (data: Record<string, unknown>) => {
|
|
96
|
+
const payload = Object.fromEntries(
|
|
97
|
+
parameters.map((parameter) => [parameter.name, serializeValue(parameter, data[parameter.name])]),
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
await requestReport(report.uuid, payload);
|
|
102
|
+
showSnackbar({
|
|
103
|
+
title: t('reportQueued', 'Report queued'),
|
|
104
|
+
kind: 'success',
|
|
105
|
+
subtitle: t('reportQueuedSubtitle', '{{name}} has been queued for processing.', { name: report.name }),
|
|
106
|
+
});
|
|
107
|
+
closeWorkspace({ discardUnsavedChanges: true });
|
|
108
|
+
navigate({ to: `${(globalThis as any).spaBase}/reporting/report/${report.uuid}` });
|
|
109
|
+
} catch (error: any) {
|
|
110
|
+
showSnackbar({
|
|
111
|
+
title: t('reportRequestError', 'Error requesting report'),
|
|
112
|
+
kind: 'error',
|
|
113
|
+
isLowContrast: false,
|
|
114
|
+
subtitle:
|
|
115
|
+
error?.responseBody?.error?.message ?? error?.message ?? t('unknownError', 'An unknown error occurred'),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const renderField = (parameter: ReportParameter) => {
|
|
121
|
+
const labelText = parameter.label?.trim() || humanizeName(parameter.name);
|
|
122
|
+
const isRequired = parameter.defaultValue === null || parameter.defaultValue === undefined;
|
|
123
|
+
const requiredRule = isRequired
|
|
124
|
+
? { required: t('fieldRequired', '{{field}} is required', { field: labelText }) }
|
|
125
|
+
: {};
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Controller
|
|
129
|
+
key={parameter.name}
|
|
130
|
+
name={parameter.name}
|
|
131
|
+
control={control}
|
|
132
|
+
rules={isBooleanType(parameter.type) ? {} : requiredRule}
|
|
133
|
+
render={({ field, fieldState }) => {
|
|
134
|
+
if (isDateType(parameter.type)) {
|
|
135
|
+
return (
|
|
136
|
+
<OpenmrsDatePicker
|
|
137
|
+
id={`${parameter.name}Input`}
|
|
138
|
+
className={styles.datePicker}
|
|
139
|
+
labelText={labelText}
|
|
140
|
+
value={(field.value as Date) ?? undefined}
|
|
141
|
+
onChange={(date) => field.onChange(date ?? null)}
|
|
142
|
+
invalid={Boolean(fieldState.error)}
|
|
143
|
+
invalidText={fieldState.error?.message}
|
|
144
|
+
/>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (isBooleanType(parameter.type)) {
|
|
149
|
+
return (
|
|
150
|
+
<Checkbox
|
|
151
|
+
id={`${parameter.name}Input`}
|
|
152
|
+
labelText={labelText}
|
|
153
|
+
checked={Boolean(field.value)}
|
|
154
|
+
onChange={(_event, { checked }) => field.onChange(checked)}
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (isNumberType(parameter.type)) {
|
|
160
|
+
return (
|
|
161
|
+
<NumberInput
|
|
162
|
+
id={`${parameter.name}Input`}
|
|
163
|
+
label={labelText}
|
|
164
|
+
value={(field.value as number) ?? ''}
|
|
165
|
+
onChange={(_event, { value }) => field.onChange(value)}
|
|
166
|
+
invalid={Boolean(fieldState.error)}
|
|
167
|
+
invalidText={fieldState.error?.message}
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<TextInput
|
|
174
|
+
id={`${parameter.name}Input`}
|
|
175
|
+
labelText={labelText}
|
|
176
|
+
value={(field.value as string) ?? ''}
|
|
177
|
+
onChange={field.onChange}
|
|
178
|
+
invalid={Boolean(fieldState.error)}
|
|
179
|
+
invalidText={fieldState.error?.message}
|
|
180
|
+
helperText={t('parameterType', 'Parameter type: {{type}}', { type: parameter.type })}
|
|
181
|
+
/>
|
|
182
|
+
);
|
|
183
|
+
}}
|
|
184
|
+
/>
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<Form onSubmit={handleSubmit(onSubmit)} className={styles.form}>
|
|
190
|
+
<div className={styles.formContainer}>
|
|
191
|
+
<div>
|
|
192
|
+
<span className={styles.reportName}>{report.name}</span>
|
|
193
|
+
{report.description && <p className={styles.reportDescription}>{report.description}</p>}
|
|
194
|
+
</div>
|
|
195
|
+
<Stack gap={5}>
|
|
196
|
+
{parameters.length === 0 ? (
|
|
197
|
+
<p className={styles.emptyState}>
|
|
198
|
+
{t('noParameters', 'This report has no parameters. Submit to queue it for processing.')}
|
|
199
|
+
</p>
|
|
200
|
+
) : (
|
|
201
|
+
parameters.map((parameter) => (
|
|
202
|
+
<ResponsiveWrapper key={parameter.name}>
|
|
203
|
+
<FormGroup legendText="">{renderField(parameter)}</FormGroup>
|
|
204
|
+
</ResponsiveWrapper>
|
|
205
|
+
))
|
|
206
|
+
)}
|
|
207
|
+
</Stack>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<ButtonSet
|
|
211
|
+
className={classNames({
|
|
212
|
+
[styles.tablet]: isTablet,
|
|
213
|
+
[styles.desktop]: !isTablet,
|
|
214
|
+
})}>
|
|
215
|
+
<Button className={styles.buttonContainer} kind="secondary" onClick={() => closeWorkspace()}>
|
|
216
|
+
{t('cancel', 'Cancel')}
|
|
217
|
+
</Button>
|
|
218
|
+
<Button
|
|
219
|
+
className={styles.buttonContainer}
|
|
220
|
+
disabled={isSubmitting || (parameters.length > 0 && !isDirty)}
|
|
221
|
+
kind="primary"
|
|
222
|
+
type="submit">
|
|
223
|
+
{isSubmitting ? (
|
|
224
|
+
<span className={styles.inlineLoading}>
|
|
225
|
+
{t('submitting', 'Submitting...')}
|
|
226
|
+
<InlineLoading status="active" iconDescription="Loading" />
|
|
227
|
+
</span>
|
|
228
|
+
) : (
|
|
229
|
+
t('requestReport', 'Request report')
|
|
230
|
+
)}
|
|
231
|
+
</Button>
|
|
232
|
+
</ButtonSet>
|
|
233
|
+
</Form>
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const ReportRequestWorkspaces: React.FC<Workspace2DefinitionProps<ReportRequestWorkspacesProps>> = ({
|
|
238
|
+
closeWorkspace,
|
|
239
|
+
workspaceProps,
|
|
240
|
+
}) => {
|
|
241
|
+
const { t } = useTranslation();
|
|
242
|
+
const { report, parameters, isLoading, error } = useReportDefinition(workspaceProps?.reportUuid ?? '');
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<Workspace2 title={t('reportRequest', 'Report Request')} hasUnsavedChanges={false}>
|
|
246
|
+
{isLoading ? (
|
|
247
|
+
<div className={styles.formContainer}>
|
|
248
|
+
<SkeletonText heading width="60%" />
|
|
249
|
+
<SkeletonText paragraph lineCount={3} />
|
|
250
|
+
</div>
|
|
251
|
+
) : error ? (
|
|
252
|
+
<div className={styles.formContainer}>
|
|
253
|
+
<ErrorState error={error} headerTitle={t('reportRequest', 'Report Request')} />
|
|
254
|
+
</div>
|
|
255
|
+
) : report ? (
|
|
256
|
+
<ReportRequestForm report={report} parameters={parameters} closeWorkspace={closeWorkspace} />
|
|
257
|
+
) : (
|
|
258
|
+
<div className={styles.formContainer}>
|
|
259
|
+
<p className={styles.emptyState}>{t('reportNotFound', 'Report not found.')}</p>
|
|
260
|
+
</div>
|
|
261
|
+
)}
|
|
262
|
+
</Workspace2>
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
export default ReportRequestWorkspaces;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": "Actions",
|
|
3
|
+
"availableSoon": "Available soon",
|
|
4
|
+
"avgGenerationTime": "Avg. Generation Time",
|
|
5
|
+
"backToAllReports": "Back to all reports",
|
|
6
|
+
"backToHistory": "Back to report history",
|
|
7
|
+
"description": "Description",
|
|
8
|
+
"errorLoadingReports": "Error loading reports",
|
|
9
|
+
"generatedOn": "Generated on {{date}}",
|
|
10
|
+
"indicator": "Indicator",
|
|
11
|
+
"indicators": "Indicators",
|
|
12
|
+
"itemsPerPage": "Items per page:",
|
|
13
|
+
"lastRunBy": "Last Run By",
|
|
14
|
+
"loadingReports": "Loading reports...",
|
|
15
|
+
"minMaxItems": "{{min}}-{{max}} of {{total}} items",
|
|
16
|
+
"name": "Name",
|
|
17
|
+
"nextPage": "Next page",
|
|
18
|
+
"noRuns": "No runs yet",
|
|
19
|
+
"noRunsSubtitle": "This report has not been requested yet.",
|
|
20
|
+
"pageRangeText_one": "of {{count}} pages",
|
|
21
|
+
"pageRangeText_other": "of {{count}} pages",
|
|
22
|
+
"patientFollowUpReports": "Patient Follow-up Reports",
|
|
23
|
+
"previousPage": "Previous page",
|
|
24
|
+
"processing": "Processing...",
|
|
25
|
+
"reportData": "Report data",
|
|
26
|
+
"reportExecutionHistory": "Report Execution History",
|
|
27
|
+
"reportExecutionHistoryDescription": "A list of all the runs of this report.",
|
|
28
|
+
"reportHistory": "Report History",
|
|
29
|
+
"reports": "Reports",
|
|
30
|
+
"reportsTable": "Reports table",
|
|
31
|
+
"reportTableDescription": "List of reports in this category",
|
|
32
|
+
"reportType": "Report",
|
|
33
|
+
"requestedBy": "Requested By",
|
|
34
|
+
"requestedDateTime": "Requested Date & Time",
|
|
35
|
+
"requestReport": "Request Report",
|
|
36
|
+
"rowActions": "Row actions",
|
|
37
|
+
"runReportNow": "Run Report Now",
|
|
38
|
+
"searchForReports": "Search for reports by name, description, or category",
|
|
39
|
+
"searchHistory": "Search history",
|
|
40
|
+
"selfServicePortal": "Self-Service Portal",
|
|
41
|
+
"showingRuns": "Showing {{min}} to {{max}} of {{total}} runs",
|
|
42
|
+
"status": "Status",
|
|
43
|
+
"successRate": "Success Rate",
|
|
44
|
+
"timeTaken": "Time Taken",
|
|
45
|
+
"totalRuns": "Total Runs",
|
|
46
|
+
"value": "Value",
|
|
47
|
+
"view": "View",
|
|
48
|
+
"viewHistory": "View History"
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": "Actions",
|
|
3
|
+
"availableSoon": "Available soon",
|
|
4
|
+
"avgGenerationTime": "Avg. Generation Time",
|
|
5
|
+
"backToAllReports": "Back to all reports",
|
|
6
|
+
"backToHistory": "Back to report history",
|
|
7
|
+
"description": "Description",
|
|
8
|
+
"errorLoadingReports": "Error loading reports",
|
|
9
|
+
"generatedOn": "Generated on {{date}}",
|
|
10
|
+
"indicator": "Indicator",
|
|
11
|
+
"indicators": "Indicators",
|
|
12
|
+
"itemsPerPage": "Items per page:",
|
|
13
|
+
"lastRunBy": "Last Run By",
|
|
14
|
+
"loadingReports": "Loading reports...",
|
|
15
|
+
"minMaxItems": "{{min}}-{{max}} of {{total}} items",
|
|
16
|
+
"name": "Name",
|
|
17
|
+
"nextPage": "Next page",
|
|
18
|
+
"noRuns": "No runs yet",
|
|
19
|
+
"noRunsSubtitle": "This report has not been requested yet.",
|
|
20
|
+
"pageRangeText_one": "of {{count}} pages",
|
|
21
|
+
"pageRangeText_other": "of {{count}} pages",
|
|
22
|
+
"patientFollowUpReports": "Patient Follow-up Reports",
|
|
23
|
+
"previousPage": "Previous page",
|
|
24
|
+
"processing": "Processing...",
|
|
25
|
+
"reportData": "Report data",
|
|
26
|
+
"reportExecutionHistory": "Report Execution History",
|
|
27
|
+
"reportExecutionHistoryDescription": "A list of all the runs of this report.",
|
|
28
|
+
"reportHistory": "Report History",
|
|
29
|
+
"reports": "Reports",
|
|
30
|
+
"reportsTable": "Reports table",
|
|
31
|
+
"reportTableDescription": "List of reports in this category",
|
|
32
|
+
"reportType": "Report",
|
|
33
|
+
"requestedBy": "Requested By",
|
|
34
|
+
"requestedDateTime": "Requested Date & Time",
|
|
35
|
+
"requestReport": "Request Report",
|
|
36
|
+
"rowActions": "Row actions",
|
|
37
|
+
"runReportNow": "Run Report Now",
|
|
38
|
+
"searchForReports": "Search for reports by name, description, or category",
|
|
39
|
+
"searchHistory": "Search history",
|
|
40
|
+
"selfServicePortal": "Self-Service Portal",
|
|
41
|
+
"showingRuns": "Showing {{min}} to {{max}} of {{total}} runs",
|
|
42
|
+
"status": "Status",
|
|
43
|
+
"successRate": "Success Rate",
|
|
44
|
+
"timeTaken": "Time Taken",
|
|
45
|
+
"totalRuns": "Total Runs",
|
|
46
|
+
"value": "Value",
|
|
47
|
+
"view": "View",
|
|
48
|
+
"viewHistory": "View History"
|
|
49
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": "Actions",
|
|
3
|
+
"availableSoon": "Available soon",
|
|
4
|
+
"avgGenerationTime": "Avg. Generation Time",
|
|
5
|
+
"backToAllReports": "Back to all reports",
|
|
6
|
+
"backToHistory": "Back to report history",
|
|
7
|
+
"description": "Description",
|
|
8
|
+
"errorLoadingReports": "Error loading reports",
|
|
9
|
+
"generatedOn": "Generated on {{date}}",
|
|
10
|
+
"indicator": "Indicator",
|
|
11
|
+
"indicators": "Indicators",
|
|
12
|
+
"itemsPerPage": "Items per page:",
|
|
13
|
+
"lastRunBy": "Last Run By",
|
|
14
|
+
"loadingReports": "Loading reports...",
|
|
15
|
+
"minMaxItems": "{{min}}-{{max}} of {{total}} items",
|
|
16
|
+
"name": "Name",
|
|
17
|
+
"nextPage": "Next page",
|
|
18
|
+
"noRuns": "No runs yet",
|
|
19
|
+
"noRunsSubtitle": "This report has not been requested yet.",
|
|
20
|
+
"pageRangeText_one": "of {{count}} pages",
|
|
21
|
+
"pageRangeText_many": "of {{count}} pages",
|
|
22
|
+
"pageRangeText_other": "of {{count}} pages",
|
|
23
|
+
"patientFollowUpReports": "Patient Follow-up Reports",
|
|
24
|
+
"previousPage": "Previous page",
|
|
25
|
+
"processing": "Processing...",
|
|
26
|
+
"reportData": "Report data",
|
|
27
|
+
"reportExecutionHistory": "Report Execution History",
|
|
28
|
+
"reportExecutionHistoryDescription": "A list of all the runs of this report.",
|
|
29
|
+
"reportHistory": "Report History",
|
|
30
|
+
"reports": "Reports",
|
|
31
|
+
"reportsTable": "Reports table",
|
|
32
|
+
"reportTableDescription": "List of reports in this category",
|
|
33
|
+
"reportType": "Report",
|
|
34
|
+
"requestedBy": "Requested By",
|
|
35
|
+
"requestedDateTime": "Requested Date & Time",
|
|
36
|
+
"requestReport": "Request Report",
|
|
37
|
+
"rowActions": "Row actions",
|
|
38
|
+
"runReportNow": "Run Report Now",
|
|
39
|
+
"searchForReports": "Search for reports by name, description, or category",
|
|
40
|
+
"searchHistory": "Search history",
|
|
41
|
+
"selfServicePortal": "Self-Service Portal",
|
|
42
|
+
"showingRuns": "Showing {{min}} to {{max}} of {{total}} runs",
|
|
43
|
+
"status": "Status",
|
|
44
|
+
"successRate": "Success Rate",
|
|
45
|
+
"timeTaken": "Time Taken",
|
|
46
|
+
"totalRuns": "Total Runs",
|
|
47
|
+
"value": "Value",
|
|
48
|
+
"view": "View",
|
|
49
|
+
"viewHistory": "View History"
|
|
50
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": "Actions",
|
|
3
|
+
"availableSoon": "Available soon",
|
|
4
|
+
"avgGenerationTime": "Avg. Generation Time",
|
|
5
|
+
"backToAllReports": "Back to all reports",
|
|
6
|
+
"backToHistory": "Back to report history",
|
|
7
|
+
"description": "Description",
|
|
8
|
+
"errorLoadingReports": "Error loading reports",
|
|
9
|
+
"generatedOn": "Generated on {{date}}",
|
|
10
|
+
"indicator": "Indicator",
|
|
11
|
+
"indicators": "Indicators",
|
|
12
|
+
"itemsPerPage": "Items per page:",
|
|
13
|
+
"lastRunBy": "Last Run By",
|
|
14
|
+
"loadingReports": "Loading reports...",
|
|
15
|
+
"minMaxItems": "{{min}}-{{max}} of {{total}} items",
|
|
16
|
+
"name": "Name",
|
|
17
|
+
"nextPage": "Next page",
|
|
18
|
+
"noRuns": "No runs yet",
|
|
19
|
+
"noRunsSubtitle": "This report has not been requested yet.",
|
|
20
|
+
"pageRangeText_one": "of {{count}} pages",
|
|
21
|
+
"pageRangeText_other": "of {{count}} pages",
|
|
22
|
+
"patientFollowUpReports": "Patient Follow-up Reports",
|
|
23
|
+
"previousPage": "Previous page",
|
|
24
|
+
"processing": "Processing...",
|
|
25
|
+
"reportData": "Report data",
|
|
26
|
+
"reportExecutionHistory": "Report Execution History",
|
|
27
|
+
"reportExecutionHistoryDescription": "A list of all the runs of this report.",
|
|
28
|
+
"reportHistory": "Report History",
|
|
29
|
+
"reports": "Reports",
|
|
30
|
+
"reportsTable": "Reports table",
|
|
31
|
+
"reportTableDescription": "List of reports in this category",
|
|
32
|
+
"reportType": "Report",
|
|
33
|
+
"requestedBy": "Requested By",
|
|
34
|
+
"requestedDateTime": "Requested Date & Time",
|
|
35
|
+
"requestReport": "Request Report",
|
|
36
|
+
"rowActions": "Row actions",
|
|
37
|
+
"runReportNow": "Run Report Now",
|
|
38
|
+
"searchForReports": "Search for reports by name, description, or category",
|
|
39
|
+
"searchHistory": "Search history",
|
|
40
|
+
"selfServicePortal": "Self-Service Portal",
|
|
41
|
+
"showingRuns": "Showing {{min}} to {{max}} of {{total}} runs",
|
|
42
|
+
"status": "Status",
|
|
43
|
+
"successRate": "Success Rate",
|
|
44
|
+
"timeTaken": "Time Taken",
|
|
45
|
+
"totalRuns": "Total Runs",
|
|
46
|
+
"value": "Value",
|
|
47
|
+
"view": "View",
|
|
48
|
+
"viewHistory": "View History"
|
|
49
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('openmrs/default-webpack-config');
|