Skip to content

Commit

Permalink
Merge branch 'develop' into issue/10158/patient-user-card-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rajku-dev authored Feb 10, 2025
2 parents e306e5c + d0c3406 commit 70e5891
Show file tree
Hide file tree
Showing 23 changed files with 348 additions and 542 deletions.
5 changes: 4 additions & 1 deletion public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,7 @@
"facility": "Facility",
"facility_actions_menu": "Facility action menu",
"facility_added_successfully": "Facility created successfully",
"facility_assign_request": "What facility would you like to assign the request to?",
"facility_consent_requests_page_title": "Patient Consent List",
"facility_count_one": "{{count}} Facility",
"facility_count_other": "{{count}} Facilities ",
Expand Down Expand Up @@ -1878,11 +1879,12 @@
"search_for_allergies_to_add": "Search for allergies to add",
"search_for_diagnoses_to_add": "Search for diagnoses to add",
"search_for_facility": "Search for Facility",
"search_for_medications_to_add": "Search for medications to add",
"search_for_symptoms_to_add": "Search for symptoms to add",
"search_icd11_placeholder": "Search for ICD-11 Diagnoses",
"search_investigation_placeholder": "Search Investigation & Groups",
"search_medication": "Search Medication",
"search_medications": "Search for medications to add",
"search_medications": "Search Medications",
"search_medicine": "Search Medicine",
"search_patient_page_text": "Search for existing patients using their phone number or create a new patient record",
"search_patients": "Search Patients",
Expand Down Expand Up @@ -2030,6 +2032,7 @@
"start_time_before_authored_error": "Start time cannot be before the medication was prescribed",
"start_time_future_error": "Start time cannot be in the future",
"start_time_must_be_before_end_time": "Start time must be before end time",
"start_typing_to_search": "Start typing to search...",
"state": "State",
"state_reason_for_archiving": "State reason for archiving <strong>{{name}}</strong> file?",
"status": "Status",
Expand Down
108 changes: 0 additions & 108 deletions src/components/Common/FacilitySelect.tsx

This file was deleted.

85 changes: 40 additions & 45 deletions src/components/Facility/ConsultationDetails/QuickAccess.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useQuery } from "@tanstack/react-query";
import { Link } from "raviger";
import { useTranslation } from "react-i18next";

Expand All @@ -9,23 +8,17 @@ import { Button } from "@/components/ui/button";

import LinkDepartmentsSheet from "@/components/Patient/LinkDepartmentsSheet";

import query from "@/Utils/request/query";
import useQuestionnaireOptions from "@/hooks/useQuestionnaireOptions";

import { Encounter } from "@/types/emr/encounter";
import questionnaireApi from "@/types/questionnaire/questionnaireApi";

interface QuickAccessProps {
encounter: Encounter;
}

export default function QuickAccess({ encounter }: QuickAccessProps) {
const { t } = useTranslation();

const { data: response } = useQuery({
queryKey: ["questionnaires"],
queryFn: query(questionnaireApi.list),
});

const questionnaireList = response?.results || [];
const questionnaireOptions = useQuestionnaireOptions("encounter_actions");

const encounterSettings = [
{ id: "encounter_settings", label: t("encounter_settings") },
Expand All @@ -34,45 +27,47 @@ export default function QuickAccess({ encounter }: QuickAccessProps) {
return (
<div className="flex flex-col gap-6">
{/* Questionnaire Section */}
<section className="space-y-2 p-2">
<h3 className="text-lg font-semibold mb-3">{t("questionnaire")}</h3>
<div className="space-y-3 p-2 font-semibold">
{questionnaireList.map((item) => (
<Link
className="flex items-center gap-2 text-sm hover:text-gray-500 text-gray-900"
key={item.id}
// className="w-full justify-start gap-2 h-auto py-2"
href={`/facility/${encounter.facility.id}/patient/${encounter.patient.id}/encounter/${encounter.id}/questionnaire/${item.slug}`}
>
<CareIcon icon="l-file-alt" className="h-4 w-4 text-gray-950" />
{item.title}
</Link>
))}
</div>
</section>

<div className="w-full border-t border-dashed border-gray-300" />

{/* Update Encounter Details */}
<section className="text-gray-950">
<h3 className="text-lg font-medium mb-3">
{t("update_encounter_details")}
</h3>
<div className="space-y-2">
{encounterSettings.map((item) => (
<div key={item.id} className="flex items-center space-x-2 px-4">
{encounter.status !== "completed" && (
<section className="space-y-2 p-2">
<h3 className="text-lg font-semibold mb-3">{t("questionnaire")}</h3>
<div className="space-y-3 p-2 font-semibold">
{questionnaireOptions.map((option) => (
<Link
href={`/facility/${encounter.facility.id}/patient/${encounter.patient.id}/encounter/${encounter.id}/questionnaire/encounter`}
className="text-sm text-gray-950 underline font-semibold"
key={option.slug}
href={`/facility/${encounter.facility.id}/patient/${encounter.patient.id}/encounter/${encounter.id}/questionnaire/${option.slug}`}
className="flex items-center gap-2 text-sm hover:text-gray-500 text-gray-900"
data-cy="update-encounter-option"
>
{item.label}
<CareIcon icon="l-file-alt" className="h-4 w-4 text-gray-950" />
{t(option.title)}
</Link>
</div>
))}
</div>
</section>
))}
</div>
<div className="w-full border-t border-dashed border-gray-300" />
</section>
)}

<div className="w-full border-t border-dashed border-gray-300" />
{/* Update Encounter Details */}
{encounter.status !== "completed" && (
<section className="text-gray-950 space-y-2">
<h3 className="text-lg font-medium mb-3">
{t("update_encounter_details")}
</h3>
<div>
{encounterSettings.map((item) => (
<div key={item.id} className="flex items-center space-x-2 px-4">
<Link
href={`/facility/${encounter.facility.id}/patient/${encounter.patient.id}/encounter/${encounter.id}/questionnaire/encounter`}
className="text-sm text-gray-950 underline font-semibold"
>
{item.label}
</Link>
</div>
))}
</div>
<div className="w-full border-t border-dashed border-gray-300" />
</section>
)}

{/* Departments and Teams */}
<section>
Expand Down
Loading

0 comments on commit 70e5891

Please sign in to comment.