@ampath/esm-patient-registration-app 6.0.1-pre.96 → 9.2.0-next.12

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.
Files changed (288) hide show
  1. package/dist/1119.js +1 -0
  2. package/dist/1197.js +1 -0
  3. package/dist/21.js +1 -0
  4. package/dist/21.js.map +1 -0
  5. package/dist/2146.js +1 -0
  6. package/dist/2372.js +1 -0
  7. package/dist/2372.js.map +1 -0
  8. package/dist/2470.js +1 -0
  9. package/dist/2470.js.map +1 -0
  10. package/dist/2690.js +1 -0
  11. package/dist/2913.js +2 -0
  12. package/dist/{913.js.LICENSE.txt → 2913.js.LICENSE.txt} +3 -23
  13. package/dist/2913.js.map +1 -0
  14. package/dist/3093.js +1 -0
  15. package/dist/3093.js.map +1 -0
  16. package/dist/3099.js +1 -0
  17. package/dist/3144.js +2 -0
  18. package/dist/3144.js.LICENSE.txt +19 -0
  19. package/dist/3144.js.map +1 -0
  20. package/dist/320.js +2 -0
  21. package/dist/{876.js.LICENSE.txt → 320.js.LICENSE.txt} +2 -3
  22. package/dist/320.js.map +1 -0
  23. package/dist/3464.js +1 -0
  24. package/dist/3464.js.map +1 -0
  25. package/dist/3474.js +2 -0
  26. package/dist/3474.js.LICENSE.txt +8 -0
  27. package/dist/3474.js.map +1 -0
  28. package/dist/3584.js +1 -0
  29. package/dist/4041.js +2 -0
  30. package/dist/4041.js.map +1 -0
  31. package/dist/4055.js +1 -0
  32. package/dist/4132.js +1 -0
  33. package/dist/4300.js +1 -0
  34. package/dist/4335.js +1 -0
  35. package/dist/4463.js +1 -0
  36. package/dist/4463.js.map +1 -0
  37. package/dist/4618.js +1 -0
  38. package/dist/4652.js +1 -0
  39. package/dist/4944.js +1 -0
  40. package/dist/5173.js +1 -0
  41. package/dist/5220.js +2 -0
  42. package/dist/5220.js.LICENSE.txt +29 -0
  43. package/dist/5220.js.map +1 -0
  44. package/dist/5241.js +1 -0
  45. package/dist/5442.js +1 -0
  46. package/dist/5661.js +1 -0
  47. package/dist/6022.js +1 -0
  48. package/dist/6078.js +2 -0
  49. package/dist/6078.js.LICENSE.txt +9 -0
  50. package/dist/6078.js.map +1 -0
  51. package/dist/627.js +1 -0
  52. package/dist/627.js.map +1 -0
  53. package/dist/6276.js +1 -0
  54. package/dist/6276.js.map +1 -0
  55. package/dist/6468.js +1 -0
  56. package/dist/6679.js +1 -0
  57. package/dist/6737.js +2 -0
  58. package/dist/6737.js.LICENSE.txt +9 -0
  59. package/dist/6737.js.map +1 -0
  60. package/dist/6840.js +1 -0
  61. package/dist/6859.js +1 -0
  62. package/dist/7092.js +1 -0
  63. package/dist/7092.js.map +1 -0
  64. package/dist/7097.js +1 -0
  65. package/dist/7159.js +1 -0
  66. package/dist/723.js +1 -0
  67. package/dist/7495.js +2 -0
  68. package/dist/7495.js.LICENSE.txt +9 -0
  69. package/dist/7495.js.map +1 -0
  70. package/dist/7617.js +1 -0
  71. package/dist/795.js +1 -0
  72. package/dist/8163.js +1 -0
  73. package/dist/8349.js +1 -0
  74. package/dist/8404.js +2 -0
  75. package/dist/{629.js.LICENSE.txt → 8404.js.LICENSE.txt} +9 -3
  76. package/dist/8404.js.map +1 -0
  77. package/dist/8434.js +1 -0
  78. package/dist/8434.js.map +1 -0
  79. package/dist/8618.js +1 -0
  80. package/dist/89.js +2 -0
  81. package/dist/89.js.LICENSE.txt +9 -0
  82. package/dist/89.js.map +1 -0
  83. package/dist/890.js +1 -0
  84. package/dist/9214.js +1 -0
  85. package/dist/9538.js +1 -0
  86. package/dist/9569.js +1 -0
  87. package/dist/986.js +1 -0
  88. package/dist/9876.js +1 -0
  89. package/dist/9876.js.map +1 -0
  90. package/dist/9879.js +1 -0
  91. package/dist/9895.js +1 -0
  92. package/dist/9900.js +1 -0
  93. package/dist/9913.js +1 -0
  94. package/dist/main.js +1 -1
  95. package/dist/main.js.LICENSE.txt +36 -1
  96. package/dist/main.js.map +1 -1
  97. package/dist/openmrs-esm-patient-registration-app.js +1 -0
  98. package/dist/openmrs-esm-patient-registration-app.js.buildmanifest.json +1576 -0
  99. package/dist/openmrs-esm-patient-registration-app.js.map +1 -0
  100. package/dist/routes.json +1 -1
  101. package/package.json +16 -15
  102. package/src/{add-patient-link.tsx → add-patient-link.extension.tsx} +4 -2
  103. package/src/add-patient-link.test.tsx +6 -10
  104. package/src/config-schema.ts +109 -55
  105. package/src/constants.ts +1 -1
  106. package/src/declarations.d.ts +5 -4
  107. package/src/index.ts +10 -29
  108. package/src/nav-link.test.tsx +3 -3
  109. package/src/offline.resources.ts +26 -18
  110. package/src/patient-photo.extension.tsx +3 -1
  111. package/src/patient-registration/field/address/address-field.component.tsx +58 -37
  112. package/src/patient-registration/field/address/address-hierarchy-levels.component.tsx +16 -18
  113. package/src/patient-registration/field/address/address-hierarchy.resource.tsx +3 -3
  114. package/src/patient-registration/field/address/address-hierarchy.test.tsx +290 -0
  115. package/src/patient-registration/field/address/address-search.component.tsx +7 -5
  116. package/src/patient-registration/field/address/address-search.scss +5 -5
  117. package/src/patient-registration/field/address/address-search.test.tsx +140 -0
  118. package/src/patient-registration/field/cause-of-death/cause-of-death.component.tsx +98 -0
  119. package/src/patient-registration/field/custom-field.component.tsx +3 -9
  120. package/src/patient-registration/field/date-and-time-of-death/date-and-time-of-death.component.tsx +84 -0
  121. package/src/patient-registration/field/dob/dob.component.tsx +55 -50
  122. package/src/patient-registration/field/dob/dob.test.tsx +90 -0
  123. package/src/patient-registration/field/field.component.tsx +12 -6
  124. package/src/patient-registration/field/field.resource.ts +11 -4
  125. package/src/patient-registration/field/field.scss +69 -25
  126. package/src/patient-registration/field/field.test.tsx +329 -0
  127. package/src/patient-registration/field/gender/gender-field.component.tsx +14 -9
  128. package/src/patient-registration/field/gender/gender-field.test.tsx +73 -33
  129. package/src/patient-registration/field/id/id-field.component.tsx +24 -23
  130. package/src/patient-registration/field/id/id-field.test.tsx +147 -0
  131. package/src/patient-registration/field/id/identifier-selection-overlay.component.tsx +12 -10
  132. package/src/patient-registration/field/id/identifier-selection.scss +12 -8
  133. package/src/patient-registration/field/name/name-field.component.tsx +10 -5
  134. package/src/patient-registration/field/obs/obs-field.component.tsx +59 -2
  135. package/src/patient-registration/field/obs/obs-field.test.tsx +133 -39
  136. package/src/patient-registration/field/person-attributes/coded-person-attribute-field.component.tsx +3 -3
  137. package/src/patient-registration/field/person-attributes/coded-person-attribute-field.test.tsx +141 -0
  138. package/src/patient-registration/field/person-attributes/location-person-attribute-field.component.tsx +105 -0
  139. package/src/patient-registration/field/person-attributes/location-person-attribute-field.resource.tsx +48 -0
  140. package/src/patient-registration/field/person-attributes/person-attribute-field.component.tsx +19 -22
  141. package/src/patient-registration/field/person-attributes/person-attribute-field.test.tsx +193 -0
  142. package/src/patient-registration/field/person-attributes/text-person-attribute-field.test.tsx +90 -0
  143. package/src/patient-registration/form-manager.test.ts +91 -0
  144. package/src/patient-registration/form-manager.ts +49 -23
  145. package/src/patient-registration/input/basic-input/input/input.component.tsx +6 -2
  146. package/src/patient-registration/input/basic-input/select/select-input.test.tsx +49 -0
  147. package/src/patient-registration/input/custom-input/autosuggest/autosuggest.scss +5 -5
  148. package/src/patient-registration/input/custom-input/autosuggest/autosuggest.test.tsx +164 -0
  149. package/src/patient-registration/input/custom-input/identifier/identifier-input.component.tsx +73 -36
  150. package/src/patient-registration/input/custom-input/identifier/identifier-input.test.tsx +335 -0
  151. package/src/patient-registration/input/dummy-data/dummy-data-input.component.tsx +3 -0
  152. package/src/patient-registration/input/dummy-data/dummy-data-input.test.tsx +2 -11
  153. package/src/patient-registration/input/input.scss +17 -13
  154. package/src/patient-registration/patient-registration-context.ts +22 -11
  155. package/src/patient-registration/patient-registration-hooks.ts +158 -193
  156. package/src/patient-registration/patient-registration-utils.test.ts +33 -0
  157. package/src/patient-registration/patient-registration-utils.ts +11 -13
  158. package/src/patient-registration/patient-registration.component.tsx +87 -103
  159. package/src/patient-registration/{patient-registration.resource.testt.tsx → patient-registration.resource.test.tsx} +0 -4
  160. package/src/patient-registration/patient-registration.resource.ts +27 -3
  161. package/src/patient-registration/patient-registration.scss +27 -38
  162. package/src/patient-registration/patient-registration.test.tsx +579 -0
  163. package/src/patient-registration/patient-registration.types.ts +23 -25
  164. package/src/patient-registration/section/death-info/death-info-section.component.tsx +22 -17
  165. package/src/patient-registration/section/death-info/death-info-section.test.tsx +47 -0
  166. package/src/patient-registration/section/demographics/demographics-section.component.tsx +5 -5
  167. package/src/patient-registration/section/demographics/demographics-section.test.tsx +98 -0
  168. package/src/patient-registration/section/patient-relationships/relationships-section.component.tsx +8 -7
  169. package/src/patient-registration/section/patient-relationships/relationships-section.test.tsx +113 -0
  170. package/src/patient-registration/section/patient-relationships/relationships.resource.tsx +28 -28
  171. package/src/patient-registration/section/patient-relationships/relationships.scss +4 -4
  172. package/src/patient-registration/section/section-wrapper.component.tsx +1 -1
  173. package/src/patient-registration/section/section.component.tsx +1 -1
  174. package/src/patient-registration/section/section.scss +21 -1
  175. package/src/patient-registration/ui-components/overlay/overlay.scss +8 -8
  176. package/src/patient-registration/validation/{patient-registration-validation.test.tsx → patient-registration-validation.test.ts} +71 -23
  177. package/src/patient-registration/validation/patient-registration-validation.ts +123 -0
  178. package/src/resources-context.ts +14 -0
  179. package/src/root.component.tsx +3 -3
  180. package/src/routes.json +10 -24
  181. package/src/widgets/cancel-patient-edit.modal.tsx +33 -0
  182. package/src/widgets/cancel-patient-edit.test.tsx +22 -0
  183. package/src/widgets/delete-identifier-confirmation.modal.tsx +48 -0
  184. package/src/widgets/{delete-identifier-confirmation-modal.testt.tsx → delete-identifier-confirmation.test.tsx} +5 -7
  185. package/src/widgets/edit-patient-details-button.component.tsx +0 -1
  186. package/src/widgets/edit-patient-details-button.test.tsx +35 -0
  187. package/translations/am.json +43 -35
  188. package/translations/ar.json +41 -33
  189. package/translations/ar_SY.json +119 -0
  190. package/translations/bn.json +119 -0
  191. package/translations/de.json +119 -0
  192. package/translations/en.json +44 -42
  193. package/translations/en_US.json +119 -0
  194. package/translations/es.json +69 -57
  195. package/translations/es_MX.json +119 -0
  196. package/translations/fr.json +74 -58
  197. package/translations/he.json +44 -40
  198. package/translations/hi.json +119 -0
  199. package/translations/hi_IN.json +119 -0
  200. package/translations/id.json +119 -0
  201. package/translations/it.json +119 -0
  202. package/translations/ka.json +119 -0
  203. package/translations/km.json +44 -40
  204. package/translations/ku.json +119 -0
  205. package/translations/ky.json +119 -0
  206. package/translations/lg.json +119 -0
  207. package/translations/ne.json +119 -0
  208. package/translations/pl.json +119 -0
  209. package/translations/pt.json +119 -0
  210. package/translations/pt_BR.json +119 -0
  211. package/translations/qu.json +119 -0
  212. package/translations/ro_RO.json +119 -0
  213. package/translations/ru_RU.json +119 -0
  214. package/translations/si.json +119 -0
  215. package/translations/sw.json +119 -0
  216. package/translations/sw_KE.json +119 -0
  217. package/translations/tr.json +119 -0
  218. package/translations/tr_TR.json +119 -0
  219. package/translations/uk.json +119 -0
  220. package/translations/uz.json +119 -0
  221. package/translations/uz@Latn.json +119 -0
  222. package/translations/uz_UZ.json +119 -0
  223. package/translations/vi.json +119 -0
  224. package/translations/zh.json +45 -23
  225. package/translations/zh_CN.json +39 -17
  226. package/.turbo/turbo-build.log +0 -40
  227. package/dist/132.js +0 -1
  228. package/dist/197.js +0 -1
  229. package/dist/236.js +0 -1
  230. package/dist/236.js.map +0 -1
  231. package/dist/300.js +0 -1
  232. package/dist/335.js +0 -1
  233. package/dist/372.js +0 -1
  234. package/dist/372.js.map +0 -1
  235. package/dist/41.js +0 -2
  236. package/dist/41.js.map +0 -1
  237. package/dist/449.js +0 -1
  238. package/dist/449.js.map +0 -1
  239. package/dist/464.js +0 -1
  240. package/dist/464.js.map +0 -1
  241. package/dist/495.js +0 -1
  242. package/dist/495.js.map +0 -1
  243. package/dist/55.js +0 -1
  244. package/dist/56.js +0 -1
  245. package/dist/56.js.map +0 -1
  246. package/dist/621.js +0 -1
  247. package/dist/621.js.map +0 -1
  248. package/dist/629.js +0 -2
  249. package/dist/629.js.map +0 -1
  250. package/dist/652.js +0 -1
  251. package/dist/661.js +0 -1
  252. package/dist/757.js +0 -1
  253. package/dist/757.js.map +0 -1
  254. package/dist/828.js +0 -1
  255. package/dist/828.js.map +0 -1
  256. package/dist/830.js +0 -1
  257. package/dist/830.js.map +0 -1
  258. package/dist/831.js +0 -2
  259. package/dist/831.js.LICENSE.txt +0 -3
  260. package/dist/831.js.map +0 -1
  261. package/dist/876.js +0 -2
  262. package/dist/876.js.map +0 -1
  263. package/dist/879.js +0 -1
  264. package/dist/913.js +0 -2
  265. package/dist/913.js.map +0 -1
  266. package/dist/927.js +0 -1
  267. package/dist/927.js.map +0 -1
  268. package/dist/99.js +0 -1
  269. package/dist/ampath-esm-patient-registration-app.js +0 -1
  270. package/dist/ampath-esm-patient-registration-app.js.buildmanifest.json +0 -694
  271. package/dist/ampath-esm-patient-registration-app.js.map +0 -1
  272. package/src/patient-registration/date-util.ts +0 -52
  273. package/src/patient-registration/field/person-attributes/custom-person-attribute-field.component.tsx +0 -56
  274. package/src/patient-registration/validation/patient-registration-validation.tsx +0 -60
  275. package/src/patient-verification/assets/counties.json +0 -236
  276. package/src/patient-verification/assets/verification-assets.ts +0 -11
  277. package/src/patient-verification/patient-verification-hook.tsx +0 -176
  278. package/src/patient-verification/patient-verification-utils.ts +0 -179
  279. package/src/patient-verification/patient-verification.component.tsx +0 -124
  280. package/src/patient-verification/patient-verification.scss +0 -25
  281. package/src/patient-verification/verification-modal/confirm-prompt.component.tsx +0 -72
  282. package/src/patient-verification/verification-modal/empty-prompt.component.tsx +0 -35
  283. package/src/patient-verification/verification-types.ts +0 -50
  284. package/src/widgets/cancel-patient-edit.component.tsx +0 -37
  285. package/src/widgets/delete-identifier-confirmation-modal.tsx +0 -41
  286. package/src/widgets/delete-identifier-modal.scss +0 -34
  287. /package/dist/{41.js.LICENSE.txt → 4041.js.LICENSE.txt} +0 -0
  288. /package/src/patient-registration/input/custom-input/identifier/{utils.testt.ts → utils.test.ts} +0 -0
@@ -1,179 +0,0 @@
1
- import { showModal } from '@openmrs/esm-framework';
2
- import { type FormikProps } from 'formik';
3
- import { type ClientRegistryPatient, type RegistryPatient } from './verification-types';
4
- import counties from './assets/counties.json';
5
- import { type FormValues } from '../patient-registration/patient-registration.types';
6
- import { capitalize } from 'lodash-es';
7
-
8
- export function handleClientRegistryResponse(
9
- clientResponse: ClientRegistryPatient,
10
- props: FormikProps<FormValues>,
11
- searchTerm: string,
12
- ) {
13
- if (clientResponse?.clientExists === false) {
14
- const nupiIdentifiers = {
15
- ['nationalId']: {
16
- initialValue: searchTerm,
17
- identifierUuid: undefined,
18
- selectedSource: { uuid: '', name: '' },
19
- preferred: false,
20
- required: false,
21
- identifierTypeUuid: '58a47054-1359-11df-a1f1-0026b9348838',
22
- identifierName: 'Kenyan National ID Number',
23
- identifierValue: searchTerm,
24
- },
25
- };
26
- const dispose = showModal('empty-client-registry-modal', {
27
- onConfirm: () => {
28
- props.setValues({ ...props.values, identifiers: { ...props.values.identifiers, ...nupiIdentifiers } });
29
- dispose();
30
- },
31
- close: () => dispose(),
32
- });
33
- }
34
-
35
- if (clientResponse?.clientExists) {
36
- const {
37
- client: {
38
- middleName,
39
- lastName,
40
- firstName,
41
- contact,
42
- country,
43
- countyOfBirth,
44
- residence,
45
- identifications,
46
- gender,
47
- dateOfBirth,
48
- isAlive,
49
- clientNumber,
50
- educationLevel,
51
- occupation,
52
- maritalStatus,
53
- },
54
- } = clientResponse;
55
-
56
- const nupiIdentifiers = {
57
- ['nationalId']: {
58
- initialValue: identifications !== undefined && identifications[0]?.identificationNumber,
59
- identifierUuid: undefined,
60
- selectedSource: { uuid: '', name: '' },
61
- preferred: false,
62
- required: false,
63
- identifierTypeUuid: '58a47054-1359-11df-a1f1-0026b9348838',
64
- identifierName: 'Kenyan National ID Number',
65
- identifierValue: identifications !== undefined && identifications[0]?.identificationNumber,
66
- },
67
-
68
- ['nationalUniquePatientIdentifier']: {
69
- identifierTypeUuid: 'cba702b9-4664-4b43-83f1-9ab473cbd64d',
70
- identifierName: 'National Unique Patient Identifier (NUPI)',
71
- identifierValue: clientNumber,
72
- initialValue: clientNumber,
73
- identifierUuid: undefined,
74
- selectedSource: { uuid: '', name: '' },
75
- preferred: false,
76
- required: false,
77
- },
78
- };
79
-
80
- const dispose = showModal('confirm-client-registry-modal', {
81
- onConfirm: () => {
82
- props.setValues({
83
- ...props.values,
84
- familyName: lastName,
85
- middleName: middleName,
86
- givenName: firstName,
87
- gender: clientResponse.client.gender,
88
- birthdate: new Date(dateOfBirth),
89
- isDead: !isAlive,
90
- attributes: {
91
- '72a759a8-1359-11df-a1f1-0026b9348838': contact?.primaryPhone,
92
- 'b0a08406-09c0-4f8b-8cb5-b22b6d4a8e46': contact?.secondaryPhone,
93
- '2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa': contact?.emailAddress ?? '',
94
- },
95
- address: {
96
- address1: residence?.address,
97
- address2: '',
98
- address4: capitalize(residence?.ward ?? ''),
99
- cityVillage: residence?.village,
100
- stateProvince: capitalize(residence?.subCounty ?? ''),
101
- countyDistrict: counties.find((county) => county.code === parseInt(residence?.county))?.name,
102
- country: 'Kenya',
103
- postalCode: residence?.address,
104
- },
105
- identifiers: { ...props.values.identifiers, ...nupiIdentifiers },
106
- obs: {
107
- 'a899a9f2-1350-11df-a1f1-0026b9348838':
108
- props.values.concepts.find((concept) =>
109
- concept.display?.toLowerCase()?.includes(clientResponse.client.maritalStatus?.toLowerCase()),
110
- )?.uuid ?? '',
111
- 'a89e48ae-1350-11df-a1f1-0026b9348838':
112
- props.values.concepts.find((concept) =>
113
- concept.display?.toLowerCase()?.includes(clientResponse.client.educationLevel?.toLowerCase()),
114
- )?.uuid ?? '',
115
- 'a8a0a00e-1350-11df-a1f1-0026b9348838':
116
- clientResponse.client.occupation === undefined || clientResponse.client.occupation === null
117
- ? 'a899e0ac-1350-11df-a1f1-0026b9348838'
118
- : props.values.concepts.find(
119
- (concept) => concept.display?.toLowerCase() === clientResponse.client.occupation?.toLowerCase(),
120
- )?.uuid ?? 'a8aaf3e2-1350-11df-a1f1-0026b9348838',
121
- },
122
- });
123
- dispose();
124
- },
125
- close: () => dispose(),
126
- patient: clientResponse.client,
127
- });
128
- }
129
- }
130
-
131
- export function generateNUPIPayload(formValues: FormValues): RegistryPatient {
132
- const educationLevel = formValues.concepts.find(
133
- (concept) => concept.uuid === formValues.obs['a89e48ae-1350-11df-a1f1-0026b9348838'],
134
- );
135
- const occupation = formValues.concepts.find(
136
- (concept) => concept.uuid === formValues.obs['a8a0a00e-1350-11df-a1f1-0026b9348838'],
137
- );
138
- const maritalStatus = formValues.concepts.find(
139
- (concept) => concept.uuid === formValues.obs['a899a9f2-1350-11df-a1f1-0026b9348838'],
140
- );
141
-
142
- let createRegistryPatient: RegistryPatient = {
143
- firstName: formValues?.givenName,
144
- middleName: formValues?.middleName,
145
- lastName: formValues?.familyName,
146
- gender: formValues?.gender === 'Male' ? 'male' : 'female',
147
- dateOfBirth: new Date(formValues.birthdate).toISOString(),
148
- isAlive: !formValues.isDead,
149
- residence: {
150
- county: `0${counties.find((county) => county.name.includes(formValues.address['countyDistrict']))?.code}`,
151
- subCounty: formValues.address['stateProvince']?.toLocaleLowerCase(),
152
- ward: formValues.address['address4']?.toLocaleLowerCase(),
153
- village: formValues.address['cityVillage'],
154
- landmark: formValues.address['address2'],
155
- address: formValues.address['postalCode'],
156
- },
157
- nextOfKins: [],
158
- contact: {
159
- primaryPhone: formValues.attributes['72a759a8-1359-11df-a1f1-0026b9348838'],
160
- secondaryPhone: formValues.attributes['b0a08406-09c0-4f8b-8cb5-b22b6d4a8e46'],
161
- emailAddress: formValues.attributes['2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa'],
162
- },
163
- country: 'KE',
164
- countyOfBirth: `0${counties.find((county) => county.name.includes(formValues.address['countyDistrict']))?.code}`,
165
- educationLevel: educationLevel?.display?.toLowerCase() ?? '',
166
- religion: '',
167
- occupation: occupation?.display?.toLowerCase() ?? '',
168
- maritalStatus: maritalStatus?.display?.toLowerCase() ?? '',
169
- originFacilityKmflCode: '',
170
- nascopCCCNumber: '',
171
- identifications: [
172
- {
173
- identificationType: 'national-id',
174
- identificationNumber: formValues.identifiers['nationalId']?.identifierValue,
175
- },
176
- ],
177
- };
178
- return createRegistryPatient;
179
- }
@@ -1,124 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { Tile, ComboBox, Layer, Button, Search, InlineLoading, InlineNotification } from '@carbon/react';
4
- import styles from './patient-verification.scss';
5
- import { countries, verificationIdentifierTypes } from './assets/verification-assets';
6
- import { searchClientRegistry, useGlobalProperties } from './patient-verification-hook';
7
- import { showSnackbar, showToast } from '@openmrs/esm-framework';
8
- import { handleClientRegistryResponse } from './patient-verification-utils';
9
- import { type FormikProps } from 'formik';
10
- import { type FormValues } from '../patient-registration/patient-registration.types';
11
-
12
- interface PatientVerificationProps {
13
- props: FormikProps<FormValues>;
14
- setInitialFormValues: React.Dispatch<FormValues>;
15
- }
16
-
17
- const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
18
- const { t } = useTranslation();
19
- const { data, isLoading, error } = useGlobalProperties();
20
- const [verificationCriteria, setVerificationCriteria] = useState({
21
- searchTerm: '',
22
- identifierType: '',
23
- countryCode: 'KE',
24
- });
25
- const [isLoadingSearch, setIsLoadingSearch] = useState(false);
26
-
27
- const handleSearch = async () => {
28
- setIsLoadingSearch(true);
29
- try {
30
- const clientRegistryResponse = await searchClientRegistry(
31
- verificationCriteria.identifierType,
32
- verificationCriteria.searchTerm,
33
- props.values.token,
34
- verificationCriteria.countryCode,
35
- );
36
- setIsLoadingSearch(false);
37
-
38
- handleClientRegistryResponse(clientRegistryResponse, props, verificationCriteria.searchTerm);
39
- } catch (error) {
40
- showSnackbar({
41
- title: 'Client registry error',
42
- subtitle: `Please reload the registration page and re-try again, if the issue persist contact system administrator`,
43
- timeoutInMs: 10000,
44
- kind: 'error',
45
- isLowContrast: true,
46
- });
47
- setIsLoadingSearch(false);
48
- }
49
- };
50
-
51
- return (
52
- <div id={'patientVerification'}>
53
- <h3 className={styles.productiveHeading02} style={{ color: '#161616' }}>
54
- {t('clientVerificationWithClientRegistry', 'Client verification with client registry')}
55
- </h3>
56
- <div style={{ margin: '1rem 0 1rem' }}>
57
- <Layer>
58
- {isLoading && <InlineLoading status="active" iconDescription="Loading" description="Loading data..." />}
59
- </Layer>
60
- {error && (
61
- <InlineNotification
62
- className={styles.errorWrapper}
63
- aria-label="closes notification"
64
- kind="error"
65
- lowContrast
66
- statusIconDescription="notification"
67
- subtitle={t(
68
- 'clientRegistryErrorSubtitle',
69
- 'Please proceed with registration contact system admin and try again later',
70
- )}
71
- title={t('clientRegistryError', 'Error occurred while reaching the client registry')}
72
- />
73
- )}
74
- <Tile className={styles.verificationWrapper}>
75
- <Layer>
76
- <ComboBox
77
- ariaLabel={t('selectCountry', 'Select country')}
78
- id="selectCountry"
79
- items={countries}
80
- itemToString={(item) => item?.name ?? ''}
81
- label="Select country"
82
- titleText={t('selectCountry', 'Select country')}
83
- initialSelectedItem={countries[0]}
84
- onChange={({ selectedItem }) =>
85
- setVerificationCriteria({ ...verificationCriteria, countryCode: selectedItem?.initials })
86
- }
87
- />
88
- </Layer>
89
- <Layer>
90
- <ComboBox
91
- ariaLabel={t('selectIdentifierType', 'Select identifier type')}
92
- id="selectIdentifierType"
93
- items={verificationIdentifierTypes}
94
- itemToString={(item) => item?.name ?? ''}
95
- label="Select identifier type"
96
- titleText={t('selectIdentifierType', 'Select identifier type')}
97
- onChange={({ selectedItem }) =>
98
- setVerificationCriteria({ ...verificationCriteria, identifierType: selectedItem?.value })
99
- }
100
- />
101
- </Layer>
102
- <Layer>
103
- <Search
104
- id="clientRegistrySearch"
105
- autoFocus
106
- placeHolderText={t('searchClientRegistry', 'Search client registry')}
107
- disabled={!verificationCriteria.identifierType}
108
- onChange={(event) => setVerificationCriteria({ ...verificationCriteria, searchTerm: event.target.value })}
109
- />
110
- </Layer>
111
- {!isLoadingSearch ? (
112
- <Button disabled={!verificationCriteria.identifierType && !isLoading} size="md" onClick={handleSearch}>
113
- {t('validate', 'Validate')}
114
- </Button>
115
- ) : (
116
- <InlineLoading status="active" iconDescription="Loading" description="Searching client registry" />
117
- )}
118
- </Tile>
119
- </div>
120
- </div>
121
- );
122
- };
123
-
124
- export default PatientVerification;
@@ -1,25 +0,0 @@
1
- @use '@carbon/colors';
2
- @import '../patient-registration/patient-registration.scss';
3
-
4
- /* Desktop */
5
- :global(.omrs-breakpoint-gt-tablet) {
6
- .verificationWrapper {
7
- display: grid;
8
- grid-template-columns: 1fr 1fr 1fr 1fr;
9
- column-gap: 0.325rem;
10
- align-items: flex-end;
11
- }
12
- }
13
-
14
- /* Tablet */
15
- :global(.omrs-breakpoint-lt-desktop) {
16
- .verificationWrapper {
17
- row-gap: 0.5rem;
18
- display: flex;
19
- flex-direction: column;
20
- }
21
- }
22
-
23
- .errorWrapper {
24
- margin: 0 0 1rem 0;
25
- }
@@ -1,72 +0,0 @@
1
- import React from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { Button } from '@carbon/react';
4
- import { age, ExtensionSlot, formatDate } from '@openmrs/esm-framework';
5
- import capitalize from 'lodash-es/capitalize';
6
- import { useFacilityName } from '../patient-verification-hook';
7
-
8
- const PatientInfo: React.FC<{ label: string; value: string }> = ({ label, value }) => {
9
- return (
10
- <div style={{ display: 'grid', gridTemplateColumns: '0.25fr 0.75fr', margin: '0.25rem' }}>
11
- <span style={{ minWidth: '5rem', fontWeight: 'bold' }}>{label}</span>
12
- <span>{value}</span>
13
- </div>
14
- );
15
- };
16
-
17
- interface ConfirmPromptProps {
18
- onConfirm: void;
19
- close: void;
20
- patient: any;
21
- }
22
-
23
- const ConfirmPrompt: React.FC<ConfirmPromptProps> = ({ close, onConfirm, patient }) => {
24
- const { t } = useTranslation();
25
- return (
26
- <>
27
- <div className="cds--modal-header">
28
- <h3 className="cds--modal-header__heading">
29
- {t('clientRegistryEmpty', `Patient ${patient?.firstName} ${patient?.lastName} found`)}
30
- </h3>
31
- </div>
32
- <div className="cds--modal-content">
33
- <p>
34
- {t(
35
- 'patientDetailsFound',
36
- 'Patient information found in the registry, do you want to use the information to continue with registration?',
37
- )}
38
- </p>
39
- <div style={{ display: 'flex', margin: '1rem' }}>
40
- <ExtensionSlot
41
- style={{ display: 'flex', alignItems: 'center' }}
42
- name="patient-photo-slot"
43
- state={{ patientName: `${patient?.firstName} ${patient?.lastName}` }}
44
- />
45
- <div style={{ width: '100%', marginLeft: '0.625rem' }}>
46
- <PatientInfo
47
- label={t('patientName', 'Patient name')}
48
- value={`${patient?.firstName} ${patient?.lastName}`}
49
- />
50
- <PatientInfo
51
- label={t('nationalId', 'National ID')}
52
- value={patient?.identifications[0]?.identificationNumber}
53
- />
54
- <PatientInfo label={t('age', 'Age')} value={age(patient?.dateOfBirth)} />
55
- <PatientInfo label={t('dateOfBirth', 'Date of birth')} value={formatDate(new Date(patient?.dateOfBirth))} />
56
- <PatientInfo label={t('gender', 'Gender')} value={capitalize(patient?.gender)} />
57
- <PatientInfo label={t('nupi', 'NUPI')} value={patient?.clientNumber} />
58
- <PatientInfo label={t('shaNumber', 'SHA Number')} value={'--'} />
59
- </div>
60
- </div>
61
- </div>
62
- <div className="cds--modal-footer">
63
- <Button kind="secondary" onClick={close}>
64
- {t('cancel', 'Cancel')}
65
- </Button>
66
- <Button onClick={onConfirm}>{t('useValues', 'Use values')}</Button>
67
- </div>
68
- </>
69
- );
70
- };
71
-
72
- export default ConfirmPrompt;
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { Button } from '@carbon/react';
4
-
5
- interface EmptyPromptProps {
6
- onConfirm: void;
7
- close: void;
8
- }
9
-
10
- const EmptyPrompt: React.FC<EmptyPromptProps> = ({ close, onConfirm }) => {
11
- const { t } = useTranslation();
12
- return (
13
- <>
14
- <div className="cds--modal-header">
15
- <h3 className="cds--modal-header__heading">{t('clientRegistryEmpty', 'Create & Post Patient')}</h3>
16
- </div>
17
- <div className="cds--modal-content">
18
- <p>
19
- {t(
20
- 'patientNotFound',
21
- 'The patient records could not be found in Client registry, do you want to continue to create and post patient to registry',
22
- )}
23
- </p>
24
- </div>
25
- <div className="cds--modal-footer">
26
- <Button kind="secondary" onClick={close}>
27
- {t('cancel', 'Cancel')}
28
- </Button>
29
- <Button onClick={onConfirm}>{t('continue', 'Continue to registration')}</Button>
30
- </div>
31
- </>
32
- );
33
- };
34
-
35
- export default EmptyPrompt;
@@ -1,50 +0,0 @@
1
- export interface ClientIdentification {
2
- identificationType: string;
3
- identificationNumber: string;
4
- }
5
-
6
- interface ClientContact {
7
- primaryPhone: string;
8
- secondaryPhone?: string;
9
- emailAddress?: string;
10
- }
11
-
12
- export interface ClientRegistryPatient {
13
- clientExists: boolean;
14
- client?: RegistryPatient;
15
- }
16
-
17
- export interface RegistryPatient {
18
- clientNumber?: string;
19
- firstName: string;
20
- middleName: string;
21
- lastName: string;
22
- dateOfBirth: string;
23
- maritalStatus?: string;
24
- gender: string;
25
- occupation?: string;
26
- religion?: string;
27
- educationLevel?: string;
28
- country: string;
29
- countyOfBirth?: string;
30
- isAlive: boolean;
31
- originFacilityKmflCode?: string;
32
- isOnART?: string;
33
- nascopCCCNumber?: string;
34
- residence: {
35
- county: string;
36
- subCounty: string;
37
- ward: string;
38
- village: string;
39
- landmark: string;
40
- address: string;
41
- };
42
- identifications: Array<ClientIdentification>;
43
- contact: ClientContact;
44
- nextOfKins: Array<{
45
- name: string;
46
- relationship: string;
47
- residence: string;
48
- contact: ClientContact;
49
- }>;
50
- }
@@ -1,37 +0,0 @@
1
- import React from 'react';
2
- import { Button } from '@carbon/react';
3
- import { useTranslation } from 'react-i18next';
4
-
5
- interface CancelPatientEditProps {
6
- close(): void;
7
- onConfirm(): void;
8
- }
9
-
10
- const CancelPatientEdit: React.FC<CancelPatientEditProps> = ({ close, onConfirm }) => {
11
- const { t } = useTranslation();
12
- return (
13
- <>
14
- <div className="cds--modal-header">
15
- <h3 className="cds--modal-header__heading">{t('discardModalHeader', 'Confirm Discard Changes')}</h3>
16
- </div>
17
- <div className="cds--modal-content">
18
- <p>
19
- {t(
20
- 'discardModalBody',
21
- "The changes you made to this patient's details have not been saved. Discard changes?",
22
- )}
23
- </p>
24
- </div>
25
- <div className="cds--modal-footer">
26
- <Button kind="secondary" onClick={close}>
27
- {t('cancel', 'Cancel')}
28
- </Button>
29
- <Button kind="danger" onClick={onConfirm}>
30
- {t('discard', 'Discard')}
31
- </Button>
32
- </div>
33
- </>
34
- );
35
- };
36
-
37
- export default CancelPatientEdit;
@@ -1,41 +0,0 @@
1
- import React, { useCallback } from 'react';
2
- import styles from './delete-identifier-modal.scss';
3
- import { useTranslation } from 'react-i18next';
4
- import { Button } from '@carbon/react';
5
-
6
- interface DeleteIdentifierConfirmationModalProps {
7
- deleteIdentifier: (x: boolean) => void;
8
- identifierName: string;
9
- identifierValue: string;
10
- }
11
-
12
- const DeleteIdentifierConfirmationModal: React.FC<DeleteIdentifierConfirmationModalProps> = ({
13
- deleteIdentifier,
14
- identifierName,
15
- identifierValue,
16
- }) => {
17
- const { t } = useTranslation();
18
-
19
- return (
20
- <div className={styles.modalContent}>
21
- <h1 className={styles.productiveHeading}>{t('deleteIdentifierModalHeading', 'Remove identifier?')}</h1>
22
- <h3 className={styles.modalSubtitle}>
23
- {identifierName}
24
- {t('deleteIdentifierModalText', ' has a value of ')} {identifierValue}
25
- </h3>
26
- <p className={styles.modalBody}>
27
- {t('confirmIdentifierDeletionText', 'Are you sure you want to remove this identifier?')}
28
- </p>
29
- <div className={styles.buttonSet}>
30
- <Button kind="secondary" size="lg" onClick={() => deleteIdentifier(false)}>
31
- {t('cancel', 'Cancel')}
32
- </Button>
33
- <Button kind="danger" size="lg" onClick={() => deleteIdentifier(true)}>
34
- {t('removeIdentifierButton', 'Remove Identifier')}
35
- </Button>
36
- </div>
37
- </div>
38
- );
39
- };
40
-
41
- export default DeleteIdentifierConfirmationModal;
@@ -1,34 +0,0 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @import '../patient-registration/patient-registration.scss';
4
-
5
- .productiveHeading {
6
- @include type.type-style('heading-compact-02');
7
- }
8
-
9
- .modalContent {
10
- width: 100%;
11
- background-color: $ui-01;
12
- padding: spacing.$spacing-05;
13
- }
14
-
15
- .modalSubtitle {
16
- @include type.type-style('body-compact-01');
17
- }
18
-
19
- .modalBody {
20
- @include type.type-style('body-compact-01');
21
- margin: spacing.$spacing-05 0;
22
- }
23
-
24
- .buttonSet {
25
- display: grid;
26
- grid-template-columns: 1fr 1fr;
27
- margin-left: -(spacing.$spacing-05);
28
- margin-right: -(spacing.$spacing-05);
29
- margin-bottom: -(spacing.$spacing-05);
30
- }
31
-
32
- .buttonSet > button {
33
- max-width: unset !important;
34
- }
File without changes