@openmrs/esm-patient-programs-app 3.0.3-pre.989 → 3.1.0

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 (53) hide show
  1. package/dist/169.js +1 -1
  2. package/dist/169.js.map +1 -1
  3. package/dist/206.js +3 -0
  4. package/dist/206.js.LICENSE.txt +14 -0
  5. package/dist/206.js.map +1 -0
  6. package/dist/313.js +1 -1
  7. package/dist/313.js.map +1 -1
  8. package/dist/339.js +1 -1
  9. package/dist/339.js.map +1 -1
  10. package/dist/364.js +1 -1
  11. package/dist/364.js.map +1 -1
  12. package/dist/373.js +1 -1
  13. package/dist/482.js +2 -0
  14. package/dist/482.js.map +1 -0
  15. package/dist/539.js +1 -1
  16. package/dist/539.js.map +1 -1
  17. package/dist/574.js +1 -1
  18. package/dist/600.js +1 -1
  19. package/dist/600.js.map +1 -1
  20. package/dist/628.js +3 -0
  21. package/dist/{970.js.LICENSE.txt → 628.js.LICENSE.txt} +0 -0
  22. package/dist/628.js.map +1 -0
  23. package/dist/78.js +3 -0
  24. package/dist/{906.js.LICENSE.txt → 78.js.LICENSE.txt} +0 -0
  25. package/dist/78.js.map +1 -0
  26. package/dist/9.js +1 -1
  27. package/dist/9.js.map +1 -1
  28. package/dist/932.js +1 -1
  29. package/dist/932.js.map +1 -1
  30. package/dist/943.js +1 -1
  31. package/dist/943.js.map +1 -1
  32. package/dist/968.js +1 -1
  33. package/dist/968.js.map +1 -1
  34. package/dist/openmrs-esm-patient-programs-app.js +1 -1
  35. package/dist/openmrs-esm-patient-programs-app.js.buildmanifest.json +95 -118
  36. package/dist/openmrs-esm-patient-programs-app.js.map +1 -1
  37. package/package.json +3 -3
  38. package/src/index.ts +1 -5
  39. package/translations/en.json +0 -3
  40. package/dist/413.js +0 -2
  41. package/dist/413.js.map +0 -1
  42. package/dist/622.js +0 -2
  43. package/dist/622.js.map +0 -1
  44. package/dist/817.js +0 -3
  45. package/dist/817.js.LICENSE.txt +0 -8
  46. package/dist/817.js.map +0 -1
  47. package/dist/906.js +0 -3
  48. package/dist/906.js.map +0 -1
  49. package/dist/970.js +0 -3
  50. package/dist/970.js.map +0 -1
  51. package/src/programs/program-record.component.tsx +0 -93
  52. package/src/programs/program-record.css +0 -42
  53. package/src/programs/program-record.test.outdated.tsx +0 -57
@@ -1,93 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import dayjs from 'dayjs';
3
- import ProgramsForm from './programs-form.component';
4
- import styles from './program-record.css';
5
- import { SummaryCard, openWorkspaceTab } from '@openmrs/esm-patient-common-lib';
6
- import { RouteComponentProps } from 'react-router-dom';
7
- import { useTranslation, Trans } from 'react-i18next';
8
- import { createErrorHandler } from '@openmrs/esm-framework';
9
- import { getPatientProgramByUuid } from './programs.resource';
10
- import { useProgramsContext } from './programs.context';
11
-
12
- interface ProgramRecordProps extends RouteComponentProps<{ programUuid: string }> {}
13
-
14
- const ProgramRecord: React.FC<ProgramRecordProps> = ({ match }) => {
15
- const [patientProgram, setPatientProgram] = useState(null);
16
- const { t } = useTranslation();
17
- const { patient, patientUuid } = useProgramsContext();
18
- const { programUuid } = match.params;
19
-
20
- useEffect(() => {
21
- if (patient && patientUuid) {
22
- const subscription = getPatientProgramByUuid(programUuid).subscribe((program) => {
23
- setPatientProgram(program), createErrorHandler();
24
- });
25
-
26
- return () => subscription.unsubscribe();
27
- }
28
- }, [patient, patientUuid, programUuid]);
29
-
30
- return (
31
- <>
32
- {!!(patientProgram && Object.entries(patientProgram).length) && (
33
- <div className={styles.programSummary}>
34
- <SummaryCard
35
- name={t('program', 'Program')}
36
- styles={{ width: '100%' }}
37
- editComponent
38
- showComponent={() =>
39
- openWorkspaceTab(ProgramsForm, `${t('editProgram', 'Edit program')}`, {
40
- program: patientProgram?.program?.name,
41
- programUuid: patientProgram?.uuid,
42
- enrollmentDate: patientProgram?.dateEnrolled,
43
- completionDate: patientProgram?.dateCompleted,
44
- locationUuid: patientProgram?.location?.uuid,
45
- })
46
- }
47
- >
48
- <div className={`omrs-type-body-regular ${styles.programCard}`}>
49
- <div>
50
- <p className="omrs-type-title-3" data-testid="program-name">
51
- {patientProgram.program.name}
52
- </p>
53
- </div>
54
- <table className={styles.programTable}>
55
- <thead>
56
- <tr>
57
- <td>
58
- <Trans i18nKey="enrolledOn">Enrolled on</Trans>
59
- </td>
60
- <td>
61
- <Trans i18nKey="status">Status</Trans>
62
- </td>
63
- <td>
64
- <Trans i18nKey="enrolledAt">Enrolled at</Trans>
65
- </td>
66
- </tr>
67
- </thead>
68
- <tbody>
69
- <tr>
70
- <td>{dayjs(patientProgram?.dateEnrolled).format('DD-MMM-YYYY')}</td>
71
- <td className={styles.completedProgram}>
72
- {patientProgram?.dateCompleted ? (
73
- <span className={styles.completionDate}>
74
- <Trans i18nKey="completedOn">Completed on</Trans>{' '}
75
- {dayjs(patientProgram?.dateCompleted).format('DD-MMM-YYYY')}
76
- </span>
77
- ) : (
78
- <Trans i18nKey="active">Active</Trans>
79
- )}
80
- </td>
81
- <td>{patientProgram?.location?.display || '-'}</td>
82
- </tr>
83
- </tbody>
84
- </table>
85
- </div>
86
- </SummaryCard>
87
- </div>
88
- )}
89
- </>
90
- );
91
- };
92
-
93
- export default ProgramRecord;
@@ -1,42 +0,0 @@
1
- :global(.omrs-breakpoint-gt-phone) .programSummary {
2
- display: flex;
3
- }
4
-
5
- :global(.omrs-breakpoint-lt-tablet) .programSummary {
6
- padding: 0.25rem 0.5rem 0 0.5rem;
7
- }
8
-
9
- .programCard {
10
- margin: 0rem 1rem;
11
- }
12
-
13
- .programTable {
14
- width: 100%;
15
- margin-top: 1rem;
16
- margin-bottom: 1rem;
17
- }
18
-
19
- .programTable thead th {
20
- color: var(--omrs-color-ink-medium-contrast);
21
- text-align: left;
22
- }
23
-
24
- .programTable thead {
25
- color: var(--omrs-color-ink-medium-contrast);
26
- }
27
-
28
- .programTable tbody td:nth-child(1) {
29
- font-family: "Work Sans";
30
- }
31
-
32
- .programTable thead td {
33
- margin-top: 0.625rem;
34
- }
35
-
36
- .completedProgram {
37
- font-family: "Work Sans";
38
- }
39
-
40
- .completionDate {
41
- color: var(--omrs-color-ink-medium-contrast);
42
- }
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
- import ProgramRecord from './program-record.component';
3
- import ProgramsForm from './programs-form.component';
4
- import { fireEvent, render, screen } from '@testing-library/react';
5
- import { BrowserRouter } from 'react-router-dom';
6
- import { mockProgramResponse } from '../../../../__mocks__/programs.mock';
7
- import { getPatientProgramByUuid } from './programs.resource';
8
- import { of } from 'rxjs/internal/observable/of';
9
-
10
- const mockFetchPatientProgram = getPatientProgramByUuid as jest.Mock;
11
-
12
- jest.mock('./programs.resource', () => ({
13
- getPatientProgramByUuid: jest.fn(),
14
- }));
15
-
16
- describe('<ProgramRecord />', () => {
17
- beforeEach(() => {
18
- mockFetchPatientProgram.mockReset;
19
- mockFetchPatientProgram.mockReturnValue(of(mockProgramResponse));
20
- });
21
-
22
- afterEach(() => jest.restoreAllMocks());
23
-
24
- it('displays a detailed summary of the selected care program', async () => {
25
- const mockOpenWorkspaceTab = jest.fn();
26
-
27
- render(
28
- <BrowserRouter>
29
- <ProgramRecord match={{ params: { programUuid: '' } }} />
30
- </BrowserRouter>,
31
- );
32
-
33
- await screen.findByRole('heading', { name: 'Program' });
34
-
35
- expect(screen.getByText('Program')).toBeInTheDocument();
36
- const editBtn = screen.getByRole('button', { name: 'Edit' });
37
- expect(editBtn).toBeInTheDocument();
38
- expect(screen.getByText('HIV Care and Treatment')).toBeInTheDocument();
39
- expect(screen.getByText('Enrolled on')).toBeInTheDocument();
40
- expect(screen.getByText('Status')).toBeInTheDocument();
41
- expect(screen.getByText('Enrolled at')).toBeInTheDocument();
42
- expect(screen.getByText('01-Nov-2019')).toBeInTheDocument();
43
- expect(screen.getByText('Active')).toBeInTheDocument();
44
- expect(screen.getByText('-')).toBeInTheDocument();
45
-
46
- // Clicking "Edit" launches edit form in workspace tab
47
- fireEvent.click(editBtn);
48
- expect(mockOpenWorkspaceTab).toHaveBeenCalled();
49
- expect(mockOpenWorkspaceTab).toHaveBeenCalledWith(ProgramsForm, 'Edit Program', {
50
- completionDate: null,
51
- enrollmentDate: '2019-11-01T15:00:00.000+0000',
52
- location: undefined,
53
- program: 'HIV Care and Treatment',
54
- programUuid: '8ba6c08f-66d9-4a18-a233-5f658b1755bf',
55
- });
56
- });
57
- });