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

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.
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import styles from '../moh711.scss';
4
4
  import classNames from 'classnames';
5
- import { useNavigate } from 'react-router-dom';
5
+ import { useLocation, useNavigate } from 'react-router-dom';
6
6
 
7
7
  interface MaternityComponentProps {
8
8
  moh711Data: any;
@@ -13,9 +13,16 @@ interface MaternityComponentProps {
13
13
 
14
14
  const MaternityComponent: React.FC<MaternityComponentProps> = ({ moh711Data, startDate, endDate, locationUuids }) => {
15
15
  const navigate = useNavigate();
16
+ const location = useLocation();
16
17
  const navigateToRegister = (indicator: string) => {
17
18
  navigate(
18
19
  `/moh-333-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
20
+ {
21
+ state: {
22
+ from: location.pathname,
23
+ reportName: 'moh711Report',
24
+ },
25
+ },
19
26
  );
20
27
  };
21
28
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import styles from '../moh711.scss';
4
4
  import classNames from 'classnames';
5
- import { useNavigate } from 'react-router-dom';
5
+ import { useLocation, useNavigate } from 'react-router-dom';
6
6
 
7
7
  interface PNCComponentProps {
8
8
  moh711Data: any;
@@ -13,9 +13,16 @@ interface PNCComponentProps {
13
13
 
14
14
  const PNCComponent: React.FC<PNCComponentProps> = ({ moh711Data, startDate, endDate, locationUuids }) => {
15
15
  const navigate = useNavigate();
16
+ const location = useLocation();
16
17
  const navigateToRegister = (indicator: string) => {
17
18
  navigate(
18
19
  `/moh-406-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
20
+ {
21
+ state: {
22
+ from: location.pathname,
23
+ reportName: 'moh711Report',
24
+ },
25
+ },
19
26
  );
20
27
  };
21
28
  return (
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import styles from '../moh717.scss';
4
4
  import classNames from 'classnames';
5
- import { useNavigate } from 'react-router-dom';
5
+ import { useLocation, useNavigate } from 'react-router-dom';
6
6
 
7
7
  interface MaternityComponentProps {
8
8
  moh717ReportData: any;
@@ -18,9 +18,16 @@ const MaternityComponent: React.FC<MaternityComponentProps> = ({
18
18
  locationUuids,
19
19
  }) => {
20
20
  const navigate = useNavigate();
21
- const navigateToRegister = (indicator?: string) => {
21
+ const location = useLocation();
22
+ const navigateToRegister = (indicator: string | string[]) => {
22
23
  navigate(
23
24
  `/moh-333-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
25
+ {
26
+ state: {
27
+ from: location.pathname,
28
+ reportName: 'moh717Report',
29
+ },
30
+ },
24
31
  );
25
32
  };
26
33
  return (
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import styles from '../moh717.scss';
4
4
  import classNames from 'classnames';
5
- import { useNavigate } from 'react-router-dom';
5
+ import { useLocation, useNavigate } from 'react-router-dom';
6
6
 
7
7
  interface OutpatientComponentProps {
8
8
  moh717ReportData: any;
@@ -18,6 +18,7 @@ const OutpatientComponent: React.FC<OutpatientComponentProps> = ({
18
18
  locationUuids,
19
19
  }) => {
20
20
  const navigate = useNavigate();
21
+ const location = useLocation();
21
22
 
22
23
  const navigateTo204ARegister = (indicator: string | string[]) => {
23
24
  navigate(
@@ -29,6 +30,39 @@ const OutpatientComponent: React.FC<OutpatientComponentProps> = ({
29
30
  `/moh-204b-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
30
31
  );
31
32
  };
33
+ const navigateToMoh405Register = (indicator: string | string[]) => {
34
+ navigate(
35
+ `/moh-405-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
36
+ {
37
+ state: {
38
+ from: location.pathname,
39
+ reportName: 'moh717Report',
40
+ },
41
+ },
42
+ );
43
+ };
44
+ const navigateToMoh406Register = (indicator: string | string[]) => {
45
+ navigate(
46
+ `/moh-406-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
47
+ {
48
+ state: {
49
+ from: location.pathname,
50
+ reportName: 'moh717Report',
51
+ },
52
+ },
53
+ );
54
+ };
55
+ const navigateTo511Register = (indicator: string | string[]) => {
56
+ navigate(
57
+ `/moh-511-register?startDate=${startDate}&endDate=${endDate}&locationUuids=${locationUuids}&indicator=${indicator}`,
58
+ {
59
+ state: {
60
+ from: location.pathname,
61
+ reportName: 'moh717Report',
62
+ },
63
+ },
64
+ );
65
+ };
32
66
  return (
33
67
  <>
34
68
  <table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
@@ -407,23 +441,31 @@ const OutpatientComponent: React.FC<OutpatientComponentProps> = ({
407
441
  <tr>
408
442
  <td>A.4.1</td>
409
443
  <td>CWC Attendances</td>
410
- <td>{moh717ReportData.cwc_attendance_new}</td>
411
- <td>{moh717ReportData.cwc_attendance_revisit}</td>
412
- <td>{(moh717ReportData.cwc_attendance_new || 0) + (moh717ReportData.cwc_attendance_revisit || 0)}</td>
444
+ <td onClick={() => navigateTo511Register('cwc_attendance_new')}>{moh717ReportData.cwc_attendance_new}</td>
445
+ <td onClick={() => navigateTo511Register('cwc_attendance_revisit')}>
446
+ {moh717ReportData.cwc_attendance_revisit}
447
+ </td>
448
+ <td onClick={() => navigateTo511Register(['cwc_attendance_new', 'cwc_attendance_revisit'])}>
449
+ {(moh717ReportData.cwc_attendance_new || 0) + (moh717ReportData.cwc_attendance_revisit || 0)}
450
+ </td>
413
451
  </tr>
414
452
  <tr>
415
453
  <td>A.4.2</td>
416
454
  <td>ANC Attendances</td>
417
- <td>{moh717ReportData.anc_new}</td>
418
- <td>{moh717ReportData.anc_revisit}</td>
419
- <td>{(moh717ReportData.anc_new || 0) + (moh717ReportData.anc_revisit || 0)}</td>
455
+ <td onClick={() => navigateToMoh405Register('anc_new')}>{moh717ReportData.anc_new}</td>
456
+ <td onClick={() => navigateToMoh405Register('anc_revisit')}>{moh717ReportData.anc_revisit}</td>
457
+ <td onClick={() => navigateToMoh405Register(['anc_new', 'anc_revisit'])}>
458
+ {(moh717ReportData.anc_new || 0) + (moh717ReportData.anc_revisit || 0)}
459
+ </td>
420
460
  </tr>
421
461
  <tr>
422
462
  <td>A.4.3</td>
423
463
  <td>PNC Attendances</td>
424
- <td>{moh717ReportData.pnc_new}</td>
425
- <td>{moh717ReportData.pnc_revisit}</td>
426
- <td>{(moh717ReportData.pnc_new || 0) + (moh717ReportData.pnc_revisit || 0)}</td>
464
+ <td onClick={() => navigateToMoh406Register('pnc_new')}>{moh717ReportData.pnc_new}</td>
465
+ <td onClick={() => navigateToMoh406Register('pnc_revisit')}>{moh717ReportData.pnc_revisit}</td>
466
+ <td onClick={() => navigateToMoh406Register(['pnc_new', 'pnc_revisit'])}>
467
+ {(moh717ReportData.pnc_new || 0) + (moh717ReportData.pnc_revisit || 0)}
468
+ </td>
427
469
  </tr>
428
470
  <tr>
429
471
  <td>A.4.4</td>
@@ -6,6 +6,7 @@ interface Moh711Params {
6
6
  startDate?: string;
7
7
  endDate?: string;
8
8
  indicator?: string | string[];
9
+ reportName?: string;
9
10
  }
10
11
 
11
12
  export async function getMoh711(params: Moh711Params): Promise<any> {
@@ -42,6 +43,7 @@ export async function getMoh406PatientList(params: Moh711Params): Promise<any> {
42
43
  startDate: params.startDate || '',
43
44
  endDate: params.endDate || '',
44
45
  indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
46
+ reportName: params.reportName || '',
45
47
  limit: '300',
46
48
  };
47
49
  const queryString = new URLSearchParams(
@@ -70,6 +72,7 @@ export async function getMoh405PatientList(params: Moh711Params): Promise<any> {
70
72
  startDate: params.startDate || '',
71
73
  endDate: params.endDate || '',
72
74
  indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
75
+ reportName: params.reportName || '',
73
76
  limit: '300',
74
77
  };
75
78
  const queryString = new URLSearchParams(
@@ -98,6 +101,7 @@ export async function getMoh333PatientList(params: Moh711Params): Promise<any> {
98
101
  startDate: params.startDate || '',
99
102
  endDate: params.endDate || '',
100
103
  indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
104
+ reportName: params.reportName || '',
101
105
  limit: '300',
102
106
  };
103
107
  const queryString = new URLSearchParams(
@@ -154,6 +158,7 @@ export async function getMoh511PatientList(params: Moh711Params): Promise<any> {
154
158
  startDate: params.startDate || '',
155
159
  endDate: params.endDate || '',
156
160
  indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
161
+ reportName: params.reportName || '',
157
162
  limit: '300',
158
163
  };
159
164
  const queryString = new URLSearchParams(