Skip to content

Commit

Permalink
patient questionnaire minor fix (#11103)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacobjeevan authored Mar 7, 2025
1 parent b08b7e2 commit 2ef181d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { useQuery } from "@tanstack/react-query";
import { t } from "i18next";
import { Link, useQueryParams } from "raviger";
import { useQueryParams } from "raviger";
import { Trans, useTranslation } from "react-i18next";

import { cn } from "@/lib/utils";

import CareIcon from "@/CAREUI/icons/CareIcon";

import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Separator } from "@/components/ui/separator";

Expand Down Expand Up @@ -297,8 +294,8 @@ function ResponseCard({
}

export default function QuestionnaireResponsesList({
encounter,
patientId,
facilityId,
isPrintPreview = false,
onlyUnstructured,
}: Props) {
Expand All @@ -314,8 +311,9 @@ export default function QuestionnaireResponsesList({
limit: RESULTS_PER_PAGE_LIMIT,
offset: ((qParams.page ?? 1) - 1) * RESULTS_PER_PAGE_LIMIT,
}),
encounter: encounter?.id,
only_unstructured: onlyUnstructured,
subject_type: "patient",
subject_type: encounter ? "encounter" : "patient",
},
maxPages: isPrintPreview ? undefined : 1,
pageSize: isPrintPreview ? 100 : RESULTS_PER_PAGE_LIMIT,
Expand All @@ -325,23 +323,6 @@ export default function QuestionnaireResponsesList({
return (
<div className="mt-4 gap-4">
<div className="max-w-full">
<div className="flex justify-between items-center mb-4">
<div className="mr-4 text-xl font-bold text-secondary-900">
{t("updates")}
</div>
<Button asChild variant="outline_primary">
<Link
href={
facilityId
? `/facility/${facilityId}/patient/${patientId}/questionnaire`
: `/patient/${patientId}/questionnaire`
}
>
<CareIcon icon="l-plus" className="mr-2" />
{t("add_patient_updates")}
</Link>
</Button>
</div>
{isLoading ? (
<div className="grid gap-5">
<CardListSkeleton count={RESULTS_PER_PAGE_LIMIT} />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Patient/PatientDetailsTab/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import QuestionnaireResponsesList from "@/components/Facility/ConsultationDetails/QuestionnaireResponsesList";
import EncounterHistory from "@/components/Patient/PatientDetailsTab//EncounterHistory";
import { HealthProfileSummary } from "@/components/Patient/PatientDetailsTab//HealthProfileSummary";
import { Demography } from "@/components/Patient/PatientDetailsTab/Demography";
Expand All @@ -9,6 +8,7 @@ import { Appointments } from "./Appointments";
import { PatientFilesTab } from "./PatientFiles";
import { PatientUsers } from "./PatientUsers";
import { ResourceRequests } from "./ResourceRequests";
import { Updates } from "./patientUpdates";

export interface PatientProps {
facilityId?: string;
Expand All @@ -35,7 +35,7 @@ export const patientTabs = [
},
{
route: "updates",
component: QuestionnaireResponsesList,
component: Updates,
},
{
route: "resource_requests",
Expand Down
36 changes: 36 additions & 0 deletions src/components/Patient/PatientDetailsTab/patientUpdates.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Link } from "raviger";
import { useTranslation } from "react-i18next";

import CareIcon from "@/CAREUI/icons/CareIcon";

import { Button } from "@/components/ui/button";

import QuestionnaireResponsesList from "@/components/Facility/ConsultationDetails/QuestionnaireResponsesList";

import { PatientProps } from ".";

export const Updates = (props: PatientProps) => {
const { patientId, facilityId } = props;
const { t } = useTranslation();

return (
<div className="mt-4 px-3 md:px-0">
<div className="flex justify-between items-center mb-4">
<h2 className="text-2xl font-semibold leading-tight">{t("updates")}</h2>
<Button asChild variant="outline_primary">
<Link
href={
facilityId
? `/facility/${facilityId}/patient/${patientId}/questionnaire`
: `/patient/${patientId}/questionnaire`
}
>
<CareIcon icon="l-plus" className="mr-2" />
{t("add_patient_updates")}
</Link>
</Button>
</div>
<QuestionnaireResponsesList patientId={patientId} />
</div>
);
};

0 comments on commit 2ef181d

Please sign in to comment.