@palladium-ethiopia/esm-admin-app 5.4.2-pre.100
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 +15 -0
- package/README.md +12 -0
- package/dist/117.js +1 -0
- package/dist/152.js +1 -0
- package/dist/152.js.map +1 -0
- package/dist/209.js +1 -0
- package/dist/209.js.map +1 -0
- package/dist/41.js +1 -0
- package/dist/41.js.map +1 -0
- package/dist/442.js +1 -0
- package/dist/442.js.map +1 -0
- package/dist/466.js +1 -0
- package/dist/466.js.map +1 -0
- package/dist/555.js +1 -0
- package/dist/555.js.map +1 -0
- package/dist/61.js +1 -0
- package/dist/61.js.map +1 -0
- package/dist/672.js +15 -0
- package/dist/672.js.map +1 -0
- package/dist/689.js +1 -0
- package/dist/689.js.map +1 -0
- package/dist/710.js +1 -0
- package/dist/710.js.map +1 -0
- package/dist/712.js +1 -0
- package/dist/712.js.map +1 -0
- package/dist/771.js +1 -0
- package/dist/771.js.map +1 -0
- package/dist/789.js +1 -0
- package/dist/789.js.map +1 -0
- package/dist/806.js +1 -0
- package/dist/826.js +1 -0
- package/dist/826.js.map +1 -0
- package/dist/914.js +27 -0
- package/dist/914.js.map +1 -0
- package/dist/926.js +17 -0
- package/dist/926.js.map +1 -0
- package/dist/ethiopia-esm-admin-app.js +6 -0
- package/dist/ethiopia-esm-admin-app.js.buildmanifest.json +556 -0
- package/dist/ethiopia-esm-admin-app.js.map +1 -0
- package/dist/main.js +32 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/jest.config.js +8 -0
- package/package.json +52 -0
- package/rspack.config.js +1 -0
- package/src/components/confirm-modal/confirmation-operation-modal.component.tsx +43 -0
- package/src/components/confirm-modal/confirmation-operation.test.tsx +69 -0
- package/src/components/dashboard/dashboard.component.tsx +131 -0
- package/src/components/dashboard/dashboard.scss +38 -0
- package/src/components/dashboard/etl-dashboard.component.tsx +11 -0
- package/src/components/empty-state/empty-state-log.components.tsx +20 -0
- package/src/components/empty-state/empty-state-log.scss +28 -0
- package/src/components/empty-state/empty-state-log.test.tsx +24 -0
- package/src/components/facility-setup/card.component.tsx +16 -0
- package/src/components/facility-setup/facility-info.component.tsx +142 -0
- package/src/components/facility-setup/facility-info.scss +87 -0
- package/src/components/facility-setup/facility-setup.component.tsx +21 -0
- package/src/components/facility-setup/facility-setup.resource.tsx +7 -0
- package/src/components/facility-setup/facility-setup.scss +38 -0
- package/src/components/facility-setup/header/header.component.tsx +23 -0
- package/src/components/facility-setup/header/header.scss +19 -0
- package/src/components/header/header-illustration.component.tsx +13 -0
- package/src/components/header/header.component.tsx +28 -0
- package/src/components/header/header.scss +19 -0
- package/src/components/hook/healthWorkerAdapter.ts +213 -0
- package/src/components/hook/useFacilityInfo.tsx +37 -0
- package/src/components/hook/useSystemRoleSetting.tsx +33 -0
- package/src/components/locations/auto-suggest/autosuggest.component.tsx +149 -0
- package/src/components/locations/auto-suggest/autosuggest.scss +61 -0
- package/src/components/locations/auto-suggest/location-autosuggest.component.tsx +94 -0
- package/src/components/locations/auto-suggest/location-autosuggest.scss +48 -0
- package/src/components/locations/common/results-tile.component.tsx +45 -0
- package/src/components/locations/common/results-tile.scss +86 -0
- package/src/components/locations/forms/add-location/add-location.workspace.scss +34 -0
- package/src/components/locations/forms/add-location/add-location.workspace.tsx +200 -0
- package/src/components/locations/forms/search-location/search-location.workspace.scss +79 -0
- package/src/components/locations/forms/search-location/search-location.workspace.tsx +215 -0
- package/src/components/locations/header/header.component.tsx +48 -0
- package/src/components/locations/header/header.scss +58 -0
- package/src/components/locations/helpers/index.ts +16 -0
- package/src/components/locations/home/home-locations.component.tsx +18 -0
- package/src/components/locations/home/home-locations.scss +8 -0
- package/src/components/locations/hooks/UseFacilityLocations.ts +12 -0
- package/src/components/locations/hooks/useLocation.ts +18 -0
- package/src/components/locations/hooks/useLocationTags.ts +15 -0
- package/src/components/locations/tables/locations-table.component.tsx +243 -0
- package/src/components/locations/tables/locations-table.resource.ts +26 -0
- package/src/components/locations/tables/locations-table.scss +115 -0
- package/src/components/locations/types/index.ts +120 -0
- package/src/components/locations/utils/index.ts +5 -0
- package/src/components/logs-table/operation-log-resource.ts +41 -0
- package/src/components/logs-table/operation-log-table.component.tsx +120 -0
- package/src/components/logs-table/operation-log.scss +10 -0
- package/src/components/logs-table/operation-log.test.tsx +47 -0
- package/src/components/modal/hwr-confirmation.modal.scss +21 -0
- package/src/components/modal/hwr-confirmation.modal.tsx +170 -0
- package/src/components/modal/hwr-empty.modal.component.tsx +54 -0
- package/src/components/modal/hwr-sync.modal.scss +30 -0
- package/src/components/modal/hwr-sync.modal.tsx +209 -0
- package/src/components/modal/hwr-sync.resource.ts +23 -0
- package/src/components/provider-banner/provider-banner.component.tsx +106 -0
- package/src/components/provider-banner/provider-banner.module.scss +51 -0
- package/src/components/provider-banner/provider-banner.resource.ts +29 -0
- package/src/components/side-menu/left-panel.scss +42 -0
- package/src/components/side-menu/left-pannel.component.tsx +22 -0
- package/src/components/users/header/header.scss +90 -0
- package/src/components/users/header/user-management-header.component.tsx +42 -0
- package/src/components/users/manage-users/hooks/useProviderAttributeMapping.ts +110 -0
- package/src/components/users/manage-users/hooks/useUserFormSteps.ts +119 -0
- package/src/components/users/manage-users/hooks/useUserFormSubmission.ts +264 -0
- package/src/components/users/manage-users/hooks/useUserManagementForm.ts +122 -0
- package/src/components/users/manage-users/manage-user-role-scope/user-role-scope-list/user-role-scope-list.component.tsx +177 -0
- package/src/components/users/manage-users/manage-user-role-scope/user-role-scope-workspace/user-role-fields.scss +117 -0
- package/src/components/users/manage-users/manage-user-role-scope/user-role-scope-workspace/user-role-scope-fields.component.tsx +290 -0
- package/src/components/users/manage-users/manage-user-role-scope/user-role-scope-workspace/user-role-scope.workspace.tsx +316 -0
- package/src/components/users/manage-users/manage-user-role-scope/user-role-scope-workspace/userRoleScopeFormSchema.tsx +43 -0
- package/src/components/users/manage-users/manage-user.component.tsx +19 -0
- package/src/components/users/manage-users/manage-user.scss +31 -0
- package/src/components/users/manage-users/provider-autosuggest.component.tsx +117 -0
- package/src/components/users/manage-users/provider-search.resource.ts +34 -0
- package/src/components/users/manage-users/sections/demographic-section.component.tsx +156 -0
- package/src/components/users/manage-users/sections/login-section.component.tsx +88 -0
- package/src/components/users/manage-users/sections/provider-section.component.tsx +270 -0
- package/src/components/users/manage-users/sections/roles-section.component.tsx +88 -0
- package/src/components/users/manage-users/user-details/user-detail.scss +75 -0
- package/src/components/users/manage-users/user-details/user-details.component.tsx +182 -0
- package/src/components/users/manage-users/user-list/user-list.component.tsx +378 -0
- package/src/components/users/manage-users/user-list/user-list.resource.ts +30 -0
- package/src/components/users/manage-users/user-list/user-list.scss +37 -0
- package/src/components/users/manage-users/user-management.constants.ts +20 -0
- package/src/components/users/manage-users/user-management.utils.ts +100 -0
- package/src/components/users/manage-users/user-management.workspace.scss +172 -0
- package/src/components/users/manage-users/user-management.workspace.tsx +334 -0
- package/src/components/users/userManagementFormSchema.tsx +179 -0
- package/src/config-schema.ts +142 -0
- package/src/constants.ts +50 -0
- package/src/declarations.d.ts +2 -0
- package/src/index.ts +55 -0
- package/src/left-pannel-link.component.tsx +40 -0
- package/src/root.component.tsx +39 -0
- package/src/root.scss +12 -0
- package/src/routes.json +100 -0
- package/src/setup-tests.ts +1 -0
- package/src/types/index.ts +385 -0
- package/src/user-management.resources.ts +232 -0
- package/src/utils/utils.ts +20 -0
- package/translations/am.json +159 -0
- package/translations/en.json +159 -0
- package/tsconfig.json +5 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Controller, Control, FieldErrors } from 'react-hook-form';
|
|
4
|
+
import { ResponsiveWrapper } from '@openmrs/esm-framework';
|
|
5
|
+
import { Column, TextInput, RadioButtonGroup, RadioButton, Button } from '@carbon/react';
|
|
6
|
+
import { ProviderAutosuggest } from '../provider-autosuggest.component';
|
|
7
|
+
import type { ProviderSearchResult } from '../provider-search.resource';
|
|
8
|
+
import type { UserFormSchema } from '../hooks/useUserManagementForm';
|
|
9
|
+
import styles from '../user-management.workspace.scss';
|
|
10
|
+
|
|
11
|
+
interface DemographicSectionProps {
|
|
12
|
+
control: Control<UserFormSchema>;
|
|
13
|
+
errors: FieldErrors<UserFormSchema>;
|
|
14
|
+
isInitialValuesEmpty: boolean;
|
|
15
|
+
isProviderReadOnly?: boolean;
|
|
16
|
+
onProviderSelected: (providerData: ProviderSearchResult) => void;
|
|
17
|
+
onFormReset?: () => void;
|
|
18
|
+
showResetButton?: boolean;
|
|
19
|
+
formResetKey?: number;
|
|
20
|
+
isFormDirty?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const DemographicSection: React.FC<DemographicSectionProps> = ({
|
|
24
|
+
control,
|
|
25
|
+
errors,
|
|
26
|
+
isInitialValuesEmpty,
|
|
27
|
+
isProviderReadOnly = false,
|
|
28
|
+
onProviderSelected,
|
|
29
|
+
onFormReset,
|
|
30
|
+
showResetButton = false,
|
|
31
|
+
formResetKey = 0,
|
|
32
|
+
isFormDirty = false,
|
|
33
|
+
}) => {
|
|
34
|
+
const { t } = useTranslation();
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<ResponsiveWrapper>
|
|
38
|
+
{isInitialValuesEmpty && (
|
|
39
|
+
<Column>
|
|
40
|
+
<ProviderAutosuggest key={formResetKey} onProviderSelected={onProviderSelected} />
|
|
41
|
+
{showResetButton && onFormReset && (
|
|
42
|
+
<Button kind="ghost" size="sm" onClick={onFormReset} disabled={!isFormDirty}>
|
|
43
|
+
{t('reset', 'Reset')}
|
|
44
|
+
</Button>
|
|
45
|
+
)}
|
|
46
|
+
</Column>
|
|
47
|
+
)}
|
|
48
|
+
<span className={styles.formHeaderSection}>{t('demographicInfo', 'Demographic info')}</span>
|
|
49
|
+
<ResponsiveWrapper>
|
|
50
|
+
<Controller
|
|
51
|
+
name="givenName"
|
|
52
|
+
control={control}
|
|
53
|
+
render={({ field }) => (
|
|
54
|
+
<TextInput
|
|
55
|
+
{...field}
|
|
56
|
+
id="givenName"
|
|
57
|
+
type="text"
|
|
58
|
+
labelText={t('givenName', 'Given Name')}
|
|
59
|
+
placeholder={t('userGivenName', 'Enter Given Name')}
|
|
60
|
+
disabled={isProviderReadOnly}
|
|
61
|
+
invalid={!!errors.givenName}
|
|
62
|
+
invalidText={errors.givenName?.message}
|
|
63
|
+
/>
|
|
64
|
+
)}
|
|
65
|
+
/>
|
|
66
|
+
</ResponsiveWrapper>
|
|
67
|
+
<ResponsiveWrapper>
|
|
68
|
+
<Controller
|
|
69
|
+
name="middleName"
|
|
70
|
+
control={control}
|
|
71
|
+
render={({ field }) => (
|
|
72
|
+
<TextInput
|
|
73
|
+
{...field}
|
|
74
|
+
id="middleName"
|
|
75
|
+
labelText={t('middleName', 'Middle Name')}
|
|
76
|
+
placeholder={t('middleName', 'Middle Name')}
|
|
77
|
+
disabled={isProviderReadOnly}
|
|
78
|
+
/>
|
|
79
|
+
)}
|
|
80
|
+
/>
|
|
81
|
+
</ResponsiveWrapper>
|
|
82
|
+
<ResponsiveWrapper>
|
|
83
|
+
<Controller
|
|
84
|
+
name="familyName"
|
|
85
|
+
control={control}
|
|
86
|
+
render={({ field }) => (
|
|
87
|
+
<TextInput
|
|
88
|
+
{...field}
|
|
89
|
+
id="familyName"
|
|
90
|
+
labelText={t('familyName', 'Family Name')}
|
|
91
|
+
placeholder={t('familyName', 'Family Name')}
|
|
92
|
+
disabled={isProviderReadOnly}
|
|
93
|
+
invalid={!!errors.familyName}
|
|
94
|
+
invalidText={errors.familyName?.message}
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
97
|
+
/>
|
|
98
|
+
</ResponsiveWrapper>
|
|
99
|
+
<ResponsiveWrapper>
|
|
100
|
+
<Controller
|
|
101
|
+
name="phoneNumber"
|
|
102
|
+
control={control}
|
|
103
|
+
render={({ field }) => (
|
|
104
|
+
<TextInput
|
|
105
|
+
{...field}
|
|
106
|
+
id="phoneNumber"
|
|
107
|
+
type="text"
|
|
108
|
+
disabled={isProviderReadOnly}
|
|
109
|
+
labelText={t('phoneNumber', 'Phone Number')}
|
|
110
|
+
placeholder={t('phoneNumber', 'Enter Phone Number')}
|
|
111
|
+
invalid={!!errors.phoneNumber}
|
|
112
|
+
invalidText={errors.phoneNumber?.message}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
115
|
+
/>
|
|
116
|
+
</ResponsiveWrapper>
|
|
117
|
+
<ResponsiveWrapper>
|
|
118
|
+
<Controller
|
|
119
|
+
name="email"
|
|
120
|
+
control={control}
|
|
121
|
+
render={({ field }) => (
|
|
122
|
+
<TextInput
|
|
123
|
+
{...field}
|
|
124
|
+
id="email"
|
|
125
|
+
type="email"
|
|
126
|
+
disabled={isProviderReadOnly}
|
|
127
|
+
labelText={t('email', 'Email')}
|
|
128
|
+
placeholder={t('email', 'Enter Email')}
|
|
129
|
+
invalid={!!errors.email}
|
|
130
|
+
invalidText={errors.email?.message}
|
|
131
|
+
className={styles.checkboxLabelSingleLine}
|
|
132
|
+
/>
|
|
133
|
+
)}
|
|
134
|
+
/>
|
|
135
|
+
</ResponsiveWrapper>
|
|
136
|
+
<ResponsiveWrapper>
|
|
137
|
+
<Controller
|
|
138
|
+
name="gender"
|
|
139
|
+
control={control}
|
|
140
|
+
render={({ field }) => (
|
|
141
|
+
<RadioButtonGroup
|
|
142
|
+
{...field}
|
|
143
|
+
legendText={t('sex', 'Sex')}
|
|
144
|
+
orientation="vertical"
|
|
145
|
+
disabled={isProviderReadOnly}
|
|
146
|
+
invalid={!!errors.gender}
|
|
147
|
+
invalidText={errors.gender?.message}>
|
|
148
|
+
<RadioButton value="M" id="M" labelText={t('male', 'Male')} checked={field.value === 'M'} />
|
|
149
|
+
<RadioButton value="F" id="F" labelText={t('female', 'Female')} checked={field.value === 'F'} />
|
|
150
|
+
</RadioButtonGroup>
|
|
151
|
+
)}
|
|
152
|
+
/>
|
|
153
|
+
</ResponsiveWrapper>
|
|
154
|
+
</ResponsiveWrapper>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Controller, Control, FieldErrors } from 'react-hook-form';
|
|
4
|
+
import { ResponsiveWrapper } from '@openmrs/esm-framework';
|
|
5
|
+
import { TextInput, PasswordInput } from '@carbon/react';
|
|
6
|
+
import type { UserFormSchema } from '../hooks/useUserManagementForm';
|
|
7
|
+
import styles from '../user-management.workspace.scss';
|
|
8
|
+
|
|
9
|
+
interface LoginSectionProps {
|
|
10
|
+
control: Control<UserFormSchema>;
|
|
11
|
+
errors: FieldErrors<UserFormSchema>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const LoginSection: React.FC<LoginSectionProps> = ({ control, errors }) => {
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<ResponsiveWrapper>
|
|
19
|
+
<span className={styles.formHeaderSection}>{t('loginInfo', 'Login Info')}</span>
|
|
20
|
+
<ResponsiveWrapper>
|
|
21
|
+
<Controller
|
|
22
|
+
name="username"
|
|
23
|
+
control={control}
|
|
24
|
+
render={({ field }) => (
|
|
25
|
+
<TextInput
|
|
26
|
+
{...field}
|
|
27
|
+
id="username"
|
|
28
|
+
labelText={t('username', 'Username')}
|
|
29
|
+
invalid={!!errors.username}
|
|
30
|
+
invalidText={errors.username?.message}
|
|
31
|
+
onBlur={(e) => {
|
|
32
|
+
field.onBlur();
|
|
33
|
+
const trimmed = e.target.value?.trim() ?? '';
|
|
34
|
+
if (trimmed !== e.target.value) {
|
|
35
|
+
field.onChange(trimmed);
|
|
36
|
+
}
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
/>
|
|
41
|
+
</ResponsiveWrapper>
|
|
42
|
+
<ResponsiveWrapper>
|
|
43
|
+
<Controller
|
|
44
|
+
name="password"
|
|
45
|
+
control={control}
|
|
46
|
+
render={({ field }) => (
|
|
47
|
+
<PasswordInput
|
|
48
|
+
{...field}
|
|
49
|
+
id="password"
|
|
50
|
+
labelText={t('password', 'Password')}
|
|
51
|
+
invalid={!!errors.password}
|
|
52
|
+
invalidText={errors.password?.message}
|
|
53
|
+
onBlur={(e) => {
|
|
54
|
+
field.onBlur();
|
|
55
|
+
const trimmed = e.target.value?.trim() ?? '';
|
|
56
|
+
if (trimmed !== e.target.value) {
|
|
57
|
+
field.onChange(trimmed);
|
|
58
|
+
}
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
61
|
+
)}
|
|
62
|
+
/>
|
|
63
|
+
</ResponsiveWrapper>
|
|
64
|
+
<ResponsiveWrapper>
|
|
65
|
+
<Controller
|
|
66
|
+
name="confirmPassword"
|
|
67
|
+
control={control}
|
|
68
|
+
render={({ field }) => (
|
|
69
|
+
<PasswordInput
|
|
70
|
+
{...field}
|
|
71
|
+
id="confirmPassword"
|
|
72
|
+
labelText={t('confirmPassword', 'Confirm Password')}
|
|
73
|
+
invalid={!!errors.confirmPassword}
|
|
74
|
+
invalidText={errors.confirmPassword?.message}
|
|
75
|
+
onBlur={(e) => {
|
|
76
|
+
field.onBlur();
|
|
77
|
+
const trimmed = e.target.value?.trim() ?? '';
|
|
78
|
+
if (trimmed !== e.target.value) {
|
|
79
|
+
field.onChange(trimmed);
|
|
80
|
+
}
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
84
|
+
/>
|
|
85
|
+
</ResponsiveWrapper>
|
|
86
|
+
</ResponsiveWrapper>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Controller, Control, FieldErrors } from 'react-hook-form';
|
|
4
|
+
import { ResponsiveWrapper, useConfig } from '@openmrs/esm-framework';
|
|
5
|
+
import { TextInput, CheckboxGroup, Checkbox, DatePicker, DatePickerInput, InlineLoading } from '@carbon/react';
|
|
6
|
+
import type { UserFormSchema } from '../hooks/useUserManagementForm';
|
|
7
|
+
import type { ProviderWithAttributes } from '../../../../user-management.resources';
|
|
8
|
+
import type { ConfigObject } from '../../../../config-schema';
|
|
9
|
+
import { extractAttributeFromProvider } from '../user-management.utils';
|
|
10
|
+
import styles from '../user-management.workspace.scss';
|
|
11
|
+
|
|
12
|
+
interface ProviderSectionProps {
|
|
13
|
+
control: Control<UserFormSchema>;
|
|
14
|
+
errors: FieldErrors<UserFormSchema>;
|
|
15
|
+
isInitialValuesEmpty: boolean;
|
|
16
|
+
isProviderReadOnly?: boolean;
|
|
17
|
+
loadingProvider: boolean;
|
|
18
|
+
providerError: unknown;
|
|
19
|
+
provider: ProviderWithAttributes[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const ProviderSection: React.FC<ProviderSectionProps> = ({
|
|
23
|
+
control,
|
|
24
|
+
errors,
|
|
25
|
+
isInitialValuesEmpty,
|
|
26
|
+
isProviderReadOnly = false,
|
|
27
|
+
loadingProvider,
|
|
28
|
+
providerError,
|
|
29
|
+
provider,
|
|
30
|
+
}) => {
|
|
31
|
+
const { t } = useTranslation();
|
|
32
|
+
const config = useConfig<ConfigObject>();
|
|
33
|
+
const externalId =
|
|
34
|
+
provider.length > 0 ? extractAttributeFromProvider(provider[0], config.providerExternalIdAttributeTypeUuid) : '';
|
|
35
|
+
const ihrisIdentifier =
|
|
36
|
+
provider.length > 0
|
|
37
|
+
? extractAttributeFromProvider(provider[0], config.providerIHRISIdentifierAttributeTypeUuid)
|
|
38
|
+
: '';
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<ResponsiveWrapper>
|
|
42
|
+
<span className={styles.formHeaderSection}>{t('providerDetails', 'Provider details')}</span>
|
|
43
|
+
<ResponsiveWrapper>
|
|
44
|
+
<Controller
|
|
45
|
+
name="providerUniqueIdentifier"
|
|
46
|
+
control={control}
|
|
47
|
+
render={({ field }) => (
|
|
48
|
+
<TextInput
|
|
49
|
+
{...field}
|
|
50
|
+
id="providerUniqueIdentifier"
|
|
51
|
+
type="text"
|
|
52
|
+
labelText={t('providerUniqueIdentifier', 'Provider Unique Identifier')}
|
|
53
|
+
placeholder={t('providerUniqueIdentifierPlaceholder', 'Enter Provider Unqiue Identifier')}
|
|
54
|
+
disabled={isProviderReadOnly}
|
|
55
|
+
invalid={!!errors.providerUniqueIdentifier}
|
|
56
|
+
invalidText={errors.providerUniqueIdentifier?.message}
|
|
57
|
+
/>
|
|
58
|
+
)}
|
|
59
|
+
/>
|
|
60
|
+
</ResponsiveWrapper>
|
|
61
|
+
{externalId && (
|
|
62
|
+
<ResponsiveWrapper>
|
|
63
|
+
<TextInput
|
|
64
|
+
id="externalId"
|
|
65
|
+
type="text"
|
|
66
|
+
labelText={t('externalId', 'External ID')}
|
|
67
|
+
value={externalId}
|
|
68
|
+
readOnly
|
|
69
|
+
className={styles.checkboxLabelSingleLine}
|
|
70
|
+
/>
|
|
71
|
+
</ResponsiveWrapper>
|
|
72
|
+
)}
|
|
73
|
+
{ihrisIdentifier && (
|
|
74
|
+
<ResponsiveWrapper>
|
|
75
|
+
<TextInput
|
|
76
|
+
id="ihrisIdentifier"
|
|
77
|
+
type="text"
|
|
78
|
+
labelText={t('ihrisIdentifier', 'IHRIS Identifier')}
|
|
79
|
+
value={ihrisIdentifier}
|
|
80
|
+
readOnly
|
|
81
|
+
className={styles.checkboxLabelSingleLine}
|
|
82
|
+
/>
|
|
83
|
+
</ResponsiveWrapper>
|
|
84
|
+
)}
|
|
85
|
+
<ResponsiveWrapper>
|
|
86
|
+
<Controller
|
|
87
|
+
name="nationalId"
|
|
88
|
+
control={control}
|
|
89
|
+
render={({ field }) => (
|
|
90
|
+
<TextInput
|
|
91
|
+
{...field}
|
|
92
|
+
id="nationalId"
|
|
93
|
+
disabled={isProviderReadOnly}
|
|
94
|
+
type="text"
|
|
95
|
+
labelText={t('nationalID', 'National id')}
|
|
96
|
+
placeholder={t('nationalID', 'National id')}
|
|
97
|
+
invalid={!!errors.nationalId}
|
|
98
|
+
invalidText={errors.nationalId?.message}
|
|
99
|
+
className={styles.checkboxLabelSingleLine}
|
|
100
|
+
/>
|
|
101
|
+
)}
|
|
102
|
+
/>
|
|
103
|
+
</ResponsiveWrapper>
|
|
104
|
+
<ResponsiveWrapper>
|
|
105
|
+
<Controller
|
|
106
|
+
name="passportNumber"
|
|
107
|
+
control={control}
|
|
108
|
+
render={({ field }) => (
|
|
109
|
+
<TextInput
|
|
110
|
+
{...field}
|
|
111
|
+
id="passportNumber"
|
|
112
|
+
disabled={isProviderReadOnly}
|
|
113
|
+
type="text"
|
|
114
|
+
labelText={t('passportNumber', 'Passport number')}
|
|
115
|
+
placeholder={t('passportNumber', 'Passport number')}
|
|
116
|
+
invalid={!!errors.nationalId}
|
|
117
|
+
invalidText={errors.nationalId?.message}
|
|
118
|
+
className={styles.checkboxLabelSingleLine}
|
|
119
|
+
/>
|
|
120
|
+
)}
|
|
121
|
+
/>
|
|
122
|
+
</ResponsiveWrapper>
|
|
123
|
+
<ResponsiveWrapper>
|
|
124
|
+
<Controller
|
|
125
|
+
name="providerLicense"
|
|
126
|
+
control={control}
|
|
127
|
+
render={({ field }) => (
|
|
128
|
+
<TextInput
|
|
129
|
+
{...field}
|
|
130
|
+
id="providerLicense"
|
|
131
|
+
type="text"
|
|
132
|
+
disabled={isProviderReadOnly}
|
|
133
|
+
labelText={t('providerLicense', 'License Number')}
|
|
134
|
+
placeholder={t('providerLicense', 'License Number')}
|
|
135
|
+
className={styles.checkboxLabelSingleLine}
|
|
136
|
+
/>
|
|
137
|
+
)}
|
|
138
|
+
/>
|
|
139
|
+
</ResponsiveWrapper>
|
|
140
|
+
<ResponsiveWrapper>
|
|
141
|
+
<Controller
|
|
142
|
+
name="registrationNumber"
|
|
143
|
+
control={control}
|
|
144
|
+
render={({ field }) => (
|
|
145
|
+
<TextInput
|
|
146
|
+
{...field}
|
|
147
|
+
id="registrationNumber"
|
|
148
|
+
type="text"
|
|
149
|
+
disabled={isProviderReadOnly}
|
|
150
|
+
labelText={t('registrationNumber', 'Registration Number')}
|
|
151
|
+
placeholder={t('registrationNumber', 'Registration Number')}
|
|
152
|
+
className={styles.checkboxLabelSingleLine}
|
|
153
|
+
/>
|
|
154
|
+
)}
|
|
155
|
+
/>
|
|
156
|
+
</ResponsiveWrapper>
|
|
157
|
+
<ResponsiveWrapper>
|
|
158
|
+
<Controller
|
|
159
|
+
name="qualification"
|
|
160
|
+
control={control}
|
|
161
|
+
render={({ field }) => (
|
|
162
|
+
<TextInput
|
|
163
|
+
{...field}
|
|
164
|
+
id="qualification"
|
|
165
|
+
type="qualification"
|
|
166
|
+
disabled={isProviderReadOnly}
|
|
167
|
+
labelText={t('qualification', 'Qualification')}
|
|
168
|
+
placeholder={t('qualification', 'Qualification')}
|
|
169
|
+
invalid={!!errors.qualification}
|
|
170
|
+
invalidText={errors.qualification?.message}
|
|
171
|
+
className={styles.checkboxLabelSingleLine}
|
|
172
|
+
/>
|
|
173
|
+
)}
|
|
174
|
+
/>
|
|
175
|
+
</ResponsiveWrapper>
|
|
176
|
+
<ResponsiveWrapper>
|
|
177
|
+
<Controller
|
|
178
|
+
name="licenseExpiryDate"
|
|
179
|
+
control={control}
|
|
180
|
+
render={({ field }) => (
|
|
181
|
+
<DatePicker
|
|
182
|
+
datePickerType="single"
|
|
183
|
+
className={styles.formDatePicker}
|
|
184
|
+
onChange={(event) => {
|
|
185
|
+
if (event.length) {
|
|
186
|
+
field.onChange(event[0]);
|
|
187
|
+
}
|
|
188
|
+
}}
|
|
189
|
+
value={field.value ? new Date(field.value) : ''}>
|
|
190
|
+
<DatePickerInput
|
|
191
|
+
className={styles.formDatePicker}
|
|
192
|
+
placeholder="mm/dd/yyyy"
|
|
193
|
+
labelText={t('licenseExpiryDate', 'License Expiry Date')}
|
|
194
|
+
id="formLicenseDatePicker"
|
|
195
|
+
size="md"
|
|
196
|
+
disabled={isProviderReadOnly}
|
|
197
|
+
invalid={!!errors.licenseExpiryDate}
|
|
198
|
+
invalidText={errors.licenseExpiryDate?.message}
|
|
199
|
+
/>
|
|
200
|
+
</DatePicker>
|
|
201
|
+
)}
|
|
202
|
+
/>
|
|
203
|
+
</ResponsiveWrapper>
|
|
204
|
+
{loadingProvider || providerError ? (
|
|
205
|
+
<InlineLoading status="active" iconDescription="Loading" description="Loading data..." />
|
|
206
|
+
) : provider.length > 0 ? (
|
|
207
|
+
<>
|
|
208
|
+
<ResponsiveWrapper>
|
|
209
|
+
<Controller
|
|
210
|
+
name="systemId"
|
|
211
|
+
control={control}
|
|
212
|
+
render={({ field }) => (
|
|
213
|
+
<TextInput
|
|
214
|
+
{...field}
|
|
215
|
+
id="systemeId"
|
|
216
|
+
type="text"
|
|
217
|
+
labelText={t('providerId', 'Provider Id')}
|
|
218
|
+
placeholder={t('providerId', 'Provider Id')}
|
|
219
|
+
disabled={isProviderReadOnly}
|
|
220
|
+
invalid={!!errors.systemId}
|
|
221
|
+
invalidText={errors.systemId?.message}
|
|
222
|
+
className={styles.checkboxLabelSingleLine}
|
|
223
|
+
/>
|
|
224
|
+
)}
|
|
225
|
+
/>
|
|
226
|
+
{!isProviderReadOnly && (
|
|
227
|
+
<Controller
|
|
228
|
+
name="isEditProvider"
|
|
229
|
+
control={control}
|
|
230
|
+
render={({ field }) => (
|
|
231
|
+
<CheckboxGroup
|
|
232
|
+
legendText={t('editProvider', 'Edit Provider Details')}
|
|
233
|
+
className={styles.multilineCheckboxLabel}>
|
|
234
|
+
<Checkbox
|
|
235
|
+
className={styles.checkboxLabelSingleLine}
|
|
236
|
+
id="isEditProvider"
|
|
237
|
+
labelText={t('EditProviderDetails', 'Edit provider details?')}
|
|
238
|
+
checked={field.value || false}
|
|
239
|
+
onChange={(e) => field.onChange(e.target.checked)}
|
|
240
|
+
/>
|
|
241
|
+
</CheckboxGroup>
|
|
242
|
+
)}
|
|
243
|
+
/>
|
|
244
|
+
)}
|
|
245
|
+
</ResponsiveWrapper>
|
|
246
|
+
</>
|
|
247
|
+
) : (
|
|
248
|
+
<>
|
|
249
|
+
<Controller
|
|
250
|
+
name="providerIdentifiers"
|
|
251
|
+
control={control}
|
|
252
|
+
render={({ field }) => (
|
|
253
|
+
<CheckboxGroup
|
|
254
|
+
legendText={t('providerIdentifiers', 'Provider Details')}
|
|
255
|
+
className={styles.multilineCheckboxLabel}>
|
|
256
|
+
<Checkbox
|
|
257
|
+
className={styles.checkboxLabelSingleLine}
|
|
258
|
+
id="providerIdentifiersa"
|
|
259
|
+
labelText={t('providerIdentifiers', 'Create a Provider account for this user')}
|
|
260
|
+
checked={field.value || false}
|
|
261
|
+
onChange={(e) => field.onChange(e.target.checked)}
|
|
262
|
+
/>
|
|
263
|
+
</CheckboxGroup>
|
|
264
|
+
)}
|
|
265
|
+
/>
|
|
266
|
+
</>
|
|
267
|
+
)}
|
|
268
|
+
</ResponsiveWrapper>
|
|
269
|
+
);
|
|
270
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Controller, Control } from 'react-hook-form';
|
|
4
|
+
import { ResponsiveWrapper } from '@openmrs/esm-framework';
|
|
5
|
+
import { Column, CheckboxGroup, InlineLoading } from '@carbon/react';
|
|
6
|
+
import { filterRolesConfig, RoleConfigCategory } from '../user-management.utils';
|
|
7
|
+
import type { UserFormSchema } from '../hooks/useUserManagementForm';
|
|
8
|
+
import type { Role } from '../../../../types';
|
|
9
|
+
import styles from '../user-management.workspace.scss';
|
|
10
|
+
|
|
11
|
+
interface RolesSectionProps {
|
|
12
|
+
control: Control<UserFormSchema>;
|
|
13
|
+
roles: Role[];
|
|
14
|
+
rolesConfig: RoleConfigCategory[];
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const RolesSection: React.FC<RolesSectionProps> = ({ control, roles, rolesConfig, isLoading }) => {
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
const filteredRolesConfig = filterRolesConfig(rolesConfig);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<ResponsiveWrapper>
|
|
24
|
+
<span className={styles.formHeaderSection}>{t('rolesInfo', 'Roles Info')}</span>
|
|
25
|
+
<ResponsiveWrapper>
|
|
26
|
+
{filteredRolesConfig.map((category) => (
|
|
27
|
+
<Column key={category.category} xsm={8} md={12} lg={12} className={styles.checkBoxColumn}>
|
|
28
|
+
<CheckboxGroup legendText={category.category} className={styles.checkboxGroupGrid}>
|
|
29
|
+
{isLoading ? (
|
|
30
|
+
<InlineLoading status="active" iconDescription="Loading" description="Loading data..." />
|
|
31
|
+
) : (
|
|
32
|
+
<Controller
|
|
33
|
+
name="roles"
|
|
34
|
+
control={control}
|
|
35
|
+
render={({ field }) => {
|
|
36
|
+
const selectedRoles = field.value || [];
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
{roles
|
|
41
|
+
.filter((role) => category.roles.includes(role.name))
|
|
42
|
+
.map((role) => {
|
|
43
|
+
const isSelected = selectedRoles.some(
|
|
44
|
+
(r) =>
|
|
45
|
+
r.display === role.display &&
|
|
46
|
+
r.description === role.description &&
|
|
47
|
+
r.uuid === role.uuid,
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<label
|
|
52
|
+
key={role.display}
|
|
53
|
+
className={isSelected ? styles.checkboxLabelSelected : styles.checkboxLabel}>
|
|
54
|
+
<input
|
|
55
|
+
type="checkbox"
|
|
56
|
+
id={role.display}
|
|
57
|
+
checked={isSelected}
|
|
58
|
+
onChange={(e) => {
|
|
59
|
+
const updatedValue = e.target.checked
|
|
60
|
+
? [
|
|
61
|
+
...selectedRoles,
|
|
62
|
+
{
|
|
63
|
+
uuid: role.uuid,
|
|
64
|
+
display: role.display,
|
|
65
|
+
description: role.description ?? null,
|
|
66
|
+
},
|
|
67
|
+
]
|
|
68
|
+
: selectedRoles.filter((selectedRole) => selectedRole.display !== role.display);
|
|
69
|
+
|
|
70
|
+
field.onChange(updatedValue);
|
|
71
|
+
}}
|
|
72
|
+
/>
|
|
73
|
+
{role.display}
|
|
74
|
+
</label>
|
|
75
|
+
);
|
|
76
|
+
})}
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
)}
|
|
82
|
+
</CheckboxGroup>
|
|
83
|
+
</Column>
|
|
84
|
+
))}
|
|
85
|
+
</ResponsiveWrapper>
|
|
86
|
+
</ResponsiveWrapper>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@use '@carbon/layout';
|
|
2
|
+
@use '@carbon/type';
|
|
3
|
+
@use '@carbon/colors';
|
|
4
|
+
@use '@openmrs/esm-styleguide/src/vars' as *;
|
|
5
|
+
|
|
6
|
+
.patientName {
|
|
7
|
+
@include type.type-style('label-02');
|
|
8
|
+
color: colors.$gray-100;
|
|
9
|
+
font-weight: 800;
|
|
10
|
+
margin-left: layout.$spacing-04;
|
|
11
|
+
margin-right: layout.$spacing-01;
|
|
12
|
+
}
|
|
13
|
+
.middot {
|
|
14
|
+
margin: 0 layout.$spacing-01;
|
|
15
|
+
}
|
|
16
|
+
.spanField {
|
|
17
|
+
margin-left: layout.$spacing-04;
|
|
18
|
+
margin-right: layout.$spacing-01;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.gender {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
color: colors.$gray-70;
|
|
25
|
+
gap: layout.$spacing-01;
|
|
26
|
+
margin-left: layout.$spacing-02;
|
|
27
|
+
}
|
|
28
|
+
.statusTag {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
color: colors.$gray-70;
|
|
32
|
+
gap: layout.$spacing-01;
|
|
33
|
+
margin-left: layout.$spacing-02;
|
|
34
|
+
}
|
|
35
|
+
.demographics {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
margin-bottom: layout.$spacing-02;
|
|
39
|
+
color: $text-02;
|
|
40
|
+
text-transform: uppercase;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.patientBanner {
|
|
44
|
+
display: flex;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.patientInfo {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
width: 100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.flexRow {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-flow: row wrap;
|
|
56
|
+
align-items: center;
|
|
57
|
+
margin-top: layout.$spacing-04;
|
|
58
|
+
}
|
|
59
|
+
.patientAvatar {
|
|
60
|
+
margin-top: layout.$spacing-06;
|
|
61
|
+
}
|
|
62
|
+
.viewRoles {
|
|
63
|
+
margin-top: layout.$spacing-06;
|
|
64
|
+
}
|
|
65
|
+
.roleContainer {
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
gap: 0.5rem;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.roleDescription {
|
|
72
|
+
margin: 0;
|
|
73
|
+
color: colors.$gray-70;
|
|
74
|
+
font-size: type.type-scale(1);
|
|
75
|
+
}
|