Skip to content

Commit

Permalink
fix: merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-malviya15 committed Feb 22, 2024
2 parents 113aaac + 3cd1361 commit 5540d52
Show file tree
Hide file tree
Showing 192 changed files with 4,777 additions and 2,030 deletions.
71 changes: 71 additions & 0 deletions __mocks__/appointments.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ export const mockAppointmentsData = {
],
};

// TODO: still used by the queue-linelist-base-table test?
export const mockMappedAppointmentsData = {
data: [
{
Expand Down Expand Up @@ -374,3 +375,73 @@ export const mockProviders = {
},
],
};

export const mockUseAppointmentServiceData = [
{
appointmentServiceId: 1,
name: 'Outpatient',
description: null,
speciality: {},
startDateTime: new Date().toISOString(),
endTime: '',
maxAppointmentsLimit: null,
durationMins: 15,
location: {},
uuid: 'e2ec9cf0-ec38-4d2b-af6c-59c82fa30b90',
color: '#006400',
initialAppointmentStatus: 'Scheduled',
creatorName: null,
weeklyAvailability: [
{
dayOfWeek: 'MONDAY',
startTime: '07:00:00',
endTime: '20:00:00',
maxAppointmentsLimit: null,
uuid: '7c7c53c8-c104-40cc-9926-50fc6fe4c4c1',
},
{
dayOfWeek: 'TUESDAY',
startTime: '07:00:00',
endTime: '20:00:00',
maxAppointmentsLimit: null,
uuid: '7683b94e-6c48-4132-b402-54837a8c0fb2',
},
{
dayOfWeek: 'SUNDAY',
startTime: '07:00:00',
endTime: '20:00:00',
maxAppointmentsLimit: null,
uuid: '00be8427-0037-4984-8875-6a5a2bc57e8e',
},
{
dayOfWeek: 'FRIDAY',
startTime: '07:00:00',
endTime: '20:00:00',
maxAppointmentsLimit: null,
uuid: 'af6b8d5b-be05-4e24-8601-30573f848bec',
},
{
dayOfWeek: 'THURSDAY',
startTime: '07:00:00',
endTime: '20:00:00',
maxAppointmentsLimit: null,
uuid: 'eb35e91b-6909-41fe-9d09-750b83fb3b9c',
},
{
dayOfWeek: 'SATURDAY',
startTime: '07:00:00',
endTime: '20:00:00',
maxAppointmentsLimit: null,
uuid: '7f6347fd-c514-4fd2-ab79-d7fd760bf82f',
},
{
dayOfWeek: 'WEDNESDAY',
startTime: '07:00:00',
endTime: '20:00:00',
maxAppointmentsLimit: null,
uuid: 'dad83f54-a0a2-4ba9-819b-01e906c89b69',
},
],
serviceTypes: [{ duration: 15, name: 'Chemotherapy', uuid: '53d58ff1-0c45-4e2e-9bd2-9cc826cb46e1' }],
},
];
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-patient-management",
"version": "5.2.1",
"version": "6.0.0",
"private": true,
"description": "Patient management microfrontend for the OpenMRS 3.x frontend",
"workspaces": [
Expand All @@ -11,21 +11,25 @@
"ci:publish": "yarn workspaces foreach --all --topological --exclude @openmrs/esm-patient-management npm publish --access public --tag latest",
"ci:prepublish": "yarn workspaces foreach --all --topological --exclude @openmrs/esm-patient-management npm publish --access public --tag next",
"release": "yarn workspaces foreach --all --topological version",
"verify": "turbo lint && turbo typescript && turbo test --color --concurrency=5",
"verify": "turbo lint typescript test --color --concurrency=2",
"prettier": "prettier --config prettier.config.js --write \"packages/**/*.{ts,tsx,css,scss}\" \"e2e/**/*.ts\"",
"test-e2e": "playwright test",
"postinstall": "husky install",
"extract-translations": "turbo extract-translations -- --config ../../tools/i18next-parser.config.js"
},
"dependencies": {
"@hookform/resolvers": "^3.3.1",
"classnames": "^2.3.2",
"react-hook-form": "^7.46.2",
"swr": "^2.0.1",
"xlsx": "^0.18.5"
"xlsx": "^0.18.5",
"zod": "^3.22.2"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@carbon/react": "~1.37.0",
"@openmrs/esm-framework": "next",
"@openmrs/esm-patient-common-lib": "next",
"@playwright/test": "1.40.1",
"@swc/core": "^1.2.165",
"@swc/jest": "^0.2.29",
Expand Down Expand Up @@ -60,6 +64,7 @@
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.1",
"openmrs": "next",
"prettier": "^3.1.1",
"react": "^18.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/esm-active-visits-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-active-visits-app",
"version": "5.2.1",
"version": "6.0.0",
"description": "Active visits widget microfrontend for the OpenMRS SPA",
"browser": "dist/openmrs-esm-active-visits-app.js",
"main": "src/index.ts",
Expand All @@ -13,7 +13,7 @@
"debug": "npm run serve",
"build": "webpack --mode production",
"analyze": "webpack --mode=production --env.analyze=true",
"lint": "cross-env TIMING=1 eslint src --ext ts,tsx",
"lint": "cross-env eslint src --ext ts,tsx",
"test": "cross-env TZ=UTC jest --config jest.config.js --verbose false --passWithNoTests --color",
"test:watch": "cross-env TZ=UTC jest --watch --config jest.config.js --color",
"coverage": "yarn test --coverage",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo, useState, useCallback, type MouseEvent, type AnchorHTMLAttributes } from 'react';
import React, { useMemo, useState, useCallback } from 'react';
import {
DataTable,
DataTableSkeleton,
Expand All @@ -7,15 +7,15 @@ import {
Pagination,
Search,
Table,
TableContainer,
TableHead,
TableRow,
TableHeader,
TableBody,
TableCell,
TableExpandRow,
TableExpandHeader,
TableContainer,
TableExpandedRow,
TableExpandHeader,
TableExpandRow,
TableHead,
TableHeader,
TableRow,
Tile,
} from '@carbon/react';
import { useTranslation } from 'react-i18next';
Expand All @@ -29,10 +29,10 @@ import {
ConfigurableLink,
} from '@openmrs/esm-framework';
import { EmptyDataIllustration } from './empty-data-illustration.component';
import { useActiveVisits, getOriginFromPathName } from './active-visits.resource';
import { useActiveVisits } from './active-visits.resource';
import styles from './active-visits.scss';

function ComputeExpensiveValue(t, config) {
function generateTableHeaders(t, config) {
let headersIndex = 0;

const headers = [
Expand Down Expand Up @@ -101,7 +101,7 @@ const ActiveVisitsTable = () => {
const [pageSize, setPageSize] = useState(config?.activeVisits?.pageSize ?? 10);
const { activeVisits, isLoading, isValidating, error } = useActiveVisits();
const [searchString, setSearchString] = useState('');
const headerData = useMemo(() => ComputeExpensiveValue(t, config), [config, t]);
const headerData = useMemo(() => generateTableHeaders(t, config), [config, t]);

const searchResults = useMemo(() => {
if (activeVisits !== undefined && activeVisits.length > 0) {
Expand Down Expand Up @@ -222,23 +222,27 @@ const ActiveVisitsTable = () => {
</TableHead>
<TableBody>
{rows.map((row, index) => {
const visit = activeVisits.find((visit) => visit.id === row.id);
const currentVisit = activeVisits.find((visit) => visit.id === row.id);

if (!visit) {
if (!currentVisit) {
return null;
}

const patientLink = `$\{openmrsSpaBase}/patient/${visit.patientUuid}/chart/Patient%20Summary`;
const patientChartUrl = '${openmrsSpaBase}/patient/${patientUuid}/chart/Patient%20Summary';

return (
<React.Fragment key={index}>
<TableExpandRow
{...getRowProps({ row })}
data-testid={`activeVisitRow${visit.patientUuid || 'unknown'}`}>
data-testid={`activeVisitRow${currentVisit.patientUuid || 'unknown'}`}>
{row.cells.map((cell) => (
<TableCell key={cell.id} data-testid={cell.id}>
{cell.info.header === 'name' && visit.patientUuid ? (
<ConfigurableLink to={patientLink}>{cell.value}</ConfigurableLink>
{cell.info.header === 'name' && currentVisit.patientUuid ? (
<ConfigurableLink
to={patientChartUrl}
templateParams={{ patientUuid: currentVisit.patientUuid }}>
{cell.value}
</ConfigurableLink>
) : (
cell.value
)}
Expand All @@ -252,8 +256,8 @@ const ActiveVisitsTable = () => {
className={styles.visitSummaryContainer}
name="visit-summary-slot"
state={{
visitUuid: visit.visitUuid,
patientUuid: visit.patientUuid,
patientUuid: currentVisit.patientUuid,
visitUuid: currentVisit.visitUuid,
}}
/>
</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
background-color: $ui-02;
}

.activeVisitsTable {
tbody tr[data-parent-row] {
// Don't show a bottom border on the last row so we don't end up with a double border from the activeVisitContainer
&:nth-last-of-type(2) > td {
border-bottom: none;
}
}
}

.backgroundDataFetchingIndicator {
align-items: center;
display: flex;
Expand Down Expand Up @@ -62,16 +71,22 @@
margin: 1rem auto;
}

.expandedActiveVisitRow > td > div {
max-height: max-content !important;
}
.expandedActiveVisitRow {
td {
padding: 0 2rem;

.expandedActiveVisitRow td {
padding: 0 2rem;
}
> div {
max-height: max-content !important;
}
}

.expandedActiveVisitRow th[colspan] td[colspan] > div:first-child {
padding: 0 1rem;
th[colspan] td[colspan] > div:first-child {
padding: 0 1rem;
}

&:last-of-type th[colspan]:last-child {
border-bottom: none;
}
}

.action {
Expand Down
Loading

0 comments on commit 5540d52

Please sign in to comment.