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

patient questionnaire minor fix #11103

Merged
merged 2 commits into from
Mar 7, 2025
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
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>
);
};
Loading