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

Treatment Summary UI Enhancement #10563

Open
wants to merge 40 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
14bb055
added borders rm bg
AdityaJ2305 Feb 11, 2025
de537ef
Update src/components/Patient/TreatmentSummary.tsx
AdityaJ2305 Feb 11, 2025
c5f0919
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 11, 2025
879c27d
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 12, 2025
b237889
check for medication
AdityaJ2305 Feb 12, 2025
e1e2a51
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 12, 2025
c8a45cb
rm color of badges on print
AdityaJ2305 Feb 12, 2025
95e6c00
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 13, 2025
00e246c
border for ongoing medication table
AdityaJ2305 Feb 13, 2025
5628f13
rm badge color for ongoing medication
AdityaJ2305 Feb 13, 2025
f293a73
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 13, 2025
9a3336c
minor css change
AdityaJ2305 Feb 13, 2025
650eb1b
Merge branch 'treatment_summary_ui_enhancement' of https://github.com…
AdityaJ2305 Feb 13, 2025
8a0a587
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 13, 2025
964bbd3
added border for questionnaire response
AdityaJ2305 Feb 13, 2025
8456c68
Merge branch 'treatment_summary_ui_enhancement' of https://github.com…
AdityaJ2305 Feb 13, 2025
817d9dc
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 13, 2025
002ec2c
rm styling on questionnaire
AdityaJ2305 Feb 13, 2025
033d212
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 14, 2025
e114ebd
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 15, 2025
bde6c68
rm avatar
AdityaJ2305 Feb 15, 2025
0811ff9
card for medication table
AdityaJ2305 Feb 15, 2025
99c93b6
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 17, 2025
fdeb510
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 17, 2025
c4a2a90
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 17, 2025
786f226
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 18, 2025
357305a
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 18, 2025
6a27a68
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 18, 2025
f8b16e1
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 19, 2025
829bcbb
created PrintTable comp
AdityaJ2305 Feb 19, 2025
41b3d9a
Print Table for symptoms
AdityaJ2305 Feb 20, 2025
611a7c6
Print Table for diagnosis
AdityaJ2305 Feb 20, 2025
d41eb85
ongoing medicine Print table
AdityaJ2305 Feb 20, 2025
fa152ad
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 20, 2025
d2b99ef
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 20, 2025
25bd9d4
rm isPrintPreveiw from symptomstabel
AdityaJ2305 Feb 20, 2025
2d594c9
rm isPrintPreveiw from tables child
AdityaJ2305 Feb 20, 2025
75e9f8d
onGoinging medication count
AdityaJ2305 Feb 20, 2025
68e2e2f
created MedicationStatementLayout
AdityaJ2305 Feb 20, 2025
9333f7a
Merge branch 'develop' into treatment_summary_ui_enhancement
AdityaJ2305 Feb 20, 2025
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
1 change: 1 addition & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,7 @@
"no_log_update_delta": "No changes since previous log update",
"no_log_updates": "No log updates found",
"no_medical_history_available": "No Medical History Available",
"no_medication_recorded": "No Medication Recorded",
"no_medications_found_for_this_encounter": "No medications found for this encounter.",
"no_medications_to_administer": "No medications to administer",
"no_notices_for_you": "No notices for you.",
Expand Down
64 changes: 64 additions & 0 deletions src/components/Common/PrintTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { cn } from "@/lib/utils";

import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";

type HeaderRow = {
title: string;
key: string;
width?: number;
};

type tableRowType = Record<string, string | undefined>;
interface GenericTableProps {
headers: HeaderRow[];
rows: tableRowType[] | undefined;
}

export default function PrintTable({ headers, rows }: GenericTableProps) {
return (
<div className="overflow-hidden rounded-lg border border-gray">
<Table className="w-full">
<TableHeader>
<TableRow className="bg-transparent hover:bg-transparent divide-x divide-gray border-b-gray">
{headers.map(({ key, title }, index) => (
<TableHead
className={cn(
index == 0 && "first:rounded-l-md",
"h-auto py-1 pl-2 pr-2 text-black text-center",
)}
key={key}
>
{title}
</TableHead>
))}
</TableRow>
</TableHeader>
<TableBody>
{!!rows &&
rows.map((row, index) => (
<TableRow
key={index}
className="bg-transparent hover:bg-transparent divide-x divide-gray"
>
{headers.map(({ key }) => (
<TableCell
className="max-w-[200px] break-words whitespace-normal text-center"
key={key}
>
{row[key] || "-"}
</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,23 @@ function StructuredResponseBadge({
);
}

function ResponseCard({ item }: { item: QuestionnaireResponse }) {
function ResponseCard({
item,
isPrintPreview,
}: {
item: QuestionnaireResponse;
isPrintPreview?: boolean;
}) {
const isStructured = !item.questionnaire;
const structuredType = Object.keys(item.structured_responses || {})[0];

return (
<Card className="flex flex-col py-3 px-4 transition-colors hover:bg-muted/50">
<Card
className={cn(
"flex flex-col py-3 px-4 transition-colors hover:bg-muted/50",
isPrintPreview && "shadow-none",
)}
>
<div className="flex items-start justify-between">
<div className="space-y-1">
<div className="flex items-center gap-2 text-xs text-gray-500">
Expand Down Expand Up @@ -327,7 +338,11 @@ export default function QuestionnaireResponsesList({
{questionnarieResponses?.results?.map(
(item: QuestionnaireResponse) => (
<li key={item.id} className="w-full">
<ResponseCard key={item.id} item={item} />
<ResponseCard
key={item.id}
item={item}
isPrintPreview={isPrintPreview}
/>
</li>
),
)}
Expand Down
8 changes: 8 additions & 0 deletions src/components/Medicine/MedicationsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";
import { useTranslation } from "react-i18next";

import { CardContent } from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";
import {
Table,
Expand Down Expand Up @@ -60,6 +61,13 @@ export const MedicationsTable = ({
</div>
);
}
if (!medications?.results.length) {
return (
<CardContent className="p-2">
<p className="text-gray-500">{t("no_medication_recorded")}</p>
</CardContent>
);
}
return (
<div className="border rounded-lg overflow-hidden">
<Table>
Expand Down
Loading
Loading