Skip to content

Commit

Permalink
Revert "Merge branch 'develop' into issue/9733/dirty-state"
Browse files Browse the repository at this point in the history
This reverts commit ad9b270, reversing
changes made to 5392459.
  • Loading branch information
rajku-dev committed Jan 8, 2025
1 parent ad9b270 commit aaa7d41
Show file tree
Hide file tree
Showing 10 changed files with 331 additions and 454 deletions.
5 changes: 3 additions & 2 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
files:
- source: public/locale/en.json
translation: /public/locale/%two_letters_code%.json
- source: /public/locale/{{lang}}.json
translation: /public/locale/%two_letters_code%/%original_file_name%
bundles:
- 2

6 changes: 0 additions & 6 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@
"all_changes_have_been_saved": "All changes have been saved",
"all_details": "All Details",
"all_patients": "All Patients",
"allergen": "Allergen",
"allergies": "Allergies",
"allow_transfer": "Allow Transfer",
"allowed_formats_are": "Allowed formats are",
Expand Down Expand Up @@ -651,7 +650,6 @@
"created_by": "Created By",
"created_date": "Created Date",
"created_on": "Created On",
"criticality": "Criticality",
"csv_file_in_the_specified_format": "Select a CSV file in the specified format",
"current_address": "Current Address",
"current_password": "Current Password",
Expand Down Expand Up @@ -832,7 +830,6 @@
"encounter_discharge_disposition__snf": "Skilled nursing facility",
"encounter_duration_confirmation": "The duration of this encounter would be",
"encounter_id": "Encounter ID",
"encounter_marked_as_complete": "Encounter Completed",
"encounter_notes__all_discussions": "All Discussions",
"encounter_notes__be_first_to_send": "Be the first to send a message",
"encounter_notes__choose_template": "Choose a template or enter a custom title",
Expand Down Expand Up @@ -903,7 +900,6 @@
"error_deleting_shifting": "Error while deleting Shifting record",
"error_fetching_slots_data": "Error while fetching slots data",
"error_sending_otp": "Error while sending OTP, Please try again later",
"error_updating_encounter": "Error to Updating Encounter",
"error_verifying_otp": "Error while verifying OTP, Please request a new OTP",
"error_while_deleting_record": "Error while deleting record",
"escape": "Escape",
Expand Down Expand Up @@ -1168,7 +1164,6 @@
"manufacturer": "Manufacturer",
"map_acronym": "M.A.P.",
"mark_all_as_read": "Mark all as Read",
"mark_as_complete": "Mark as Complete",
"mark_as_fulfilled": "Mark as Fullfilled",
"mark_as_noshow": "Mark as no-show",
"mark_as_read": "Mark as Read",
Expand Down Expand Up @@ -1634,7 +1629,6 @@
"select": "Select",
"select_all": "Select All",
"select_date": "Select date",
"select_department": "Select Department",
"select_eligible_policy": "Select an Eligible Insurance Policy",
"select_facility_for_discharged_patients_warning": "Facility needs to be selected to view discharged patients.",
"select_for_administration": "Select for Administration",
Expand Down
48 changes: 24 additions & 24 deletions src/Routers/routes/ConsultationRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ const consultationRoutes: AppRoutes = {
patientId={patientId}
/>
),
"/facility/:facilityId/patient/:patientId/consultation/:id/consent-records":
({ facilityId, patientId, id }) => (
<PatientConsentRecords
facilityId={facilityId}
patientId={patientId}
consultationId={id}
/>
),
"/facility/:facilityId/patient/:patientId/encounterId/:id/files/": ({
facilityId,
patientId,
id,
}) => (
<FileUploadPage
facilityId={facilityId}
patientId={patientId}
encounterId={id}
type="encounter"
/>
),
"/facility/:facilityId/patient/:patientId/questionnaire": ({
facilityId,
patientId,
Expand All @@ -60,6 +80,10 @@ const consultationRoutes: AppRoutes = {
patientId={patientId}
/>
),
"/facility/:facilityId/patient/:patientId/encounter/:encounterId/questionnaire_response/:id":
({ patientId, id }) => (
<QuestionnaireResponseView responseId={id} patientId={patientId} />
),
"/facility/:facilityId/patient/:patientId/encounter/:encounterId/questionnaire/:slug":
({ facilityId, encounterId, slug, patientId }) => (
<EncounterQuestionnaire
Expand All @@ -69,30 +93,6 @@ const consultationRoutes: AppRoutes = {
patientId={patientId}
/>
),
"/facility/:facilityId/patient/:patientId/encounter/:encounterId/questionnaire_response/:id":
({ patientId, id }) => (
<QuestionnaireResponseView responseId={id} patientId={patientId} />
),
"/facility/:facilityId/patient/:patientId/consultation/:id/consent-records":
({ facilityId, patientId, id }) => (
<PatientConsentRecords
facilityId={facilityId}
patientId={patientId}
consultationId={id}
/>
),
"/facility/:facilityId/patient/:patientId/encounterId/:id/files/": ({
facilityId,
patientId,
id,
}) => (
<FileUploadPage
facilityId={facilityId}
patientId={patientId}
encounterId={id}
type="encounter"
/>
),
};

export default consultationRoutes;
91 changes: 8 additions & 83 deletions src/components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import {
BedSingle,
Building,
Expand All @@ -10,18 +9,8 @@ import {
} from "lucide-react";
import { Link } from "raviger";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";

import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
Popover,
PopoverContent,
Expand All @@ -30,29 +19,13 @@ import {

import { Avatar } from "@/components/Common/Avatar";

import routes from "@/Utils/request/api";
import mutate from "@/Utils/request/mutate";
import { formatDateTime, formatPatientAge } from "@/Utils/utils";
import { Encounter, completedEncounterStatus } from "@/types/emr/encounter";
import { Patient } from "@/types/emr/newPatient";

import { Button } from "../ui/button";
import ManageEncounterOrganizations from "./ManageEncounterOrganizations";

const QUESTIONNAIRE_OPTIONS = [
{
slug: "encounter",
title: "Update Encounter",
},
{
slug: "community-nurse",
title: "Community Nurse Form",
},
{
slug: "recommend_discharge_v2",
title: "Recommend Discharge",
},
] as const;

export interface PatientInfoCardProps {
patient: Patient;
encounter: Encounter;
Expand All @@ -62,36 +35,6 @@ export interface PatientInfoCardProps {
export default function PatientInfoCard(props: PatientInfoCardProps) {
const { patient, encounter } = props;
const { t } = useTranslation();
const queryClient = useQueryClient();

const { mutate: updateEncounter } = useMutation({
mutationFn: mutate(routes.encounter.update, {
pathParams: { id: encounter.id },
}),
onSuccess: () => {
toast.success(t("encounter_marked_as_complete"));
queryClient.invalidateQueries({ queryKey: ["encounter", encounter.id] });
},
onError: () => {
toast.error(t("error_updating_encounter"));
},
});

const handleMarkAsComplete = () => {
updateEncounter({
...encounter,
status: "completed",
organizations: encounter.organizations.map((org) => org.id),
patient: encounter.patient.id,
encounter_class: encounter.encounter_class,
period: encounter.period,
hospitalization: encounter.hospitalization,
priority: encounter.priority,
external_identifier: encounter.external_identifier,
facility: encounter.facility.id,
});
};

return (
<>
<section className="flex flex-col lg:flex-row">
Expand Down Expand Up @@ -319,31 +262,13 @@ export default function PatientInfoCard(props: PatientInfoCardProps) {
>
{!completedEncounterStatus.includes(encounter.status) && (
<div className="flex w-full flex-col gap-3 lg:w-auto 2xl:flex-row">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="primary">
{t("update")}
<ChevronDown className="ml-2 h-4 w-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
{QUESTIONNAIRE_OPTIONS.map((option) => (
<DropdownMenuItem key={option.slug} asChild>
<Link
href={`/facility/${encounter.facility.id}/patient/${patient.id}/encounter/${encounter.id}/questionnaire/${option.slug}`}
className="cursor-pointer text-gray-800"
>
{t(option.title)}
</Link>
</DropdownMenuItem>
))}
<DropdownMenuSeparator />
<DropdownMenuLabel>{t("actions")}</DropdownMenuLabel>
<DropdownMenuItem onClick={handleMarkAsComplete}>
{t("mark_as_complete")}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<Button asChild variant="primary">
<Link
href={`/facility/${encounter.facility.id}/patient/${patient.id}/encounter/${encounter.id}/edit_encounter`}
>
Update Encounter
</Link>
</Button>
</div>
)}
</div>
Expand Down
Loading

0 comments on commit aaa7d41

Please sign in to comment.