Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O3-1027: Encounters view should use the encounter time #526

Merged
merged 4 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/esm-patient-chart-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
},
"dependencies": {
"@carbon/icons-react": "^10.18.0",
"@openmrs/esm-patient-common-lib": "^3.0.3",
"carbon-components-react": "^7.25.0",
"lodash-es": "^4.17.15",
"uuid": "^8.3.2"
Expand All @@ -52,6 +51,7 @@
"rxjs": "6.x"
},
"devDependencies": {
"@types/uuid": "^8.3.0"
"@types/uuid": "^8.3.0",
"@openmrs/esm-patient-common-lib": "^3.0.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const EncounterListDataTable: React.FC<EncounterListProps> = ({ encounters, visi
{rows.map((row, ind) => (
<React.Fragment key={row.id}>
<TableExpandRow {...getRowProps({ row })}>
{row.cells.map((cell, ind) => (
{row.cells.map((cell) => (
<TableCell key={cell.id}>{cell.value}</TableCell>
))}
</TableExpandRow>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import React, { useState, useMemo, useEffect } from 'react';
import dayjs from 'dayjs';
import styles from '../visit-detail-overview.scss';
import EncounterList from './encounter-list.component';
import VisitSummary from './visit-summary.component';
import { Button } from 'carbon-components-react';
import { useTranslation } from 'react-i18next';
import { Encounter } from '../visit.resource';
import { Visit } from '@openmrs/esm-framework';

function formatDateTime(date) {
return dayjs(date).format('MMM DD, YYYY - hh:mm');
}
import { formatDate, formatDatetime, formatTime, parseDate, Visit } from '@openmrs/esm-framework';
import dayjs from 'dayjs';

interface VisitDetailComponentProps {
visit: Visit;
Expand All @@ -25,7 +21,7 @@ const VisitDetailComponent: React.FC<VisitDetailComponentProps> = ({ visit, pati
() =>
visit.encounters.map((encounter: Encounter) => ({
id: encounter.uuid,
time: dayjs(encounter.encounterDateTime).format('hh:mm'),
time: formatTime(parseDate(encounter.encounterDatetime)),
encounterType: encounter.encounterType.display,
provider: encounter.encounterProviders.length > 0 ? encounter.encounterProviders[0].display : '',
obs: encounter.obs,
Expand All @@ -44,7 +40,7 @@ const VisitDetailComponent: React.FC<VisitDetailComponentProps> = ({ visit, pati
<h4 className={styles.productiveHeading02}>
{visit.visitType.display}
<br />
<p className={`${styles.bodyLong01} ${styles.text02}`}>{formatDateTime(visit.startDatetime)}</p>
<p className={`${styles.bodyLong01} ${styles.text02}`}>{formatDatetime(parseDate(visit.startDatetime))}</p>
</h4>
<div className={styles.toggleButtons}>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('VisitDetailOverview', () => {
userEvent.click(encountersButton);

expect(screen.getByRole('table')).toBeInTheDocument();
expect(screen.getByRole('heading', { name: /ECH Aug 18, 2021/i })).toBeInTheDocument();
expect(screen.getByRole('heading', { name: /ECH 18-Aug-2021/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /encounters/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Visit summary/i })).toBeInTheDocument();
expect(screen.getByRole('row', { name: /Vitals/i })).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function usePastVisits(patientUuid: string) {

export interface Encounter {
uuid: string;
encounterDateTime: string;
encounterDatetime: string;
encounterProviders: Array<{
uuid: string;
display: string;
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8770,7 +8770,7 @@ [email protected]:
loader-utils "^2.0.0"
schema-utils "^3.0.0"

"file-saver@github:eligrey/FileSaver.js#1.3.8":
file-saver@eligrey/FileSaver.js#1.3.8:
version "1.3.8"
resolved "https://codeload.github.com/eligrey/FileSaver.js/tar.gz/e865e37af9f9947ddcced76b549e27dc45c1cb2e"

Expand Down