@ampath/esm-reports-app 1.0.0-next.40 → 1.0.0-next.42

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 (147) hide show
  1. package/dist/110.js +2 -1
  2. package/dist/110.js.LICENSE.txt +35 -0
  3. package/dist/110.js.map +1 -1
  4. package/dist/205.js +1 -1
  5. package/dist/441.js +1 -0
  6. package/dist/441.js.map +1 -0
  7. package/dist/738.js +1 -0
  8. package/dist/738.js.map +1 -0
  9. package/dist/812.js +1 -1
  10. package/dist/812.js.map +1 -1
  11. package/dist/ampath-esm-reports-app.js +1 -1
  12. package/dist/ampath-esm-reports-app.js.buildmanifest.json +66 -39
  13. package/dist/main.js +1 -1
  14. package/dist/main.js.map +1 -1
  15. package/dist/routes.json +1 -1
  16. package/package.json +1 -1
  17. package/src/common/report-error/index.ts +1 -0
  18. package/src/common/report-error/show-report-error.ts +25 -0
  19. package/src/common/report-filters/date-range.ts +137 -0
  20. package/src/common/report-filters/index.ts +4 -0
  21. package/src/common/report-filters/report-filters.component.tsx +291 -104
  22. package/src/common/report-filters/report-filters.scss +199 -32
  23. package/src/common/report-filters/types.ts +66 -0
  24. package/src/common/report-filters/use-restore-period.ts +43 -0
  25. package/src/common/report-page/index.ts +2 -0
  26. package/src/common/report-page/report-page.component.tsx +32 -0
  27. package/src/common/report-page/report-page.scss +45 -0
  28. package/src/common/report-page/use-page-scale.ts +50 -0
  29. package/src/common/report-placeholder/has-report-data.ts +15 -0
  30. package/src/common/report-placeholder/index.ts +2 -0
  31. package/src/common/report-placeholder/report-placeholder.component.tsx +56 -0
  32. package/src/common/report-placeholder/report-placeholder.scss +46 -0
  33. package/src/common/report-register/index.ts +5 -0
  34. package/src/common/report-register/register-columns.ts +34 -0
  35. package/src/common/report-register/register-layout.component.tsx +237 -0
  36. package/src/common/report-register/register-layout.scss +140 -0
  37. package/src/common/report-register/register-table.scss +62 -0
  38. package/src/common/report-register/report-parents.ts +27 -0
  39. package/src/common/report-register/rows-to-csv.ts +59 -0
  40. package/src/common/report-register/use-patient-list.ts +92 -0
  41. package/src/common/report-skeleton/index.ts +1 -0
  42. package/src/common/report-skeleton/report-skeleton.component.tsx +46 -0
  43. package/src/common/report-skeleton/report-skeleton.scss +29 -0
  44. package/src/config-schema.ts +9 -1
  45. package/src/dashboard/report-catalog.ts +173 -0
  46. package/src/dashboard/reports-dasboard.tsx +101 -35
  47. package/src/dashboard/reports-dashboard.module.scss +269 -11
  48. package/src/index.ts +13 -1
  49. package/src/reports/datatable-wrapper/datatable-wrapper.component.tsx +50 -48
  50. package/src/reports/moh-240/moh-240-header.component.tsx +54 -56
  51. package/src/reports/moh-240/moh-240.columns.ts +64 -0
  52. package/src/reports/moh-240/moh-240.component.tsx +65 -84
  53. package/src/reports/moh-240/moh-240.scss +36 -7
  54. package/src/reports/moh-240/sub-reports/moh-240-register.component.tsx +27 -65
  55. package/src/reports/moh-240/sub-reports/page-summary.component.tsx +2 -2
  56. package/src/reports/moh-505/moh-505-header.component.tsx +59 -57
  57. package/src/reports/moh-505/moh-505.component.tsx +51 -56
  58. package/src/reports/moh-505/moh-505.scss +116 -2
  59. package/src/reports/moh-705B/moh-204b-register.component.tsx +41 -42
  60. package/src/reports/moh-705B/moh-204b.columns.ts +39 -0
  61. package/src/reports/moh-705B/moh-705b.component.tsx +492 -473
  62. package/src/reports/moh-705B/moh-705b.scss +110 -24
  63. package/src/reports/moh-705a/moh-705a.component.tsx +496 -476
  64. package/src/reports/moh-705a/moh-705a.scss +109 -24
  65. package/src/reports/moh-705a/registers/moh-204a-register.component.tsx +41 -42
  66. package/src/reports/moh-705a/registers/moh-204a.columns.ts +57 -0
  67. package/src/reports/moh-706/moh-706-header.component.tsx +58 -56
  68. package/src/reports/moh-706/moh-706.component.tsx +84 -55
  69. package/src/reports/moh-706/moh-706.scss +115 -19
  70. package/src/reports/moh-710/moh-710.component.tsx +743 -727
  71. package/src/reports/moh-710/moh-710.scss +140 -23
  72. package/src/reports/moh-710/registers/moh-511-710-register.component.tsx +48 -43
  73. package/src/reports/moh-710/registers/moh-511-710.columns.ts +52 -0
  74. package/src/reports/moh-711/moh-711.component.tsx +94 -106
  75. package/src/reports/moh-711/moh711.scss +95 -64
  76. package/src/reports/moh-711/registers/moh-333-register.component.tsx +92 -94
  77. package/src/reports/moh-711/registers/moh-333.columns.ts +119 -0
  78. package/src/reports/moh-711/registers/moh-405-register.component.tsx +88 -89
  79. package/src/reports/moh-711/registers/moh-405.columns.ts +120 -0
  80. package/src/reports/moh-711/registers/moh-406-register.component.tsx +85 -88
  81. package/src/reports/moh-711/registers/moh-406.columns.ts +133 -0
  82. package/src/reports/moh-711/registers/moh-510-register.component.tsx +38 -44
  83. package/src/reports/moh-711/registers/moh-511-register.component.tsx +42 -43
  84. package/src/reports/moh-711/registers/moh-511.columns.ts +59 -0
  85. package/src/reports/moh-711/sections/anc.component.tsx +3 -3
  86. package/src/reports/moh-711/sections/cervical-cancer.component.tsx +3 -3
  87. package/src/reports/moh-711/sections/chanis.component.tsx +2 -3
  88. package/src/reports/moh-711/sections/family-planning.component.tsx +2 -2
  89. package/src/reports/moh-711/sections/gbv.component.tsx +2 -2
  90. package/src/reports/moh-711/sections/maternity.component.tsx +3 -8
  91. package/src/reports/moh-711/sections/medical-social-work.component.tsx +2 -12
  92. package/src/reports/moh-711/sections/other.component.tsx +2 -2
  93. package/src/reports/moh-711/sections/physiotherapy.component.tsx +2 -2
  94. package/src/reports/moh-711/sections/pnc.component.tsx +7 -5
  95. package/src/reports/moh-711/sections/post-abortion.component.tsx +2 -2
  96. package/src/reports/moh-711/sections/rehabilitation.component.tsx +2 -2
  97. package/src/reports/moh-711/sections/report-compiled-by.component.tsx +12 -4
  98. package/src/reports/moh-711/sections/tb-screening.component.tsx +2 -2
  99. package/src/reports/moh-717/moh-717.component.tsx +100 -121
  100. package/src/reports/moh-717/moh717.scss +163 -102
  101. package/src/reports/moh-717/sections/maternity.component.tsx +1 -1
  102. package/src/reports/moh-717/sections/orthopaedic-trauma.component.tsx +1 -1
  103. package/src/reports/moh-717/sections/outpatient.component.tsx +23 -23
  104. package/src/reports/moh-717/sections/preparedby.component.tsx +7 -2
  105. package/src/reports/moh-717/sections/special-services.component.tsx +1 -1
  106. package/src/reports/moh-731/moh-731.component.tsx +127 -110
  107. package/src/reports/moh-731/moh-731.scss +396 -68
  108. package/src/reports/moh-731/registers/moh-366.columns.ts +38 -0
  109. package/src/reports/moh-731/registers/moh-366.component.tsx +76 -83
  110. package/src/reports/moh-731/registers/prep-register.component.tsx +70 -78
  111. package/src/reports/moh-731/registers/prep.columns.ts +34 -0
  112. package/src/reports/moh-731/sections/hiv-and-tb-treatment.component.tsx +1031 -751
  113. package/src/reports/moh-731/sections/hiv-testing-and-pre-exposure.component.tsx +230 -86
  114. package/src/reports/moh-731/sections/pmtct.component.tsx +185 -64
  115. package/src/reports/moh-740/moh-740.component.scss +159 -79
  116. package/src/reports/moh-740/moh-740.component.tsx +258 -227
  117. package/src/reports/moh-740/moh-740.resource.ts +17 -10
  118. package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.tsx +77 -96
  119. package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.tsx +50 -70
  120. package/src/reports/moh-740/registers/moh-740-patient-list.tsx +61 -32
  121. package/src/reports/moh-740/registers/moh-740.columns.ts +52 -0
  122. package/src/reports/moh-745/moh-745.component.tsx +897 -877
  123. package/src/reports/moh-745/moh-745.scss +104 -46
  124. package/src/reports/moh-745/registers/moh-412-register.component.tsx +42 -43
  125. package/src/reports/moh-745/registers/moh-412.columns.ts +52 -0
  126. package/src/reports/table-wrapper/table-wrapper.component.tsx +23 -14
  127. package/src/reports/table-wrapper/table-wrapper.scss +1 -16
  128. package/src/resources/moh-505.resource.ts +18 -35
  129. package/src/resources/moh-705.resource.ts +28 -39
  130. package/src/resources/moh-706.resource.ts +17 -30
  131. package/src/resources/moh-710.resource.ts +7 -17
  132. package/src/resources/moh-711.resource.ts +46 -64
  133. package/src/resources/moh-717.resource.ts +7 -17
  134. package/src/resources/moh-731.resource.ts +26 -32
  135. package/src/resources/moh-745.resource.ts +18 -20
  136. package/src/resources/patient-list-page.ts +66 -0
  137. package/src/root.component.tsx +28 -26
  138. package/src/root.scss +39 -0
  139. package/src/utils/get-base-url.ts +39 -7
  140. package/dist/822.js +0 -2
  141. package/dist/822.js.LICENSE.txt +0 -20
  142. package/dist/822.js.map +0 -1
  143. package/src/reports/moh-731/registers/moh-366.scss +0 -45
  144. package/src/reports/moh-731/registers/prep-registers.scss +0 -45
  145. package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.scss +0 -18
  146. package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.scss +0 -18
  147. /package/src/{reports/moh-740/shared/utils → utils}/format-indicator.ts +0 -0
@@ -1,17 +1,14 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React from 'react';
2
2
 
3
- import styles from './moh-366.scss';
3
+ import styles from '../../../common/report-register/register-table.scss';
4
4
  import classNames from 'classnames';
5
- import { useNavigate, useSearchParams } from 'react-router-dom';
5
+ import { useSearchParams } from 'react-router-dom';
6
6
  import { getMoh366PatientList } from '../../../resources/moh-731.resource';
7
- import { Button, Loading } from '@carbon/react';
7
+ import { RegisterLayout, usePatientList } from '../../../common/report-register';
8
+ import { moh366Columns } from './moh-366.columns';
8
9
 
9
10
  interface Moh366RegisterProps {}
10
11
  const Moh366Register: React.FC<Moh366RegisterProps> = () => {
11
- const navigate = useNavigate();
12
- const [patientlist, setPatientList] = useState<any[]>([]);
13
- const [isLoading, setIsLoading] = useState(false);
14
-
15
12
  const [searchParams] = useSearchParams();
16
13
 
17
14
  const startDate = searchParams.get('startDate');
@@ -20,48 +17,44 @@ const Moh366Register: React.FC<Moh366RegisterProps> = () => {
20
17
  const indicator = searchParams.get('indicator');
21
18
  const gender = searchParams.get('gender');
22
19
 
23
- useEffect(() => {
24
- const fetchData = async () => {
25
- if (!startDate || !endDate || !locationUuids || !indicator || gender === null) return;
26
-
27
- setIsLoading(true);
28
-
29
- try {
30
- const params = {
31
- startDate,
32
- endDate,
33
- locationUuids,
34
- indicator,
35
- gender,
36
- };
37
-
38
- const data = await getMoh366PatientList(params);
39
-
40
- setPatientList(data?.results.results || []);
41
- } catch (error) {
42
- console.error('Failed to fetch register data', error);
43
- } finally {
44
- setIsLoading(false);
45
- }
46
- };
47
-
48
- fetchData();
49
- }, [startDate, endDate, locationUuids, indicator, gender]);
50
-
51
- function navigateBack() {
52
- navigate('/moh-731');
53
- }
20
+ const {
21
+ rows: patientlist,
22
+ total,
23
+ isTotalExact,
24
+ isLoading,
25
+ page,
26
+ pageSize,
27
+ onPageChange,
28
+ fetchAll,
29
+ } = usePatientList(
30
+ ({ startIndex, limit }) =>
31
+ getMoh366PatientList({
32
+ startDate,
33
+ endDate,
34
+ locationUuids,
35
+ indicator,
36
+ gender,
37
+ startIndex,
38
+ limit,
39
+ }),
40
+ [startDate, endDate, locationUuids, indicator, gender],
41
+ );
42
+
54
43
  return (
55
- <>
56
- <div className={styles.buttonContainer}>
57
- <Button onClick={navigateBack}>Back</Button>
58
- </div>
59
- {isLoading && <Loading />}
60
- <div className={styles.container}>
61
- <b>Ministry Of Health</b>
62
- <b>HIV Care Treatment Daily Activity Register MOH 366</b>
63
- <b>Ver. July 2023</b>
64
- </div>
44
+ <RegisterLayout
45
+ parentLabel="MOH-731 Report"
46
+ parentPath="/moh-731"
47
+ title="HIV Care Treatment Daily Activity Register MOH 366"
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={moh366Columns}
57
+ >
65
58
  <table className={classNames(styles.table, styles.tableBordered, styles.textCentre)}>
66
59
  <thead>
67
60
  <tr>
@@ -114,7 +107,7 @@ const Moh366Register: React.FC<Moh366RegisterProps> = () => {
114
107
  <th colSpan={4} className={styles.textCentre}>
115
108
  Indicate Y/N/NA
116
109
  </th>
117
- <th colSpan={2} rowSpan={2} className={classNames(styles.textCenter, styles.verticalText)}>
110
+ <th colSpan={2} rowSpan={2} className={classNames(styles.textCentre, styles.verticalText)}>
118
111
  E=Established <br />
119
112
  NE=Not Established
120
113
  </th>
@@ -138,38 +131,38 @@ const Moh366Register: React.FC<Moh366RegisterProps> = () => {
138
131
  </th>
139
132
  </tr>
140
133
  <tr>
141
- <th className={classNames(styles.textCenter, styles.verticalText)}>&lt; 1 yrs (M)</th>
142
- <th className={classNames(styles.textCenter, styles.verticalText)}>&lt; 1 yrs (F)</th>
143
- <th className={classNames(styles.textCenter, styles.verticalText)}>1-4 yrs (M)</th>
144
- <th className={classNames(styles.textCenter, styles.verticalText)}>1-4 yrs (F)</th>
145
- <th className={classNames(styles.textCenter, styles.verticalText)}>5-9 yrs (M)</th>
146
- <th className={classNames(styles.textCenter, styles.verticalText)}>5-9 yrs (F)</th>
147
- <th className={classNames(styles.textCenter, styles.verticalText)}>10-14 yrs (M)</th>
148
- <th className={classNames(styles.textCenter, styles.verticalText)}>10-14 yrs (F)</th>
149
- <th className={classNames(styles.textCenter, styles.verticalText)}>15-19 yrs (M)</th>
150
- <th className={classNames(styles.textCenter, styles.verticalText)}>15-19 yrs (F)</th>
151
- <th className={classNames(styles.textCenter, styles.verticalText)}>20-24 yrs(M)</th>
152
- <th className={classNames(styles.textCenter, styles.verticalText)}>20-24 yrs (F)</th>
153
- <th className={classNames(styles.textCenter, styles.verticalText)}>25+ yrs (M)</th>
154
- <th className={classNames(styles.textCenter, styles.verticalText)}>25+ yrs (F)</th>
155
- <th className={classNames(styles.textCenter, styles.verticalText)}>&lt 15 yrs</th>
156
- <th className={classNames(styles.textCenter, styles.verticalText)}>15+ yrs</th>
157
- <th className={classNames(styles.textCenter, styles.verticalText)}>&lt; 15 yrs</th>
158
- <th className={classNames(styles.textCenter, styles.verticalText)}>15+ yrs</th>
159
- <th className={classNames(styles.textCenter, styles.verticalText)}>&lt; 1 yrs (M)</th>
160
- <th className={classNames(styles.textCenter, styles.verticalText)}>&lt; 1 yrs (F)</th>
161
- <th className={classNames(styles.textCenter, styles.verticalText)}>1-4 yrs (M)</th>
162
- <th className={classNames(styles.textCenter, styles.verticalText)}>1-4 yrs (F)</th>
163
- <th className={classNames(styles.textCenter, styles.verticalText)}>5-9 yrs (M)</th>
164
- <th className={classNames(styles.textCenter, styles.verticalText)}>5-9 yrs (F)</th>
165
- <th className={classNames(styles.textCenter, styles.verticalText)}>10-14 yrs (M)</th>
166
- <th className={classNames(styles.textCenter, styles.verticalText)}>10-14 yrs (F)</th>
167
- <th className={classNames(styles.textCenter, styles.verticalText)}>15-19 yrs (M)</th>
168
- <th className={classNames(styles.textCenter, styles.verticalText)}>15-19 yrs (F)</th>
169
- <th className={classNames(styles.textCenter, styles.verticalText)}>20-24 yrs(M)</th>
170
- <th className={classNames(styles.textCenter, styles.verticalText)}>20-24 yrs (F)</th>
171
- <th className={classNames(styles.textCenter, styles.verticalText)}>25+ yrs (M)</th>
172
- <th className={classNames(styles.textCenter, styles.verticalText)}>25+ yrs (F)</th>
134
+ <th className={classNames(styles.textCentre, styles.verticalText)}>&lt; 1 yrs (M)</th>
135
+ <th className={classNames(styles.textCentre, styles.verticalText)}>&lt; 1 yrs (F)</th>
136
+ <th className={classNames(styles.textCentre, styles.verticalText)}>1-4 yrs (M)</th>
137
+ <th className={classNames(styles.textCentre, styles.verticalText)}>1-4 yrs (F)</th>
138
+ <th className={classNames(styles.textCentre, styles.verticalText)}>5-9 yrs (M)</th>
139
+ <th className={classNames(styles.textCentre, styles.verticalText)}>5-9 yrs (F)</th>
140
+ <th className={classNames(styles.textCentre, styles.verticalText)}>10-14 yrs (M)</th>
141
+ <th className={classNames(styles.textCentre, styles.verticalText)}>10-14 yrs (F)</th>
142
+ <th className={classNames(styles.textCentre, styles.verticalText)}>15-19 yrs (M)</th>
143
+ <th className={classNames(styles.textCentre, styles.verticalText)}>15-19 yrs (F)</th>
144
+ <th className={classNames(styles.textCentre, styles.verticalText)}>20-24 yrs(M)</th>
145
+ <th className={classNames(styles.textCentre, styles.verticalText)}>20-24 yrs (F)</th>
146
+ <th className={classNames(styles.textCentre, styles.verticalText)}>25+ yrs (M)</th>
147
+ <th className={classNames(styles.textCentre, styles.verticalText)}>25+ yrs (F)</th>
148
+ <th className={classNames(styles.textCentre, styles.verticalText)}>&lt 15 yrs</th>
149
+ <th className={classNames(styles.textCentre, styles.verticalText)}>15+ yrs</th>
150
+ <th className={classNames(styles.textCentre, styles.verticalText)}>&lt; 15 yrs</th>
151
+ <th className={classNames(styles.textCentre, styles.verticalText)}>15+ yrs</th>
152
+ <th className={classNames(styles.textCentre, styles.verticalText)}>&lt; 1 yrs (M)</th>
153
+ <th className={classNames(styles.textCentre, styles.verticalText)}>&lt; 1 yrs (F)</th>
154
+ <th className={classNames(styles.textCentre, styles.verticalText)}>1-4 yrs (M)</th>
155
+ <th className={classNames(styles.textCentre, styles.verticalText)}>1-4 yrs (F)</th>
156
+ <th className={classNames(styles.textCentre, styles.verticalText)}>5-9 yrs (M)</th>
157
+ <th className={classNames(styles.textCentre, styles.verticalText)}>5-9 yrs (F)</th>
158
+ <th className={classNames(styles.textCentre, styles.verticalText)}>10-14 yrs (M)</th>
159
+ <th className={classNames(styles.textCentre, styles.verticalText)}>10-14 yrs (F)</th>
160
+ <th className={classNames(styles.textCentre, styles.verticalText)}>15-19 yrs (M)</th>
161
+ <th className={classNames(styles.textCentre, styles.verticalText)}>15-19 yrs (F)</th>
162
+ <th className={classNames(styles.textCentre, styles.verticalText)}>20-24 yrs(M)</th>
163
+ <th className={classNames(styles.textCentre, styles.verticalText)}>20-24 yrs (F)</th>
164
+ <th className={classNames(styles.textCentre, styles.verticalText)}>25+ yrs (M)</th>
165
+ <th className={classNames(styles.textCentre, styles.verticalText)}>25+ yrs (F)</th>
173
166
  </tr>
174
167
  <tr>
175
168
  <th className={styles.textCentre}>(a)</th>
@@ -471,7 +464,7 @@ const Moh366Register: React.FC<Moh366RegisterProps> = () => {
471
464
  ))}
472
465
  </tbody>
473
466
  </table>
474
- </>
467
+ </RegisterLayout>
475
468
  );
476
469
  };
477
470
 
@@ -1,15 +1,12 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React from 'react';
2
2
 
3
- import styles from './prep-registers.scss';
4
- import { useNavigate, useSearchParams } from 'react-router-dom';
3
+ import styles from '../../../common/report-register/register-table.scss';
4
+ import { useSearchParams } from 'react-router-dom';
5
5
  import { getPrepPatientList } from '../../../resources/moh-731.resource';
6
- import { Button, Loading } from '@carbon/react';
7
6
  import classNames from 'classnames';
7
+ import { prepExportColumns } from './prep.columns';
8
+ import { RegisterLayout, usePatientList } from '../../../common/report-register';
8
9
  const PrepRegisterComponent: React.FC = () => {
9
- const navigate = useNavigate();
10
- const [patientlist, setPatientList] = useState<any[]>([]);
11
- const [isLoading, setIsLoading] = useState(false);
12
-
13
10
  const [searchParams] = useSearchParams();
14
11
 
15
12
  const startDate = searchParams.get('startDate');
@@ -18,37 +15,28 @@ const PrepRegisterComponent: React.FC = () => {
18
15
  const indicator = searchParams.get('indicator');
19
16
  const gender = searchParams.get('gender');
20
17
 
21
- useEffect(() => {
22
- const fetchData = async () => {
23
- if (!startDate || !endDate || !locationUuids || !indicator || !gender) return;
24
-
25
- setIsLoading(true);
26
-
27
- try {
28
- const params = {
29
- startDate,
30
- endDate,
31
- locationUuids,
32
- indicator,
33
- gender,
34
- };
35
-
36
- const data = await getPrepPatientList(params);
37
-
38
- setPatientList(data?.results.results || []);
39
- } catch (error) {
40
- console.error('Failed to fetch register data', error);
41
- } finally {
42
- setIsLoading(false);
43
- }
44
- };
45
-
46
- fetchData();
47
- }, [startDate, endDate, locationUuids, indicator, gender]);
48
-
49
- function navigateBack() {
50
- navigate('/moh-731');
51
- }
18
+ const {
19
+ rows: patientlist,
20
+ total,
21
+ isTotalExact,
22
+ isLoading,
23
+ page,
24
+ pageSize,
25
+ onPageChange,
26
+ fetchAll,
27
+ } = usePatientList(
28
+ ({ startIndex, limit }) =>
29
+ getPrepPatientList({
30
+ startDate,
31
+ endDate,
32
+ locationUuids,
33
+ indicator,
34
+ gender,
35
+ startIndex,
36
+ limit,
37
+ }),
38
+ [startDate, endDate, locationUuids, indicator, gender],
39
+ );
52
40
 
53
41
  const transformDate = (date: string): string => {
54
42
  if (!date) return '';
@@ -60,16 +48,20 @@ const PrepRegisterComponent: React.FC = () => {
60
48
  }).format(new Date(date));
61
49
  };
62
50
  return (
63
- <>
64
- <div className={styles.buttonContainer}>
65
- <Button onClick={navigateBack}>Back</Button>
66
- </div>
67
- {isLoading && <Loading />}
68
- <div className={styles.container}>
69
- <b>Ministry Of Health</b>
70
- <b>MOH 267 PrEP Daily Activity Register</b>
71
- <b>Ver. July 2023</b>
72
- </div>
51
+ <RegisterLayout
52
+ parentLabel="MOH-731 Report"
53
+ parentPath="/moh-731"
54
+ title="MOH 267 PrEP Daily Activity Register"
55
+ isLoading={isLoading}
56
+ isEmpty={patientlist.length === 0}
57
+ page={page}
58
+ pageSize={pageSize}
59
+ total={total}
60
+ isTotalExact={isTotalExact}
61
+ onPageChange={onPageChange}
62
+ fetchAll={fetchAll}
63
+ columns={prepExportColumns}
64
+ >
73
65
  <table className={classNames(styles.table, styles.tableBordered, styles.textCentre)}>
74
66
  <thead>
75
67
  <tr>
@@ -141,40 +133,40 @@ const PrepRegisterComponent: React.FC = () => {
141
133
  </th>
142
134
  </tr>
143
135
  <tr>
144
- <th colSpan={2} className={styles.textCenter}>
136
+ <th colSpan={2} className={styles.textCentre}>
145
137
  (a)
146
138
  </th>
147
- <th colSpan={2} className={styles.textCenter}>
139
+ <th colSpan={2} className={styles.textCentre}>
148
140
  (b)
149
141
  </th>
150
- <th colSpan={2} className={styles.textCenter}>
142
+ <th colSpan={2} className={styles.textCentre}>
151
143
  (l)
152
144
  </th>
153
- <th colSpan={3} className={styles.textCenter}>
145
+ <th colSpan={3} className={styles.textCentre}>
154
146
  (c)
155
147
  </th>
156
- <th colSpan={2} className={styles.textCenter}>
148
+ <th colSpan={2} className={styles.textCentre}>
157
149
  (d)
158
150
  </th>
159
- <th colSpan={2} className={styles.textCenter}>
151
+ <th colSpan={2} className={styles.textCentre}>
160
152
  (e)
161
153
  </th>
162
- <th colSpan={3} className={styles.textCenter}>
154
+ <th colSpan={3} className={styles.textCentre}>
163
155
  (f)
164
156
  </th>
165
- <th colSpan={2} className={styles.textCenter}>
157
+ <th colSpan={2} className={styles.textCentre}>
166
158
  (g)
167
159
  </th>
168
- <th colSpan={3} className={styles.textCenter}>
160
+ <th colSpan={3} className={styles.textCentre}>
169
161
  (h)
170
162
  </th>
171
- <th colSpan={2} className={styles.textCenter}>
163
+ <th colSpan={2} className={styles.textCentre}>
172
164
  (i)
173
165
  </th>
174
- <th colSpan={2} className={styles.textCenter}>
166
+ <th colSpan={2} className={styles.textCentre}>
175
167
  (j)
176
168
  </th>
177
- <th colSpan={4} className={styles.textCenter}>
169
+ <th colSpan={4} className={styles.textCentre}>
178
170
  (k)
179
171
  </th>
180
172
  </tr>
@@ -241,23 +233,23 @@ const PrepRegisterComponent: React.FC = () => {
241
233
  <b>TOTAL this Page</b>
242
234
  </td>
243
235
 
244
- <td colSpan={2} className={styles.textCenter}>
236
+ <td colSpan={2} className={styles.textCentre}>
245
237
  {patientlist.length}
246
238
  </td>
247
239
 
248
- <td colSpan={2} className={styles.textCenter}></td>
240
+ <td colSpan={2} className={styles.textCentre}></td>
249
241
 
250
- <td colSpan={3} className={styles.textCenter}></td>
242
+ <td colSpan={3} className={styles.textCentre}></td>
251
243
 
252
- <td colSpan={2} className={styles.textCenter}></td>
244
+ <td colSpan={2} className={styles.textCentre}></td>
253
245
 
254
- <td colSpan={3} className={styles.textCenter}></td>
246
+ <td colSpan={3} className={styles.textCentre}></td>
255
247
 
256
- <td colSpan={2} className={styles.textCenter}></td>
248
+ <td colSpan={2} className={styles.textCentre}></td>
257
249
 
258
- <td colSpan={2} className={styles.textCenter}></td>
250
+ <td colSpan={2} className={styles.textCentre}></td>
259
251
 
260
- <td colSpan={4} className={styles.textCenter}></td>
252
+ <td colSpan={4} className={styles.textCentre}></td>
261
253
  </tr>
262
254
 
263
255
  <tr>
@@ -265,27 +257,27 @@ const PrepRegisterComponent: React.FC = () => {
265
257
  <b>TOTAL this Month</b>
266
258
  </td>
267
259
 
268
- <td colSpan={2} className={styles.textCenter}>
260
+ <td colSpan={2} className={styles.textCentre}>
269
261
  {patientlist.length}
270
262
  </td>
271
263
 
272
- <td colSpan={2} className={styles.textCenter}></td>
264
+ <td colSpan={2} className={styles.textCentre}></td>
273
265
 
274
- <td colSpan={3} className={styles.textCenter}></td>
266
+ <td colSpan={3} className={styles.textCentre}></td>
275
267
 
276
- <td colSpan={2} className={styles.textCenter}></td>
268
+ <td colSpan={2} className={styles.textCentre}></td>
277
269
 
278
- <td colSpan={3} className={styles.textCenter}></td>
270
+ <td colSpan={3} className={styles.textCentre}></td>
279
271
 
280
- <td colSpan={2} className={styles.textCenter}></td>
272
+ <td colSpan={2} className={styles.textCentre}></td>
281
273
 
282
- <td colSpan={2} className={styles.textCenter}></td>
274
+ <td colSpan={2} className={styles.textCentre}></td>
283
275
 
284
- <td colSpan={4} className={styles.textCenter}></td>
276
+ <td colSpan={4} className={styles.textCentre}></td>
285
277
  </tr>
286
278
  </tbody>
287
279
  </table>
288
- </>
280
+ </RegisterLayout>
289
281
  );
290
282
  };
291
283
 
@@ -0,0 +1,34 @@
1
+ import { type RegisterColumn } from '../../../common/report-register';
2
+
3
+ /**
4
+ * The PrEP register's columns, with the headings the register prints.
5
+ *
6
+ * This register prints two rows per client with cells spanning both, so the
7
+ * headings could not be paired to fields by position; they are taken from the
8
+ * header row by the column letter each one carries.
9
+ */
10
+ export const prepExportColumns: RegisterColumn[] = [
11
+ { header: 'PrEP No (a)', value: (row) => row.PrEP_Number ?? '' },
12
+ { header: 'Date of Visit (b)', value: (row) => row.Date_Of_Visit ?? '' },
13
+ { header: 'AMRSID (l)', value: (row) => row.amrsId ?? '' },
14
+ { header: 'National Identification Number (c)', value: (row) => row.National_ID ?? '' },
15
+ { header: 'National Unique Patient Identifier (NUPI) (c)', value: (row) => row.NUPI ?? '' },
16
+ { header: 'Age (d)', value: (row) => row.Age ?? '' },
17
+ { header: 'Sex (M/F) (e)', value: (row) => row.Sex ?? '' },
18
+ {
19
+ header: 'Population type (f): 1. General Population 2. Discordant Couple 3. MSM/MSW 4. FSW 5. PWID/PWUD 6. VP',
20
+ value: (row) => row.population_type ?? '',
21
+ },
22
+ {
23
+ header: 'Client PrEP Status (g): N-New C-Continuing D-Discontinued R-Restart',
24
+ value: (row) => row.client_prep_status ?? '',
25
+ },
26
+ {
27
+ header:
28
+ 'PrEP Method (h): 1. Daily oral PrEP 2. Event driven oral PrEP 3. Dapivirine Vaginal ring 4. Cabotegravir Injectable',
29
+ value: (row) => row.prep_method ?? '',
30
+ },
31
+ { header: 'HIV Results (N/P/Ic/NA) (i)', value: (row) => row.HIV_result ?? '' },
32
+ { header: 'Diagnosed with STI (N/Y) (j)', value: (row) => row.with_STI ?? '' },
33
+ { header: 'Remarks (k)', value: (row) => row.remarks ?? '' },
34
+ ];