@ampath/esm-reports-app 1.0.0-next.41 → 1.0.0-next.45

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 (183) hide show
  1. package/dist/143.css +1 -0
  2. package/dist/143.css.map +1 -0
  3. package/dist/143.js +1 -0
  4. package/dist/143.js.map +1 -0
  5. package/dist/197.js +1 -1
  6. package/dist/282.js +1 -1
  7. package/dist/282.js.map +1 -1
  8. package/dist/295.css +1 -0
  9. package/dist/295.css.map +1 -0
  10. package/dist/295.js +1 -0
  11. package/dist/295.js.map +1 -0
  12. package/dist/300.js +1 -1
  13. package/dist/311.js +1 -1
  14. package/dist/311.js.map +1 -1
  15. package/dist/335.js +1 -1
  16. package/dist/353.js +1 -1
  17. package/dist/353.js.map +1 -1
  18. package/dist/410.js +1 -0
  19. package/dist/410.js.map +1 -0
  20. package/dist/427.js +2 -0
  21. package/dist/427.js.LICENSE.txt +35 -0
  22. package/dist/427.js.map +1 -0
  23. package/dist/441.js +1 -0
  24. package/dist/441.js.map +1 -0
  25. package/dist/478.js +1 -1
  26. package/dist/478.js.map +1 -1
  27. package/dist/540.js +1 -1
  28. package/dist/540.js.map +1 -1
  29. package/dist/55.js +1 -1
  30. package/dist/652.js +1 -1
  31. package/dist/961.js +1 -1
  32. package/dist/961.js.map +1 -1
  33. package/dist/99.js +1 -1
  34. package/dist/ampath-esm-reports-app.js +1 -1
  35. package/dist/ampath-esm-reports-app.js.map +1 -1
  36. package/dist/routes.json +1 -1
  37. package/package.json +2 -2
  38. package/src/common/report-error/index.ts +1 -0
  39. package/src/common/report-error/show-report-error.ts +25 -0
  40. package/src/common/report-filters/date-range.ts +137 -0
  41. package/src/common/report-filters/index.ts +4 -0
  42. package/src/common/report-filters/report-filters.component.tsx +281 -151
  43. package/src/common/report-filters/report-filters.scss +180 -55
  44. package/src/common/report-filters/types.ts +66 -0
  45. package/src/common/report-filters/use-restore-period.ts +43 -0
  46. package/src/common/report-page/index.ts +2 -0
  47. package/src/common/report-page/report-page.component.tsx +32 -0
  48. package/src/common/report-page/report-page.scss +45 -0
  49. package/src/common/report-page/use-page-scale.ts +50 -0
  50. package/src/common/report-placeholder/has-report-data.ts +15 -0
  51. package/src/common/report-placeholder/index.ts +2 -0
  52. package/src/common/report-placeholder/report-placeholder.component.tsx +56 -0
  53. package/src/common/report-placeholder/report-placeholder.scss +46 -0
  54. package/src/common/report-register/index.ts +5 -0
  55. package/src/common/report-register/register-columns.ts +34 -0
  56. package/src/common/report-register/register-layout.component.tsx +237 -0
  57. package/src/common/report-register/register-layout.scss +140 -0
  58. package/src/common/report-register/register-table.scss +62 -0
  59. package/src/common/report-register/report-parents.ts +27 -0
  60. package/src/common/report-register/rows-to-csv.ts +59 -0
  61. package/src/common/report-register/use-patient-list.ts +92 -0
  62. package/src/common/report-skeleton/index.ts +1 -0
  63. package/src/common/report-skeleton/report-skeleton.component.tsx +46 -0
  64. package/src/common/report-skeleton/report-skeleton.scss +29 -0
  65. package/src/config-schema.ts +9 -1
  66. package/src/dashboard/report-catalog.ts +173 -0
  67. package/src/dashboard/reports-dasboard.tsx +101 -35
  68. package/src/dashboard/reports-dashboard.module.scss +269 -11
  69. package/src/index.ts +13 -1
  70. package/src/reports/datatable-wrapper/datatable-wrapper.component.tsx +50 -48
  71. package/src/reports/moh-240/moh-240-header.component.tsx +54 -56
  72. package/src/reports/moh-240/moh-240.columns.ts +64 -0
  73. package/src/reports/moh-240/moh-240.component.tsx +65 -84
  74. package/src/reports/moh-240/moh-240.scss +36 -7
  75. package/src/reports/moh-240/sub-reports/moh-240-register.component.tsx +27 -65
  76. package/src/reports/moh-240/sub-reports/page-summary.component.tsx +2 -2
  77. package/src/reports/moh-505/moh-505-header.component.tsx +59 -57
  78. package/src/reports/moh-505/moh-505.component.tsx +51 -56
  79. package/src/reports/moh-505/moh-505.scss +116 -2
  80. package/src/reports/moh-705B/moh-204b-register.component.tsx +41 -42
  81. package/src/reports/moh-705B/moh-204b.columns.ts +39 -0
  82. package/src/reports/moh-705B/moh-705b.component.tsx +492 -473
  83. package/src/reports/moh-705B/moh-705b.scss +110 -24
  84. package/src/reports/moh-705a/moh-705a.component.tsx +496 -476
  85. package/src/reports/moh-705a/moh-705a.scss +109 -24
  86. package/src/reports/moh-705a/registers/moh-204a-register.component.tsx +41 -42
  87. package/src/reports/moh-705a/registers/moh-204a.columns.ts +57 -0
  88. package/src/reports/moh-706/moh-706-header.component.tsx +58 -56
  89. package/src/reports/moh-706/moh-706.component.tsx +84 -55
  90. package/src/reports/moh-706/moh-706.scss +115 -19
  91. package/src/reports/moh-710/moh-710.component.tsx +743 -727
  92. package/src/reports/moh-710/moh-710.scss +140 -23
  93. package/src/reports/moh-710/registers/moh-511-710-register.component.tsx +48 -43
  94. package/src/reports/moh-710/registers/moh-511-710.columns.ts +52 -0
  95. package/src/reports/moh-711/moh-711.component.tsx +94 -106
  96. package/src/reports/moh-711/moh711.scss +95 -64
  97. package/src/reports/moh-711/registers/moh-333-register.component.tsx +92 -94
  98. package/src/reports/moh-711/registers/moh-333.columns.ts +119 -0
  99. package/src/reports/moh-711/registers/moh-405-register.component.tsx +88 -89
  100. package/src/reports/moh-711/registers/moh-405.columns.ts +120 -0
  101. package/src/reports/moh-711/registers/moh-406-register.component.tsx +85 -88
  102. package/src/reports/moh-711/registers/moh-406.columns.ts +133 -0
  103. package/src/reports/moh-711/registers/moh-510-register.component.tsx +38 -44
  104. package/src/reports/moh-711/registers/moh-511-register.component.tsx +42 -43
  105. package/src/reports/moh-711/registers/moh-511.columns.ts +59 -0
  106. package/src/reports/moh-711/sections/anc.component.tsx +3 -3
  107. package/src/reports/moh-711/sections/cervical-cancer.component.tsx +3 -3
  108. package/src/reports/moh-711/sections/chanis.component.tsx +2 -3
  109. package/src/reports/moh-711/sections/family-planning.component.tsx +2 -2
  110. package/src/reports/moh-711/sections/gbv.component.tsx +2 -2
  111. package/src/reports/moh-711/sections/maternity.component.tsx +3 -8
  112. package/src/reports/moh-711/sections/medical-social-work.component.tsx +2 -12
  113. package/src/reports/moh-711/sections/other.component.tsx +2 -2
  114. package/src/reports/moh-711/sections/physiotherapy.component.tsx +2 -2
  115. package/src/reports/moh-711/sections/pnc.component.tsx +7 -5
  116. package/src/reports/moh-711/sections/post-abortion.component.tsx +2 -2
  117. package/src/reports/moh-711/sections/rehabilitation.component.tsx +2 -2
  118. package/src/reports/moh-711/sections/report-compiled-by.component.tsx +12 -4
  119. package/src/reports/moh-711/sections/tb-screening.component.tsx +2 -2
  120. package/src/reports/moh-717/moh-717.component.tsx +100 -121
  121. package/src/reports/moh-717/moh717.scss +163 -102
  122. package/src/reports/moh-717/sections/maternity.component.tsx +1 -1
  123. package/src/reports/moh-717/sections/orthopaedic-trauma.component.tsx +1 -1
  124. package/src/reports/moh-717/sections/outpatient.component.tsx +23 -23
  125. package/src/reports/moh-717/sections/preparedby.component.tsx +7 -2
  126. package/src/reports/moh-717/sections/special-services.component.tsx +1 -1
  127. package/src/reports/moh-731/moh-731.component.tsx +127 -110
  128. package/src/reports/moh-731/moh-731.scss +396 -68
  129. package/src/reports/moh-731/registers/moh-366.columns.ts +38 -0
  130. package/src/reports/moh-731/registers/moh-366.component.tsx +76 -83
  131. package/src/reports/moh-731/registers/prep-register.component.tsx +70 -78
  132. package/src/reports/moh-731/registers/prep.columns.ts +34 -0
  133. package/src/reports/moh-731/sections/hiv-and-tb-treatment.component.tsx +1031 -751
  134. package/src/reports/moh-731/sections/hiv-testing-and-pre-exposure.component.tsx +230 -86
  135. package/src/reports/moh-731/sections/pmtct.component.tsx +185 -64
  136. package/src/reports/moh-740/moh-740.component.scss +159 -79
  137. package/src/reports/moh-740/moh-740.component.tsx +261 -230
  138. package/src/reports/moh-740/moh-740.resource.ts +17 -10
  139. package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.tsx +77 -96
  140. package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.tsx +50 -70
  141. package/src/reports/moh-740/registers/moh-740-patient-list.tsx +61 -32
  142. package/src/reports/moh-740/registers/moh-740.columns.ts +52 -0
  143. package/src/reports/moh-740/shared/utils/indicator-register-map.ts +3 -3
  144. package/src/reports/moh-740/types/index.ts +3 -3
  145. package/src/reports/moh-745/moh-745.component.tsx +897 -877
  146. package/src/reports/moh-745/moh-745.scss +104 -46
  147. package/src/reports/moh-745/registers/moh-412-register.component.tsx +42 -43
  148. package/src/reports/moh-745/registers/moh-412.columns.ts +52 -0
  149. package/src/reports/table-wrapper/table-wrapper.component.tsx +23 -14
  150. package/src/reports/table-wrapper/table-wrapper.scss +1 -16
  151. package/src/resources/moh-505.resource.ts +18 -35
  152. package/src/resources/moh-705.resource.ts +28 -39
  153. package/src/resources/moh-706.resource.ts +17 -30
  154. package/src/resources/moh-710.resource.ts +7 -17
  155. package/src/resources/moh-711.resource.ts +46 -64
  156. package/src/resources/moh-717.resource.ts +7 -17
  157. package/src/resources/moh-731.resource.ts +26 -32
  158. package/src/resources/moh-745.resource.ts +18 -20
  159. package/src/resources/patient-list-page.ts +66 -0
  160. package/src/root.component.tsx +28 -26
  161. package/src/root.scss +36 -0
  162. package/src/utils/get-base-url.ts +39 -7
  163. package/tsconfig.json +1 -1
  164. package/dist/110.js +0 -1
  165. package/dist/110.js.map +0 -1
  166. package/dist/184.js +0 -2
  167. package/dist/184.js.LICENSE.txt +0 -14
  168. package/dist/184.js.map +0 -1
  169. package/dist/205.js +0 -1
  170. package/dist/205.js.map +0 -1
  171. package/dist/812.js +0 -1
  172. package/dist/812.js.map +0 -1
  173. package/dist/822.js +0 -2
  174. package/dist/822.js.LICENSE.txt +0 -20
  175. package/dist/822.js.map +0 -1
  176. package/dist/ampath-esm-reports-app.js.buildmanifest.json +0 -560
  177. package/dist/main.js +0 -1
  178. package/dist/main.js.map +0 -1
  179. package/src/reports/moh-731/registers/moh-366.scss +0 -45
  180. package/src/reports/moh-731/registers/prep-registers.scss +0 -45
  181. package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.scss +0 -18
  182. package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.scss +0 -18
  183. /package/src/{reports/moh-740/shared/utils → utils}/format-indicator.ts +0 -0
@@ -1,17 +1,15 @@
1
- import { Button, Loading, TableCell, TableRow } from '@carbon/react';
2
- import React, { useEffect, useState } from 'react';
1
+ import { TableCell, TableRow } from '@carbon/react';
2
+ import React from 'react';
3
3
  import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
4
4
 
5
- import styles from '../moh711.scss';
5
+ import styles from '../../../common/report-register/register-table.scss';
6
6
  import classNames from 'classnames';
7
7
  import { getMoh405PatientList } from '../../../resources/moh-711.resource';
8
8
  import { moh405Columns } from './type';
9
+ import { moh405ExportColumns } from './moh-405.columns';
10
+ import { RegisterLayout, usePatientList } from '../../../common/report-register';
9
11
 
10
12
  const Moh405Register: React.FC = () => {
11
- const navigate = useNavigate();
12
- const [patientlist, setPatientList] = useState<any[]>([]);
13
- const [isLoading, setIsLoading] = useState(false);
14
-
15
13
  const [searchParams] = useSearchParams();
16
14
  const location = useLocation();
17
15
 
@@ -21,42 +19,43 @@ const Moh405Register: React.FC = () => {
21
19
  const indicator = searchParams.get('indicator');
22
20
  const reportName = location.state?.reportName || '';
23
21
 
24
- useEffect(() => {
25
- const fetchData = async () => {
26
- if (!startDate || !endDate || !locationUuids || !indicator) return;
27
-
28
- setIsLoading(true);
29
-
30
- try {
31
- const params = {
32
- startDate,
33
- endDate,
34
- locationUuids,
35
- indicator,
36
- reportName,
37
- };
38
-
39
- const data = await getMoh405PatientList(params);
40
-
41
- setPatientList(data?.results.results || []);
42
- } catch (error) {
43
- console.error('Failed to fetch register data', error);
44
- } finally {
45
- setIsLoading(false);
46
- }
47
- };
48
-
49
- fetchData();
50
- }, [startDate, endDate, locationUuids, indicator, reportName]);
51
- function navigateBack() {
52
- navigate('/moh-711');
53
- }
22
+ const {
23
+ rows: patientlist,
24
+ total,
25
+ isTotalExact,
26
+ isLoading,
27
+ page,
28
+ pageSize,
29
+ onPageChange,
30
+ fetchAll,
31
+ } = usePatientList(
32
+ ({ startIndex, limit }) =>
33
+ getMoh405PatientList({
34
+ startDate,
35
+ endDate,
36
+ locationUuids,
37
+ indicator,
38
+ reportName,
39
+ startIndex,
40
+ limit,
41
+ }),
42
+ [startDate, endDate, locationUuids, indicator, reportName],
43
+ );
54
44
  return (
55
- <>
56
- <div className={styles.buttonContainer}>
57
- <Button onClick={navigateBack}>Back</Button>
58
- </div>
59
- <div>{isLoading && <Loading />}</div>
45
+ <RegisterLayout
46
+ parentLabel="MOH-711 Report"
47
+ parentPath="/moh-711"
48
+ title="MOH 405 ANC Register"
49
+ isLoading={isLoading}
50
+ isEmpty={patientlist.length === 0}
51
+ page={page}
52
+ pageSize={pageSize}
53
+ total={total}
54
+ isTotalExact={isTotalExact}
55
+ onPageChange={onPageChange}
56
+ fetchAll={fetchAll}
57
+ columns={moh405ExportColumns}
58
+ >
60
59
  <div className={styles.tableContainer}>
61
60
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
62
61
  <thead>
@@ -351,52 +350,52 @@ const Moh405Register: React.FC = () => {
351
350
  </thead>
352
351
  <tbody>
353
352
  <tr>
354
- <td className={styles.textCenter}>(a)</td>
355
- <td className={styles.textCenter}>(b)</td>
356
- <td className={styles.textCenter}>(c)</td>
357
- <td className={styles.textCenter}>(d)</td>
358
- <td className={styles.textCenter}>(e)</td>
359
- <td className={styles.textCenter}>(f)</td>
360
- <td className={styles.textCenter}>(g)</td>
361
- <td className={styles.textCenter}>(h)</td>
362
- <td className={styles.textCenter}>(i)</td>
363
- <td className={styles.textCenter}>(j)</td>
364
- <td className={styles.textCenter}>(k)</td>
365
- <td className={styles.textCenter}>(l)</td>
366
- <td className={styles.textCenter}>(m)</td>
367
- <td className={styles.textCenter}>(n)</td>
368
- <td className={styles.textCenter}>(o)</td>
369
- <td className={styles.textCenter}>(p)</td>
370
- <td className={styles.textCenter}>(q)</td>
371
- <td className={styles.textCenter}>(r)</td>
372
- <td className={styles.textCenter}>(s)</td>
373
- <td className={styles.textCenter}>(t)</td>
374
- <td className={styles.textCenter}>(u)</td>
375
- <td className={styles.textCenter}>(v)</td>
376
- <td className={styles.textCenter}>(w)</td>
377
- <td className={styles.textCenter}>(x)</td>
378
- <td className={styles.textCenter}>(y)</td>
379
- <td className={styles.textCenter}>(z)</td>
380
- <td className={styles.textCenter}>(aa)</td>
381
- <td className={styles.textCenter}>(ab)</td>
382
- <td className={styles.textCenter}>(ac)</td>
383
- <td className={styles.textCenter}>(ad)</td>
384
- <td className={styles.textCenter}>(ae)</td>
385
- <td className={styles.textCenter}>(af)</td>
386
- <td className={styles.textCenter}>(ag)</td>
387
- <td className={styles.textCenter}>(ah)</td>
388
- <td className={styles.textCenter}>(ai)</td>
389
- <td className={styles.textCenter}>(aj)</td>
390
- <td className={styles.textCenter}>(ak)</td>
391
- <td className={styles.textCenter}>(al)</td>
392
- <td className={styles.textCenter}>(am)</td>
393
- <td className={styles.textCenter}>(an)</td>
394
- <td className={styles.textCenter}>(ao)</td>
395
- <td className={styles.textCenter}>(ap)</td>
396
- <td className={styles.textCenter}>(aq)</td>
397
- <td className={styles.textCenter}>(ar)</td>
398
- <td className={styles.textCenter}>(as)</td>
399
- <td className={styles.textCenter}>(at)</td>
353
+ <td className={styles.textCentre}>(a)</td>
354
+ <td className={styles.textCentre}>(b)</td>
355
+ <td className={styles.textCentre}>(c)</td>
356
+ <td className={styles.textCentre}>(d)</td>
357
+ <td className={styles.textCentre}>(e)</td>
358
+ <td className={styles.textCentre}>(f)</td>
359
+ <td className={styles.textCentre}>(g)</td>
360
+ <td className={styles.textCentre}>(h)</td>
361
+ <td className={styles.textCentre}>(i)</td>
362
+ <td className={styles.textCentre}>(j)</td>
363
+ <td className={styles.textCentre}>(k)</td>
364
+ <td className={styles.textCentre}>(l)</td>
365
+ <td className={styles.textCentre}>(m)</td>
366
+ <td className={styles.textCentre}>(n)</td>
367
+ <td className={styles.textCentre}>(o)</td>
368
+ <td className={styles.textCentre}>(p)</td>
369
+ <td className={styles.textCentre}>(q)</td>
370
+ <td className={styles.textCentre}>(r)</td>
371
+ <td className={styles.textCentre}>(s)</td>
372
+ <td className={styles.textCentre}>(t)</td>
373
+ <td className={styles.textCentre}>(u)</td>
374
+ <td className={styles.textCentre}>(v)</td>
375
+ <td className={styles.textCentre}>(w)</td>
376
+ <td className={styles.textCentre}>(x)</td>
377
+ <td className={styles.textCentre}>(y)</td>
378
+ <td className={styles.textCentre}>(z)</td>
379
+ <td className={styles.textCentre}>(aa)</td>
380
+ <td className={styles.textCentre}>(ab)</td>
381
+ <td className={styles.textCentre}>(ac)</td>
382
+ <td className={styles.textCentre}>(ad)</td>
383
+ <td className={styles.textCentre}>(ae)</td>
384
+ <td className={styles.textCentre}>(af)</td>
385
+ <td className={styles.textCentre}>(ag)</td>
386
+ <td className={styles.textCentre}>(ah)</td>
387
+ <td className={styles.textCentre}>(ai)</td>
388
+ <td className={styles.textCentre}>(aj)</td>
389
+ <td className={styles.textCentre}>(ak)</td>
390
+ <td className={styles.textCentre}>(al)</td>
391
+ <td className={styles.textCentre}>(am)</td>
392
+ <td className={styles.textCentre}>(an)</td>
393
+ <td className={styles.textCentre}>(ao)</td>
394
+ <td className={styles.textCentre}>(ap)</td>
395
+ <td className={styles.textCentre}>(aq)</td>
396
+ <td className={styles.textCentre}>(ar)</td>
397
+ <td className={styles.textCentre}>(as)</td>
398
+ <td className={styles.textCentre}>(at)</td>
400
399
  </tr>
401
400
  {patientlist?.length > 0 ? (
402
401
  patientlist.map((patient, rowIndex) => (
@@ -514,7 +513,7 @@ const Moh405Register: React.FC = () => {
514
513
  </tbody>
515
514
  </table>
516
515
  </div>
517
- </>
516
+ </RegisterLayout>
518
517
  );
519
518
  };
520
519
 
@@ -0,0 +1,120 @@
1
+ import { type RegisterColumn } from '../../../common/report-register';
2
+
3
+ /**
4
+ * MOH 405 as the register prints it: one column per cell, in the order they appear.
5
+ *
6
+ * The last 10 columns are rendered by the table but have no headings above
7
+ * them -- the header row is 46 columns wide against 56 of data. They carry
8
+ * their field names rather than headings borrowed from neighbouring columns.
9
+ */
10
+ export const moh405ExportColumns: RegisterColumn[] = [
11
+ { header: 'Date of visit', value: (row) => row.date_of_visit ?? '' },
12
+ { header: '(New Client) - ANC Number - NUPI', value: (row) => row.anc_number ?? '' },
13
+ { header: 'ANC Number/NUPI (Re Visit)', value: (row) => row.anc_number_NUPI ?? '' },
14
+ { header: 'AMRSID', value: (row) => row.amrsID ?? '' },
15
+ { header: 'Number of Visits (1st,2nd,3rd, 4th ….)', value: (row) => row.number_of_anc_visits ?? '' },
16
+ { header: 'Full Name (First, Middle, Surname)', value: (row) => row.full_names ?? '' },
17
+ { header: 'Date of Birth (DD/MM/YYYY) - Age', value: (row) => row.date_of_birth ?? '' },
18
+ { header: 'Subcounty/ County', value: (row) => row.subcounty_county ?? '' },
19
+ { header: 'Village/Estate/ Landmark - Phone Number', value: (row) => row.village_estate_landmark ?? '' },
20
+ {
21
+ header:
22
+ 'Marital Status NM=Never Married/Single MM=Married Monogamous MP=Married Polygamous W=Widowed D=Divorced S=Separated',
23
+ value: (row) => row.marital_status ?? '',
24
+ },
25
+ { header: 'Parity', value: (row) => row.parity ?? '' },
26
+ { header: 'Gravidae', value: (row) => row.gravidae ?? '' },
27
+ { header: 'Date of Last Menstrual Period (LMP) - (dd/mm/yyyy)', value: (row) => row.last_lmp_date ?? '' },
28
+ { header: 'Expected Date of Delivery (EDD) - (dd/mm/yyyy)', value: (row) => row.edd ?? '' },
29
+ { header: 'Gestation in Weeks', value: (row) => row.gestation_in_weeks ?? '' },
30
+ { header: 'MUAC 1= Green, 2=Yellow, 3=Red', value: (row) => row.muac ?? '' },
31
+ { header: 'Height (cm)', value: (row) => row.height ?? '' },
32
+ { header: 'Weight (kg)', value: (row) => row.weight ?? '' },
33
+ { header: 'Blood Pressure', value: (row) => row.blood_pressure ?? '' },
34
+ { header: 'Breast Exam 1=normal 2=abnormal', value: (row) => row.breast_exam ?? '' },
35
+ {
36
+ header: 'FGM (Y/N) - FGM associated complications: 1=Scarring 2=Keloids 3=Dyspaneuria 4=UTI 5 = NA',
37
+ value: (row) => row.fgm ?? '',
38
+ },
39
+ { header: 'Laboratory - Haemoglobin (Level/ ND/NA)', value: (row) => row.haemoglobin ?? '' },
40
+ {
41
+ header:
42
+ 'Laboratory - Blood Sugar Testing for Diabetes: 1=RBS&lt; 11.1 mmol/L, No Diabetes, 2=RBS&gt;11.1 mmol/L, Has Diabetes, 3=No RBS done',
43
+ value: (row) => row.blood_sugar_test ?? '',
44
+ },
45
+ { header: 'Laboratory - Blood group and rhesus (Y/N)', value: (row) => row.blood_group_rhesus ?? '' },
46
+ { header: 'Laboratory - Urinalysis (Y/N)', value: (row) => row.urinalysis ?? '' },
47
+ {
48
+ header: 'Laboratory - Type of Test RPR/ VDRL/ Duo Test/ NA - Test Results (P/N/NA)',
49
+ value: (row) => row.rpr_vdrl_duo ?? '',
50
+ },
51
+ {
52
+ header: 'Laboratory - Hepatitis B virus Sceening Result (P/N/ND) - Treatment (Y/N/NA)',
53
+ value: (row) => row.hepatitisB ?? '',
54
+ },
55
+ {
56
+ header: 'Laboratory - TB Screening: Codes (1-5) - 1=Presumed TB 2=No Signs 3=On TB Treatment 4=On TPT 5=Not Done',
57
+ value: (row) => row.tb_screening ?? '',
58
+ },
59
+ {
60
+ header: 'Laboratory - HIV Testing (Initial or Retest, Known Poitive or Revisit) - (I/R/KP/ND/Rev)',
61
+ value: (row) => row.hiv_test_type ?? '',
62
+ },
63
+ {
64
+ header: 'Laboratory - HIV Test 1 - Kit Name - Expiry / / - (N/P/I/NA)',
65
+ value: (row) => row.hiv_test_1_kit_name ?? '',
66
+ },
67
+ {
68
+ header: 'Laboratory - HIV Test 2 - Kit Name - Expiry / / - (N/P/I/NA)',
69
+ value: (row) => row.hiv_test_2_kit_name ?? '',
70
+ },
71
+ {
72
+ header: 'Laboratory - HIV Test 3 - Kit Name - Expiry / / - (N/P/I/NA)',
73
+ value: (row) => row.hiv_test_3_kit_name ?? '',
74
+ },
75
+ { header: 'Laboratory - HIV Results - (N/P/Ic/U/N A)', value: (row) => row.hiv_results ?? '' },
76
+ {
77
+ header: 'Maternal HAART - N = New on ART. OA = On ART NA = Not Applicable',
78
+ value: (row) => row.maternal_haart ?? '',
79
+ },
80
+ { header: 'Infant Prophylaxis - AN = AZT&NVP A = AZT N = NVP NA', value: (row) => row.infant_prophylaxis ?? '' },
81
+ { header: 'Partner HIV Testing - N/P/KP/NA', value: (row) => row.partner_hiv_testing ?? '' },
82
+ {
83
+ header:
84
+ 'Other Conditions and Treatment - 1=Hypertension; 2=Diabetes; 3=Epilepsy; 4=Malaria in Pregnancy; 5=STIs/RTI; 6=Others (Specify) 7=None Record all that apply - Treatment (Y/N/NA)',
85
+ value: (row) => row.other_conditions ?? '',
86
+ },
87
+ { header: 'Deworming - (Y/N/NA)', value: (row) => row.deworming ?? '' },
88
+ { header: 'IPT 1-3 - (1,2,3,N,NA)', value: (row) => row.ipt_1_3 ?? '' },
89
+ {
90
+ header: 'TT Dose - 1=TT Dose 1st dose 2=2nd dose 3=3rd dose 4=4th dose 5=5th dose NA=None',
91
+ value: (row) => row.tt_dose ?? '',
92
+ },
93
+ {
94
+ header:
95
+ 'Supplementation - Given Supplementation 1=Combined IFAs 2=Iron 3=Folate 4=Iron+Folate Separately 5=Calcium',
96
+ value: (row) => row.supplementation ?? '',
97
+ },
98
+ { header: 'LLITNs - Received LLITNs (Y/N)', value: (row) => row.llitns ?? '' },
99
+ {
100
+ header: 'Referrrals - From - 1=From Community Unit 2=Another Health Facility 3=Not Applicable',
101
+ value: (row) => row.referrals_from ?? '',
102
+ },
103
+ {
104
+ header:
105
+ 'Referrrals - To - 1=To Community Unit 2=HIV preventive services 3=Another Health Facility 4=Not Applicable',
106
+ value: (row) => row.referrals_to ?? '',
107
+ },
108
+ { header: 'Referrrals - Reason for referral (specify)', value: (row) => row.reason_for_referral ?? '' },
109
+ { header: 'Remarks', value: (row) => row.remarks ?? '' },
110
+ { header: 'NUPI', value: (row) => row.NUPI ?? '' },
111
+ { header: 'Age', value: (row) => row.age ?? '' },
112
+ { header: 'Phone number', value: (row) => row.phone_number ?? '' },
113
+ { header: 'Fgm complications', value: (row) => row.fgm_complications ?? '' },
114
+ { header: 'Rpr vdrl duo results', value: (row) => row.rpr_vdrl_duo_results ?? '' },
115
+ { header: 'Hepatitis B treatment', value: (row) => row.hepatitisB_treatment ?? '' },
116
+ { header: 'Hiv test 1 expiry date', value: (row) => row.hiv_test_1_expiry_date ?? '' },
117
+ { header: 'Hiv test 2 expiry date', value: (row) => row.hiv_test_2_expiry_date ?? '' },
118
+ { header: 'Hiv test 3 expiry date', value: (row) => row.hiv_test_3_expiry_date ?? '' },
119
+ { header: 'Other conditions treatment', value: (row) => row.other_conditions_treatment ?? '' },
120
+ ];
@@ -1,18 +1,14 @@
1
- import { Button, Loading } from '@carbon/react';
2
- import React, { useEffect, useState } from 'react';
1
+ import React from 'react';
3
2
  import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
4
3
 
5
- import styles from '../moh711.scss';
4
+ import styles from '../../../common/report-register/register-table.scss';
6
5
  import classNames from 'classnames';
7
6
  import { getMoh406PatientList } from '../../../resources/moh-711.resource';
8
7
  import { moh406Columns } from './type';
8
+ import { moh406ExportColumns } from './moh-406.columns';
9
+ import { RegisterLayout, usePatientList } from '../../../common/report-register';
9
10
 
10
11
  const Moh406Register: React.FC = () => {
11
- const navigate = useNavigate();
12
-
13
- const [patientlist, setPatientList] = useState<any[]>([]);
14
- const [isLoading, setIsLoading] = useState(false);
15
-
16
12
  const [searchParams] = useSearchParams();
17
13
  const location = useLocation();
18
14
 
@@ -22,42 +18,43 @@ const Moh406Register: React.FC = () => {
22
18
  const indicator = searchParams.get('indicator');
23
19
  const reportName = location.state?.reportName || '';
24
20
 
25
- useEffect(() => {
26
- const fetchData = async () => {
27
- if (!startDate || !endDate || !locationUuids || !indicator) return;
28
-
29
- setIsLoading(true);
30
-
31
- try {
32
- const params = {
33
- startDate,
34
- endDate,
35
- locationUuids,
36
- indicator,
37
- reportName,
38
- };
39
-
40
- const data = await getMoh406PatientList(params);
41
-
42
- setPatientList(data?.results.results || []);
43
- } catch (error) {
44
- console.error('Failed to fetch register data', error);
45
- } finally {
46
- setIsLoading(false);
47
- }
48
- };
49
-
50
- fetchData();
51
- }, [startDate, endDate, locationUuids, indicator, reportName]);
52
- function navigateBack() {
53
- navigate('/moh-711');
54
- }
21
+ const {
22
+ rows: patientlist,
23
+ total,
24
+ isTotalExact,
25
+ isLoading,
26
+ page,
27
+ pageSize,
28
+ onPageChange,
29
+ fetchAll,
30
+ } = usePatientList(
31
+ ({ startIndex, limit }) =>
32
+ getMoh406PatientList({
33
+ startDate,
34
+ endDate,
35
+ locationUuids,
36
+ indicator,
37
+ reportName,
38
+ startIndex,
39
+ limit,
40
+ }),
41
+ [startDate, endDate, locationUuids, indicator, reportName],
42
+ );
55
43
  return (
56
- <>
57
- <div className={styles.buttonContainer}>
58
- <Button onClick={navigateBack}>Back</Button>
59
- </div>
60
- <div>{isLoading && <Loading />}</div>
44
+ <RegisterLayout
45
+ parentLabel="MOH-711 Report"
46
+ parentPath="/moh-711"
47
+ title="MOH 406 Register"
48
+ isLoading={isLoading}
49
+ isEmpty={patientlist.length === 0}
50
+ page={page}
51
+ pageSize={pageSize}
52
+ total={total}
53
+ isTotalExact={isTotalExact}
54
+ onPageChange={onPageChange}
55
+ fetchAll={fetchAll}
56
+ columns={moh406ExportColumns}
57
+ >
61
58
  <div className={styles.tableContainer}>
62
59
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
63
60
  <thead>
@@ -388,49 +385,49 @@ const Moh406Register: React.FC = () => {
388
385
  </thead>
389
386
  <tbody>
390
387
  <tr>
391
- <td className={styles.textCenter}>(a)</td>
392
- <td className={styles.textCenter}>(b)</td>
393
- <td className={styles.textCenter}>(c)</td>
394
- <td className={styles.textCenter}>(d)</td>
395
- <td className={styles.textCenter}>(e)</td>
396
- <td className={styles.textCenter}>(f)</td>
397
- <td className={styles.textCenter}>(g)</td>
398
- <td className={styles.textCenter}>(h)</td>
399
- <td className={styles.textCenter}>(i)</td>
400
- <td className={styles.textCenter}>(j)</td>
401
- <td className={styles.textCenter}>(k)</td>
402
- <td className={styles.textCenter}>(l)</td>
403
- <td className={styles.textCenter}>(m)</td>
404
- <td className={styles.textCenter}>(n)</td>
405
- <td className={styles.textCenter}>(o)</td>
406
- <td className={styles.textCenter}>(p)</td>
407
- <td className={styles.textCenter}>(q)</td>
408
- <td className={styles.textCenter}>(r)</td>
409
- <td className={styles.textCenter}>(s)</td>
410
- <td className={styles.textCenter}>(t)</td>
411
- <td className={styles.textCenter}>(u)</td>
412
- <td className={styles.textCenter}>(v)</td>
413
- <td className={styles.textCenter}>(w)</td>
414
- <td className={styles.textCenter}>(x)</td>
415
- <td className={styles.textCenter}>(y)</td>
416
- <td className={styles.textCenter}>(z)</td>
417
- <td className={styles.textCenter}>(aa)</td>
418
- <td className={styles.textCenter}>(ab)</td>
419
- <td className={styles.textCenter}>(ac)</td>
420
- <td className={styles.textCenter}>(ad)</td>
421
- <td className={styles.textCenter}>(ae)</td>
422
- <td className={styles.textCenter}>(af)</td>
423
- <td className={styles.textCenter}>(ag)</td>
424
- <td className={styles.textCenter}>(ah)</td>
425
- <td className={styles.textCenter}>(ai)</td>
426
- <td className={styles.textCenter}>(aj)</td>
427
- <td className={styles.textCenter}>(ak)</td>
428
- <td className={styles.textCenter}>(al)</td>
429
- <td className={styles.textCenter}>(am)</td>
430
- <td className={styles.textCenter}>(an)</td>
431
- <td className={styles.textCenter}>(ao)</td>
432
- <td className={styles.textCenter}>(ap)</td>
433
- <td className={styles.textCenter}>(aq)</td>
388
+ <td className={styles.textCentre}>(a)</td>
389
+ <td className={styles.textCentre}>(b)</td>
390
+ <td className={styles.textCentre}>(c)</td>
391
+ <td className={styles.textCentre}>(d)</td>
392
+ <td className={styles.textCentre}>(e)</td>
393
+ <td className={styles.textCentre}>(f)</td>
394
+ <td className={styles.textCentre}>(g)</td>
395
+ <td className={styles.textCentre}>(h)</td>
396
+ <td className={styles.textCentre}>(i)</td>
397
+ <td className={styles.textCentre}>(j)</td>
398
+ <td className={styles.textCentre}>(k)</td>
399
+ <td className={styles.textCentre}>(l)</td>
400
+ <td className={styles.textCentre}>(m)</td>
401
+ <td className={styles.textCentre}>(n)</td>
402
+ <td className={styles.textCentre}>(o)</td>
403
+ <td className={styles.textCentre}>(p)</td>
404
+ <td className={styles.textCentre}>(q)</td>
405
+ <td className={styles.textCentre}>(r)</td>
406
+ <td className={styles.textCentre}>(s)</td>
407
+ <td className={styles.textCentre}>(t)</td>
408
+ <td className={styles.textCentre}>(u)</td>
409
+ <td className={styles.textCentre}>(v)</td>
410
+ <td className={styles.textCentre}>(w)</td>
411
+ <td className={styles.textCentre}>(x)</td>
412
+ <td className={styles.textCentre}>(y)</td>
413
+ <td className={styles.textCentre}>(z)</td>
414
+ <td className={styles.textCentre}>(aa)</td>
415
+ <td className={styles.textCentre}>(ab)</td>
416
+ <td className={styles.textCentre}>(ac)</td>
417
+ <td className={styles.textCentre}>(ad)</td>
418
+ <td className={styles.textCentre}>(ae)</td>
419
+ <td className={styles.textCentre}>(af)</td>
420
+ <td className={styles.textCentre}>(ag)</td>
421
+ <td className={styles.textCentre}>(ah)</td>
422
+ <td className={styles.textCentre}>(ai)</td>
423
+ <td className={styles.textCentre}>(aj)</td>
424
+ <td className={styles.textCentre}>(ak)</td>
425
+ <td className={styles.textCentre}>(al)</td>
426
+ <td className={styles.textCentre}>(am)</td>
427
+ <td className={styles.textCentre}>(an)</td>
428
+ <td className={styles.textCentre}>(ao)</td>
429
+ <td className={styles.textCentre}>(ap)</td>
430
+ <td className={styles.textCentre}>(aq)</td>
434
431
  </tr>
435
432
  {patientlist?.length > 0 ? (
436
433
  patientlist.map((patient, index) => (
@@ -518,7 +515,7 @@ const Moh406Register: React.FC = () => {
518
515
  ))
519
516
  ) : (
520
517
  <tr>
521
- <td colSpan={moh406Columns.length} className={styles.textCenter}>
518
+ <td colSpan={moh406Columns.length} className={styles.textCentre}>
522
519
  No data available
523
520
  </td>
524
521
  </tr>
@@ -526,7 +523,7 @@ const Moh406Register: React.FC = () => {
526
523
  </tbody>
527
524
  </table>
528
525
  </div>
529
- </>
526
+ </RegisterLayout>
530
527
  );
531
528
  };
532
529