Skip to content

Commit

Permalink
Merge branch 'develop' into debouned-for-appointments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahendar0701 authored Jan 29, 2025
2 parents a5b0b67 + 3976382 commit d132375
Show file tree
Hide file tree
Showing 18 changed files with 211 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/label-merge-conflict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: github.repository == 'ohcnetwork/care_fe'
runs-on: ubuntu-24.04-arm
steps:
- uses: prince-chrismc/label-merge-conflicts-action@v2
- uses: prince-chrismc/label-merge-conflicts-action@v3
with:
conflict_label_name: "merge conflict"
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,8 @@
"enter_year_of_birth_to_verify": "Enter year of birth to verify",
"entered_in_error": "Entered in Error",
"entered_in_error_warning": "This action cannot be undone. The appointment will be marked as entered in error and removed from the system.",
"entity_count_one": "{{count}} {{entity}}",
"entity_count_other": "{{count}} {{entity}}s",
"environment": "Environment",
"error_404": "Error 404",
"error_deleting_shifting": "Error while deleting Shifting record",
Expand Down Expand Up @@ -948,6 +950,8 @@
"facility": "Facility",
"facility_added_successfully": "Facility created successfully",
"facility_consent_requests_page_title": "Patient Consent List",
"facility_count_one": "{{count}} Facility",
"facility_count_other": "{{count}} Facilities ",
"facility_district_name": "Facility/District Name",
"facility_district_pincode": "Facility/District/Pincode",
"facility_for_care_support": "Facility for Care Support",
Expand Down Expand Up @@ -1304,6 +1308,7 @@
"no_beds_available": "No beds available",
"no_changes": "No changes",
"no_changes_made": "No changes made",
"no_comments_available": "No comments available",
"no_consultation_filed": "No consultation filed",
"no_consultation_history": "No consultation history available",
"no_consultation_updates": "No consultation updates",
Expand Down Expand Up @@ -1364,6 +1369,7 @@
"no_tests_taken": "No tests taken",
"no_treating_physicians_available": "This facility does not have any home facility doctors. Please contact your admin.",
"no_update_available": "No update available",
"no_updates_found": "No updates found",
"no_user_assigned": "No User Assigned to this patient",
"no_users_found": "No Users Found",
"no_vitals_present": "No Vitals Monitor present in this location or facility",
Expand Down Expand Up @@ -2108,8 +2114,6 @@
"use_phone_number_for_emergency": "Use this phone number for emergency contact",
"user_add_error": "Error while adding User",
"user_added_successfully": "User added successfully",
"user_count_one": "{{count}} user",
"user_count_other": "{{count}} users",
"user_delete_error": "Error while deleting User",
"user_deleted_successfully": "User Deleted Successfully",
"user_deleted_successfuly": "User Deleted Successfully",
Expand Down
14 changes: 12 additions & 2 deletions src/Routers/routes/PatientRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import FileUploadPage from "@/components/Patient/FileUploadPage";
import { patientTabs } from "@/components/Patient/PatientDetailsTab";
import {
facilityPatientTabs,
patientTabs,
} from "@/components/Patient/PatientDetailsTab";
import { PatientHome } from "@/components/Patient/PatientHome";
import PatientIndex from "@/components/Patient/PatientIndex";
import PatientRegistration from "@/components/Patient/PatientRegistration";
Expand All @@ -19,13 +22,20 @@ const PatientRoutes: AppRoutes = {
<VerifyPatient facilityId={facilityId} />
),
"/patient/:id": ({ id }) => <PatientHome id={id} page="demography" />,
"/patient/:id/update": ({ id }) => <PatientRegistration patientId={id} />,
...patientTabs.reduce((acc: AppRoutes, tab) => {
acc["/patient/:id/" + tab.route] = ({ id }) => (
<PatientHome id={id} page={tab.route} />
);
return acc;
}, {}),
"/facility/:facilityId/patient/create": ({ facilityId }) => (
<PatientRegistration facilityId={facilityId} />
),
"/facility/:facilityId/patient/:id": ({ facilityId, id }) => (
<PatientHome facilityId={facilityId} id={id} page="demography" />
),
...patientTabs.reduce((acc: AppRoutes, tab) => {
...facilityPatientTabs.reduce((acc: AppRoutes, tab) => {
acc["/facility/:facilityId/patient/:id/" + tab.route] = ({
facilityId,
id,
Expand Down
13 changes: 9 additions & 4 deletions src/components/Facility/FacilityUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function FacilityUsers(props: { facilityId: string }) {

let usersList: JSX.Element = <></>;

const { data: userListData, isLoading: userListLoading } = useQuery({
const { data: userListData, isFetching: userListFetching } = useQuery({
queryKey: ["facilityUsers", facilityId, qParams],
queryFn: query.debounced(routes.facility.getUsers, {
pathParams: { facility_id: facilityId },
Expand All @@ -45,7 +45,7 @@ export default function FacilityUsers(props: { facilityId: string }) {
enabled: !!facilityId,
});

if (userListLoading || !userListData) {
if (userListFetching || !userListData) {
usersList =
activeTab === "card" ? (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
Expand All @@ -71,10 +71,15 @@ export default function FacilityUsers(props: { facilityId: string }) {
title={t("users_management")}
componentRight={
<Badge
className="bg-purple-50 text-purple-700 ml-2 text-sm font-medium rounded-xl px-3 m-3"
className="bg-purple-50 text-purple-700 ml-2 text-sm font-medium rounded-xl px-3 m-3 w-max"
variant="outline"
>
{t("user_count", { count: userListData?.count ?? 0 })}
{userListFetching
? t("loading")
: t("entity_count", {
count: userListData?.count ?? 0,
entity: "User",
})}
</Badge>
}
>
Expand Down
56 changes: 0 additions & 56 deletions src/components/Form/FormFields/TextAreaFormField.tsx

This file was deleted.

10 changes: 7 additions & 3 deletions src/components/Patient/PatientDetailsTab/Demography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ export const Demography = (props: PatientProps) => {
};

const handleEditClick = (sectionId: string) => {
navigate(
`/facility/${facilityId}/patient/${id}/update?section=${sectionId}`,
);
if (facilityId) {
navigate(
`/facility/${facilityId}/patient/${id}/update?section=${sectionId}`,
);
} else {
navigate(`/patient/${id}/update?section=${sectionId}`);
}
};

const hasEditPermission = () => {
Expand Down
31 changes: 31 additions & 0 deletions src/components/Patient/PatientDetailsTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,37 @@ export interface PatientProps {
}

export const patientTabs = [
{
route: "demography",
component: Demography,
},
{
route: "encounters",
component: EncounterHistory,
},
{
route: "health-profile",
component: HealthProfileSummary,
},
{
route: "updates",
component: Updates,
},
{
route: "resource_requests",
component: ResourceRequests,
},
{
route: "users",
component: PatientUsers,
},
{
route: "files",
component: PatientFilesTab,
},
];

export const facilityPatientTabs = [
{
route: "demography",
component: Demography,
Expand Down
35 changes: 23 additions & 12 deletions src/components/Patient/PatientHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {
import { Avatar } from "@/components/Common/Avatar";
import Loading from "@/components/Common/Loading";
import Page from "@/components/Common/Page";
import { patientTabs } from "@/components/Patient/PatientDetailsTab";
import {
facilityPatientTabs,
patientTabs,
} from "@/components/Patient/PatientDetailsTab";

import { PLUGIN_Component } from "@/PluginEngine";
import routes from "@/Utils/request/api";
Expand All @@ -26,7 +29,7 @@ import { Patient } from "@/types/emr/newPatient";
export const PatientHome = (props: {
facilityId?: string;
id: string;
page: (typeof patientTabs)[0]["route"];
page: (typeof patientTabs | typeof facilityPatientTabs)[0]["route"];
}) => {
const { facilityId, id, page } = props;

Expand All @@ -46,7 +49,9 @@ export const PatientHome = (props: {
return <Loading />;
}

const Tab = patientTabs.find((t) => t.route === page)?.component;
const tabs = facilityId ? facilityPatientTabs : patientTabs;

const Tab = tabs.find((t) => t.route === page)?.component;

if (!patientData) {
return <div>{t("patient_not_found")}</div>;
Expand All @@ -57,13 +62,15 @@ export const PatientHome = (props: {
title={t("patient_details")}
options={
<>
<Button asChild variant="primary">
<Link
href={`/facility/${facilityId}/patient/${id}/book-appointment`}
>
{t("schedule_appointment")}
</Link>
</Button>
{facilityId && (
<Button asChild variant="primary">
<Link
href={`/facility/${facilityId}/patient/${id}/book-appointment`}
>
{t("schedule_appointment")}
</Link>
</Button>
)}
</>
}
>
Expand Down Expand Up @@ -105,10 +112,14 @@ export const PatientHome = (props: {
role="navigation"
>
<div className="flex flex-row" role="tablist">
{patientTabs.map((tab) => (
{tabs.map((tab) => (
<Link
key={tab.route}
href={`/facility/${facilityId}/patient/${id}/${tab.route}`}
href={
facilityId
? `/facility/${facilityId}/patient/${id}/${tab.route}`
: `/patient/${id}/${tab.route}`
}
className={`whitespace-nowrap px-4 py-2 text-sm font-medium ${
page === tab.route
? "border-b-4 border-green-800 text-green-800 md:border-b-2"
Expand Down
14 changes: 8 additions & 6 deletions src/components/Patient/PatientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import { PatientModel } from "@/types/emr/patient";
import { Organization } from "@/types/organization/organization";

interface PatientRegistrationPageProps {
facilityId: string;
facilityId?: string;
patientId?: string;
}

Expand Down Expand Up @@ -219,11 +219,13 @@ export default function PatientRegistration(
return;
}

createPatient({
...values,
facility: facilityId,
ward_old: undefined,
});
if (facilityId) {
createPatient({
...values,
facility: facilityId,
ward_old: undefined,
});
}
}

const sidebarItems = [
Expand Down
2 changes: 1 addition & 1 deletion src/components/Questionnaire/QuestionnaireSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function QuestionnaireSearch({
icon="l-spinner"
className="mr-2 h-4 w-4 animate-spin"
/>
Loading...
{t("loading")}
</>
) : (
<span>{t("add_questionnaire")}</span>
Expand Down
Loading

0 comments on commit d132375

Please sign in to comment.