@pih/esm-referrals-queue-app 2.0.0-pre.9 → 2.1.1-pre.3

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 (254) hide show
  1. package/.turbo/turbo-build.log +39 -0
  2. package/dist/023bd53d342b7463.woff +0 -0
  3. package/dist/02acc4469a2fe2e4.woff2 +0 -0
  4. package/dist/033e03f8663ab9b1.woff +0 -0
  5. package/dist/052607e67da262ec.woff +0 -0
  6. package/dist/081587ca0db8e63f.woff2 +0 -0
  7. package/dist/08cf53c4e5e71cf1.woff2 +0 -0
  8. package/dist/090b2bc014d24ea4.woff2 +0 -0
  9. package/dist/0a28cd0b47497b71.woff +0 -0
  10. package/dist/0a9765a89ff0437d.woff +0 -0
  11. package/dist/0ae92bcea615e948.woff2 +0 -0
  12. package/dist/0be8520d8945b3b7.woff2 +0 -0
  13. package/dist/0bf6b66a8b86b014.woff +0 -0
  14. package/dist/0e7dd073cd8bb0ad.woff2 +0 -0
  15. package/dist/144.js +2 -0
  16. package/dist/144.js.LICENSE.txt +19 -0
  17. package/dist/144.js.map +1 -0
  18. package/dist/14869ac5d1830304.woff2 +0 -0
  19. package/dist/14aaceff85fc8b28.woff2 +0 -0
  20. package/dist/1590052e1cf8f28d.woff +0 -0
  21. package/dist/16f443eed01776ca.woff2 +0 -0
  22. package/dist/173.js +1 -0
  23. package/dist/173.js.map +1 -0
  24. package/dist/183bae0e53a22182.woff2 +0 -0
  25. package/dist/19b239a0bb74b27e.woff +0 -0
  26. package/dist/19c8f94ccd6289f5.woff2 +0 -0
  27. package/dist/1ae86565eab7451c.woff2 +0 -0
  28. package/dist/1c7bf8797e0a9be6.woff2 +0 -0
  29. package/dist/1d9aff9a93a3bb66.woff +0 -0
  30. package/dist/1f266d3619b30f16.woff2 +0 -0
  31. package/dist/1f8c5a4087a524fd.woff2 +0 -0
  32. package/dist/20ba2b23c5c0cd0b.woff2 +0 -0
  33. package/dist/2269d45733c5cf8f.woff +0 -0
  34. package/dist/258ecbd235953099.woff +0 -0
  35. package/dist/295dd01a1fbfee6d.woff2 +0 -0
  36. package/dist/2d7f835ab7c7c764.woff +0 -0
  37. package/dist/2f66cca99eeead63.woff +0 -0
  38. package/dist/2f686985e26e7107.woff2 +0 -0
  39. package/dist/300.js +1 -0
  40. package/dist/315eff729e4ccbd9.woff2 +0 -0
  41. package/dist/32f1e5aadf845e08.woff +0 -0
  42. package/dist/338484e1c850669c.woff +0 -0
  43. package/dist/33b7a82f1e295190.woff +0 -0
  44. package/dist/3674d98ec4a9173d.woff +0 -0
  45. package/dist/368d16e3259bf207.woff2 +0 -0
  46. package/dist/36c49aa341a7079a.woff2 +0 -0
  47. package/dist/36e1e0430475edee.woff2 +0 -0
  48. package/dist/3bc19662b8630ee9.woff2 +0 -0
  49. package/dist/3f645f473b3f8fba.woff2 +0 -0
  50. package/dist/4095df88acae9e98.woff +0 -0
  51. package/dist/41.js +2 -0
  52. package/dist/41.js.map +1 -0
  53. package/dist/4218ac9901b9d36d.woff2 +0 -0
  54. package/dist/4680ba68412e4da9.woff2 +0 -0
  55. package/dist/47d7a8698d562a0e.woff +0 -0
  56. package/dist/47ec6c9dffe776a0.woff +0 -0
  57. package/dist/48e37bd7ebf85a1f.woff2 +0 -0
  58. package/dist/48edfdf51dfb3160.woff +0 -0
  59. package/dist/4a35a2746c8ad7a5.woff +0 -0
  60. package/dist/4e11b8a7c445255f.woff2 +0 -0
  61. package/dist/4ea1f5c3baf89fe3.woff +0 -0
  62. package/dist/4ea99f41c896bf9d.woff +0 -0
  63. package/dist/5005db1d1caf70c7.woff +0 -0
  64. package/dist/528a8e7c1c141a31.woff +0 -0
  65. package/dist/52ca12f5b516d4ea.woff +0 -0
  66. package/dist/534.js +2 -0
  67. package/dist/534.js.LICENSE.txt +30 -0
  68. package/dist/534.js.map +1 -0
  69. package/dist/537ddd61c5c1fce2.woff2 +0 -0
  70. package/dist/5432f7541ec25c34.woff +0 -0
  71. package/dist/54a95d73a9454ba3.woff +0 -0
  72. package/dist/55.js +1 -0
  73. package/dist/56c4118c0907f151.woff2 +0 -0
  74. package/dist/5938bc2ae7ec60c0.woff2 +0 -0
  75. package/dist/594306657c4e44e8.woff +0 -0
  76. package/dist/5a538aa477a66067.woff +0 -0
  77. package/dist/5c6586155f0d278a.woff2 +0 -0
  78. package/dist/60.js +1 -0
  79. package/dist/60.js.map +1 -0
  80. package/dist/60ec587649ba812a.woff2 +0 -0
  81. package/dist/616567cd947eb9dd.woff +0 -0
  82. package/dist/65168b59f44caab4.woff +0 -0
  83. package/dist/65c0982f98374864.woff +0 -0
  84. package/dist/65e6511e035870e1.woff2 +0 -0
  85. package/dist/661425f6798cd16a.woff2 +0 -0
  86. package/dist/66b864fe213caf46.woff2 +0 -0
  87. package/dist/6775fee945132ef9.woff +0 -0
  88. package/dist/68bbd362c8e4983b.woff +0 -0
  89. package/dist/68d6deec87b6b604.woff +0 -0
  90. package/dist/69a7e6d31d390296.woff +0 -0
  91. package/dist/69d087d970ee9455.woff2 +0 -0
  92. package/dist/69fa3fc7363bbc04.woff +0 -0
  93. package/dist/6a1f0178b45b2e9e.woff +0 -0
  94. package/dist/6c6c45e66ff54281.woff2 +0 -0
  95. package/dist/6ffb9ed97b21fdc0.woff +0 -0
  96. package/dist/7073a7323e92bd11.woff2 +0 -0
  97. package/dist/718c6cc31274ab1a.woff2 +0 -0
  98. package/dist/726.js +1 -0
  99. package/dist/726.js.map +1 -0
  100. package/dist/72cdbedfe04be9f9.woff2 +0 -0
  101. package/dist/746.js +2 -0
  102. package/dist/{147.js.LICENSE.txt → 746.js.LICENSE.txt} +9 -16
  103. package/dist/746.js.map +1 -0
  104. package/dist/7509c9f56fe9e532.woff2 +0 -0
  105. package/dist/75dc5c5b04adc8bf.woff2 +0 -0
  106. package/dist/76a7c256fc8b3490.woff +0 -0
  107. package/dist/77b48bc05299ecca.woff2 +0 -0
  108. package/dist/787f56efa306ddbc.woff +0 -0
  109. package/dist/7a0a0215c248c73d.woff2 +0 -0
  110. package/dist/7c4463d9c84f263a.woff +0 -0
  111. package/dist/7d112a556b7670d2.woff +0 -0
  112. package/dist/7d52d6014b5f2bbc.woff +0 -0
  113. package/dist/7f00bebb24e40167.woff2 +0 -0
  114. package/dist/7f2c6ea3e740417e.woff +0 -0
  115. package/dist/802c6176541eeed7.woff2 +0 -0
  116. package/dist/8080081b3379c637.woff2 +0 -0
  117. package/dist/8274cc1afc7619f1.woff +0 -0
  118. package/dist/831.js +2 -0
  119. package/dist/831.js.LICENSE.txt +3 -0
  120. package/dist/831.js.map +1 -0
  121. package/dist/8605507b7a8487c4.woff2 +0 -0
  122. package/dist/8a83d654702f6534.woff2 +0 -0
  123. package/dist/8ccee65f6cf254ee.woff +0 -0
  124. package/dist/8d82a082a4aba439.woff +0 -0
  125. package/dist/8de04ae985937b56.woff +0 -0
  126. package/dist/8fe71173a13fe571.woff2 +0 -0
  127. package/dist/90edccb224a51cee.woff +0 -0
  128. package/dist/94b292fe87831a8b.woff +0 -0
  129. package/dist/95dc66c1b88745f8.woff +0 -0
  130. package/dist/95fb698be77c85ef.woff +0 -0
  131. package/dist/9624cec0f9bdd81e.woff2 +0 -0
  132. package/dist/9662331fa31e3f20.woff +0 -0
  133. package/dist/98a3af55a1698171.woff2 +0 -0
  134. package/dist/99.js +1 -0
  135. package/dist/9ba85996af74c5ce.woff2 +0 -0
  136. package/dist/9bc133b1df25cb74.woff +0 -0
  137. package/dist/9ddb22faa35006e7.woff2 +0 -0
  138. package/dist/9e97352380611b95.woff +0 -0
  139. package/dist/a167fb2799dd741b.woff2 +0 -0
  140. package/dist/a2045a5cc4fdf94f.woff2 +0 -0
  141. package/dist/a246c73905a31c93.woff2 +0 -0
  142. package/dist/a401aa7939cb6e6f.woff2 +0 -0
  143. package/dist/a41a71258c38684d.woff +0 -0
  144. package/dist/a60d94a72d615a8e.woff +0 -0
  145. package/dist/a66764dd0c1fa213.woff +0 -0
  146. package/dist/a6ed036f17a1ea29.woff2 +0 -0
  147. package/dist/a8f635129d660202.woff +0 -0
  148. package/dist/a9f25ca430709a1a.woff2 +0 -0
  149. package/dist/ae14d98ad8a1212c.woff +0 -0
  150. package/dist/aeec4f78084adf7f.woff +0 -0
  151. package/dist/af11e94b0644eba5.woff +0 -0
  152. package/dist/afa9121a49e95351.woff2 +0 -0
  153. package/dist/afcda12d9f805543.woff2 +0 -0
  154. package/dist/b09ded85a7da77f1.woff2 +0 -0
  155. package/dist/b2f4e9d1e821b71c.woff2 +0 -0
  156. package/dist/b30b06698dc369b2.woff +0 -0
  157. package/dist/b4a074bf828bb757.woff2 +0 -0
  158. package/dist/b7f447da43f6e596.woff2 +0 -0
  159. package/dist/b7f633b871b84820.woff +0 -0
  160. package/dist/bcca84a524572d10.woff2 +0 -0
  161. package/dist/be4d1f97b11d087c.woff2 +0 -0
  162. package/dist/be91def2232f6776.woff +0 -0
  163. package/dist/bec14780d81164de.woff2 +0 -0
  164. package/dist/c285f4b15d11f172.woff +0 -0
  165. package/dist/c4673617b80801f3.woff +0 -0
  166. package/dist/c553f7e0199c5084.woff2 +0 -0
  167. package/dist/c8470ed2c145ace7.woff +0 -0
  168. package/dist/c9d9ce9f465df4fe.woff2 +0 -0
  169. package/dist/ccb2870475da9fe8.woff +0 -0
  170. package/dist/d04134fa33c2606d.woff +0 -0
  171. package/dist/d11f9c5cd7d9ea16.woff +0 -0
  172. package/dist/d188f7f036ac5779.woff2 +0 -0
  173. package/dist/d265d81c58525ae4.woff2 +0 -0
  174. package/dist/d5942cd81663e136.woff2 +0 -0
  175. package/dist/d6097a5c452acf6d.woff +0 -0
  176. package/dist/d66b8ff73d95cabb.woff2 +0 -0
  177. package/dist/d77f5bf95de8edaa.woff +0 -0
  178. package/dist/d8829a685af4f372.woff +0 -0
  179. package/dist/d88899ef0fd16719.woff2 +0 -0
  180. package/dist/d9a5d958e69e058d.woff2 +0 -0
  181. package/dist/da65d9a514c628c8.woff +0 -0
  182. package/dist/dac90d495be353a0.woff2 +0 -0
  183. package/dist/dd7071bc6306585c.woff +0 -0
  184. package/dist/dd8ce598529c3fab.woff2 +0 -0
  185. package/dist/ddef6f2dd566c2b9.woff +0 -0
  186. package/dist/de013f1be25103fa.woff2 +0 -0
  187. package/dist/dee2ff599db31e5b.woff +0 -0
  188. package/dist/dee7c6b5dd954d9b.woff +0 -0
  189. package/dist/df222fceeffca849.woff2 +0 -0
  190. package/dist/e0d2e5b12f028b5d.woff +0 -0
  191. package/dist/e33e3db8e4f7559f.woff +0 -0
  192. package/dist/e62b00b9199c1ac9.woff2 +0 -0
  193. package/dist/e696cef1407b2610.woff2 +0 -0
  194. package/dist/e89ca83b24959664.woff +0 -0
  195. package/dist/eb8c0ae77ad55249.woff +0 -0
  196. package/dist/ed0997bd7d221b8e.woff +0 -0
  197. package/dist/eed48feba743e21c.woff2 +0 -0
  198. package/dist/f280bda8a6e535a6.woff +0 -0
  199. package/dist/f543c88feb236d11.woff2 +0 -0
  200. package/dist/f591b0079faa93fe.woff2 +0 -0
  201. package/dist/f6ed27923769ad1d.woff2 +0 -0
  202. package/dist/f8803bebe640d99a.woff +0 -0
  203. package/dist/fbebeb4336e67012.woff2 +0 -0
  204. package/dist/fd522cd7a5c646fe.woff +0 -0
  205. package/dist/main.js +1 -1
  206. package/dist/main.js.map +1 -0
  207. package/dist/pih-esm-referrals-queue-app.js +1 -1
  208. package/dist/pih-esm-referrals-queue-app.js.buildmanifest.json +364 -73
  209. package/dist/pih-esm-referrals-queue-app.js.map +1 -0
  210. package/dist/routes.json +1 -0
  211. package/jest.config.js +3 -0
  212. package/package.json +28 -46
  213. package/src/config-schema.ts +8 -16
  214. package/src/declarations.d.tsx +4 -4
  215. package/src/index.ts +11 -65
  216. package/src/referrals-queue/referrals-queue.component.tsx +71 -120
  217. package/src/referrals-queue/referrals-queue.resource.tsx +6 -9
  218. package/src/referrals-queue/referrals-queue.scss +26 -0
  219. package/src/referrals-queue/referrals-queue.test.tsx +132 -115
  220. package/src/root.component.test.tsx +3 -3
  221. package/src/root.component.tsx +6 -6
  222. package/src/routes.json +9 -0
  223. package/src/setup-tests.ts +8 -8
  224. package/src/table/referrals-table.component.tsx +83 -0
  225. package/src/util.ts +5 -9
  226. package/translations/en.json +13 -2
  227. package/translations/es.json +15 -0
  228. package/translations/fr.json +15 -0
  229. package/tsconfig.json +4 -22
  230. package/.editorconfig +0 -12
  231. package/.eslintignore +0 -2
  232. package/.eslintrc +0 -4
  233. package/.github/workflows/node.js.yml +0 -79
  234. package/.husky/pre-commit +0 -6
  235. package/.husky/pre-push +0 -6
  236. package/.prettierignore +0 -14
  237. package/LICENSE +0 -401
  238. package/dist/132.js +0 -1
  239. package/dist/147.js +0 -2
  240. package/dist/281.js +0 -1
  241. package/dist/294.js +0 -2
  242. package/dist/574.js +0 -1
  243. package/dist/595.js +0 -2
  244. package/dist/595.js.LICENSE.txt +0 -1
  245. package/dist/879.js +0 -2
  246. package/dist/879.js.LICENSE.txt +0 -21
  247. package/dist/90.js +0 -1
  248. package/dist/pih-esm-referrals-queue-app.old +0 -1
  249. package/jest.config.json +0 -19
  250. package/src/referrals-queue/react-dates-overrides.css +0 -39
  251. package/src/referrals-queue/referrals-queue.css +0 -63
  252. package/src/table/table.component.tsx +0 -95
  253. package/src/table/table.css +0 -16
  254. /package/dist/{294.js.LICENSE.txt → 41.js.LICENSE.txt} +0 -0
package/package.json CHANGED
@@ -1,63 +1,55 @@
1
1
  {
2
2
  "name": "@pih/esm-referrals-queue-app",
3
- "version": "2.0.0-pre.9",
4
- "license": "MPL-2.0",
3
+ "version": "2.1.1-pre.3",
5
4
  "description": "A page for viewing the J9 Home Visits from CommCare",
6
5
  "browser": "dist/pih-esm-referrals-queue-app.js",
7
6
  "main": "src/index.ts",
8
7
  "source": true,
8
+ "license": "MPL-2.0",
9
+ "homepage": "https://github.com/PIH/openmrs-esm-pihemr#readme",
9
10
  "scripts": {
10
11
  "start": "openmrs develop",
11
12
  "serve": "webpack serve --mode=development",
13
+ "debug": "npm run serve",
12
14
  "build": "webpack --mode production",
13
15
  "analyze": "webpack --mode=production --env.analyze=true",
14
- "lint": "eslint src --ext js,jsx,ts,tsx",
15
- "prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
16
+ "lint": "cross-env eslint src --ext ts,tsx",
17
+ "test": "cross-env TZ=UTC jest --config jest.config.js --verbose false --passWithNoTests --color",
18
+ "test:watch": "cross-env TZ=UTC jest --watch --config jest.config.js --color",
19
+ "coverage": "yarn test --coverage",
16
20
  "typescript": "tsc",
17
- "test": "jest --config jest.config.json",
18
- "verify": "concurrently 'yarn:lint' 'yarn:test' 'yarn:typescript'",
19
- "coverage": "yarn test -- --coverage",
20
- "prepare": "husky install"
21
- },
22
- "husky": {
23
- "hooks": {
24
- "pre-commit": "pretty-quick --staged && yarn verify"
25
- }
21
+ "extract-translations": "i18next 'src/**/*.component.tsx'"
26
22
  },
27
23
  "browserslist": [
28
24
  "extends browserslist-config-openmrs"
29
25
  ],
30
26
  "keywords": [
31
- "openmrs",
32
- "microfrontends"
27
+ "openmrs"
33
28
  ],
34
- "repository": {
35
- "type": "git",
36
- "url": "git+https://github.com/pih/pih-esm-referrals-queue.git"
37
- },
38
- "homepage": "https://github.com/pih/pih-esm-referrals-queue#readme",
39
29
  "publishConfig": {
40
30
  "access": "public"
41
31
  },
42
- "bugs": {
43
- "url": "https://github.com/pih/pih-esm-referrals-queue/issues"
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/PIH/openmrs-esm-pihemr.git"
44
35
  },
45
- "dependencies": {
46
- "lodash-es": "^4.17.15"
36
+ "bugs": {
37
+ "url": "https://github.com/PIH/openmrs-esm-pihemr/issues"
47
38
  },
48
39
  "peerDependencies": {
49
40
  "@carbon/react": "^1.9.0",
50
- "@openmrs/esm-framework": "next",
41
+ "@openmrs/esm-framework": "^5.4.0",
51
42
  "dayjs": "1.x",
43
+ "i18next": "^21.10.0",
52
44
  "react": "18.x",
45
+ "react-dom": "18.x",
53
46
  "react-i18next": "11.x",
54
- "react-router-dom": "6.x",
55
- "rxjs": "6.x"
47
+ "rxjs": "6.x",
48
+ "single-spa": "^6.x",
49
+ "swr": "^2.2.2"
56
50
  },
57
51
  "devDependencies": {
58
- "@carbon/react": "^1.9.0",
59
- "@carbon/icons-react": "^10.18.0",
60
- "@openmrs/esm-framework": "next",
52
+ "@openmrs/esm-framework": "^5.4.0",
61
53
  "@swc/core": "^1.2.203",
62
54
  "@swc/jest": "^0.2.21",
63
55
  "@testing-library/dom": "^7.20.0",
@@ -71,30 +63,20 @@
71
63
  "@types/react-router": "^5.1.14",
72
64
  "@types/react-router-dom": "^5.1.7",
73
65
  "@types/webpack-env": "^1.16.0",
74
- "@typescript-eslint/parser": "^5.28.0",
75
- "concurrently": "^6.2.0",
76
66
  "css-loader": "^6.7.1",
77
- "eslint": "^7.27.0",
78
- "eslint-config-prettier": "^8.3.0",
79
- "eslint-config-ts-react-important-stuff": "^3.0.0",
80
- "eslint-plugin-prettier": "^3.4.0",
81
- "husky": "^6.0.0",
82
67
  "identity-obj-proxy": "^3.0.0",
83
68
  "jest": "^27.0.4",
84
69
  "jest-cli": "^27.0.4",
85
70
  "mockdate": "^3.0.5",
86
- "openmrs": "next",
87
- "prettier": "^2.3.0",
88
- "pretty-quick": "^3.1.0",
89
71
  "react": "^18.2.0",
90
72
  "react-dates": "^21.8.0",
91
73
  "react-dom": "^18.2.0",
92
74
  "react-i18next": "^11.7.0",
93
75
  "react-router-dom": "^6.3.0",
94
- "rxjs": "^6.5.4",
95
- "typescript": "^4.3.2"
76
+ "rxjs": "^6.6.7",
77
+ "swc-loader": "^0.2.6",
78
+ "webpack": "^5.90.3",
79
+ "webpack-cli": "^4.10.0"
96
80
  },
97
- "resolutions": {
98
- "**/@types/react": "^18.0.14"
99
- }
100
- }
81
+ "stableVersion": "2.1.0"
82
+ }
@@ -1,4 +1,4 @@
1
- import { Type, validators } from "@openmrs/esm-framework";
1
+ import { Type, validators } from '@openmrs/esm-framework';
2
2
 
3
3
  /**
4
4
  * This is the config schema. It expects a configuration object which
@@ -25,33 +25,25 @@ export const configSchema = {
25
25
  patientDash: {
26
26
  _type: Type.String,
27
27
  _default:
28
- "${openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&app=pih.app.clinicianDashboard",
29
- _validators: [validators.isUrlWithTemplateParameters(["patientUuid"])],
28
+ '${openmrsBase}/coreapps/clinicianfacing/patient.page?patientId=${patientUuid}&app=pih.app.clinicianDashboard',
29
+ _validators: [validators.isUrlWithTemplateParameters(['patientUuid'])],
30
30
  },
31
31
  visitPage: {
32
32
  _type: Type.String,
33
33
  _default:
34
- "${openmrsBase}/pihcore/visit/visit.page?patient=${patientUuid}&visit=${visitUuid}&suppressActions=true#/overview",
35
- _validators: [
36
- validators.isUrlWithTemplateParameters(["patientUuid", "visitUuid"]),
37
- ],
34
+ '${openmrsBase}/pihcore/visit/visit.page?patient=${patientUuid}&visit=${visitUuid}&suppressActions=true#/overview',
35
+ _validators: [validators.isUrlWithTemplateParameters(['patientUuid', 'visitUuid'])],
38
36
  },
39
37
  homeVisitForm: {
40
38
  _type: Type.String,
41
39
  _default:
42
- "${openmrsBase}/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId=${patientUuid}&visitId=${visitUuid}&encounterId=${encounterUuid}&definitionUiResource=file:configuration/pih/htmlforms/section-mch-referral.xml&returnUrl=/mirebalais/spa/referrals-queue",
43
- _validators: [
44
- validators.isUrlWithTemplateParameters([
45
- "patientUuid",
46
- "visitUuid",
47
- "encounterUuid",
48
- ]),
49
- ],
40
+ '${openmrsBase}/htmlformentryui/htmlform/editHtmlFormWithStandardUi.page?patientId=${patientUuid}&visitId=${visitUuid}&encounterId=${encounterUuid}&definitionUiResource=file:configuration/pih/htmlforms/section-mch-referral.xml&returnUrl=/mirebalais/spa/referrals-queue',
41
+ _validators: [validators.isUrlWithTemplateParameters(['patientUuid', 'visitUuid', 'encounterUuid'])],
50
42
  },
51
43
  },
52
44
  pendingStatuses: {
53
45
  _type: Type.Array,
54
- _default: ["Pending status", "Referral unmet"],
46
+ _default: ['Pending status', 'Referral unmet'],
55
47
  _elements: {
56
48
  _type: Type.String,
57
49
  },
@@ -1,7 +1,7 @@
1
- declare type Observable<T> = import("rxjs").Observable<T>;
2
-
3
- declare module "*.css";
4
- declare module "*.scss";
1
+ declare module '*.css';
2
+ declare module '*.scss';
3
+ declare module '@carbon/react';
4
+ declare type SideNavProps = {};
5
5
 
6
6
  type Referral = {
7
7
  details: string;
package/src/index.ts CHANGED
@@ -5,79 +5,25 @@
5
5
  * microfrontend.
6
6
  */
7
7
 
8
- import {
9
- getAsyncLifecycle,
10
- defineConfigSchema,
11
- registerBreadcrumbs,
12
- } from "@openmrs/esm-framework";
13
- import { configSchema } from "./config-schema";
8
+ import { getAsyncLifecycle, defineConfigSchema, registerBreadcrumbs } from '@openmrs/esm-framework';
9
+ import { configSchema } from './config-schema';
14
10
 
15
- /**
16
- * This tells the app shell the version of this app. We inject this variable
17
- * via the Webpack DefinePlugin, so first, in order to keep TypeScript happy,
18
- * we need to tell it that this is an available variable in this scope. At
19
- * build-time the __VERSION__ variable is replaced with the version from
20
- * package.json
21
- */
22
- declare var __VERSION__: string;
23
- const version = __VERSION__;
24
-
25
- /**
26
- * This tells the app shell how to obtain translation files: that they
27
- * are JSON files in the directory `../translations` (which you should
28
- * see in the directory structure).
29
- */
30
- const importTranslation = require.context(
31
- "../translations",
32
- false,
33
- /.json$/,
34
- "lazy"
35
- );
11
+ const moduleName = '@pih/esm-referrals-queue-app';
12
+ const options = {
13
+ featureName: 'referrals-queue',
14
+ moduleName,
15
+ };
36
16
 
37
- /**
38
- * This tells the app shell what versions of what OpenMRS backend modules
39
- * are expected. Warnings will appear if suitable modules are not
40
- * installed. The keys are the part of the module name after
41
- * `openmrs-module-`; e.g., `openmrs-module-fhir2` becomes `fhir2`.
42
- */
43
- const backendDependencies = {};
17
+ export const importTranslation = require.context('../translations', false, /.json$/, 'lazy');
44
18
 
45
- /**
46
- * This function performs any setup that should happen at microfrontend
47
- * load-time (such as defining the config schema) and then returns an
48
- * object which describes how the React application(s) should be
49
- * rendered.
50
- *
51
- * In this example, our return object contains a single page definition.
52
- * It tells the app shell that the default export of `greeter.tsx`
53
- * should be rendered when the route matches `hello`. The full route
54
- * will be `openmrsSpaBase() + 'hello'`, which is usually
55
- * `/openmrs/spa/hello`.
56
- */
57
- function setupOpenMRS() {
58
- const moduleName = "@pih/esm-referrals-queue-app";
59
- const options = {
60
- featureName: "referrals-queue",
61
- moduleName,
62
- };
19
+ export const root = getAsyncLifecycle(() => import('./root.component'), options);
63
20
 
21
+ export function startupApp() {
64
22
  defineConfigSchema(moduleName, configSchema);
65
-
66
23
  registerBreadcrumbs([
67
24
  {
68
25
  path: `${window.spaBase}/referrals-queue`,
69
- title: "Referrals Queue",
26
+ title: 'Referrals Queue',
70
27
  },
71
28
  ]);
72
-
73
- return {
74
- pages: [
75
- {
76
- load: getAsyncLifecycle(() => import("./root.component"), options),
77
- route: "referrals-queue",
78
- },
79
- ],
80
- };
81
29
  }
82
-
83
- export { backendDependencies, importTranslation, setupOpenMRS, version };
@@ -1,185 +1,136 @@
1
- import React from "react";
2
- import { Trans, useTranslation } from "react-i18next";
3
- import "react-dates/initialize";
4
- import { SingleDatePicker } from "react-dates";
5
- import moment, { Moment } from "moment";
6
- import "moment/locale/fr";
7
- import { createErrorHandler } from "@openmrs/esm-framework";
8
- import Table from "../table/table.component";
9
- import styles from "./referrals-queue.css";
10
- import { getReferrals } from "./referrals-queue.resource";
11
-
12
- // Override the webpack CSS loader config in order to load react-dates styles.
13
- // See thread: https://github.com/webpack-contrib/css-loader/issues/295
14
- import "!style-loader!css-loader!react-dates/lib/css/_datepicker.css";
15
- import "!style-loader!css-loader!./react-dates-overrides.css";
1
+ import React from 'react';
2
+ import { Trans, useTranslation } from 'react-i18next';
3
+ import 'react-dates/initialize';
4
+ import moment from 'moment';
5
+ import { Content, Tile, Heading, Search, Dropdown, DatePicker, DatePickerInput } from '@carbon/react';
6
+ import 'moment/locale/fr';
7
+ import { createErrorHandler } from '@openmrs/esm-framework';
8
+ import Table from '../table/referrals-table.component';
9
+ import styles from './referrals-queue.scss';
10
+ import { getReferrals } from './referrals-queue.resource';
16
11
 
17
12
  export default function ReferralsQueue(props: ReferralsQueueProps) {
18
13
  const [referrals, setReferrals]: [Referral[], Function] = React.useState([]);
19
- const [referralTypeFilter, setReferralTypeFilter] = React.useState("");
20
- const [statusFilter, setStatusFilter] = React.useState("");
14
+ const [referralTypeFilter, setReferralTypeFilter] = React.useState('');
15
+ const [statusFilter, setStatusFilter] = React.useState('');
21
16
  const today = moment();
22
- const [fromDate, setFromDate] = React.useState(moment().subtract(1, "month"));
17
+ const [fromDate, setFromDate] = React.useState(moment().subtract(1, 'month'));
23
18
  const [toDate, setToDate] = React.useState(today);
24
- const [ptQuery, setPtQuery] = React.useState("");
25
- const [fromDateFocused, setFromDateFocused] = React.useState(false);
26
- const [toDateFocused, setToDateFocused] = React.useState(false);
19
+ const [ptQuery, setPtQuery] = React.useState('');
27
20
  const { t, i18n } = useTranslation();
28
21
 
29
22
  const languageMatches = i18n.language?.match(/^(en|fr|ht).*/);
30
- const language = (languageMatches && languageMatches[1]) || "en";
23
+ const language = (languageMatches && languageMatches[1]) || 'en';
31
24
 
32
25
  React.useEffect(() => {
33
- moment.locale(language === "ht" ? "fr" : language);
26
+ moment.locale(language === 'ht' ? 'fr' : language);
34
27
  }, [language]);
35
28
 
36
29
  React.useEffect(() => {
37
30
  if (fromDate && toDate) {
38
31
  const sub = getReferrals({
39
- fromDate: fromDate.format("YYYY-MM-DD"),
40
- toDate: toDate.format("YYYY-MM-DD"),
32
+ fromDate: fromDate.format('YYYY-MM-DD'),
33
+ toDate: toDate.format('YYYY-MM-DD'),
41
34
  locale: language,
42
- }).subscribe(
43
- (referrals) => setReferrals(referrals),
44
- createErrorHandler()
45
- );
35
+ }).subscribe((referrals) => setReferrals(referrals), createErrorHandler());
46
36
  return () => sub.unsubscribe();
47
37
  }
48
38
  }, [fromDate, toDate, language]);
49
39
 
50
- // console.log(referrals);
51
40
  const filteredReferrals = referrals
52
- .filter((r) => !referralTypeFilter || r.referral_type == referralTypeFilter)
53
- .filter((r) => !statusFilter || r.fulfillment_status == statusFilter)
41
+ .filter(
42
+ (r) => !referralTypeFilter || referralTypeFilter == t('any', 'Any') || r.referral_type == referralTypeFilter,
43
+ )
44
+ .filter((r) => !statusFilter || statusFilter == t('any', 'Any') || r.fulfillment_status == statusFilter)
54
45
  .filter((r) => matchQuery(r, ptQuery));
55
- const referralTypes = [...new Set(referrals.map((r) => r.referral_type))];
56
- const statuses = [
57
- ...new Set(
58
- referrals.map((r) => r.fulfillment_status).filter((r) => r != null)
59
- ),
60
- ];
46
+
47
+ const referralTypes = [t('any', 'Any'), ...new Set(referrals.map((r) => r.referral_type).filter((r) => r != null))];
48
+
49
+ const statuses = [t('any', 'Any'), ...new Set(referrals.map((r) => r.fulfillment_status).filter((r) => r != null))];
50
+
61
51
  return (
62
- <div className={styles.container}>
63
- <div className="omrs-card omrs-margin-top-16 omrs-padding-16">
64
- <div className="omrs-type-title-2">
52
+ <Content className={styles.container}>
53
+ <Tile>
54
+ <Heading>
65
55
  <Trans i18nKey="referrals-queue">Referrals Queue</Trans>
66
- </div>
56
+ </Heading>
67
57
  <div className={styles.controlsContainer}>
68
58
  <div className={styles.inputContainer}>
69
- <div className={styles.dateInputContainer}>
70
- <label htmlFor="from-date">
71
- <Trans i18nKey="from">From</Trans>
72
- </label>
73
- <SingleDatePicker
74
- id="from-date"
75
- date={fromDate}
76
- onDateChange={(date) => setFromDate(date)}
77
- focused={fromDateFocused}
78
- onFocusChange={({ focused }) => setFromDateFocused(focused)}
79
- isOutsideRange={(date: Moment) => date.isAfter(today)}
80
- displayFormat="DD MMM YYYY"
81
- numberOfMonths={1}
82
- />
83
- </div>
84
- <div className={styles.dateInputContainer}>
85
- <label htmlFor="to-date">
86
- <Trans i18nKey="to">To</Trans>
87
- </label>
88
- <SingleDatePicker
89
- id="to-date"
90
- date={toDate}
91
- onDateChange={(date) => setToDate(date)}
92
- focused={toDateFocused}
93
- onFocusChange={({ focused }) => setToDateFocused(focused)}
94
- isOutsideRange={(date: Moment) => date.isAfter(today)}
95
- displayFormat="DD MMM YYYY"
96
- numberOfMonths={1}
97
- />
98
- </div>
59
+ <DatePicker
60
+ dateFormat="d/M/Y"
61
+ datePickerType="range"
62
+ locale={language === 'ht' ? 'fr' : language}
63
+ maxDate={new Date().toISOString()}
64
+ onChange={(date) => {
65
+ if (date && date.length > 0) {
66
+ setFromDate(date ? moment(date[0]) : null);
67
+ if (date.length > 1) {
68
+ setToDate(date ? moment(date[1]) : null);
69
+ }
70
+ }
71
+ }}
72
+ value={[fromDate.toISOString(), toDate.toISOString()]}>
73
+ <DatePickerInput id="from-date" labelText={t('from', 'From')} />
74
+ <DatePickerInput id="to-date" labelText={t('to', 'To')} />
75
+ </DatePicker>
99
76
  </div>
100
77
  <div className={styles.inputContainer}>
101
- <div className="omrs-input-group">
102
- <label htmlFor="referral-type">
103
- <Trans i18nKey="referral-type">Referral Type</Trans>
104
- </label>
105
- <select
78
+ <div style={{ width: 400 }}>
79
+ <Dropdown
106
80
  id="referral-type"
107
- value={referralTypeFilter}
108
- onChange={(e) => setReferralTypeFilter(e.target.value)}
109
- className={styles.dropdown}
110
- >
111
- <option value="">{t("any", "Any")}</option>
112
- {referralTypes.map((t) => (
113
- <option key={t} value={t}>
114
- {t}
115
- </option>
116
- ))}
117
- </select>
81
+ label={t('select-referral-type', 'Select Referral Type')}
82
+ titleText={t('referral-type', 'Referral Type')}
83
+ items={referralTypes}
84
+ onChange={(e) => setReferralTypeFilter(e.selectedItem)}
85
+ />
118
86
  </div>
119
87
  </div>
120
88
  <div className={styles.inputContainer}>
121
- <div className="omrs-input-group">
89
+ <div style={{ width: 400 }}>
122
90
  <label htmlFor="query-input">
123
91
  <Trans i18nKey="filter-by-patient">Filter by patient</Trans>
124
92
  </label>
125
- <input
126
- id="query-input"
127
- type="text"
128
- value={ptQuery}
129
- onChange={(e) => setPtQuery(e.target.value)}
130
- className="omrs-input-outlined"
131
- />
93
+ <Search id="query-input" labelText="" onChange={(e) => setPtQuery(e.target.value)} />
132
94
  </div>
133
95
  </div>
134
96
  <div className={styles.inputContainer}>
135
- <div className="omrs-input-group">
136
- <label htmlFor="status">
137
- <Trans i18nKey="status">Status</Trans>
138
- </label>
139
- <select
97
+ <div style={{ width: 400 }}>
98
+ <Dropdown
140
99
  id="status"
141
- value={statusFilter}
142
- onChange={(e) => setStatusFilter(e.target.value)}
143
- className={styles.dropdown}
144
- >
145
- <option value="">{t("any", "Any")}</option>
146
- {statuses.map((t) => (
147
- <option key={t} value={t}>
148
- {t}
149
- </option>
150
- ))}
151
- </select>
100
+ label={t('select-status', 'Select Status')}
101
+ titleText={t('status', 'Status')}
102
+ items={statuses}
103
+ onChange={(e) => setStatusFilter(e.selectedItem)}
104
+ />
152
105
  </div>
153
106
  </div>
154
107
  </div>
155
108
  <div className={styles.tableContainer}>
156
109
  <Table referrals={filteredReferrals} />
157
110
  </div>
158
- </div>
159
- </div>
111
+ </Tile>
112
+ </Content>
160
113
  );
161
114
  }
162
115
 
163
116
  function matchQuery(referral: Referral, query: string): boolean {
164
117
  return (
165
118
  !query ||
166
- prepareQuery(query).every((regexp) =>
167
- regexp.test(removeDiacritics(referral.patient_name))
168
- ) ||
169
- new RegExp(query, "i").test(referral.zl_emr_id)
119
+ prepareQuery(query).every((regexp) => regexp.test(removeDiacritics(referral.patient_name))) ||
120
+ new RegExp(query, 'i').test(referral.zl_emr_id)
170
121
  );
171
122
  }
172
123
 
173
124
  function prepareQuery(query: string): RegExp[] {
174
125
  return query.split(/\s/).map((token) => {
175
126
  const tokenCleaned = removeDiacritics(token);
176
- return new RegExp("\\b" + tokenCleaned, "i");
127
+ return new RegExp('\\b' + tokenCleaned, 'i');
177
128
  });
178
129
  }
179
130
 
180
131
  function removeDiacritics(str: string) {
181
132
  // From https://stackoverflow.com/a/37511463/1464495
182
- return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
133
+ return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
183
134
  }
184
135
 
185
136
  type ReferralsQueueProps = {};
@@ -1,12 +1,9 @@
1
- import { openmrsObservableFetch } from "@openmrs/esm-framework";
2
- import { map } from "rxjs/operators";
1
+ import { openmrsObservableFetch } from '@openmrs/esm-framework';
2
+ import { type Observable } from 'rxjs';
3
+ import { map } from 'rxjs/operators';
3
4
 
4
- export function getReferrals({
5
- fromDate,
6
- toDate,
7
- locale,
8
- }): Observable<Object[]> {
5
+ export function getReferrals({ fromDate, toDate, locale }): Observable<Object[]> {
9
6
  return openmrsObservableFetch(
10
- `/ws/rest/v1/reportingrest/reportdata/cd7dfde7-764a-4da6-81c2-d5887ed1df51?startDate=${fromDate}&endDate=${toDate}&locale=${locale}`
11
- ).pipe(map(({ data }) => data["dataSets"][0]["rows"]));
7
+ `/ws/rest/v1/reportingrest/reportdata/cd7dfde7-764a-4da6-81c2-d5887ed1df51?startDate=${fromDate}&endDate=${toDate}&locale=${locale}`,
8
+ ).pipe(map(({ data }) => data['dataSets'][0]['rows']));
12
9
  }
@@ -0,0 +1,26 @@
1
+ @use '@carbon/react';
2
+
3
+ .container {
4
+ margin-right: auto;
5
+ margin-left: auto;
6
+ max-width: 1500px;
7
+ }
8
+
9
+ .tableContainer {
10
+ height: 500px;
11
+ overflow-x: auto;
12
+ }
13
+
14
+ .controlsContainer {
15
+ display: flex;
16
+ flex-wrap: wrap;
17
+ }
18
+
19
+ .inputContainer {
20
+ display: flex;
21
+ width: 50%;
22
+ min-width: 300px;
23
+ text-align: left;
24
+ padding: 0.5rem;
25
+ align-items: flex-end;
26
+ }